Skip to content
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

C++23 crash in DiagnosticInfo.h #17686

Open
1 task
elmsheus opened this issue Feb 10, 2025 · 5 comments · May be fixed by #17735
Open
1 task

C++23 crash in DiagnosticInfo.h #17686

elmsheus opened this issue Feb 10, 2025 · 5 comments · May be fixed by #17735
Assignees
Labels

Comments

@elmsheus
Copy link

Check duplicate issues.

  • Checked for duplicates

Description

I fully understand that ROOT 6.34/02 is not yet ready for the C++23 standard since it's explicitly disabled in the ROOT cmake configuration at https://github.com/root-project/root/blob/master/cmake/modules/CheckCompiler.cmake#L164C1-L164C43

I took my chances and have overwritten that setting and tried to compile ROOT 6.34/02 from source with gcc 14.2 and "-DCMAKE_CXX_STANDARD=23" in the ATLAS AnalysisBase configuration (https://gitlab.cern.ch/atlas/atlasexternals/-/blob/main/External/ROOT/CMakeLists.txt?ref_type=heads) and see the following compilation problem in ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h:

[ 69%] Building CXX object interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/IRSimilarityIdentifier.cpp.o
In file included from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h:18,
                 from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineCost.cpp:26:
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h: In instantiation of 'RemarkT& llvm::operator<<(RemarkT&&, std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), DiagnosticInfoOptimizationBase::Argument>) [with RemarkT = OptimizationRemarkMissed; std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), DiagnosticInfoOptimizationBase::Argument> = DiagnosticInfoOptimizationBase::Argument]':
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineCost.cpp:2584:36:   required from here
 2584 |                  << NV("Callee", &F) << " has uninlinable pattern ("
      |                                    ^
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h:584:10: error: cannot bind non-const lvalue reference of type 'llvm::OptimizationRemarkMissed&' to an rvalue of type 'llvm::OptimizationRemarkMissed'
  584 |   return R;
      |          ^
In file included from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h:18,
                 from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineAdvisor.cpp:19:
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h: In instantiation of 'RemarkT& llvm::operator<<(RemarkT&&, std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), StringRef>) [with RemarkT = OptimizationRemarkMissed; std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), StringRef> = StringRef]':
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineAdvisor.cpp:94:19:   required from here
   94 |                << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
      |                   ^~~
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h:562:10: error: cannot bind non-const lvalue reference of type 'llvm::OptimizationRemarkMissed&' to an rvalue of type 'llvm::OptimizationRemarkMissed'
  562 |   return R;
      |          ^
gmake[6]: *** [interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/build.make:692: interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/InlineCost.cpp.o] Error 1
gmake[6]: *** Waiting for unfinished jobs....
gmake[6]: *** [interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/build.make:706: interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/InlineAdvisor.cpp.o] Error 1
[ 69%] Linking CXX static library ../../libLLVMCoverage.a
[ 69%] Built target LLVMCoverage
gmake[5]: *** [CMakeFiles/Makefile2:15517: interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/all] Error 2
gmake[4]: *** [Makefile:156: all] Error 2
gmake[3]: *** [External/ROOT/CMakeFiles/ROOT.dir/build.make:93: src/ROOT-stamp/ROOT-build] Error 2
gmake[2]: *** [CMakeFiles/Makefile2:2373: External/ROOT/CMakeFiles/ROOT.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:2380: External/ROOT/CMakeFiles/ROOT.dir/rule] Error 2
gmake: *** [Makefile:1083: ROOT] Error 2

Reproducer

See above

ROOT version

6.34/02

Installation method

from source

Operating system

RHEL9.5

Additional context

No response

@elmsheus elmsheus added the bug label Feb 10, 2025
@ferdymercury
Copy link
Contributor

ferdymercury commented Feb 10, 2025

Related PRs: #17253 and #17273

@guitargeek
Copy link
Contributor

Hi @ferdymercury, thanks for the cross-referencing! Maybe you wanted to link two different PRs? You linked the same PR twice

@ferdymercury
Copy link
Contributor

ferdymercury commented Feb 10, 2025

Yep, sorry, fixed.
The error in https://github.com/root-project/root/actions/runs/12327755238/job/34410152029?pr=17273 is the same one as reported here.

@hahnjo
Copy link
Member

hahnjo commented Feb 12, 2025

Note that this is a problem upstream, ie you currently cannot compile LLVM with -std=c++23. I think the issue related to this report is llvm/llvm-project#105778. But from trying to compile current main, it seems there are many more problems in the LLVM code base...

hahnjo added a commit to hahnjo/root that referenced this issue Feb 17, 2025
@hahnjo hahnjo linked a pull request Feb 17, 2025 that will close this issue
@hahnjo
Copy link
Member

hahnjo commented Feb 17, 2025

I started fixing the issues upstream (notably llvm/llvm-project#127400 for the issue described here) and this makes it work with GCC, but for Clang with C++23 there are many more problems. What I think we should be doing instead downstream in ROOT is always build LLVM with C++17: #17735 Then we only need to backport one of my upstream PRs to fix one header (llvm/llvm-project#127459) and fix RooFit (#17733) to get a working ROOT with C++23 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants