[LLVMbugs] [Bug 13154] New: Segfault in constructor when initializing a reference inside an anonymous struct (at runtime)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 20 04:11:00 PDT 2012


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

             Bug #: 13154
           Summary: Segfault in constructor when initializing a reference
                    inside an anonymous struct (at runtime)
           Product: clang
           Version: 3.0
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: alcosholik at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8731
  --> http://llvm.org/bugs/attachment.cgi?id=8731
The code that segfaults when run

I've attached the code that crashes with segfault when run. If you comment out
the struct, you'll see that it's working fine without it.

When I run the code under lldb, it stops with

    stop reason = EXC_BAD_ACCESS (code=1, address=0x0)

Similar behavior can also be observed on iOS (armv6).

struct VectorTest{
//*
    struct {
        float &x;
    };
/*/
    float &x;
//*/
    VectorTest(float &x);
};

VectorTest::VectorTest(float &xx)
  : x(xx)
{}

int main(int argc, const char *argv[])
{
    float x = 13;
    VectorTest _t(x);
    return 0;
}

I've also attached a diff of the generated assembly for both cases (with and
without struct) obtained with this invocation:

    clang -S llvm-test.cpp -o <filename>

---

Tested on two clang versions:

λ /usr/local/bin/clang --version
clang version 3.0 (tags/RELEASE_30/final)
Target: x86_64-apple-darwin11.4.0
Thread model: posix

λ clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix

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