[Mlir-commits] [mlir] [mlir] Fix UB in comparator lambdas in getRegisteredOperationsByDialect (PR #186428)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Mar 13 09:25:44 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

The build failed before running any tests. Click on a failure below to see the details.

<details>
<summary>tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/MLIRContext.cpp.o</summary>

```
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/MLIRContext.cpp.o
sccache /opt/llvm/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/mlir/lib/IR -I/home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/lib/IR -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/mlir/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Werror=mismatched-tags -Werror=global-constructors -O3 -DNDEBUG -std=c++17 -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/MLIRContext.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/MLIRContext.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/MLIRContext.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/lib/IR/MLIRContext.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/lib/IR/MLIRContext.cpp:1002:54: error: invalid operands to binary expression ('StringAttr' and 'StringAttr')
1002 |                           return lhs.getIdentifier() < rhs.getIdentifier();
|                                  ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/predefined_ops.h:240:16: note: in instantiation of function template specialization 'mlir::RegisteredOperationName::insert(std::unique_ptr<RegisteredOperationName::Impl>, ArrayRef<StringRef>)::(lambda)::operator()<const mlir::RegisteredOperationName, mlir::RegisteredOperationName>' requested here
240 |         { return bool(_M_comp(__val, *__it)); }
|                       ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_algo.h:2035:8: note: in instantiation of function template specialization '__gnu_cxx::__ops::_Val_comp_iter<(lambda at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/lib/IR/MLIRContext.cpp:1001:25)>::operator()<const mlir::RegisteredOperationName, mlir::RegisteredOperationName *>' requested here
2035 |           if (__comp(__val, __middle))
|               ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_algo.h:2102:19: note: in instantiation of function template specialization 'std::__upper_bound<mlir::RegisteredOperationName *, mlir::RegisteredOperationName, __gnu_cxx::__ops::_Val_comp_iter<(lambda at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/lib/IR/MLIRContext.cpp:1001:25)>>' requested here
2102 |       return std::__upper_bound(__first, __last, __val,
|                   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/STLExtras.h:2072:15: note: in instantiation of function template specialization 'std::upper_bound<mlir::RegisteredOperationName *, mlir::RegisteredOperationName, (lambda at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/lib/IR/MLIRContext.cpp:1001:25)>' requested here
2072 |   return std::upper_bound(adl_begin(Range), adl_end(Range),
|               ^
1 error generated.
```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/186428


More information about the Mlir-commits mailing list