This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: target/3850: gcc 2.73-3.0 code generation on HP and SUN WRONG
- To: daniel at innologic-systems dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Subject: Re: target/3850: gcc 2.73-3.0 code generation on HP and SUN WRONG
- From: aoliva at gcc dot gnu dot org
- Date: 29 Jul 2001 02:54:45 -0000
Synopsis: gcc 2.73-3.0 code generation on HP and SUN WRONG
State-Changed-From-To: open->closed
State-Changed-By: aoliva
State-Changed-When: Sat Jul 28 19:54:45 2001
State-Changed-Why:
It is the expectation that is wrong. There's no sequence point between arguments to a function call. Not only can they be executed in any order, but also, their evaluations can be interleaved. The C Standard says that this code invokes undefined behavior, so as to place no limits on the amount of optimization a compiler can do on this kind of code. If your code depends on any particular order of execution, the code is in error, and should be fixed by inserting sequence points between expressions that modify the same variable. There's a sequence point between consecutive commands (semicolon) and between expressions separated by the comma operator (comma), but not when the comma is only used to separate arguments.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3850&database=gcc