🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #294

possible bug in the C compiler

#294
From: Steve Peshman x7-4406
Date: Thu, 06 Aug 1992 22:02
33 lines
1404 bytes
/*
 * I believe this may be a bug in version 1.4 of the C compiler.
 * With the -pedantic switch, I am unable to increment a void pointer.
 * Here is a copy of the results I get:
 *
 * chinook-peshman% gcc -pedantic -o ped.o ped.c
 * ped.c: In function tfunc:
 * ped.c:24: invalid lvalue in increment
 * ped.c:25: invalid lvalue in assignment
 * ped.c:26: invalid lvalue in assignment
 * chinook-peshman% 
 *
 * The closest I can come to incrementing a void pointer is to assign it
 * to a pointer to the appropriate type and increment that.
 *
 * I apologies if this is simply a result of my ignorance.  In that event,
 * please let me know the correct way to do this.
 */
void tfunc(void *voidp)
{
    int *intp;

/* this stuff does not work */
    ((int *)voidp)++;
    ((int *)voidp) += 1;
    ((int *)voidp) = ((int *)voidp) + 1;

/* but this stuff does */
    intp = (int *)voidp;
    intp++;
}
/* Steve Peshman */
/* I'm told I can be reached at peshmanS@med.ge.com */
Technical Details
Message-ID: <9208062202.AA14375@sol.med.ge.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sol.med.ge.COM!peshman

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sol.med.ge.COM!peshman
From: peshman@sol.med.ge.COM (Steve Peshman  x7-4406)
Subject: possible bug in the C compiler
Message-ID: <9208062202.AA14375@sol.med.ge.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 6 Aug 1992 22:02:04 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 34