[LLVMbugs] [Bug 10115] New: clang crashes on invalid code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 9 12:16:47 PDT 2011


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

           Summary: clang crashes on invalid code
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: zaffanella at cs.unipr.it
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


When parsing the following invalid code

struct S {
  int m[];
  not_known foo();
  S() {}
};

clang crashes on an assertion producing the following:

$ Debug+Asserts/bin/clang++  -c bug.cc
bug.cc:3:3: error: unknown type name
      'not_known'
  not_known foo();
  ^
clang: SemaDeclCXX.cpp:2260: bool
clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*,
clang::CXXCtorInitializer**, unsigned int, bool): Assertion
`ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"'
failed.

[...]

1.    bug.cc:4:7: current parser token '{'
2.    bug.cc:1:1: parsing struct/union/class body 'S'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)

Note that the assertion is not triggered if the method foo() is commented out.

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