[LLVMbugs] [Bug 8735] New: c++ miscompile at -O2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 3 15:56:35 PST 2010


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

           Summary: c++ miscompile at -O2
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu


I have a testcase which fails when used with __versa_string. For those not
familiar, versa_string is an alternate string type in libstdc++ (#include
<ext/vstring.h>) that implements the small string optimization. This header
(and its dependencies) are missing lots of "this->" so I'm posting only the
preprocessed source. You can extract the original testcase from the bottom if
you're willing to change your system headers.

Steps to repro:

nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/clang++ -O2 -fno-exceptions rr.ii
-o rr
nlewycky at ducttape:~$ ./rr
r1 removeremove
r2 removeremove
i insertBar

The two 'removeremove' strings should be 'removeBar'. The problem is that
string::operator+ is getting the wrong 'this' pointer (but a valid one! it's
just one for a different object) after opt -O2.

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