brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · c2dc759 Raw
123 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check that if constructs only accept scalar logical expressions.3! TODO: expand the test to check this restriction for more types.4 5INTEGER :: I6LOGICAL, DIMENSION (2) :: B7 8!ERROR: Must be a scalar value, but is a rank-1 array9if ( B ) then10  a = 111end if12 13!ERROR: Must be a scalar value, but is a rank-1 array14if ( B ) then15  a = 216else17  a = 318endif19 20!ERROR: Must be a scalar value, but is a rank-1 array21if ( B ) then22  a = 423!ERROR: Must be a scalar value, but is a rank-1 array24else if( B ) then25  a = 526end if27 28!ERROR: Must be a scalar value, but is a rank-1 array29if ( B ) then30  a = 631!ERROR: Must be a scalar value, but is a rank-1 array32else if( B ) then33  a = 734!ERROR: Must be a scalar value, but is a rank-1 array35elseif( B ) then36  a = 837end if38 39!ERROR: Must be a scalar value, but is a rank-1 array40if ( B ) then41  a = 942!ERROR: Must be a scalar value, but is a rank-1 array43else if( B ) then44  a = 1045else46  a = 1147end if48 49!ERROR: Must be a scalar value, but is a rank-1 array50if ( B ) then51  a = 1252!ERROR: Must be a scalar value, but is a rank-1 array53else if( B ) then54  a = 1355!ERROR: Must be a scalar value, but is a rank-1 array56else if( B ) then57  a = 1458end if59 60 61!ERROR: Must have LOGICAL type, but is INTEGER(4)62if ( I ) then63  a = 164end if65 66!ERROR: Must have LOGICAL type, but is INTEGER(4)67if ( I ) then68  a = 269else70  a = 371endif72 73!ERROR: Must have LOGICAL type, but is INTEGER(4)74if ( I ) then75  a = 476!ERROR: Must have LOGICAL type, but is INTEGER(4)77else if( I ) then78  a = 579end if80 81!ERROR: Must have LOGICAL type, but is INTEGER(4)82if ( I ) then83  a = 684!ERROR: Must have LOGICAL type, but is INTEGER(4)85else if( I ) then86  a = 787!ERROR: Must have LOGICAL type, but is INTEGER(4)88elseif( I ) then89  a = 890end if91 92!ERROR: Must have LOGICAL type, but is INTEGER(4)93if ( I ) then94  a = 995!ERROR: Must have LOGICAL type, but is INTEGER(4)96else if( I ) then97  a = 1098else99  a = 11100end if101 102!ERROR: Must have LOGICAL type, but is INTEGER(4)103if ( I ) then104  a = 12105!ERROR: Must have LOGICAL type, but is INTEGER(4)106else if( I ) then107  a = 13108!ERROR: Must have LOGICAL type, but is INTEGER(4)109else if( I ) then110  a = 14111end if112 113!ERROR: Must have LOGICAL type, but is REAL(4)114if (f()) then115  a = 15116end if117 118contains119  real function f()120    f = 1.0121  end122end123