[llvm-bugs] [Bug 33537] New: Illegitimate implicitly-unsigned-literal warning for LLONG_MIN value.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 20 18:16:17 PDT 2017


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

            Bug ID: 33537
           Summary: Illegitimate implicitly-unsigned-literal warning for
                    LLONG_MIN value.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: babokin at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang trunk, x86_64.

Using long long literal with LLONG_MIN value causes illegitimate warning. Note
using LLONG_MIN macro is ok, as it's defined as (-9223372036854775807LL -1)

> cat f.cpp
#include <climits>
// these guys are ok.
int min_int1 = -2147483648;
int min_int2 = INT_MIN;
// min_ll1 causes troubles, while min_ll2 is ok, because it's defined as
(-9223372036854775807LL -1)
long long int min_ll1 = -9223372036854775808LL; // 0x8000000000000000LL
long long int min_ll2 = LLONG_MIN;
> clang++ f.cpp -c
f.cpp:6:26: warning: integer literal is too large to be represented in a signed
integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
long long int min_ll1 = -9223372036854775808LL; // 0x8000000000000000LL
                         ^
1 warning generated.

-- 
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/20170621/3b3a9c88/attachment.html>


More information about the llvm-bugs mailing list