[Bug c++/102303] optimizer elides -ftrapv overflow detection

2021-09-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102303 Andrew Pinski changed: What|Removed |Added Resolution|--- |DUPLICATE Status|UNCONFIRME

[Bug c++/102303] optimizer elides -ftrapv overflow detection

2021-09-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102303 --- Comment #2 from Richard Biener --- No, the issue is that we apply constant folding and elide the trapping operation which is generally considered OK by GCC (eliding traps, that is). For example we also elide the trap in int main() {

[Bug c++/102303] optimizer elides -ftrapv overflow detection

2021-09-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102303 --- Comment #1 from Andrew Pinski --- This is a known bug with -ftrapv where gcc widens everything to word mode (64bit in this case) and uses libcalls to implement-ftrapv. There are a few other bugs that say the same thing.