2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / unconstrained_commons.f
blobbee67ab7d5baef5a1fe1fed482686ea9c0965a18
1 ! { dg-do compile }
2 ! { dg-options "-O3 -funconstrained-commons -fdump-tree-dom2-details" }
4 ! Test for PR69368: a single-element array in a common block, which will be
5 ! overridden with a larger size at link time (contrary to language spec).
6 ! Dominator opts considers accesses to differently-computed elements of X as
7 ! equivalent, unless -funconstrained-commons is passed in.
8 SUBROUTINE FOO
9 IMPLICIT DOUBLE PRECISION (X)
10 INTEGER J
11 COMMON /MYCOMMON / X(1)
12 DO 10 J=1,1024
13 X(J+1)=X(J+7)
14 10 CONTINUE
15 RETURN
16 END
17 ! { dg-final { scan-tree-dump-not "FIND" "dom2" } }
18 ! We should retain both a read and write of mycommon.x.
19 ! { dg-final { scan-tree-dump-times " _\[0-9\]+ = mycommon\\.x\\\[_\[0-9\]+\\\];" 1 "dom2" } }
20 ! { dg-final { scan-tree-dump-times " mycommon\\.x\\\[j?_\[0-9\]+\\\] = _\[0-9\]+;" 1 "dom2" } }