llvm-project
0b79f712 - [clang][OpenMP] Fix crash on `linear(uval)` with a reference parameter (#237754)

Commit
31 days ago
[clang][OpenMP] Fix crash on `linear(uval)` with a reference parameter (#237754) Fixes #108166 `linear(uval(x))` crashed when `x` is a reference parameter. For `uval`, Sema read the initial value from the reference's initializer instead of the reference, and a parameter has none, so a null `Expr` reached `DefaultLvalueConversion`. Even with an initializer this was wrong: a defaulted `int &x = g` made the loop update `g`, and in a `parallel` region or a lambda it could name an uncaptured variable. Drop the shortcut in `ActOnOpenMPLinearClause` and `FinishOpenMPLinearClause`, so a `uval` item is read from and written back through the reference, like `val`. That is what the spec says for loop constructs, where `uval` only adds the requirement that the item be a reference, which is still checked. AI Assisted!
Parents
Loading