[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 --- Comment #7 from Andrew Pinski --- Note ubsan (-fsanitize=undefined) gives an runtime message as expected: /app/example.cpp:11:17: runtime error: signed integer overflow: 65535 * 65535 cannot be represented in type 'int'

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 --- Comment #6 from Andrew Pinski --- Yes doing: uint32_t q = ((uint32_t)ah) * ((uint32_t)bl); uint32_t r = ((uint32_t)al) * ((uint32_t)bh); "Fixes" the issue by avoiding signed integer overflows (which is undefined).

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 --- Comment #5 from Andrew Pinski --- Well just use: ((unsigned)al)*((unsigned)bh)

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 --- Comment #4 from Michael Zucchi --- ok thought it might be something like that. is there any way to prevent it?

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 --- Comment #2 from Michael Zutti --- Created attachment 58630 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58630&action=edit output of gcc -v

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864 --- Comment #1 from Michael Zutti --- Created attachment 58629 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58629&action=edit preprocessed file