Commit 2c9f36c
[flang] Implemented a warning about contiguity of compile time constant values (llvm#161084)
Implemented `common::UsageWarning::ConstantIsContiguous` to warn about
the
following case:
```
integer, parameter :: num = 3
integer, parameter :: arr(num)=[(i, i=1,num)]
logical, parameter :: result=is_contiguous(arr(num:1:-1))
end
```
Here, while array section is discontiguous, `arr` is a compile time
constant,
so array section created at compile time will end up being contiguous
and
`result` will be "true". If `arr` wasn't a constant, the result at
runtime
would have been "false".1 parent 09a38a3 commit 2c9f36c
File tree
3 files changed
+15
-1
lines changed- flang
- include/flang/Support
- lib/Evaluate
- test/Semantics
3 files changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
802 | 808 | | |
803 | 809 | | |
| 810 | + | |
804 | 811 | | |
805 | 812 | | |
806 | 813 | | |
807 | 814 | | |
| 815 | + | |
808 | 816 | | |
809 | 817 | | |
810 | 818 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments