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'
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).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864
--- Comment #5 from Andrew Pinski ---
Well just use:
((unsigned)al)*((unsigned)bh)
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?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864
Andrew Pinski changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
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
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