target/3850: gcc 2.73-3.0 code generation on HP and SUN WRONG
aoliva@gcc.gnu.org
aoliva@gcc.gnu.org
Sat Jul 28 19:54:00 GMT 2001
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
More information about the Gcc-bugs
mailing list