[LLVMbugs] [Bug 18837] New: Segmentation fault on ambiguous constructor call in ObjC++ mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 14 05:58:45 PST 2014


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

            Bug ID: 18837
           Summary: Segmentation fault on ambiguous constructor call in
                    ObjC++ mode
           Product: clang
           Version: 3.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: warp.grrr at gmx.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang crashes with a segmentation fault when parsing an Objective-C++ file
(.mm) containing an ambiguous constructor call using an initializer list
syntax. (Curiously, it does not crash when compiling the same code in C++ mode,
instead giving the proper error message.)

Put the following code eg. in a test.mm file and then compile with
clang++ -std=c++11 test.mm

//--------------------------------------------
struct TestStruct { float x, y; };

class Test
{
 public:
    Test(TestStruct) {}
    Test(float, float) {}
};

Test test({ 0, 0 });
//--------------------------------------------

Clang prints:

Stack dump:
0.    Program arguments: (omitted here)
1.    test.mm:12:24: current parser token ';'
2.    test.mm:11:1: parsing function body 'foo'
3.    test.mm:11:1: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault: 11

Confirmed to happen with:

Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0

and:

Debian clang version 3.3-16 (branches/release_33) (based on LLVM 3.3)
Target: x86_64-pc-linux-gnu

The full invocation in the former case (as reported by clang) is:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name test.mm -mrelocation-model pic
-pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 224.1 -stdlib=libc++ -std=c++11 -fdeprecated-macro
-ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fencode-extended-block-signature
-fobjc-exceptions -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -x objective-c++ test-MNOZUN.mm

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140214/d8b56aef/attachment.html>


More information about the llvm-bugs mailing list