[clang] [llvm] [OMPIRBuilder] Perform atomic compare on padded FP types at their allocation size (PR #226567)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 21:50:01 PST 2026
================
@@ -787,6 +787,7 @@ documentation](CIR/index.md) for more information regarding ClangIR's status and
- Fixed USR generation for declarations whose signature mentions a class-type
non-type template parameter. (#GH212351)
- Fixed an assertion caused by Microsoft integer literals exceeding the maximum value. (#GH212504)
+- Fixed an assertion failure when `#pragma omp atomic compare` was applied to a `long double` on x86-64, whose 80-bit value is stored in 16 bytes. (#GH140080)
----------------
MattPD wrote:
The PR title and description should identify x86-64 equality comparisons, and the release note should identify equality comparisons. The PR description currently presents the change as fixing `#pragma omp atomic compare` on `long double` broadly.
On the PR head, a relational `long double` compare still reaches the `Alignment is not a power of 2` assertion at `Alignment.h:67` through the unchanged `CreateAtomicRMW` min/max call at `OMPIRBuilder.cpp:12137`.
```c
void f(long double *x, long double e) {
#pragma omp atomic compare
*x = *x < e ? e : *x;
}
```
Save it as `repro.c` and run `clang -target x86_64-unknown-linux-gnu -O0 -fopenmp -c repro.c -o /dev/null`. Under the release note's current scope, the command should compile successfully with the PR head. Instead, compilers built at the PR head and at the PR's base revision both assert during lowering.
Both `RUN` lines in the added codegen test select x86-64. A separate `i386-unknown-linux-gnu` compile of `atomic_compare_long_double_codegen.c` asserts with compilers built at both revisions.
https://github.com/llvm/llvm-project/pull/226567
More information about the cfe-commits
mailing list