This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80592] gcc fails to detect overflow in shift statement
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 May 2017 16:14:13 +0000
- Subject: [Bug c/80592] gcc fails to detect overflow in shift statement
- Auto-submitted: auto-generated
- References: <bug-80592-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80592
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
clang can detect this but only if max_tu_symbol is made const:
l.c:9:21: warning: signed shift result (0x1F7FFF800000) requires 46 bits to
represent, but 'int' only
has 32 bits [-Wshift-overflow]
g(max_tu_symbol << 23);
~~~~~~~~~~~~~ ^ ~~