[llvm-bugs] [Bug 40103] New: Incorrect -Warray-bounds-pointer-arithmetic warning with INT_MIN

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 19 11:36:48 PST 2018


            Bug ID: 40103
           Summary: Incorrect -Warray-bounds-pointer-arithmetic warning
                    with INT_MIN
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: efriedma at codeaurora.org
                CC: bruno.bugs.contact at gmail.com, htmldeveloper at gmail.com,
                    llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Testcase (build with -Warray-bounds-pointer-arithmetic):

char x[0x80000000];
char *nowarn() { return x - (-0x7FFFFFFF-1LL); }
char *warn() { return x - (-0x7FFFFFFF-1); }

<stdin>:3:23: warning: the pointer decremented by -2147483648 refers before the
beginning of the array [-Warray-bounds-pointer-arithmetic]
char *warn() { return x - (-0x7FFFFFFF-1); }
                      ^    ~~~~~~~~~~~~~
<stdin>:1:1: note: array 'x' declared here
char x[0x80000000];

Found by inspection while reviewing https://reviews.llvm.org/D55862 .

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/20181219/10a6023e/attachment.html>

More information about the llvm-bugs mailing list