[LLVMbugs] [Bug 21703] New: minimum value for int64_t seems to be off by 1

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 1 12:03:53 PST 2014


            Bug ID: 21703
           Summary: minimum value for int64_t seems to be off by 1
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: b.van.den.berg.nl at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The most negative value for a signed type is always one 'larger' then the most
positive value. Eg for a 'char', the range is [-128,127]. For 64-bit signeds
however there seems something smelly:

    long long a = 9223372036854775807ll;    // no error, correct
    long long b = 9223372036854775808ll;    // error, correct
    long long c = -9223372036854775807ll;   // no error, correct
    long long d = -9223372036854775808ll;   // error, NOT correct

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/20141201/e8b17fec/attachment.html>

More information about the llvm-bugs mailing list