Skip to content

Commit 1e7772a

Browse files
authored
[flang][OpenMP] Reassociate ATOMIC update expressions (#153488)
An atomic update expression of form x = x + a + b is technically illegal, since the right-hand side is parsed as (x+a)+b, and the atomic variable x should be an argument to the top-level +. When the type of x is integer, the result of (x+a)+b is guaranteed to be the same as x+(a+b), so instead of reporting an error, the compiler can treat (x+a)+b as x+(a+b). This PR implements this kind of reassociation for integral types, and for the two arithmetic associative/commutative operators: + and *. Reinstate PR153098 one more time with fixes for the issues that came up: - unused variable "lsrc", - use of ‘outer1’ before deduction of ‘auto’.
1 parent af87214 commit 1e7772a

File tree

5 files changed

+343
-46
lines changed

5 files changed

+343
-46
lines changed

0 commit comments

Comments
 (0)