[LLVMbugs] [Bug 13926] New: New SROA miscompiles std::stable_sort from libstdc++
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Sep 26 04:27:37 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13926
Bug #: 13926
Summary: New SROA miscompiles std::stable_sort from libstdc++
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Keywords: miscompilation
Severity: release blocker
Priority: P
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: benny.kra at gmail.com
CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9262
--> http://llvm.org/bugs/attachment.cgi?id=9262
unreduced standalone test case
Sorry for the large testcase, I only got this to reproduce with pulling in
large parts of llvm.
There seems to be a miscompile around std::__merge_adaptive that leads to
memory corruption. On i386/linux the heap gets corrupted and glibc aborts, on
OSX I'm only seeing valgrind errors with new SROA that don't show up with old
SROA but no crashes. Note that the test case was generated on i386/linux and
doesn't work on x86_64 (-m32 works though)
$ clang++ -O3 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS t.cc -mllvm -use-new-sroa=false
$ ./a.out
[no output]
$ clang++ -O3 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS t.cc
$ ./a.out
*** glibc detected *** ./a.out: double free or corruption (!prev): 0x099ec240
***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6(+0x6b381)[0xb7517381]
/lib/i686/cmov/libc.so.6(+0x6cbd8)[0xb7518bd8]
/lib/i686/cmov/libc.so.6(cfree+0x6d)[0xb751bcbd]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb76f3701]
./a.out[0x8048a16]
======= Memory map: ========
08048000-0804b000 r-xp 00000000 08:03 306633 /var/tmp/llvm-build/a.out
0804b000-0804c000 rw-p 00002000 08:03 306633 /var/tmp/llvm-build/a.out
099ec000-09a0d000 rw-p 00000000 00:00 0 [heap]
b7300000-b7321000 rw-p 00000000 00:00 0
b7321000-b7400000 ---p 00000000 00:00 0
b74ab000-b74ac000 rw-p 00000000 00:00 0
b74ac000-b75ec000 r-xp 00000000 08:01 626 /lib/i686/cmov/libc-2.11.3.so
b75ec000-b75ed000 ---p 00140000 08:01 626 /lib/i686/cmov/libc-2.11.3.so
b75ed000-b75ef000 r--p 00140000 08:01 626 /lib/i686/cmov/libc-2.11.3.so
b75ef000-b75f0000 rw-p 00142000 08:01 626 /lib/i686/cmov/libc-2.11.3.so
b75f0000-b75f3000 rw-p 00000000 00:00 0
b75f3000-b7610000 r-xp 00000000 08:01 191 /lib/libgcc_s.so.1
b7610000-b7611000 rw-p 0001c000 08:01 191 /lib/libgcc_s.so.1
b7611000-b7612000 rw-p 00000000 00:00 0
b7612000-b7636000 r-xp 00000000 08:01 339 /lib/i686/cmov/libm-2.11.3.so
b7636000-b7637000 r--p 00023000 08:01 339 /lib/i686/cmov/libm-2.11.3.so
b7637000-b7638000 rw-p 00024000 08:01 339 /lib/i686/cmov/libm-2.11.3.so
b7638000-b7721000 r-xp 00000000 08:04 7824783 /usr/lib/libstdc++.so.6.0.13
b7721000-b7725000 r--p 000e9000 08:04 7824783 /usr/lib/libstdc++.so.6.0.13
b7725000-b7726000 rw-p 000ed000 08:04 7824783 /usr/lib/libstdc++.so.6.0.13
b7726000-b772d000 rw-p 00000000 00:00 0
b774e000-b7750000 rw-p 00000000 00:00 0
b7750000-b7751000 r-xp 00000000 00:00 0 [vdso]
b7751000-b776c000 r-xp 00000000 08:01 2196 /lib/ld-2.11.3.so
b776c000-b776d000 r--p 0001b000 08:01 2196 /lib/ld-2.11.3.so
b776d000-b776e000 rw-p 0001c000 08:01 2196 /lib/ld-2.11.3.so
bfb2c000-bfb69000 rw-p 00000000 00:00 0 [stack]
[1] 23126 abort ./a.out
--
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