1! RUN: %S/test_errors.sh %s %t %f18 2! Check that if constructs only accept scalar logical expressions. 3! TODO: expand the test to check this restriction for more types. 4 5INTEGER :: I 6LOGICAL, DIMENSION (2) :: B 7 8!ERROR: Must be a scalar value, but is a rank-1 array 9if ( B ) then 10 a = 1 11end if 12 13!ERROR: Must be a scalar value, but is a rank-1 array 14if ( B ) then 15 a = 2 16else 17 a = 3 18endif 19 20!ERROR: Must be a scalar value, but is a rank-1 array 21if ( B ) then 22 a = 4 23!ERROR: Must be a scalar value, but is a rank-1 array 24else if( B ) then 25 a = 5 26end if 27 28!ERROR: Must be a scalar value, but is a rank-1 array 29if ( B ) then 30 a = 6 31!ERROR: Must be a scalar value, but is a rank-1 array 32else if( B ) then 33 a = 7 34!ERROR: Must be a scalar value, but is a rank-1 array 35elseif( B ) then 36 a = 8 37end if 38 39!ERROR: Must be a scalar value, but is a rank-1 array 40if ( B ) then 41 a = 9 42!ERROR: Must be a scalar value, but is a rank-1 array 43else if( B ) then 44 a = 10 45else 46 a = 11 47end if 48 49!ERROR: Must be a scalar value, but is a rank-1 array 50if ( B ) then 51 a = 12 52!ERROR: Must be a scalar value, but is a rank-1 array 53else if( B ) then 54 a = 13 55!ERROR: Must be a scalar value, but is a rank-1 array 56else if( B ) then 57 a = 14 58end if 59 60 61!ERROR: Must have LOGICAL type, but is INTEGER(4) 62if ( I ) then 63 a = 1 64end if 65 66!ERROR: Must have LOGICAL type, but is INTEGER(4) 67if ( I ) then 68 a = 2 69else 70 a = 3 71endif 72 73!ERROR: Must have LOGICAL type, but is INTEGER(4) 74if ( I ) then 75 a = 4 76!ERROR: Must have LOGICAL type, but is INTEGER(4) 77else if( I ) then 78 a = 5 79end if 80 81!ERROR: Must have LOGICAL type, but is INTEGER(4) 82if ( I ) then 83 a = 6 84!ERROR: Must have LOGICAL type, but is INTEGER(4) 85else if( I ) then 86 a = 7 87!ERROR: Must have LOGICAL type, but is INTEGER(4) 88elseif( I ) then 89 a = 8 90end if 91 92!ERROR: Must have LOGICAL type, but is INTEGER(4) 93if ( I ) then 94 a = 9 95!ERROR: Must have LOGICAL type, but is INTEGER(4) 96else if( I ) then 97 a = 10 98else 99 a = 11 100end if 101 102!ERROR: Must have LOGICAL type, but is INTEGER(4) 103if ( I ) then 104 a = 12 105!ERROR: Must have LOGICAL type, but is INTEGER(4) 106else if( I ) then 107 a = 13 108!ERROR: Must have LOGICAL type, but is INTEGER(4) 109else if( I ) then 110 a = 14 111end if 112 113!ERROR: Must have LOGICAL type, but is REAL(4) 114if (f()) then 115 a = 15 116end if 117 118contains 119 real function f() 120 f = 1.0 121 end 122end 123