This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66673] swapping variables via chained xor fails
- From: "joe.carnuccio at qlogic dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 25 Jun 2015 19:46:37 +0000
- Subject: [Bug c/66673] swapping variables via chained xor fails
- Auto-submitted: auto-generated
- References: <bug-66673-4 at http dot gcc dot gnu dot org/bugzilla/>
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;
int *p = &a, *q = &b;