This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/80592] gcc fails to detect overflow in shift statement


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);
      ~~~~~~~~~~~~~ ^  ~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]