home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.linux
- Path: sparky!uunet!kithrup!cygnus.com!dje
- From: dje@cygnus.com (Doug Evans)
- Subject: Re: GCC 2.2.2d bug
- Organization: Cygnus Support
- Date: Sat, 05 Sep 1992 01:33:20 GMT
- Message-ID: <1992Sep05.013320.2317@kithrup.COM>
- X-Newsreader: Tin 1.1 PL5
- References: <1992Sep4.202913.14346@hippo.ru.ac.za>
- Sender: news@kithrup.COM (Network News)
- Nntp-Posting-Host: cygnus.com
- Lines: 21
-
- Pieter Immelman (pi@oliver.sun.ac.za) wrote:
- : I have found that gcc is generating the wrong code for the following
- : code fragment:
- :
- : int p = 10;
- : p = p++;
-
- My, albeit limited, reading of the standard says that the behaviour
- is "unspecified" - the implementor can choose what happens.
-
- ANSI introduced the concept of "sequence points" to aid in pinning down
- exactly when various things occur. In this particular case, the standard
- says the increment "shall occur between the previous and next sequence point."
- So gcc is perfectly free to increment {p} after the assignment.
-
- And, of course, programs that depend upon unspecified behaviour are
- nonportable. Etc. etc. etc.
-
- --
- Doug Evans | With views like these ...
- dje@cygnus.com | who needs disclaimers.
-