[LLVMbugs] [Bug 2125] New: C backend mishandles C++ struct return

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Mar 6 20:08:54 PST 2008


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

           Summary: C backend mishandles C++ struct return
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: C
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: gohman at apple.com
                CC: llvmbugs at cs.uiuc.edu


Compiling the following C++ testcase:

#include <string>
#include <sstream>
using namespace std;

int main()
{
  ostringstream  oss(string(1162*9, 'x'));
  oss.str();
  return 0;
}

with llvm-g++ -emit-llvm and using llc -march=c to produce a C
source file, compiling that and executing it, gets a Segmentation
Fault, at least on x86 Darwin. The problem is the call to str(), which returns
a std::string by value. The generated C source has str() returning a
small struct by value, however the library is expecting it to be returned
by hidden-argument because std::string has a copy constructor.

This is causing bigfib and possibly other llvm-test tests to fail.


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