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 #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.
Assignee: unassigned at gcc dot gnu.org
Reporter: joe.carnuccio at qlogic dot com
Target Milestone: ---
This is the same as 39121 which has been marked RESOLVED INVALID (to which I
strongly disagree):
this produces incorrect executable: *p ^= *q ^= *p ^= *q;
( if gcc option &quo
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66673
--- Comment #2 from joe.carnuccio at qlogic dot com ---
-Wall produces no warnings...
root@elab305:/home/joe/test/c# make -B x -Wall
cc-c -o x.o x.c
cc x.o -o x
root@elab305:/home/joe/test/c# ./x
0 32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66673
--- Comment #3 from joe.carnuccio at qlogic dot com ---
Sorry, I ment this:
root@elab305:/home/joe/test/c# make -B x CFLAGS+='-Wall'
cc -Wall -c -o x.o x.c
cc x.o -o x
root@elab305:/home/joe/test/c# ./x
0 32
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=66673
--- Comment #4 from joe.carnuccio at qlogic dot com ---
if I do a ^= b ^= a ^= b it always work correctly;
doing *p ^= *q ^= *p ^= *q fails (unless -Os is used);
i.e. dereferenced pointers are being treated differently
int a = 0x32, b = 0x45