https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39121
frankhb1989 at gmail dot com changed:
What|Removed |Added
CC||frankhb1989 at gmail dot
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39121
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
CC||manu at gcc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39121
--- Comment #7 from joe.carnuccio at qlogic dot com ---
Ok, the sequence points are at each of the assignment operators.
The crux of this is that doing the xor chain with dereferenced pointers fails
(incorrect execution), whereas doing it with
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39121
joe.carnuccio at qlogic dot com changed:
What|Removed |Added
CC||joe.carnuccio at qlogic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39121
--- Comment #6 from Andrew Pinski pinskia at gcc dot gnu.org ---
(In reply to joe.carnuccio from comment #5)
Since using gcc -Os causes the correct execution, then sequence point does
not have anything to do with it.
And you are wrong about
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39121
--- Comment #5 from joe.carnuccio at qlogic dot com ---
Since using gcc -Os causes the correct execution, then sequence point does
not have anything to do with it.
--- Comment #1 from pinskia at gcc dot gnu dot org 2009-02-06 20:09 ---
This is undefined code as you are modifying *a twice without a sequence point
inbetween the modifies.
*** This bug has been marked as a duplicate of 15145 ***
--
pinskia at gcc dot gnu dot org changed:
--- Comment #2 from nospam at pamies dot cat 2009-02-06 21:07 ---
Is not the same bug as #15145. I agree with you that there is just one sequence
point, but the operation is not undefined.
void swap(int *a, int *b) {
*a ^= *b ^= *a ^= *b;
}
This code should be compiled to:
*a =
--- Comment #3 from rguenth at gcc dot gnu dot org 2009-02-06 21:21 ---
Evaluation order is undefined if there is no sequence point.
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added