Files
clang-p2996/flang/test/Semantics/shape.f90
Michael Kruse 58c3f20bbf [flang][windows] Run regression tests under Windows. NFCI.
Allow the lit test suite to run under Windows. This encompasses the following changes:

 * Define `lit_tools_dir` for flang's test configuration
 * Replace `(<command> || true)` idiom with `not <command>`
 * Add `REQUIRES: shell` on tests that invoke a shell script

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D89368
2021-06-10 05:13:44 -05:00

51 lines
2.0 KiB
Fortran

! RUN: %S/test_errors.sh %s %t %flang_fc1
! REQUIRES: shell
! Test comparisons that use the intrinsic SHAPE() as an operand
program testShape
contains
subroutine sub1(arrayDummy)
integer :: arrayDummy(:)
integer, allocatable :: arrayDeferred(:)
integer :: arrayLocal(2) = [88, 99]
!ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
!ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
if (all(shape(arrayDummy)==shape(8))) then
print *, "hello"
end if
!ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
!ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
if (all(shape(27)==shape(arrayDummy))) then
print *, "hello"
end if
if (all(64==shape(arrayDummy))) then
print *, "hello"
end if
!ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
!ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
if (all(shape(arrayDeferred)==shape(8))) then
print *, "hello"
end if
!ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
!ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
if (all(shape(27)==shape(arrayDeferred))) then
print *, "hello"
end if
if (all(64==shape(arrayDeferred))) then
print *, "hello"
end if
!ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
!ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
if (all(shape(arrayLocal)==shape(8))) then
print *, "hello"
end if
!ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
!ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
if (all(shape(27)==shape(arrayLocal))) then
print *, "hello"
end if
if (all(64==shape(arrayLocal))) then
print *, "hello"
end if
end subroutine sub1
end program testShape