Skip to content

clang-15.0.0 crashes when using consteval and coverage #57668

New issue

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

Closed
AMS21 opened this issue Sep 10, 2022 · 3 comments
Closed

clang-15.0.0 crashes when using consteval and coverage #57668

AMS21 opened this issue Sep 10, 2022 · 3 comments
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. consteval C++20 consteval coverage crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@AMS21
Copy link
Contributor

AMS21 commented Sep 10, 2022

output:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/local/bin/clang++ -g -fmacro-backtrace-limit=0 -fms-extensions -fdeclspec -fborland-extensions -fchar8_t -fdiagnostics-color=always -g3 -ftrapv -ftrivial-auto-var-init=pattern -fcheck-new -fdebug-macro -grecord-gcc-switches -grecord-command-line -O0 -fno-inline -fno-inline-functions -fprofile-instr-generate -fcoverage-mapping -Weverything -Wno-constexpr-not-const -Wno-c++1y-extensions -Wno-c++1z-extensions -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++98-c++11-compat-pedantic -Wno-documentation-unknown-command -Wno-gnu-zero-variadic-macro-arguments -Wno-language-extension-token -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-padded -Wno-switch-enum -Wno-unused-macros -Wno-unused-template -Wno-variadic-macros -Wno-weak-vtables -Wno-unused-function -pthread -std=c++2b -fcolor-diagnostics -Werror -DPHI_CONFIG_ALWAYS_INLINE_OVERWRITE=PHI_NEVER_INLINE -DPHI_CONFIG_FPM_DEFAULT -DPHI_CONFIG_PEDANTIC_WARNINGS -DPHI_CONFIG_WARNINGS_AS_ERRORS -DCMAKE_INTDIR=\"Debug\" -I/mnt/data/dev/Phi/tests/PhiCore/unittests/include -I/mnt/data/dev/Phi/libs/PhiCore/include -I/mnt/data/dev/Phi/build-clang-coverage/generated-includes -I/mnt/data/dev/Phi/libs/PhiTest/include -c -MD -MT tests/PhiCore/unittests/CMakeFiles/Phi_CoreUnittest-23.dir/Debug/src/type_traits/is_constant_evaluated.test.cpp.o -MF tests/PhiCore/unittests/CMakeFiles/Phi_CoreUnittest-23.dir/Debug/src/type_traits/is_constant_evaluated.test.cpp.o.d -fcolor-diagnostics -o tests/PhiCore/unittests/CMakeFiles/Phi_CoreUnittest-23.dir/Debug/src/type_traits/is_constant_evaluated.test.cpp.o /mnt/data/dev/Phi/tests/PhiCore/unittests/src/type_traits/is_constant_evaluated.test.cpp
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      /mnt/data/dev/Phi/libs/PhiCore/include/phi/type_traits/is_constant_evaluated.hpp:22:48: Generating code for declaration 'phi::is_constant_evaluated'
 #0 0x0000560b820538f4 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000560b8205161c llvm::sys::CleanupOnSignal(unsigned long) (/usr/local/bin/clang+++0x382661c)
 #2 0x0000560b81f90378 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f5250f69a40 (/usr/lib/libc.so.6+0x38a40)
 #4 0x0000560b84cf7540 clang::Stmt::getBeginLoc() const (/usr/local/bin/clang+++0x64cc540)
 #5 0x0000560b8254dedd (anonymous namespace)::CoverageMappingBuilder::getStart(clang::Stmt const*) CoverageMappingGen.cpp:0:0
 #6 0x0000560b825559e3 (anonymous namespace)::CounterCoverageMappingBuilder::extendRegion(clang::Stmt const*) CoverageMappingGen.cpp:0:0
 #7 0x0000560b82559bd1 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*) CoverageMappingGen.cpp:0:0
 #8 0x0000560b8255c943 (anonymous namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*) CoverageMappingGen.cpp:0:0
 #9 0x0000560b82560a9f clang::CodeGen::CoverageMappingGen::emitCounterMapping(clang::Decl const*, llvm::raw_ostream&) (/usr/local/bin/clang+++0x3d35a9f)
#10 0x0000560b82525202 clang::CodeGen::CodeGenPGO::emitCounterRegionMapping(clang::Decl const*) (/usr/local/bin/clang+++0x3cfa202)
#11 0x0000560b825417c3 clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl, llvm::Function*) (/usr/local/bin/clang+++0x3d167c3)
#12 0x0000560b824d4824 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/local/bin/clang+++0x3ca9824)
#13 0x0000560b82519b65 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/local/bin/clang+++0x3ceeb65)
#14 0x0000560b8251582c clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/local/bin/clang+++0x3cea82c)
#15 0x0000560b8251dee4 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/local/bin/clang+++0x3cf2ee4)
#16 0x0000560b8251defc clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/local/bin/clang+++0x3cf2efc)
#17 0x0000560b8251f46b clang::CodeGen::CodeGenModule::Release() (/usr/local/bin/clang+++0x3cf446b)
#18 0x0000560b831f273a (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#19 0x0000560b831f02ed clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/bin/clang+++0x49c52ed)
#20 0x0000560b83db20a9 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang+++0x55870a9)
#21 0x0000560b82b2dc59 clang::FrontendAction::Execute() (/usr/local/bin/clang+++0x4302c59)
#22 0x0000560b82ab48f9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang+++0x42898f9)
#23 0x0000560b82beb263 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/bin/clang+++0x43c0263)
#24 0x0000560b7f95e0a0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/bin/clang+++0x11330a0)
#25 0x0000560b7f957afd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#26 0x0000560b829202c5 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
#27 0x0000560b81f90483 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local/bin/clang+++0x3765483)
#28 0x0000560b8292066f 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.0) Job.cpp:0:0
#29 0x0000560b828ec035 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/local/bin/clang+++0x40c1035)
#30 0x0000560b828eca4d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&, bool) const (/usr/local/bin/clang+++0x40c1a4d)
#31 0x0000560b828fcd1c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/usr/local/bin/clang+++0x40d1d1c)
#32 0x0000560b7f95c06c clang_main(int, char**) (/usr/local/bin/clang+++0x113106c)
#33 0x00007f5250f542d0 (/usr/lib/libc.so.6+0x232d0)
#34 0x00007f5250f5438a __libc_start_main (/usr/lib/libc.so.6+0x2338a)
#35 0x0000560b7f956f95 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
clang-15: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 15.0.0 (https://github.com/llvm/llvm-project.git 4ba6a9c9f65bbc8bd06e3652cb20fd4dfc846137)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-15: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-15: note: diagnostic msg: /tmp/is_constant_evaluated-377219.cpp
clang-15: note: diagnostic msg: /tmp/is_constant_evaluated-377219.sh
clang-15: note: diagnostic msg: 

********************

is_constant_evaluated-377219.zip

@EugeneZelenko EugeneZelenko added clang:codegen IR generation bugs: mangling, exceptions, etc. coverage crash Prefer [crash-on-valid] or [crash-on-invalid] consteval C++20 consteval and removed new issue labels Sep 10, 2022
@llvmbot
Copy link
Member

llvmbot commented Sep 10, 2022

@llvm/issue-subscribers-clang-codegen

AMS21 added a commit to AMS21/Phi that referenced this issue Sep 10, 2022
…eval`

Since `if consteval` causes lots of problems and compiler crashes. See
llvm/llvm-project#57568
llvm/llvm-project#57668
@AaronBallman
Copy link
Collaborator

I think this might be the same issue as in #57377 -- can you see if the issue still reproduces for you with Clang trunk/Clang 16?

@AMS21
Copy link
Contributor Author

AMS21 commented Feb 22, 2023

Just did some testing and can neither reproduce this crash with clang-15.0.7 nor trunk.

Closing as fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. consteval C++20 consteval coverage crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
Status: No status
Development

No branches or pull requests

4 participants