llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Assertion failure in clang::ASTContext::adjustExceptionSpec

Open miyuki opened this issue 7 years ago • 2 comments

Bugzilla Link 41835
Resolution FIXED
Resolved on May 13, 2019 03:22
Version trunk
OS Linux
CC @PiJoules,@zygoloid

Extended Description

Starting with

commit 8ad70e473414cc639f35b6e61ed3af1db334d845
Author: Leonard Chan [email protected]
Date: Tue May 7 03:20:17 2019 +0000

Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"

Updated with fix for read of uninitialized memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360109 91177308-0d34-0410-b5e6-96231b3b80d8

The following code causes an assertion failure:

$ cat test.cc #define _LIBCPP_FLOAT_ABI attribute((pcs("aapcs"))) struct A { _LIBCPP_FLOAT_ABI int operator()() throw(); };

$ clang -target arm -mfloat-abi=soft -fsyntax-only test.cc clang-9: /tmp/plgbuild/abs_build/784414_36738/trunk/work/src/llvm/tools/clang/lib/AST/ASTContext.cpp:2807: void clang::ASTContext::adjustExceptionSpec(clang::FunctionDecl*, const clang::FunctionProtoType::ExceptionSpecInfo&, bool): Assertion `TypeLoc::getFullDataSizeForType(Updated) == TypeLoc::getFullDataSizeForType(TSInfo->getType()) && "TypeLoc size mismatch from updating exception specification"' failed. Stack dump: 0. Program arguments: /arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9 -cc1 -triple armv4t-- -fsyntax-only -disable-free -main-file-name test.cc -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu arm7tdmi -target-feature +soft-float -target-feature +soft-float-abi -target-feature -fp-only-sp -target-feature -d16 -target-feature -vfp2 -target-feature -vfp3 -target-feature -fp16 -target-feature -vfp4 -target-feature -fp-armv8 -target-feature -neon -target-feature -crypto -target-feature +strict-align -target-abi aapcs -msoft-float -mfloat-abi soft -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -resource-dir /arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/lib/clang/9.0.0 -fdeprecated-macro -fdebug-compilation-dir /work/ONT-libcxx-fail -ferror-limit 19 -fmessage-length 239 -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ test.cc -faddrsig

  1. parser at end of file
  2. test.cc:2:1: parsing struct/union/class body 'A' #​0 0x00000000026f1cfa llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x26f1cfa) #​1 0x00000000026efb14 llvm::sys::RunSignalHandlers() (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x26efb14) #​2 0x00000000026efc42 SignalHandler(int) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x26efc42) #​3 0x00007f7e508ac390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390) #​4 0x00007f7e4f418428 raise /build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0 #​5 0x00007f7e4f41a02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0 #​6 0x00007f7e4f410bd7 __assert_fail_base /build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0 #​7 0x00007f7e4f410c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82) #​8 0x00000000042e3f1f (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x42e3f1f) #​9 0x0000000003e22ab5 clang::Sema::actOnDelayedExceptionSpecification(clang::Decl*, clang::ExceptionSpecificationType, clang::SourceRange, llvm::ArrayRef<clang::OpaquePtrclang::QualType >, llvm::ArrayRefclang::SourceRange, clang::Expr*) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3e22ab5) #​10 0x0000000003b6514f clang::Parser::ParseLexedMethodDeclaration(clang::Parser::LateParsedMethodDeclaration&) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b6514f) #​11 0x0000000003b5e162 clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b5e162) #​12 0x0000000003b8ff1d clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b8ff1d) #​13 0x0000000003b91fc5 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b91fc5) #​14 0x0000000003b78ab2 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b78ab2) #​15 0x0000000003b5634f clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b5634f) #​16 0x0000000003b56c49 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.217) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b56c49) #​17 0x0000000003b5aa90 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b5aa90) #​18 0x0000000003b5bec9 clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, bool) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b5bec9) #​19 0x0000000003b5c247 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b5c247) #​20 0x0000000003b51d76 clang::ParseAST(clang::Sema&, bool, bool) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x3b51d76) #​21 0x0000000002d8b3ee clang::FrontendAction::Execute() (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x2d8b3ee) #​22 0x0000000002d4e346 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x2d4e346) #​23 0x0000000002e2e5a5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0x2e2e5a5) #​24 0x0000000000b958f0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0xb958f0) #​25 0x0000000000b11e42 main (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0xb11e42) #​26 0x00007f7e4f403830 __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0 #​27 0x0000000000b91669 _start (/arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin/clang-9+0xb91669) clang-9: error: unable to execute command: Aborted (core dumped) clang-9: error: clang frontend command failed due to signal (use -v to see invocation) clang version 9.0.0 Target: arm Thread model: posix InstalledDir: /arm/warehouse/OpenSource/llvm/0.0/2084/linux-x86_64-high-rel/bin

miyuki avatar May 10 '19 16:05 miyuki

Works for me. Thanks for a quick fix.

miyuki avatar May 13 '19 10:05 miyuki

Submitted r360448 which should fix this.

PiJoules avatar May 10 '19 18:05 PiJoules