mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 23:06:34 +00:00

To enable Flang testing on Windows, shell scripts have to be ported to Python. In this patch the "test_errors.sh" script is ported to python ("test_errors.py"). The RUN line of existing tests was changed to make use of the python script. Used python regex in place of awk/sed. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D107575
123 lines
2.3 KiB
Fortran
123 lines
2.3 KiB
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Check that if constructs only accept scalar logical expressions.
|
|
! TODO: expand the test to check this restriction for more types.
|
|
|
|
INTEGER :: I
|
|
LOGICAL, DIMENSION (2) :: B
|
|
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
if ( B ) then
|
|
a = 1
|
|
end if
|
|
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
if ( B ) then
|
|
a = 2
|
|
else
|
|
a = 3
|
|
endif
|
|
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
if ( B ) then
|
|
a = 4
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
else if( B ) then
|
|
a = 5
|
|
end if
|
|
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
if ( B ) then
|
|
a = 6
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
else if( B ) then
|
|
a = 7
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
elseif( B ) then
|
|
a = 8
|
|
end if
|
|
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
if ( B ) then
|
|
a = 9
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
else if( B ) then
|
|
a = 10
|
|
else
|
|
a = 11
|
|
end if
|
|
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
if ( B ) then
|
|
a = 12
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
else if( B ) then
|
|
a = 13
|
|
!ERROR: Must be a scalar value, but is a rank-1 array
|
|
else if( B ) then
|
|
a = 14
|
|
end if
|
|
|
|
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
if ( I ) then
|
|
a = 1
|
|
end if
|
|
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
if ( I ) then
|
|
a = 2
|
|
else
|
|
a = 3
|
|
endif
|
|
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
if ( I ) then
|
|
a = 4
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
else if( I ) then
|
|
a = 5
|
|
end if
|
|
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
if ( I ) then
|
|
a = 6
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
else if( I ) then
|
|
a = 7
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
elseif( I ) then
|
|
a = 8
|
|
end if
|
|
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
if ( I ) then
|
|
a = 9
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
else if( I ) then
|
|
a = 10
|
|
else
|
|
a = 11
|
|
end if
|
|
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
if ( I ) then
|
|
a = 12
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
else if( I ) then
|
|
a = 13
|
|
!ERROR: Must have LOGICAL type, but is INTEGER(4)
|
|
else if( I ) then
|
|
a = 14
|
|
end if
|
|
|
|
!ERROR: Must have LOGICAL type, but is REAL(4)
|
|
if (f()) then
|
|
a = 15
|
|
end if
|
|
|
|
contains
|
|
real function f()
|
|
f = 1.0
|
|
end
|
|
end
|