[LLVMbugs] [Bug 1942] New: problem with assigning returned object to *this

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jan 23 04:46:29 PST 2008


           Summary: problem with assigning returned object to *this
           Product: tools
           Version: 2.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jay.foad at antixlabs.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=1348)
 --> (http://llvm.org/bugs/attachment.cgi?id=1348)
test case

I'm using LLVM 2.1 with the pre-built "llvm-gcc4.0-2.1-x86-linux-RHEL4" GCC
front end.

The attached program ought to print "4 6", but when I run it I get:

foad at debian:~$ ~/llvm/llvm-gcc4.0-2.1-x86-linux-RHEL4/bin/llvm-gcc -o ke ke.cpp
foad at debian:~$ ./ke
3 4

I don't see this problem if I compile with a standard GCC 4.0.1 distribution,
configured for i686-pc-linux-gnu.

>From looking at the generated llvm code, the problem is that when
foo::operator+= calls foo::operator+, it passes in "this" directly as the
structure return pointer. That doesn't work because foo::operator+ writes to
its return value before reading from its arguments.

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