[LLVMbugs] [Bug 7426] New: overflow checking for increment

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 20 06:00:20 PDT 2010


           Summary: overflow checking for increment
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: llvmbugs at contacts.eelis.net
                CC: llvmbugs at cs.uiuc.edu

Clang's -trapv currently only checks binary operations. It would be nice if it
also checked ++.

In the following testcase, the overflow goes undetected:

  #include <stdio.h>
  #include <limits.h>

  void overflow_handler(long long a, long long b, char c, char d)
  { printf("overflow occurred\n"); }

  void (*__overflow_handler)(long long, long long, char, char)
    = overflow_handler;

  int main() {
    int x = INT_MAX;
    return 0;

If the increment is changed to "x += 1;" instead, the overflow /is/ detected.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list