Skip to content

Crash on invalid in Microsoft anonymous struct extension #12219

@llvmbot

Description

@llvmbot
Bugzilla Link 11847
Resolution FIXED
Resolved on Sep 17, 2014 19:42
Version trunk
OS Windows XP
Blocks llvm/llvm-bugzilla-archive#12477
Attachments Possible fix.
Reporter LLVM Bugzilla Contributor
CC @majnemer

Extended Description

The following invalid program crashes clang:

jason$ cat test.c
typedef struct { UNKNOWN c; } A;
typedef struct { A; } B;

jason$ clang -target i386-pc-win32 test.c
test.c:1:18: error: unknown type name 'UNKNOWN'
typedef struct { UNKNOWN c; } A;
^
test.c:2:18: warning: anonymous structs are a Microsoft extension [-Wmicrosoft]
typedef struct { A; } B;
^
Stack dump:
0. Program arguments: /Users/jason/Sources/llvm/build/release/bin/clang-3.1 -cc1 -triple i386-pc-win32 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu pentium4 -momit-leaf-frame-pointer -resource-dir /Users/jason/Sources/llvm/build/release/bin/../lib/clang/3.1 -fmodule-cache-path /var/folders/lf/36_5tdts1953gfg4mjwfmq8h0000gn/T/clang-module-cache -internal-isystem /Users/jason/Sources/llvm/build/release/bin/../lib/clang/3.1/include -internal-isystem C:/Program Files/Microsoft Visual Studio 10.0/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 9.0/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include -internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include -fdebug-compilation-dir /Users/jason/Desktop/test -ferror-limit 19 -fmessage-length 173 -mstackrealign -fms-extensions -fms-compatibility -fmsc-version=1300 -fdelayed-template-parsing -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/lf/36_5tdts1953gfg4mjwfmq8h0000gn/T/test-Ct8Uam.o -x c test.c

  1. test.c:2:19: current parser token ';'
  2. test.c:2:9: parsing struct/union body
    clang-3: error: unable to execute command: Segmentation fault: 11
    clang-3: error: clang frontend command failed due to signal (use -v to see invocation)
    clang-3: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information.
    clang-3: note: diagnostic msg: Preprocessed source(s) and associated run script(s) are located at:
    clang-3: note: diagnostic msg: /var/folders/lf/36_5tdts1953gfg4mjwfmq8h0000gn/T/test-B8wNe4.i
    clang-3: note: diagnostic msg: /var/folders/lf/36_5tdts1953gfg4mjwfmq8h0000gn/T/test-B8wNe4.sh

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions