[llvm-bugs] [Bug 50345] New: coroutines + templates + "-fsanitize=undefined" = error in backend: Cannot represent a difference across sections (clang++ 10, 11, 12, trunk)
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 14 10:30:09 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50345
Bug ID: 50345
Summary: coroutines + templates + "-fsanitize=undefined" =
error in backend: Cannot represent a difference across
sections (clang++ 10, 11, 12, trunk)
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: kamilgbraun at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 24858
--> https://bugs.llvm.org/attachment.cgi?id=24858&action=edit
Code that crashes the compiler
The attached file causes clang++ to crash given certain compilation flags.
also godbolt: https://godbolt.org/z/j14YMxj5M
$ clang++ --version
clang version 10.0.1 (Fedora 10.0.1-3.fc32)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang++ coro-crash.cpp -std=c++20 -stdlib=libc++ -fsanitize=undefined
fatal error: error in backend: Cannot represent a difference across
sections
Stack dump:
0. Program arguments: /usr/bin/clang++ -std=c++20 -fsanitize=undefined
-fcolor-diagnostics -stdlib=libc++ -c -o coro-crash.o coro-crash.cpp
1. <eof> parser at end of file
2. Code generation
/lib64/libLLVM-10.so(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x2e)[0x7f60b555e10e]
/lib64/libLLVM-10.so(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x7f60b555c3e4]
/lib64/libLLVM-10.so(_ZN4llvm20CrashRecoveryContext10HandleExitEi+0x78)[0x7f60b549b768]
/lib64/libLLVM-10.so(_ZN4llvm3sys7Process4ExitEi+0x1b)[0x7f60b5556ffb]
/usr/bin/clang++(+0x16372)[0x55988c5f0372]
/lib64/libLLVM-10.so(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x8b)[0x7f60b54a702b]
/lib64/libLLVM-10.so(+0x1bc7623)[0x7f60b66db623]
/lib64/libLLVM-10.so(+0x1ba83c6)[0x7f60b66bc3c6]
/lib64/libLLVM-10.so(_ZN4llvm11MCAssembler11handleFixupERKNS_11MCAsmLayoutERNS_10MCFragmentERKNS_7MCFixupE+0xf2)[0x7f60b66d2ed2]
/lib64/libLLVM-10.so(_ZN4llvm11MCAssembler6layoutERNS_11MCAsmLayoutE+0x281)[0x7f60b66d40b1]
/lib64/libLLVM-10.so(_ZN4llvm11MCAssembler6FinishEv+0x3d)[0x7f60b66d42ad]
/lib64/libLLVM-10.so(_ZN4llvm10AsmPrinter14doFinalizationERNS_6ModuleE+0x731)[0x7f60b5c64b11]
/lib64/libLLVM-10.so(_ZN4llvm13FPPassManager14doFinalizationERNS_6ModuleE+0x65)[0x7f60b5658895]
/lib64/libLLVM-10.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x460)[0x7f60b5664220]
/lib64/libclang-cpp.so.10(+0x16123e1)[0x7f60baea73e1]
/lib64/libclang-cpp.so.10(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsERKN4llvm10DataLayoutEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISM_EE+0x2fe)[0x7f60baea805e]
/lib64/libclang-cpp.so.10(+0x190fb39)[0x7f60bb1a4b39]
/lib64/libclang-cpp.so.10(_ZN5clang8ParseASTERNS_4SemaEbb+0x499)[0x7f60ba208c09]
/lib64/libclang-cpp.so.10(_ZN5clang14FrontendAction7ExecuteEv+0xb9)[0x7f60bb83c139]
/lib64/libclang-cpp.so.10(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x1cd)[0x7f60bb7f827d]
/lib64/libclang-cpp.so.10(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x95c)[0x7f60bb8b212c]
/usr/bin/clang++(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x6c0)[0x55988c5f1440]
/usr/bin/clang++(+0x15a94)[0x55988c5efa94]
/lib64/libclang-cpp.so.10(+0x1c8cec9)[0x7f60bb521ec9]
/lib64/libLLVM-10.so(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0x27)[0x7f60b549b5e7]
/lib64/libclang-cpp.so.10(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x157)[0x7f60bb524537]
/lib64/libclang-cpp.so.10(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x9d)[0x7f60bb4f8bed]
/lib64/libclang-cpp.so.10(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x86)[0x7f60bb4f9156]
/lib64/libclang-cpp.so.10(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x93)[0x7f60bb501693]
/usr/bin/clang++(main+0x14a6)[0x55988c5ebb86]
/lib64/libc.so.6(__libc_start_main+0xf2)[0x7f60b4766042]
/usr/bin/clang++(_start+0x2e)[0x55988c5ecc1e]
also checked through godbolt: crashes in clang 11 and clang trunk, clang 12
doesn't crash but prints errors.
None of these commands crash:
clang++ coro-crash.cpp -std=c++20 -stdlib=libc++ -fsanitize=undefined
-emit-llvm -Xclang -disable-llvm-passes -c
clang++ coro-crash.cpp -std=c++20 -stdlib=libc++ -fsanitize=undefined
-emit-llvm -Xclang -c
by https://llvm.org/docs/HowToSubmitABug.html#crashing-bugs I deduced that it's
a backend bug (as if it wasn't obvious by the error message and the "Code
generation" part in the dump).
However, after generating coro_crash.bc using:
clang++ coro-crash.cpp -std=c++20 -stdlib=libc++ -fsanitize=undefined
-emit-llvm -c -o coro_crash.bc
none of these commands crash either:
llc coro_crash.bc
llc coro_crash.bc -relocation-model=pic
llc coro_crash.bc -relocation-model=static
Hence https://llvm.org/docs/HowToSubmitABug.html#backend-code-generator-bugs
claims that I should follow instructions for front-end bugs, but every other
evidence points to a backend bug, so dunno. Maybe it's a mix of bugs,
frontent/middle passing incorrect input to backend or whatever.
Anyway, bugpoint doesn't want to cooperate with me either:
bugpoint -run-llc coro_crash.bc
Read input file : 'coro_crash.bc'
*** All input ok
Initializing execution environment: Found llc: /usr/bin/llc
Sorry, I can't automatically select a safe interpreter!
Exiting.
So I guess that's all what I can give in this bug report.
--
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/20210514/b2df42a1/attachment-0001.html>
More information about the llvm-bugs
mailing list