[llvm-bugs] [Bug 48466] New: -Wconsumed ICE on switch default case with empty enum

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 9 19:23:09 PST 2020


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

            Bug ID: 48466
           Summary: -Wconsumed ICE on switch default case with empty enum
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: arthur.j.odwyer at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

Originally reported by Drew Gross.
Possibly somehow related to #16212, #33699. The enum being "empty" (an enum
type with no enumerators) is important to this ICE somehow.

// https://godbolt.org/z/KxbGsv
enum E {};
void foo(E e) {
    switch (e) { default:; }
}

clang++ -Wconsumed test.cpp


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-trunk/bin/clang++ -g -o
./output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot
-fcolor-diagnostics -fno-crash-diagnostics -Wconsumed <source>
1.      <eof> parser at end of file
2.      <source>:3:15: parsing function body 'foo'
 #0 0x00005651c0f17e4c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2e0ae4c)
 #1 0x00005651c0f15be4 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2e08be4)
 #2 0x00005651c0f15e75 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2e08e75)
 #3 0x00005651c0e84338 CrashRecoverySignalHandler(int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2d77338)
 #4 0x00007fc53fc493c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x00005651c34128b3
clang::consumed::ConsumedAnalyzer::run(clang::AnalysisDeclContext&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x53058b3)
 #6 0x00005651c336466e
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x525766e)
 #7 0x00005651c2c54dfe
clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy
const*, clang::Decl const*, clang::QualType)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4b47dfe)
 #8 0x00005651c2dab042 clang::Sema::ActOnFinishFunctionBody(clang::Decl*,
clang::Stmt*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4c9e042)
 #9 0x00005651c2bf9d97 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4aecd97)
#10 0x00005651c2b4e527
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a41527)
#11 0x00005651c2b6a6d5 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a5d6d5)
#12 0x00005651c2b49551
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a3c551)
#13 0x00005651c2b49c81
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.250)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a3cc81)
#14 0x00005651c2b4fc29
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a42c29)
#15 0x00005651c2b511b1
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a441b1)
#16 0x00005651c2b44319 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a37319)
#17 0x00005651c1735be1 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3628be1)
#18 0x00005651c16ebe3b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x35dee3b)
#19 0x00005651c17fd463
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x36f0463)
#20 0x00005651bf00629c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xef929c)
#21 0x00005651bf00297d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xef597d)
#22 0x00005651c15b6955 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)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x34a9955)
#23 0x00005651c0e84413
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2d77413)
#24 0x00005651c15b7487
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.172)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x34aa487)
#25 0x00005651c159019a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348319a)
#26 0x00005651c1590cef
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3483cef)
#27 0x00005651c1599ba5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348cba5)
#28 0x00005651bef31cf6 main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xe24cf6)
#29 0x00007fc53f6fa0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#30 0x00005651bf0024fa _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xef54fa)

-- 
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/20201210/dc07082f/attachment.html>


More information about the llvm-bugs mailing list