PR preprocessor/79214 - -Wno-system-header defeats strncat buffer overflow warnings
[official-gcc.git] / gcc / testsuite / gfortran.dg / unconstrained_commons.f
blobcb84e7fc26fb3012e4c7a9f5a418f336e03b1ed1
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" } }
21 ! { dg-prune-output "overflows the destination" }