[LLVMbugs] [Bug 11584] New: Segmentation fault in clang::Sema::ActOnFields() on ObjC code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 15 05:53:12 PST 2011


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

             Bug #: 11584
           Summary: Segmentation fault in clang::Sema::ActOnFields() on
                    ObjC code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: glider at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


=====================================
$ cat test.mm
       @class NSString;
  typedef struct _NSZone NSZone;
   extern NSZone *NSDefaultMallocZone(void);
 extern NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL
canFree);
 extern void NSRecycleZone(NSZone *zone);
  @end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
 - (id)initWithCoder:(NSCoder *)aDecoder;
  @end    @interface NSObject <NSObject> {
=====================================
(note this is a malformed code)

$ clang++ -c test.mm -o test64.o -ObjC

test.mm:4:30: error: unknown type name 'NSUInteger'
 extern NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL
canFree);
                             ^
test.mm:4:52: error: unknown type name 'NSUInteger'
 extern NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL
canFree);
                                                   ^
test.mm:4:76: error: unknown type name 'BOOL'
 extern NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL
canFree);
                                                                           ^
test.mm:6:3: error: '@end' must appear in an Objective-C context
  @end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
  ^
test.mm:6:54: error: expected a type
  @end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
                                                     ^
test.mm:7:23: error: expected a type
 - (id)initWithCoder:(NSCoder *)aDecoder;
                      ^
test.mm:8:32: error: cannot find protocol declaration for 'NSObject'
  @end    @interface NSObject <NSObject> {
                               ^
test.mm:8:43: error: expected '}'
  @end    @interface NSObject <NSObject> {
                                          ^
test.mm:8:42: note: to match this '{'
  @end    @interface NSObject <NSObject> {
                                         ^
0  clang             0x0000000101531282 PrintStackTrace(void*) + 34
1  clang             0x00000001015317d9 SignalHandler(int) + 745
2  libSystem.B.dylib 0x00007fff83fa31ba _sigtramp + 26
3  libSystem.B.dylib 0x00007fff5fbfba00 _sigtramp + 3687155808
4  clang             0x00000001003979b8 clang::Sema::ActOnFields(clang::Scope*,
clang::SourceLocation, clang::Decl*, llvm::ArrayRef<clang::Decl*>,
clang::SourceLocation, clang::SourceLocation, clang::AttributeList*) + 6388
5  clang             0x00000001002e2804
clang::Parser::ParseObjCClassInstanceVariables(clang::Decl*,
clang::tok::ObjCKeywordKind, clang::SourceLocation) + 1546
6  clang             0x00000001002e8e9d
clang::Parser::ParseObjCAtInterfaceDeclaration(clang::SourceLocation,
clang::ParsedAttributes&) + 1793
7  clang             0x00000001002df340 clang::Parser::ParseObjCAtDirectives()
+ 288
8  clang             0x0000000100300273
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 773
9  clang             0x000000010030113e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 262
10 clang             0x00000001002ac035 clang::ParseAST(clang::Sema&, bool) +
325
11 clang             0x000000010027909c clang::CodeGenAction::ExecuteAction() +
924
12 clang             0x0000000100068716
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 962
13 clang             0x0000000100050982
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2162
14 clang             0x000000010004aa7b cc1_main(char const**, char const**,
char const*, void*) + 2907
15 clang             0x000000010004d920 main + 640
16 clang             0x0000000100049f0c start + 52
Stack dump:
0.    Program arguments:
/Users/glider/src/asan/asan-llvm-trunk/llvm/build/Release+Asserts/bin/clang
-cc1 -triple x86_64-apple-macosx10.6.8 -emit-obj -mrelax-all -disable-free
-main-file-name test.mm -pic-level 1 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 97.17 -coverage-file
test64.o -resource-dir
/Users/glider/src/asan/asan-llvm-trunk/llvm/build/Release+Asserts/bin/../lib/clang/3.1
-fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir
/Users/glider/src/asan/asan-llvm-trunk/llvm/projects/compiler-rt/lib/asan
-ferror-limit 19 -fmessage-length 222 -stack-protector 1 -mstackrealign
-fblocks -fobjc-dispatch-method=mixed -fobjc-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o test64.o -x objective-c
test.mm 
1.    <eof> parser at end of file
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/test-c7qt2o.mi
clang: note: diagnostic msg: /tmp/test-c7qt2o.sh

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