Open
Description
I see two aliasing issues here:
First issue:
- test1 declares common/com/dummy,a
- inline1 declares common/com/b,dummy (different order)
- The array a is passed as an argument to inline1
- Inside inline1, in the statement a(i) = b(i) + 1, a and b are both referencing the same memory location through different paths (dummy argument and common block)
Second issue:
- Module moda uses equivalence(x,y(2)), making x overlap with y starting at y(2)
- test2 uses x as a and passes it to inline2
- inline2 uses y as b and performs a(i) = b(i) + 1, with a and b reference overlapping memory regions
This causes all of these compilers to give different answers when optimizations are enabled:
ifx -O0 /0366_0074.f90
./a.out
500500.0
500500.0
gfortran -O0 /0366_0074.f90
./a.out
500500.000
500500.000
flang -O0 /0366_0074.f90
./a.out
500500.
500500.
nvfortran -O0 /0366_0074.f90
./a.out
500500.0
500500.0
ifx -O2 /0366_0074.f90
./a.out
1255.000
1255.000
gfortran -O2 /0366_0074.f90
./a.out
1249.00000
500500.000
flang -O2 /0366_0074.f90
./a.out
1124.
1124.
nvfortran -O2 /0366_0074.f90
./a.out
1124.000
1124.000
This looks similar to #10. CC @eugeneepshteyn
Metadata
Metadata
Assignees
Labels
No labels