[llvm-bugs] [Bug 33703] New: Integer overflow in C array dimension goes unremarked, creates zero-sized object

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 6 12:43:53 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33703

            Bug ID: 33703
           Summary: Integer overflow in C array dimension goes unremarked,
                    creates zero-sized object
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arcata at gmail.com
                CC: llvm-bugs at lists.llvm.org

If you compile the following as C, it quietly works without warning or error:

char x[4*1024*1024*1024] = {};
_Static_assert(sizeof(x) == 0, "hmm");

The same code in C++ (substituting static_assert for _Static_assert) correctly
flags the integer overflow and non-constexpr-ness of the expression.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170706/8a692d34/attachment.html>


More information about the llvm-bugs mailing list