[LLVMbugs] [Bug 6526] New: Optimization bug with clang -O2 (not -O1)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 6 11:30:20 PST 2010


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

           Summary: Optimization bug with clang -O2 (not -O1)
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: gonsolo at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4406)
 --> (http://llvm.org/bugs/attachment.cgi?id=4406)
Bitcode that exposes optimization bug

The attached bitcode fails when compiled with clang -O2. It runs fine
unoptimized and at -O1.
I verified the correctness with valgrind with clang++ unoptimized, clang++ -O1
and g++.

 The error ist:

*** glibc detected *** ./opted: free(): invalid pointer: 0x00e797e0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0x910ff1]
/lib/tls/i686/cmov/libc.so.6[0x9126f2]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x9157cd]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xe466f1]
/usr/lib/libstdc++.so.6(_ZdaPv+0x1d)[0xe4674d]
/usr/lib/libstdc++.so.6(_ZNSt6locale5_ImplD1Ev+0x7d)[0xde5a8d]
/usr/lib/libstdc++.so.6(_ZNSt6localeD1Ev+0x4c)[0xde609c]
/usr/lib/libstdc++.so.6(_ZNSt8ios_baseD2Ev+0x61)[0xde3041]
./opted[0x804a7ce]
======= Memory map: ========
003ab000-003c6000 r-xp 00000000 08:07 64         /lib/ld-2.10.1.so
003c6000-003c7000 r--p 0001a000 08:07 64         /lib/ld-2.10.1.so
003c7000-003c8000 rw-p 0001b000 08:07 64         /lib/ld-2.10.1.so
003ec000-00410000 r-xp 00000000 08:07 144631    
/lib/tls/i686/cmov/libm-2.10.1.so
00410000-00411000 r--p 00023000 08:07 144631    
/lib/tls/i686/cmov/libm-2.10.1.so
00411000-00412000 rw-p 00024000 08:07 144631    
/lib/tls/i686/cmov/libm-2.10.1.so
008a6000-009e4000 r-xp 00000000 08:07 144625    
/lib/tls/i686/cmov/libc-2.10.1.so
009e4000-009e5000 ---p 0013e000 08:07 144625    
/lib/tls/i686/cmov/libc-2.10.1.so
009e5000-009e7000 r--p 0013e000 08:07 144625    
/lib/tls/i686/cmov/libc-2.10.1.so
009e7000-009e8000 rw-p 00140000 08:07 144625    
/lib/tls/i686/cmov/libc-2.10.1.so
009e8000-009eb000 rw-p 00000000 00:00 0 
00d8e000-00e74000 r-xp 00000000 08:07 235237     /usr/lib/libstdc++.so.6.0.13
00e74000-00e78000 r--p 000e6000 08:07 235237     /usr/lib/libstdc++.so.6.0.13
00e78000-00e79000 rw-p 000ea000 08:07 235237     /usr/lib/libstdc++.so.6.0.13
00e79000-00e80000 rw-p 00000000 00:00 0 
00ef5000-00ef6000 r-xp 00000000 00:00 0          [vdso]
00fb5000-00fd1000 r-xp 00000000 08:07 18         /lib/libgcc_s.so.1
00fd1000-00fd2000 r--p 0001b000 08:07 18         /lib/libgcc_s.so.1
00fd2000-00fd3000 rw-p 0001c000 08:07 18         /lib/libgcc_s.so.1
08048000-0804d000 r-xp 00000000 08:07 172256     /home/gonsolo/opted
0804d000-0804e000 r--p 00004000 08:07 172256     /home/gonsolo/opted
0804e000-0804f000 rw-p 00005000 08:07 172256     /home/gonsolo/opted
08bd6000-08bf7000 rw-p 00000000 00:00 0          [heap]
b7600000-b7621000 rw-p 00000000 00:00 0 
b7621000-b7700000 ---p 00000000 00:00 0 
b7795000-b7797000 rw-p 00000000 00:00 0 
b77aa000-b77ac000 rw-p 00000000 00:00 0 
bfb12000-bfb27000 rw-p 00000000 00:00 0          [stack]
Aborted

Bugpoint show how to reproduce:

*** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc
-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -globalopt -ipsccp
-deadargelim -instcombine -simplifycfg -basiccg -prune-eh -inline
-functionattrs -domtree -domfrontier -scalarrepl -simplify-libcalls
-instcombine -jump-threading -simplifycfg -instcombine -tailcallelim
-simplifycfg -reassociate -domtree -loops -loopsimplify -domfrontier
-loopsimplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine
-scalar-evolution -loopsimplify -lcssa -iv-users -indvars -loop-deletion
-loopsimplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt
-sccp -instcombine -jump-threading -domtree -memdep -dse -adce -simplifycfg
-strip-dead-prototypes -print-used-types -deadtypeelim -constmerge -preverify
-domtree -verify

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