Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / misc-intrinsics.f90
blobb454d4764e411431d95a34deae534d1aa2f48c3d
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Miscellaneous constraint and requirement checking on intrinsics
3 program test_size
4 real, dimension(5, 5) :: array
5 call test(array)
6 contains
7 subroutine test(arg)
8 real, dimension(5, *) :: arg
9 !ERROR: A dim= argument is required for 'size' when the array is assumed-size
10 print *, size(arg)
11 !ERROR: missing mandatory 'dim=' argument
12 print *, ubound(arg)
13 !ERROR: The 'source=' argument to the intrinsic function 'shape' may not be assumed-size
14 print *, shape(arg)
15 ! But these cases are fine:
16 print *, size(arg, dim=1)
17 print *, ubound(arg, dim=1)
18 print *, lbound(arg)
19 print *, size(array)
20 print *, ubound(array)
21 print *, lbound(array)
22 print *, size(arg(:,1))
23 print *, ubound(arg(:,1))
24 print *, shape(arg(:,1))
25 end subroutine
26 end