llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.99k stars 11.55k forks source link

Clang 17.0.6 compiler error: "clang frontend command failed with exit code 139" #107821

Closed guyin456 closed 6 days ago

guyin456 commented 1 week ago

I updated to the newest version of Clang 17.0.6 ( 79fffa20ed39ec9ef0ddc51e6d2e95975bc25d2d) and we are getting a frontend error. Compiler output:

2024-09-09 15:27:58.000 1.  <eof> parser at end of file
2024-09-09 15:27:58.000 2.  teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:222:3: instantiating function definition 'kai_fg::RegisterViewsHelper<kai_fg::FGFArrayColumnInnerAtStatic, -1, flatvector::Array<long>, flatvector::Array<long>>::RegisterViewsHelper'
2024-09-09 15:27:58.000 3.  teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:119:15: instantiating function definition 'kai_fg::detail::RegisterViewsHelperImpl<std::tuple<>, std::tuple<>, kai_fg::FGFArrayColumnInnerAtStatic, 2, flatvector::Array<long>, flatvector::Array<long>>::Build'
2024-09-09 15:27:58.000 4.  teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:119:15: instantiating function definition 'kai_fg::detail::RegisterViewsHelperImpl<std::tuple<flatvector::Array<long>>, std::tuple<>, kai_fg::FGFArrayColumnInnerAtStatic, 1, flatvector::Array<long>>::Build'
2024-09-09 15:27:58.000 5.  teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:144:15: instantiating function definition 'kai_fg::detail::RegisterViewsHelperImpl<std::tuple<flatvector::Array<long>, flatvector::Array<long>>, std::tuple<>, kai_fg::FGFArrayColumnInnerAtStatic, 0>::Build'
2024-09-09 15:27:58.000 6.  /media/ssd1/jenkins/cppTools/distcc/clang-17.0.6/bin/../include/c++/v1/tuple:1833:26: instantiating function definition 'std::apply<(lambda at teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:148:20), std::tuple<flatvector::Array<long>, flatvector::Array<long>> &>'
2024-09-09 15:27:58.000 7.  /media/ssd1/jenkins/cppTools/distcc/clang-17.0.6/bin/../include/c++/v1/tuple:1823:26: instantiating function definition 'std::__apply_tuple_impl<(lambda at teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:148:20), std::tuple<flatvector::Array<long>, flatvector::Array<long>> &, 0UL, 1UL>'
2024-09-09 15:27:58.000 #0 0x0000562020dc8d97 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/distcc/clang-17.0.6/bin/clang+++0x3ea5d97)
2024-09-09 15:27:58.000 #1 0x0000562020dc8b13 llvm::sys::CleanupOnSignal(unsigned long) (/home/distcc/clang-17.0.6/bin/clang+++0x3ea5b13)
2024-09-09 15:27:58.000 #2 0x0000562020d865c1 CrashRecoverySignalHandler(int) (.__uniq.38239496060036942940988527518170416919.llvm.10835154612738550066) CrashRecoveryContext.cpp:0:0
2024-09-09 15:27:58.000 #3 0x00007f826e1e1630 __restore_rt sigaction.c:0:0
2024-09-09 15:27:58.000 #4 0x00005620247f50d1 clang::Sema::TemplateParameterListsAreEqual(clang::NamedDecl const*, clang::TemplateParameterList*, clang::NamedDecl const*, clang::TemplateParameterList*, bool, clang::Sema::TemplateParameterListEqualKind, clang::SourceLocation)::$_0::operator()() const (.__uniq.28277423733606557018459929003813365289) SemaTemplate.cpp:0:0
2024-09-09 15:27:58.000 #5 0x00007ffea0079490 
2024-09-09 15:27:58.000 clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
2024-09-09 15:27:58.000 clang version 17.0.6 (https://git.corp.kuaishou.com/cpptools/build/llvm.git 79fffa20ed39ec9ef0ddc51e6d2e95975bc25d2d)
2024-09-09 15:27:58.000 Target: x86_64-unknown-linux-gnu
2024-09-09 15:27:58.000 Thread model: posix
2024-09-09 15:27:58.000 InstalledDir: /home/distcc/clang-17.0.6/bin
2024-09-09 15:27:58.000 clang++: note: diagnostic msg: 
2024-09-09 15:27:58.000 ********************
2024-09-09 15:27:58.000 
2024-09-09 15:27:58.000 PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
2024-09-09 15:27:58.000 Preprocessed source(s) and associated run script(s) are located at:
2024-09-09 15:27:58.000 clang++: note: diagnostic msg: /tmp/array_column-e43221.cpp
2024-09-09 15:27:58.000 clang++: note: diagnostic msg: /tmp/array_column-e43221.sh
2024-09-09 15:27:58.000 clang++: note: diagnostic msg: 
2024-09-09 15:27:58.000 
2024-09-09 15:27:58.000 ********************
llvmbot commented 1 week ago

@llvm/issue-subscribers-clang-frontend

Author: None (guyin456)

I updated to the newest version of Clang 17.0.6 ( 79fffa20ed39ec9ef0ddc51e6d2e95975bc25d2d) and we are getting a frontend error. Compiler output: ``` 2024-09-09 15:27:58.000 1. <eof> parser at end of file 2024-09-09 15:27:58.000 2. teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:222:3: instantiating function definition 'kai_fg::RegisterViewsHelper<kai_fg::FGFArrayColumnInnerAtStatic, -1, flatvector::Array<long>, flatvector::Array<long>>::RegisterViewsHelper' 2024-09-09 15:27:58.000 3. teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:119:15: instantiating function definition 'kai_fg::detail::RegisterViewsHelperImpl<std::tuple<>, std::tuple<>, kai_fg::FGFArrayColumnInnerAtStatic, 2, flatvector::Array<long>, flatvector::Array<long>>::Build' 2024-09-09 15:27:58.000 4. teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:119:15: instantiating function definition 'kai_fg::detail::RegisterViewsHelperImpl<std::tuple<flatvector::Array<long>>, std::tuple<>, kai_fg::FGFArrayColumnInnerAtStatic, 1, flatvector::Array<long>>::Build' 2024-09-09 15:27:58.000 5. teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:144:15: instantiating function definition 'kai_fg::detail::RegisterViewsHelperImpl<std::tuple<flatvector::Array<long>, flatvector::Array<long>>, std::tuple<>, kai_fg::FGFArrayColumnInnerAtStatic, 0>::Build' 2024-09-09 15:27:58.000 6. /media/ssd1/jenkins/cppTools/distcc/clang-17.0.6/bin/../include/c++/v1/tuple:1833:26: instantiating function definition 'std::apply<(lambda at teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:148:20), std::tuple<flatvector::Array<long>, flatvector::Array<long>> &>' 2024-09-09 15:27:58.000 7. /media/ssd1/jenkins/cppTools/distcc/clang-17.0.6/bin/../include/c++/v1/tuple:1823:26: instantiating function definition 'std::__apply_tuple_impl<(lambda at teams/reco-arch/kaifg/csrc/fgf/fgf_register.h:148:20), std::tuple<flatvector::Array<long>, flatvector::Array<long>> &, 0UL, 1UL>' 2024-09-09 15:27:58.000 #0 0x0000562020dc8d97 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/distcc/clang-17.0.6/bin/clang+++0x3ea5d97) 2024-09-09 15:27:58.000 #1 0x0000562020dc8b13 llvm::sys::CleanupOnSignal(unsigned long) (/home/distcc/clang-17.0.6/bin/clang+++0x3ea5b13) 2024-09-09 15:27:58.000 #2 0x0000562020d865c1 CrashRecoverySignalHandler(int) (.__uniq.38239496060036942940988527518170416919.llvm.10835154612738550066) CrashRecoveryContext.cpp:0:0 2024-09-09 15:27:58.000 #3 0x00007f826e1e1630 __restore_rt sigaction.c:0:0 2024-09-09 15:27:58.000 #4 0x00005620247f50d1 clang::Sema::TemplateParameterListsAreEqual(clang::NamedDecl const*, clang::TemplateParameterList*, clang::NamedDecl const*, clang::TemplateParameterList*, bool, clang::Sema::TemplateParameterListEqualKind, clang::SourceLocation)::$_0::operator()() const (.__uniq.28277423733606557018459929003813365289) SemaTemplate.cpp:0:0 2024-09-09 15:27:58.000 #5 0x00007ffea0079490 2024-09-09 15:27:58.000 clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation) 2024-09-09 15:27:58.000 clang version 17.0.6 (https://git.corp.kuaishou.com/cpptools/build/llvm.git 79fffa20ed39ec9ef0ddc51e6d2e95975bc25d2d) 2024-09-09 15:27:58.000 Target: x86_64-unknown-linux-gnu 2024-09-09 15:27:58.000 Thread model: posix 2024-09-09 15:27:58.000 InstalledDir: /home/distcc/clang-17.0.6/bin 2024-09-09 15:27:58.000 clang++: note: diagnostic msg: 2024-09-09 15:27:58.000 ******************** 2024-09-09 15:27:58.000 2024-09-09 15:27:58.000 PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: 2024-09-09 15:27:58.000 Preprocessed source(s) and associated run script(s) are located at: 2024-09-09 15:27:58.000 clang++: note: diagnostic msg: /tmp/array_column-e43221.cpp 2024-09-09 15:27:58.000 clang++: note: diagnostic msg: /tmp/array_column-e43221.sh 2024-09-09 15:27:58.000 clang++: note: diagnostic msg: 2024-09-09 15:27:58.000 2024-09-09 15:27:58.000 ******************** ```
zyn0217 commented 1 week ago

You should attach the processed files to the issue, otherwise we have no idea what particular bug it is.

guyin456 commented 1 week ago

You should attach the processed files to the issue, otherwise we have no idea what particular bug it is.

Ok no problem, here is my preprocessed file(bug_report.txt==>bug_report.ii), bug_report.txt

You can reproduce it with the following command:

clang-17.0.6/bin/clang++ bug_report.ii
EugeneZelenko commented 1 week ago

Could you please try 19 or main branch?

DimitryAndric commented 1 week ago

It compiles fine for me here with clang 17.0.6. Note that clang 17.0.6 is not the newest version, the latest released version is 18.1.8 (https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8), while the most recent 19.1.0 release candidate is 19.1.0 rc4 (https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.0-rc4).

Are you getting the error consistently in the same place? Do you see any out-of-memory errors in dmesg, or other indicators of memory corruption?

guyin456 commented 1 week ago

使用 clang 17.0.6 编译对我来说没问题。请注意,clang 17.0.6 不是最新版本,最新发布的版本是 18.1.8 ( https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8 ),而最新的 19.1.0 候选版本是 19.1.0 rc4 ( https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.0-rc4 )。

您是否总是在同一个地方收到错误?您是否在 dmesg 中看到任何内存不足错误,或者其他内存损坏指示?

OK, I tried it again. Since my clang is optimized with PGO and BOLT, there will be no problem using the original version of clang 17.0.6.