[Bug c++/110933] Add warning flags to check against integer overflow

2023-08-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110933

--- Comment #3 from Andrew Pinski  ---
Try -Wconversion.

Also there is no overflow here as unsigned is always defined as wrapping.

[Bug c++/110933] Add warning flags to check against integer overflow

2023-08-07 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110933

--- Comment #2 from Richard Biener  ---
I think there should be specific warnings for the specific cases, not one that
tries to be general.

The example you give might be -Wiv-bound-conversion?

[Bug c++/110933] Add warning flags to check against integer overflow

2023-08-07 Thread mail+gcc at nh2 dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110933

--- Comment #1 from Niklas Hambüchen  ---
A tangentially related issue is bug 24542 which is about another common
overflow bug, the pattern "u64 = u32 * u32".

Just linking it here because people interested in solving integer overflow
issues may find it relevant.