[llvm-bugs] [Bug 50675] New: Crash while compiling code

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 11 01:25:03 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50675

            Bug ID: 50675
           Summary: Crash while compiling code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: megabyte1024 at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Dear LLVM maintainers,

Playing with C++ code in an online playground, I found that the code generates
an issue in the LLVM compiler.

The code with the error message and stack trace are available online by the
link https://gcc.godbolt.org/z/f1TaoobEE .

Also the code and the stack trace are below and it does not require any script
to reproduce.

The code:

------------- cut here -------------

template<class C> struct Data {
    template<typename T> struct Item1 {
        void Test() {
        }
    };
};

template <class C> 
struct MyData : Data<C> {
    class Data<C>::template Item1<int> item10;              // (1)
};

struct S;

MyData<S> dataS;

------------- cut here -------------

The error description and the call stack:

------------- cut here -------------
clang++: tools/clang/include/clang/AST/TypeNodes.inc:70: clang::TypeInfo
clang::ASTContext::getTypeInfoImpl(const clang::Type*) const: Assertion
`!T->isDependentType() && "should not see dependent types here"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments:
/opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s
-mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics
-fno-crash-diagnostics -std=c++11 <source>
1.      <source>:15:16: current parser token ';'
 #0 0x0000557182df2def PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000557182df0c10 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x379bc10)
 #2 0x0000557182d40ac8 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #3 0x00007f3f6f7193c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x00007f3f6f1e918b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618b)
 #5 0x00007f3f6f1c8859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
 #6 0x00007f3f6f1c8729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729)
 #7 0x00007f3f6f1d9f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x00005571856eabe2
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6095be2)
 #9 0x00005571856e99d2 clang::ASTContext::getTypeInfo(clang::Type const*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60949d2)
#10 0x00005571856e9c71 clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6094c71)
#11 0x00005571856e99d2 clang::ASTContext::getTypeInfo(clang::Type const*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60949d2)
#12 0x00005571856f7a7b clang::ASTContext::getTypeInfoInChars(clang::Type
const*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60a2a7b)
#13 0x00005571856f7bc6 clang::ASTContext::getTypeInfoInChars(clang::QualType)
const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60a2bc6)
#14 0x00005571859ff954 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*,
bool)::'lambda'(bool)::operator()(bool) const RecordLayoutBuilder.cpp:0:0
#15 0x0000557185a0cb4f (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*,
bool) RecordLayoutBuilder.cpp:0:0
#16 0x0000557185a0d319 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*)
RecordLayoutBuilder.cpp:0:0
#17 0x0000557185a0f0e0 (anonymous
namespace)::ItaniumRecordLayoutBuilder::Layout(clang::CXXRecordDecl const*)
RecordLayoutBuilder.cpp:0:0
#18 0x0000557185a08fa7 clang::ASTContext::getASTRecordLayout(clang::RecordDecl
const*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63b3fa7)
#19 0x00005571856ea91d clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x609591d)
#20 0x00005571856e99d2 clang::ASTContext::getTypeInfo(clang::Type const*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60949d2)
#21 0x00005571856e9b5e clang::ASTContext::getTypeAlignInChars(clang::QualType)
const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6094b5e)
#22 0x0000557184dd40b0 clang::Sema::CheckArgAlignment(clang::SourceLocation,
clang::NamedDecl*, llvm::StringRef, clang::QualType, clang::QualType)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x577f0b0)
#23 0x0000557184dfe35b clang::Sema::CheckConstructorCall(clang::FunctionDecl*,
clang::QualType, llvm::ArrayRef<clang::Expr const*>, clang::FunctionProtoType
const*, clang::SourceLocation)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x57a935b)
#24 0x0000557184f21df8
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x58ccdf8)
#25 0x000055718517ffdf PerformConstructorInitialization(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step
const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation)
SemaInit.cpp:0:0
#26 0x000055718519235d clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5b3d35d)
#27 0x0000557184eba2e2 clang::Sema::ActOnUninitializedDecl(clang::Decl*)
(.part.3353) SemaDecl.cpp:0:0
#28 0x0000557184c8e26b
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x563926b)
#29 0x0000557184c9ed5a clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5649d5a)
#30 0x0000557184c78929
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5623929)
#31 0x0000557184c79071
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.280) Parser.cpp:0:0
#32 0x0000557184c79260
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5624260)
#33 0x0000557184c79eb9
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5624eb9)
#34 0x0000557184c70009 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x561b009)
#35 0x0000557183da18f8 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x474c8f8)
#36 0x0000557183702241 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40ad241)
#37 0x000055718369e92a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x404992a)
#38 0x00005571837d03ba
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x417b3ba)
#39 0x00005571809e151c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x138c51c)
#40 0x00005571809dc8c9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#41 0x0000557183550015 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#42 0x0000557182d410b3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36ec0b3)
#43 0x00005571835521c4
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3efd1c4)
#44 0x000055718352871a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ed371a)
#45 0x00005571835293bf
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ed43bf)
#46 0x0000557183532c6a
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3eddc6a)
#47 0x000055718090a5b8 main
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x12b55b8)
#48 0x00007f3f6f1ca0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#49 0x00005571809dc43a _start
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x138743a)
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
Compiler returned: 134
------------- cut here -------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210611/4340fd05/attachment.html>


More information about the llvm-bugs mailing list