[cfe-dev] size mismatch! assertion failure

Pedro Ferreira Pedro.Ferreira at imgtec.com
Fri Jul 2 09:35:14 PDT 2010


Try building clang with debug info, as the present stack dump doesn't
give a lot of info.
After that, run with gdb and when the assert fails, do a "bt" to get the
stack trace. By going back on clang's function calls, you may be able to
track the problem down to the line of code on your source (the file you
are trying to compile) that generated the error in the first place.

> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu 
> [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Jay Foad
> Sent: 02 July 2010 13:45
> To: clang-dev Developers
> Subject: [cfe-dev] size mismatch! assertion failure
> 
> Hi,
> 
> On a particular source file I get:
> 
> $ clang -cc1 -w -S foo.i
> clang: 
> /home/jay/svn/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstan
> t.cpp:401:
> static 
> llvm::Constant*<unnamed>::ConstStructBuilder::BuildStruct(clan
> g::CodeGen::CodeGenModule&,
> clang::CodeGen::CodeGenFunction*, clang::InitListExpr*): 
> Assertion `llvm::RoundUpToAlignment(Builder.NextFieldOffsetInBytes,
> Builder.getAlignment(Result)) == 
> Builder.getSizeInBytes(Result) && "Size mismatch!"' failed.
> 0  clang           0x00000000015a0dc0
> 1  clang           0x00000000015a0c84
> 2  libpthread.so.0 0x00007f19c3a978f0
> 3  libc.so.6       0x00007f19c2d87a75 gsignal + 53
> 4  libc.so.6       0x00007f19c2d8b5c0 abort + 384
> 5  libc.so.6       0x00007f19c2d80941 __assert_fail + 241
> 6  clang           0x00000000005f1487
> 7  clang           0x00000000005f23a6
> 8  clang           0x00000000005f254b
> 9  clang           0x00000000005f5485
> 10 clang           0x00000000005f3965
> 11 clang           0x00000000005bd5e0
> 12 clang           0x00000000005bb333
> 13 clang           0x00000000005bb22e
> 14 clang           0x000000000064f1f9
> 15 clang           0x000000000064d68e
> 16 clang           0x000000000064d1b2
> 17 clang           0x000000000064d8ae
> 18 clang           0x000000000064d64d
> 19 clang           0x000000000064d1b2
> 20 clang           0x0000000000678b34
> 21 clang           0x0000000000679129
> 22 clang           0x00000000005676f5
> 23 clang           0x000000000056584f
> 24 clang           0x0000000000564b45
> 25 clang           0x0000000000562ec0
> 26 clang           0x000000000055f9ad
> 27 clang           0x000000000055d614
> 28 clang           0x00000000006a381e
> 29 clang           0x00000000004524ce
> 30 clang           0x000000000055e63c
> 31 clang           0x000000000045212e
> 32 clang           0x000000000043bd6c
> 33 clang           0x00000000004093ee
> 34 clang           0x00000000004121c4 main + 357
> 35 libc.so.6       0x00007f19c2d72c4d __libc_start_main + 253
> 36 clang           0x0000000000407d89
> Stack dump:
> 0.	Program arguments: 
> /home/jay/clang/objdir/Debug/bin/clang -cc1 -w -S foo.i
> 1.	<eof> parser at end of file
> 2.	Per-file LLVM IR generation
> 3.	foo.c:801:13: Generating code for declaration 'bar'
> 4.	foo.c:802:2: LLVM IR generation of compound statement ('{}')
> Aborted
> 
> 
> The source file is (a) quite big and (b) proprietary, so I 
> don't really want to post it in its current form. What can I 
> do to help fix the problem? E.g. is there something like 
> bugpoint that can reduce it automatically, or is there 
> anything useful I can do in the debugger when it fails?
> 
> I'm running Ubuntu 10.4 x86_64, and I built LLVM and clang 
> from svn trunk as of a few hours ago.
> 
> Thanks,
> Jay.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 





More information about the cfe-dev mailing list