[cfe-dev] size mismatch! assertion failure

Jay Foad jay.foad at gmail.com
Fri Jul 2 05:45:11 PDT 2010


Hi,

On a particular source file I get:

$ clang -cc1 -w -S foo.i
clang: /home/jay/svn/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp:401:
static llvm::Constant*<unnamed>::ConstStructBuilder::BuildStruct(clang::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.



More information about the cfe-dev mailing list