We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following testcase will cause clang to assert when using precompiled headers:
foo.cpp:
void foo() { Bar bar; }
foo.h:
struct Bar { int buffer[123] attribute((aligned(4))); };
http://gist.github.com/632128
Assertion failed: (Align && (Align & (Align-1)) == 0 && "Alignment must be power of 2"), function getTypeInfo, file /Users/torarne/dev/llvm/clang/lib/AST/ASTContext.cpp, line 845. 0 clang 0x00000001013aee62 PrintStackTrace(void*) + 34 1 clang 0x00000001013afcb3 SignalHandler(int) + 707 2 libSystem.B.dylib 0x00007fff8013135a _sigtramp + 26 3 libSystem.B.dylib 0x0000000102119ec8 _sigtramp + 2180942728 4 clang 0x000000010001cca2 __assert_rtn + 66 5 clang 0x000000010071cf1f clang::ASTContext::getTypeInfo(clang::Type const*) + 319 6 clang 0x000000010071dc88 clang::ASTContext::getPreferredTypeAlign(clang::Type const*) + 24 7 clang 0x000000010071e229 clang::ASTContext::getDeclAlign(clang::Decl const*, bool) + 1161 8 clang 0x00000001001b9a13 clang::CodeGen::CodeGenFunction::EmitLocalBlockVarDecl(clang::VarDecl const&, void ()(clang::CodeGen::CodeGenFunction&, clang::VarDecl const&, llvm::Value)) + 67 9 clang 0x00000001001bc6ef clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) + 191 10 clang 0x0000000100269dbb clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 171 11 clang 0x000000010026d5f7 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 167 12 clang 0x000000010026a3f0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 48 13 clang 0x000000010026d36b clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 283 14 clang 0x000000010026d712 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 450 15 clang 0x000000010026a3f0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 48 16 clang 0x0000000100293c98 clang::CodeGen::CodeGenFunction::GenerateCode(clang::CodeGen::GlobalDecl, llvm::Function*) + 1160 17 clang 0x000000010029e72b clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::CodeGen::GlobalDecl) + 715 18 clang 0x00000001002a257b clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::CodeGen::GlobalDecl) + 395 19 clang 0x00000001002a26f6 clang::CodeGen::CodeGenModule::EmitGlobal(clang::CodeGen::GlobalDecl) + 150 20 clang 0x00000001002a332f clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 895 21 clang 0x00000001002c3f1c (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 60 22 clang 0x000000010028c4ab (anonymous namespace)::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 155 23 clang 0x00000001002d0476 clang::ParseAST(clang::Sema&, bool) + 182 24 clang 0x000000010028cd2c clang::CodeGenAction::ExecuteAction() + 60 25 clang 0x00000001000525f9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 393 26 clang 0x00000001000264fe clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1614 27 clang 0x000000010001e53e cc1_main(char const**, char const**, char const*, void*) + 510 28 clang 0x0000000100025074 main + 4884 29 clang 0x000000010001cf78 start + 52 Stack dump: 0. Program arguments: /Users/torarne/build/llvm/Release+Asserts/bin/clang -cc1 -triple x86_64-apple-darwin10.0.0 -emit-obj -mrelax-all -disable-free -main-file-name foo.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 97.14 -resource-dir /Users/torarne/build/llvm/Release+Asserts/lib/clang/2.9 -include-pch foo.h.pch -ferror-limit 19 -fmessage-length 266 -stack-protector 1 -fblocks -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o foo.clang.o -x c++ foo.cpp
<eof> parser at end of file
foo.cpp:2:6: LLVM IR generation of declaration 'foo'
foo.cpp:2:6: Generating code for declaration 'foo'
foo.cpp:2:12: LLVM IR generation of compound statement ('{}')
clang: error: clang frontend command failed due to signal 4 (use -v to see invocation)
Looking briefly at the code in a debugger it seems it thinks the alignement is 123, the size of the buffer, not 4, what's passed to aligned()
clang version 2.9 (git://repo.or.cz/clang.git 4449662e4b0482d42bcdae68cd767559879d762d) Target: x86_64-apple-darwin10 Thread model: posix
Reproducible on both OSX and Linux.
The text was updated successfully, but these errors were encountered:
I can't reproduce it, could you try latest clang ?
Sorry, something went wrong.
Oops, scratch that, I see it. On it...
Thanks!
Fixed at r116737.
No branches or pull requests
Extended Description
The following testcase will cause clang to assert when using precompiled headers:
foo.cpp:
void foo() {
Bar bar;
}
foo.h:
struct Bar
{
int buffer[123] attribute((aligned(4)));
};
http://gist.github.com/632128
Assertion failed: (Align && (Align & (Align-1)) == 0 && "Alignment must be power of 2"), function getTypeInfo, file /Users/torarne/dev/llvm/clang/lib/AST/ASTContext.cpp, line 845.
0 clang 0x00000001013aee62 PrintStackTrace(void*) + 34
1 clang 0x00000001013afcb3 SignalHandler(int) + 707
2 libSystem.B.dylib 0x00007fff8013135a _sigtramp + 26
3 libSystem.B.dylib 0x0000000102119ec8 _sigtramp + 2180942728
4 clang 0x000000010001cca2 __assert_rtn + 66
5 clang 0x000000010071cf1f clang::ASTContext::getTypeInfo(clang::Type const*) + 319
6 clang 0x000000010071dc88 clang::ASTContext::getPreferredTypeAlign(clang::Type const*) + 24
7 clang 0x000000010071e229 clang::ASTContext::getDeclAlign(clang::Decl const*, bool) + 1161
8 clang 0x00000001001b9a13 clang::CodeGen::CodeGenFunction::EmitLocalBlockVarDecl(clang::VarDecl const&, void ()(clang::CodeGen::CodeGenFunction&, clang::VarDecl const&, llvm::Value)) + 67
9 clang 0x00000001001bc6ef clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) + 191
10 clang 0x0000000100269dbb clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 171
11 clang 0x000000010026d5f7 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 167
12 clang 0x000000010026a3f0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 48
13 clang 0x000000010026d36b clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 283
14 clang 0x000000010026d712 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 450
15 clang 0x000000010026a3f0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 48
16 clang 0x0000000100293c98 clang::CodeGen::CodeGenFunction::GenerateCode(clang::CodeGen::GlobalDecl, llvm::Function*) + 1160
17 clang 0x000000010029e72b clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::CodeGen::GlobalDecl) + 715
18 clang 0x00000001002a257b clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::CodeGen::GlobalDecl) + 395
19 clang 0x00000001002a26f6 clang::CodeGen::CodeGenModule::EmitGlobal(clang::CodeGen::GlobalDecl) + 150
20 clang 0x00000001002a332f clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 895
21 clang 0x00000001002c3f1c (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 60
22 clang 0x000000010028c4ab (anonymous namespace)::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 155
23 clang 0x00000001002d0476 clang::ParseAST(clang::Sema&, bool) + 182
24 clang 0x000000010028cd2c clang::CodeGenAction::ExecuteAction() + 60
25 clang 0x00000001000525f9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 393
26 clang 0x00000001000264fe clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1614
27 clang 0x000000010001e53e cc1_main(char const**, char const**, char const*, void*) + 510
28 clang 0x0000000100025074 main + 4884
29 clang 0x000000010001cf78 start + 52
Stack dump:
0. Program arguments: /Users/torarne/build/llvm/Release+Asserts/bin/clang -cc1 -triple x86_64-apple-darwin10.0.0 -emit-obj -mrelax-all -disable-free -main-file-name foo.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 97.14 -resource-dir /Users/torarne/build/llvm/Release+Asserts/lib/clang/2.9 -include-pch foo.h.pch -ferror-limit 19 -fmessage-length 266 -stack-protector 1 -fblocks -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o foo.clang.o -x c++ foo.cpp
clang: error: clang frontend command failed due to signal 4 (use -v to see invocation)
Looking briefly at the code in a debugger it seems it thinks the alignement is 123, the size of the buffer, not 4, what's passed to aligned()
clang version 2.9 (git://repo.or.cz/clang.git 4449662e4b0482d42bcdae68cd767559879d762d)
Target: x86_64-apple-darwin10
Thread model: posix
Reproducible on both OSX and Linux.
The text was updated successfully, but these errors were encountered: