[Bug middle-end/48814] [4.3/4.4/4.5/4.6/4.7 Regression] Incorrect scalar increment result
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon May 2 15:52:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48814
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-02 15:35:01 UTC ---
(In reply to comment #2)
> Since the order of evaluation is undefined it may evaluate "count++" and
> "incr()" in any order, as it pleases.
>
> Since there is a sequence point before entering a function, and before leaving
> a function, and since function invocations do not interleave, we know that no
> matter whether we evaluate "count++" before or after executing "incr", the side
> effects of both "count++" and "++count" do not happen without an intervening
> sequence point.
The side-effects yes, but the read in count++ happens at either before
or after incr is executed. At least that is my reading of undefined
evaluation order. Does the sequence point before entering a function
make that evaluation order suddenly defined?
Of course since Joseph seems to agree I won't object to fixing it.
More information about the Gcc-bugs
mailing list