[cfe-commits] [PATCH] Fix for crash on invalid in microsoft anonymous struct extension

Jason Haslam jason.haslam at gmail.com
Tue Jan 31 15:53:25 PST 2012


Ah, of course. Updated patch including test case attached. Thanks!

Jason

-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash-on-invalid.diff
Type: application/octet-stream
Size: 1305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120131/a63b92f4/attachment.obj>
-------------- next part --------------



On Jan 31, 2012, at 3:55 PM, Nico Weber wrote:

> Thanks for the patch! Can you include a test case? See e.g.
> test/Sema/ms_class_layout.cpp for an example.
> 
> Nico
> 
> On Tue, Jan 31, 2012 at 2:33 PM, Jason Haslam <jason.haslam at gmail.com> wrote:
>> The attached trivial patch fixes PR 11847. From the PR:
>> 
>> 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...
>> 
>> Please apply.
>> 
>> Jason
>> 
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 



More information about the cfe-commits mailing list