1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
5 integer, kind
:: k
= kind(1)
6 integer, len
:: l
= 666
10 pure
integer function ifunc()
13 !PORTABILITY: Automatic data object 'x1' should not appear in the specification part of a main program
14 type(t1(k
=4,l
=ifunc())) x1
15 !PORTABILITY: Statement function 'sf1' should not contain an array constructor
16 sf1(n
) = sum([(j
,j
=1,n
)])
18 !PORTABILITY: Statement function 'sf2' should not contain a structure constructor
20 !PORTABILITY: Statement function 'sf3' should not contain a type parameter inquiry
22 !ERROR: Recursive call to statement function 'sf4' is not allowed
24 !ERROR: Statement function 'sf5' may not reference another statement function 'sf6' that is defined later
27 !ERROR: Statement function 'sf6' may not reference another statement function 'sf7' that is defined later
29 !PORTABILITY: Statement function 'sf7' should not reference function 'explicit' that requires an explicit interface
31 real :: a(3) = [1., 2., 3.]
32 !PORTABILITY: Statement function 'sf8' should not pass an array argument that is not a whole array
36 !ERROR: Defining expression of statement function 'sf9' cannot be converted to its result type INTEGER(4)
38 !ERROR: Statement function 'sf10' may not reference another statement function 'sf11' that is defined later
40 sf11(n
) = sf10(n
) ! mutual recursion, caused crash
42 !PORTABILITY: nonstandard usage: based POINTER
43 pointer(iarg1p
, iarg1
)
46 print *, sf13(iarg1
) ! ok
49 real function explicit(x
,y
)
50 integer, intent(in
) :: x
51 integer, intent(in
), optional
:: y
59 !PORTABILITY: An implicitly typed statement function should not appear when the same symbol is available in its host scope
66 !ERROR: 'sf' is not a callable procedure
72 !ERROR: An entity may not have the ASYNCHRONOUS attribute unless it is a variable
78 !ERROR: A statement function must not have the POINTER attribute
84 !ERROR: The entity 'sf' with an explicit SAVE attribute must be a variable, procedure pointer, or COMMON block
90 !ERROR: VOLATILE attribute may apply only to a variable
95 !ERROR: Invalid specification expression: reference to impure function 'k'
97 !WARNING: Name 'k' from host scope should have a type declaration before its local statement function definition
98 !ERROR: 'k' is already declared in this scoping unit