https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90882
--- Comment #5 from Jonathan Wakely ---
(In reply to Kevin Dewald from comment #1)
> From what I've read, modifying a boolean variable with an int pointer is
> undefined.
Yes.
> Nevertheless, this feels unexpected from a programmers point of
>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90882
--- Comment #4 from Andrew Pinski ---
Since it is undefined behavior both GCC and clang are correct.
-fsanitizer=undefined can be detect it at runtime. This code is undefined in
two different ways really. you also violate C aliasing rules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90882
Andrew Pinski changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90882
--- Comment #2 from Kevin Dewald ---
Created attachment 46489
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46489=edit
objdump of main section
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90882
--- Comment #1 from Kevin Dewald ---
When compiling and running the attached code using GCC 7.4.0, the output prints
both 'true' and 'false'.
When testing if the variable 'boolean' is false, an XOR 1,EAX instruction is
executed on that memory