[all-commits] [llvm/llvm-project] c4a739: [flang] Limit shape inquiries rewrite to associate...
jeanPerier via All-commits
all-commits at lists.llvm.org
Wed Sep 21 01:28:14 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c4a73957f6c59f4f88d186c1a98327a826fbfb16
https://github.com/llvm/llvm-project/commit/c4a73957f6c59f4f88d186c1a98327a826fbfb16
Author: Jean Perier <jperier at nvidia.com>
Date: 2022-09-21 (Wed, 21 Sep 2022)
Changed paths:
M flang/include/flang/Evaluate/check-expression.h
M flang/lib/Evaluate/check-expression.cpp
M flang/lib/Evaluate/shape.cpp
M flang/test/Evaluate/rewrite01.f90
Log Message:
-----------
[flang] Limit shape inquiries rewrite to associate construct entity
The previous code was rewriting all shape inquires on associate
construct entities to inquires on the associated expression or variable.
This is is incorrect because at the point of inquiry, some statement
between the association and the inquiry may have modified the expression
operands or variable in a way that changes its shapes or bounds.
For instance, in the example below, expression rewrites was previously
replacing `size(x, 1)` by `size(p, 1)` which is invalid if p is a
pointer.
```
associate(x => p + 1)
call call_that_may_modify_p_shape()
print *, size(x, 1)
end associate
```
This change restricts rewrites of shape inquiries on associate construct entity
to use the associated expression shape and bounds if and only if the
shape/bounds are compile time constant. Otherwise, this may be invalid.
Differential Revision: https://reviews.llvm.org/D133857
More information about the All-commits
mailing list