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++/55095] New: Wshift-overflow


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: unassigned@gcc.gnu.org
        ReportedBy: manu@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. :-(


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