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

Fix or work around gcc-14 warnings/errors. #19758

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

ScottTodd
Copy link
Member

Fixing or working around a few "warnings as errors" on gcc-14 (released May 2024). These are also causing the aarch64 nightly distribution builds to fail. Note that we also have some new warnings as errors coming in clang-20 (not yet released): https://clang.llvm.org/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics.

dangling-reference

Not sure how we want to handle these. We have a bunch of code in IREE and torch-mlir that uses temporaries in loop headers, which this warning does not like. For now just disabling the warning.

/iree/compiler/src/iree/compiler/API/Internal/Diagnostics.cpp: In function 'std::optional<mlir::CallSiteLoc> mlir::iree_compiler::embed::{anonymous}::getCallSiteLoc(mlir::Location)':
/iree/compiler/src/iree/compiler/API/Internal/Diagnostics.cpp:30:57: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
   30 |     for (auto subLoc : cast<FusedLoc>(loc).getLocations()) {
      |                                                         ^
/iree/compiler/src/iree/compiler/API/Internal/Diagnostics.cpp:30:56: note: the temporary was destroyed at the end of the full expression 'llvm::cast<mlir::FusedLoc, mlir::Location>(loc).mlir::FusedLoc::getLocations()'
   30 |     for (auto subLoc : cast<FusedLoc>(loc).getLocations()) {
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

template-id-cdtor

These looked legit and were easy enough to fix.

/iree/compiler/src/iree/compiler/Dialect/LinalgExt/Transforms/ConvertConv2DToWinograd.cpp:159:33: error: template-id not allowed for constructor in C++20 [-Werror=template-id-cdtor]
  159 |   ConvertConvToWinograd<ConvOp>(MLIRContext *context, bool replaceAllConvs,
      |                                 ^~~~~~~~~~~
/iree/compiler/src/iree/compiler/Dialect/LinalgExt/Transforms/ConvertConv2DToWinograd.cpp:159:33: note: remove the '< >'

@@ -248,6 +248,8 @@ iree_select_compiler_opts(IREE_DEFAULT_COPTS
"-Wno-unknown-pragmas"
"-Wno-unused-but-set-variable"
"-Wno-misleading-indentation"
# False positives? Not useful? https://stackoverflow.com/a/78760067
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annoying? ✅

@ScottTodd ScottTodd merged commit cac390d into iree-org:main Jan 22, 2025
40 checks passed
@ScottTodd ScottTodd deleted the gcc-14-fixes branch January 22, 2025 04:27
@@ -248,6 +248,8 @@ iree_select_compiler_opts(IREE_DEFAULT_COPTS
"-Wno-unknown-pragmas"
"-Wno-unused-but-set-variable"
"-Wno-misleading-indentation"
# False positives? Not useful? https://stackoverflow.com/a/78760067
$<$<COMPILE_LANGUAGE:CXX>:-Wno-dangling-reference>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc1plus: error: unrecognized command line option '-Wno-dangling-reference' [-Werror]

argh, older versions of gcc don't recognize this option
https://github.com/iree-org/iree/actions/runs/12905050255/job/35983453401#step:4:6256

will try to fix-forward with something like GCC_GTE_XYZ

"ALL;CLANG;CLANG_GTE_10;CLANG_GTE_12;CLANG_CL;MSVC;GCC;CLANG_OR_GCC;MSVC_OR_CLANG_CL"

ScottTodd added a commit that referenced this pull request Jan 22, 2025
This should fix the error reported at
#19758 (comment) on
older gcc versions: `cc1plus: error: unrecognized command line option
'-Wno-dangling-reference' [-Werror]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants