[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 --- Comment #12 from Jonathan Wakely --- (And for the linux kernel I think it's that the don't want the data flow analysis done by that option, rather than allowing objects to live at address zero)

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 --- Comment #11 from Jonathan Wakely --- The fact that objects cannot live at address zero is not just a GCC quirk. As I said, it's required by the C and C++ standards. A null pointer cannot be dereferenced, and cannot point to any object. I'm su

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread peter at int19h dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 --- Comment #10 from Peter Bisroev --- Jonathan, thank you so much for your explanation. As soon as I read it, it all started to make sense. >You cannot increment or decrement a pointer past the end of an array (except >the one past the end pos

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 --- Comment #9 from Jonathan Wakely --- 6.3.2.3 p3 says a null pointer compares unequal to any pointer to an object, so that means no object can ever be at address 0 in a valid C program. If you're not using the -fno-delete-null-pointer-checks o

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 --- Comment #8 from Jonathan Wakely --- 6.5.6 p8 covers it. You cannot increment or decrement a pointer past the end of an array (except the one past the end position). C++ has similar rules. GCC assumes there is no object at address zero, see th

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread peter at int19h dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 --- Comment #7 from Peter Bisroev --- Thank you for your response Jonathan. If you have a minute, could you please clarify a few things. I have been talking about this behavior with a few colleagues and we are all slightly confused by the same i

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 Jonathan Wakely changed: What|Removed |Added Resolution|FIXED |INVALID --- Comment #6 from Jonathan W

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread peter at int19h dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 Peter Bisroev changed: What|Removed |Added Resolution|INVALID |FIXED --- Comment #5 from Peter Bisroev

[Bug c++/97976] Optimization relating to NULL pointer assumptions in gcc 9.1

2020-11-25 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97976 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---