http://llvm.org/bugs/show_bug.cgi?id=7426

           Summary: overflow checking for increment
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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;
    ++x;
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to