[Bug c/90882] Possible security breach through undefined behavior when treating boolean as int

2019-06-14 Thread redi at gcc dot gnu.org
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 >

[Bug c/90882] Possible security breach through undefined behavior when treating boolean as int

2019-06-13 Thread pinskia at gcc dot gnu.org
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

[Bug c/90882] Possible security breach through undefined behavior when treating boolean as int

2019-06-13 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90882 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/90882] Possible security breach through undefined behavior when treating boolean as int

2019-06-13 Thread kevin.dewald at ieee dot org
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

[Bug c/90882] Possible security breach through undefined behavior when treating boolean as int

2019-06-13 Thread kevin.dewald at ieee dot org
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