http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55095



             Bug #: 55095

           Summary: Wshift-overflow

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: enhancement

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: m...@gcc.gnu.org





From: http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html



const long kMaxDiskSpace = 10 << 30;  // Ten gigs ought to be enough for

anybody.



clang++ (no other options)

test.c:1:31: warning: signed shift result (0x280000000) requires 35 bits to

represent, but 'int' only has 32 bits [-Wshift-overflow]

const long kMaxDiskSpace = 10 << 30;  // Ten gigs ought to be enough for

anybody.

                           ~~ ^  ~~

1 warning generated.



g++ -Wall -Wextra -Wconversion:



silence. :-(

Reply via email to