[LLVMbugs] [Bug 14157] New: Optimizer problem in case of multiplication of long long int's with an arithmetic overflow

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 23 08:26:36 PDT 2012


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

             Bug #: 14157
           Summary: Optimizer problem in case of multiplication of long
                    long int's with an arithmetic overflow
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: malex984 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9405
  --> http://llvm.org/bugs/attachment.cgi?id=9405
compile with optimization (-O1) in order to trigger the problem

clang optimizer (e.g. compilation with 'clang -O1') is wrong thinking that
"(a*b)/a" is b and "(a*b)/b" is a, for example if there was an arithmetic
overflow and a*b is zero.

For instance (see the attachment): 
let INT64 be "long long int", long a be 72057594037927936L, long b be
268435456L, then INT64 result = (INT64)a * (INT64)b is zero but optimizer still
thinks that result/a == b and result/b == a

clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Any other way to detect such an arithmetic overflow?

-- 
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