diff --git a/CMakeLists.txt b/CMakeLists.txt index dedcdc21f142..957e8daeb719 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ add_subdirectory(lib) add_subdirectory(runtime) add_subdirectory(unittests) add_subdirectory(tools) -add_subdirectory(test-lit) +add_subdirectory(test) configure_file( ${FLANG_SOURCE_DIR}/include/flang/Config/config.h.cmake diff --git a/test-lit/Evaluate/folding01.f90 b/test-lit/Evaluate/folding01.f90 deleted file mode 100644 index 8a75a819ff81..000000000000 --- a/test-lit/Evaluate/folding01.f90 +++ /dev/null @@ -1,126 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t - -! Test intrinsic operation folding - -module m -! Check logical intrinsic operation folding - logical, parameter :: test_not1 = .NOT..false. - logical, parameter :: test_not2 = .NOT..NOT..true. - - logical, parameter :: test_parentheses1 = .NOT.(.false.) - logical, parameter :: test_parentheses2 = .NOT..NOT.(.true.) - - logical, parameter :: test_and1 = .true..AND..true. - logical, parameter :: test_and2 = .NOT.(.false..AND..true.) - logical, parameter :: test_and3 = .NOT.(.false..AND..false.) - logical, parameter :: test_and4 = .NOT.(.true..AND..false.) - - logical, parameter :: test_or1 = .true..OR..true. - logical, parameter :: test_or2 = .false..OR..true. - logical, parameter :: test_or3 = .NOT.(.false..OR..false.) - logical, parameter :: test_or4 = .true..OR..false. - - logical, parameter :: test_eqv1 = .false..EQV..false. - logical, parameter :: test_eqv2 = .true..EQV..true. - logical, parameter :: test_eqv3 = .NOT.(.false..EQV..true.) - logical, parameter :: test_eqv4 = .NOT.(.true..EQV..false.) - - logical, parameter :: test_neqv1 = .true..NEQV..false. - logical, parameter :: test_neqv2 = .false..NEQV..true. - logical, parameter :: test_neqv3 = .NOT.(.false..NEQV..false.) - logical, parameter :: test_neqv4 = .NOT.(.true..NEQV..true.) - -! Check integer intrinsic operator folding - -! Check integer relational intrinsic operation folding - logical, parameter :: test_le_i1 = 1.LE.2 - logical, parameter :: test_le_i2 = .NOT.(2.LE.1) - logical, parameter :: test_le_i3 = 2.LE.2 - logical, parameter :: test_le_i4 = -1.LE.2 - logical, parameter :: test_le_i5 = .NOT.(-2.LE.-3) - - logical, parameter :: test_lt_i1 = 1.LT.2 - logical, parameter :: test_lt_i2 = .NOT.(2.LT.1) - logical, parameter :: test_lt_i3 = .NOT.(2.LT.2) - logical, parameter :: test_lt_i4 = -1.LT.2 - logical, parameter :: test_lt_i5 = .NOT.(-2.LT.-3) - - logical, parameter :: test_ge_i1 = .NOT.(1.GE.2) - logical, parameter :: test_ge_i2 = 2.GE.1 - logical, parameter :: test_ge_i3 = 2.GE.2 - logical, parameter :: test_ge_i4 = .NOT.(-1.GE.2) - logical, parameter :: test_ge_i5 = -2.GE.-3 - - logical, parameter :: test_gt_i1 = .NOT.(1.GT.2) - logical, parameter :: test_gt_i2 = 2.GT.1 - logical, parameter :: test_gt_i3 = .NOT.(2.GT.2) - logical, parameter :: test_gt_i4 = .NOT.(-1.GT.2) - logical, parameter :: test_gt_i5 = -2.GT.-3 - - logical, parameter :: test_eq_i1 = 2.EQ.2 - logical, parameter :: test_eq_i2 = .NOT.(-2.EQ.2) - - logical, parameter :: test_ne_i1 =.NOT.(2.NE.2) - logical, parameter :: test_ne_i2 = -2.NE.2 - -! Check integer intrinsic operation folding - logical, parameter :: test_unaryminus_i = (-(-1)).EQ.1 - logical, parameter :: test_unaryplus_i = (+1).EQ.1 - - logical, parameter :: test_plus_i1 = (1+1).EQ.2 - logical, parameter :: test_plus_i2 = ((-3)+1).EQ.-2 - - logical, parameter :: test_minus_i1 = (1-1).EQ.0 - logical, parameter :: test_minus_i2 = (1-(-1)).EQ.2 - - logical, parameter :: test_multiply_i1 = (2*2).EQ.4 - logical, parameter :: test_multiply_i2 = (0*1).EQ.0 - logical, parameter :: test_multiply_i3= ((-3)*2).EQ.(-6) - - logical, parameter :: test_divide_i1 = (5/3).EQ.(1) - logical, parameter :: test_divide_i2 = (6/3).EQ.(2) - logical, parameter :: test_divide_i3 = ((-7)/2).EQ.(-3) - logical, parameter :: test_divide_i4 = (0/127).EQ.(0) - - logical, parameter :: test_pow1 = (2**0).EQ.(1) - logical, parameter :: test_pow2 = (1**100).EQ.(1) - logical, parameter :: test_pow3 = (2**4).EQ.(16) - logical, parameter :: test_pow4 = (7**5).EQ.(16807) - logical, parameter :: test_pow5 = kind(real(1., kind=8)**cmplx(1., kind=4)).EQ.(8) - logical, parameter :: test_pow6 = kind(cmplx(1., kind=4)**real(1., kind=8)).EQ.(8) - - ! test MIN and MAX - real, parameter :: x1 = -35., x2= -35.05, x3=0., x4=35.05, x5=35. - real, parameter :: res_max_r = max(x1, x2, x3, x4, x5) - real, parameter :: res_min_r = min(x1, x2, x3, x4, x5) - logical, parameter :: test_max_r = res_max_r.EQ.x4 - logical, parameter :: test_min_r = res_min_r.EQ.x2 - - logical, parameter :: test_min_i = min(-3, 3).EQ.-3 - logical, parameter :: test_max_i = max(-3, 3).EQ.3 - integer, parameter :: i1 = 35, i2= 36, i3=0, i4=-35, i5=-36 - integer, parameter :: res_max_i = max(i1, i2, i3, i4, i5) - integer, parameter :: res_min_i = min(i1, i2, i3, i4, i5) - logical, parameter :: test_max_i2 = res_max_i.EQ.i2 - logical, parameter :: test_min_i2 = res_min_i.EQ.i5 - - character(*), parameter :: c1 = "elephant", c2="elevator" - character(*), parameter :: c3 = "excalibur", c4="z", c5="epsilon" - character(*), parameter :: res_max_c = max(c1, c2, c3, c4, c5) - character(*), parameter :: res_min_c = min(c1, c2, c3, c4, c5) - ! length of result is length of longest arguments! - character(len(c3)), parameter :: exp_min = c1 - character(len(c3)), parameter :: exp_max = c4 - logical, parameter :: test_max_c_1 = res_max_c.EQ.exp_max - logical, parameter :: test_max_c_2 = res_max_c.NE.c4 - logical, parameter :: test_max_c_3 = len(res_max_c).EQ.len(c3) - logical, parameter :: test_min_c_1 = res_min_c.NE.c1 - logical, parameter :: test_min_c_2 = res_min_c.EQ.exp_min - logical, parameter :: test_min_c_3 = len(res_min_c).EQ.len(c3) - - integer, parameter :: x1a(*) = [1, 12, 3, 14] - integer, parameter :: x2a(*) = [11, 2, 13, 4] - logical, parameter :: test_max_a1 = all(max(x1a, x2a).EQ.[11, 12, 13, 14]) - logical, parameter :: test_min_a1 = all(min(x1a, x2a).EQ.[1, 2, 3, 4]) - -end module diff --git a/test-lit/Evaluate/folding02.f90 b/test-lit/Evaluate/folding02.f90 deleted file mode 100644 index b69ff87b5c20..000000000000 --- a/test-lit/Evaluate/folding02.f90 +++ /dev/null @@ -1,255 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Check intrinsic function folding with host runtime library - -module m - real(4), parameter :: eps4 = 0.000001_4 - real(8), parameter :: eps8 = 0.000000000000001_8 - - ! These eps have been set so that constant folding of intrinsic - ! functions that use host runtime can be tested independently of - ! the underlying math library used. - ! C++ and libpgmath precise, relaxed and fast libraries pass the test. - ! It may have to be relaxed to pass on all architectures. - ! The purpose is to check that the "correct" runtime functions are mapped - ! to intrinsic functions but not to test the stability between different libraries. - ! The eps should just be low enough to give confidence that intrinsic - ! functions are mapped to runtime functions implementing the same math - ! function. - ! Compared values were selected to be around 1 +/- 0.5 so that eps is meaningful. - ! Expected values come from libpgmath-precise for Real(4) and Real(8) and - ! were computed on X86_64. - -! Real scalar intrinsic function tests - - #define TEST_R4(name, result, expected) \ - real(kind=4), parameter :: res_##name##_r4 = result; \ - real(kind=4), parameter :: exp_##name##_r4 = expected; \ - logical, parameter :: test_##name##_r4 = abs(res_##name##_r4 - exp_##name##_r4).LE.(eps4) - - logical, parameter :: test_sign_i4 = sign(1_4,2_4) == 1_4 .and. sign(1_4,-3_4) == -1_4 - logical, parameter :: test_sign_i8 = sign(1_8,2_8) == 1_8 .and. sign(1_8,-3_8) == -1_8 - - logical, parameter :: test_abs_r4 = abs(-2._4).EQ.(2._4) - TEST_R4(acos, acos(0.5_4), 1.0471975803375244140625_4) - TEST_R4(acosh, acosh(1.5_4), 0.96242368221282958984375_4) - logical, parameter :: test_aint1 = aint(2.783).EQ.(2.) - logical, parameter :: test_anint1 = anint(2.783).EQ.(3.) - logical, parameter :: test_floor1 = floor(-2.783).EQ.(-3.) - logical, parameter :: test_floor2 = floor(2.783).EQ.(2.) - logical, parameter :: test_ceiling1 = ceiling(-2.783).EQ.(-2.) - logical, parameter :: test_ceiling2 = ceiling(2.783).EQ.(3.) - TEST_R4(asin, asin(0.9_4), 1.11976945400238037109375_4) - TEST_R4(asinh, asinh(1._4), 0.881373584270477294921875_4) - TEST_R4(atan, atan(1.5_4), 0.982793748378753662109375_4) - TEST_R4(atan2, atan2(1.5_4, 1._4), 0.982793748378753662109375_4) - TEST_R4(atan_2, atan(1.5_4, 1._4), 0.982793748378753662109375_4) - TEST_R4(atanh, atanh(0.8_4), 1.098612308502197265625_4) - TEST_R4(cos, cos(0.5_4), 0.877582550048828125_4) - TEST_R4(cosh, cosh(0.1_4), 1.0050041675567626953125_4) - TEST_R4(erf, erf(1._4), 0.842700779438018798828125_4) - TEST_R4(erfc, erfc(0.1_4), 0.887537062168121337890625_4) - TEST_R4(exp, exp(0.1_4), 1.1051709651947021484375_4) - TEST_R4(gamma, gamma(0.9_4), 1.06862866878509521484375_4) - TEST_R4(hypot, hypot(1.1_4, 0.1_4), 1.10453617572784423828125_4) - TEST_R4(log, log(3._4), 1.098612308502197265625_4) - TEST_R4(log10, log10(10.5_4), 1.02118933200836181640625_4) - TEST_R4(log_gamma, log_gamma(3.5_4), 1.20097362995147705078125_4) - TEST_R4(mod, mod(-8.1_4, 5._4), (-3.1000003814697265625_4)) - TEST_R4(real, real(z'3f800000'), 1._4) - logical, parameter :: test_sign_r4 = sign(1._4,2._4) == 1._4 .and. sign(1._4,-2._4) == -1._4 - TEST_R4(sin, sin(1.6_4), 0.99957358837127685546875_4) - TEST_R4(sinh, sinh(0.9_4), 1.0265166759490966796875_4) - TEST_R4(sqrt, sqrt(1.1_4), 1.0488088130950927734375_4) - TEST_R4(tan, tan(0.8_4), 1.0296385288238525390625_4) - TEST_R4(tanh, tanh(3._4), 0.995054781436920166015625_4) - -! Real(kind=8) tests. - - #define TEST_R8(name, result, expected) \ - real(kind=8), parameter :: res_##name##_r8 = result; \ - real(kind=8), parameter :: exp_##name##_r8 = expected; \ - logical, parameter :: test_##name##_r8 = abs(res_##name##_r8 - exp_##name##_r8).LE.(eps8) - - logical, parameter :: test_abs_r8 = abs(-2._8).EQ.(2._8) - TEST_R8(acos, acos(0.5_8), & - 1.047197551196597853362391106202267110347747802734375_8) - TEST_R8(acosh, acosh(1.5_8), & - 0.9624236501192069415111518537742085754871368408203125_8) - TEST_R8(asin, asin(0.9_8), & - 1.119769514998634196700777465594001114368438720703125_8) - TEST_R8(asinh, asinh(1._8), & - 0.88137358701954304773806825323845259845256805419921875_8) - TEST_R8(atan, atan(1.5_8), & - 0.98279372324732905408239957978366874158382415771484375_8) - TEST_R8(atan2, atan2(1.5_8, 1._8), & - 0.98279372324732905408239957978366874158382415771484375_8) - TEST_R8(atan_2, atan(1.5_8, 1._8), & - 0.98279372324732905408239957978366874158382415771484375_8) - TEST_R8(atanh, atanh(0.8_8), & - 1.0986122886681097821082175869378261268138885498046875_8) - TEST_R8(cos, cos(0.5_8), & - 0.8775825618903727587394314468838274478912353515625_8) - TEST_R8(cosh, cosh(0.1_8), & - 1.0050041680558035039894093642942607402801513671875_8) - TEST_R8(erf, erf(1._8), & - 0.84270079294971489414223242420121096074581146240234375_8) - TEST_R8(erfc, erfc(0.1_8), & - 0.8875370839817151580319887216319330036640167236328125_8) - TEST_R8(exp, exp(0.1_8), & - 1.10517091807564771244187795673497021198272705078125_8) - TEST_R8(gamma, gamma(0.9_8), & - 1.0686287021193192625645451698801480233669281005859375_8) - TEST_R8(hypot, hypot(1.1_8, 0.1_8), & - 1.1045361017187260710414875575224868953227996826171875_8) - TEST_R8(log, log(3._8), & - 1.0986122886681097821082175869378261268138885498046875_8) - TEST_R8(log10, log10(10.5_8), & - 1.0211892990699380501240511875948868691921234130859375_8) - TEST_R8(log_gamma, log_gamma(3.5_8), & - 1.200973602347074287166606154642067849636077880859375_8) - TEST_R8(mod, mod(-8.1_8, 5._8), & - (-3.0999999999999996447286321199499070644378662109375_8)) - TEST_R8(real, real(z'3ff0000000000000',8), 1._8) - logical, parameter :: test_sign_r8 = sign(1._8,2._8) == 1._8 .and. sign(1._8,-2._8) == -1._8 - TEST_R8(sin, sin(1.6_8), & - 0.99957360304150510987852840116829611361026763916015625_8) - TEST_R8(sinh, sinh(0.9_8), & - 1.0265167257081753149350333842448890209197998046875_8) - TEST_R8(sqrt, sqrt(1.1_8), & - 1.048808848170151630796453900984488427639007568359375_8) - TEST_R8(tan, tan(0.8_8), & - 1.0296385570503641115891468871268443763256072998046875_8) - TEST_R8(tanh, tanh(3._8), & - 0.995054753686730464323773048818111419677734375_8) - - #define TEST_C4(name, result, expected) \ - complex(kind=4), parameter :: res_##name##_c4 = result; \ - complex(kind=4), parameter :: exp_##name##_c4 = expected; \ - logical, parameter :: test_##name##_c4 = abs(res_##name##_c4 - exp_##name##_c4).LE.(eps4) - - logical, parameter :: test_abs_c4 = abs(abs((1.1_4, 0.1_4)) & - - 1.10453617572784423828125_4).LE.(eps4) - TEST_C4(acos, acos((0.7_4, 1.1_4)), & - (1.11259567737579345703125_4, -1.03283786773681640625_4)) - TEST_C4(acosh, acosh((0.7_4, 1.1_4)), & - (1.03283774852752685546875_4, 1.11259555816650390625_4)) - TEST_C4(asin, asin((1.4_4, 0.7_4)), & - (1.0101039409637451171875_4,1.08838176727294921875_4)) - TEST_C4(asinh, asinh((0.7_4, 1.4_4)), & - (1.08838176727294921875_4,1.0101039409637451171875_4)) - TEST_C4(atan, atan((0.2_4, 1.1_4)), & - (1.06469786167144775390625_4,1.12215900421142578125_4)) - TEST_C4(atanh, atanh((1.1_4, 0.2_4)), & - (1.12215900421142578125_4,1.06469786167144775390625_4)) - TEST_C4(cmplx, cmplx(z'bf800000',z'3f000000'), (-1._4,0.5_4)) - TEST_C4(cos, cos((0.9_4, 1.1_4)), & - (1.0371677875518798828125_4,(-1.0462486743927001953125_4))) - TEST_C4(cosh, cosh((1.1_4, 0.9_4)), & - (1.0371677875518798828125_4,1.0462486743927001953125_4)) - TEST_C4(exp, exp((0.4_4, 0.8_4)), & - (1.039364337921142578125_4,1.07016956806182861328125_4)) - TEST_C4(log, log((1.5_4, 2.5_4)), & - (1.07003307342529296875_4,1.03037679195404052734375_4)) - TEST_C4(sin, sin((0.7_4, 1.1_4)), & - (1.07488918304443359375_4,1.02155959606170654296875_4)) - TEST_C4(sinh, sinh((1.1_4, 0.7_4)), & - (1.02155959606170654296875_4,1.07488918304443359375_4)) - TEST_C4(sqrt, sqrt((0.1_4, 2.1_4)), & - (1.04937589168548583984375_4,1.00059473514556884765625_4)) - TEST_C4(tan, tan((1.1_4, 0.4_4)), & - (1.07952976226806640625_4,1.1858270168304443359375_4)) - TEST_C4(tanh, tanh((0.4_4, 1.1_4)), & - (1.1858270168304443359375_4,1.07952976226806640625_4)) - - #define TEST_C8(name, result, expected) \ - complex(kind=8), parameter :: res_##name##_c8 = result; \ - complex(kind=8), parameter :: exp_##name##_c8 = expected; \ - logical, parameter :: test_##name##_c8 = abs(res_##name##_c8 - exp_##name##_c8).LE.(eps8) - - logical, parameter :: test_abs_c8 = abs(abs((1.1_8, 0.1_8)) & - - 1.1045361017187260710414875575224868953227996826171875_8).LE.(eps4) - TEST_C8(acos, acos((0.7_8, 1.1_8)), & - (1.1125956244800556671492586247040890157222747802734375_8, & - (-1.032837729564676454430127705563791096210479736328125_8))) - TEST_C8(acosh, acosh((0.7_8, 1.1_8)), & - (1.0328377295646762323855227805324830114841461181640625_8, & - (1.1125956244800558891938635497353971004486083984375_8))) - TEST_C8(asin, asin((1.4_8, 0.7_8)), & - (1.010103922959187716656970223993994295597076416015625_8, & - (1.088381716746653626870511288871057331562042236328125_8))) - TEST_C8(asinh, asinh((0.7_8, 1.4_8)), & - (1.088381716746653626870511288871057331562042236328125_8, & - (1.0101039229591874946123652989626862108707427978515625_8))) - TEST_C8(atan, atan((0.2_8, 1.1_8)), & - (1.064697821069229721757665174663998186588287353515625_8, & - (1.122159092433034910385458715609274804592132568359375_8))) - TEST_C8(atanh, atanh((1.1_8, 0.2_8)), & - (1.122159092433034910385458715609274804592132568359375_8, & - (1.064697821069229721757665174663998186588287353515625_8))) - TEST_C8(cmplx, cmplx(z'bff0000000000000', kind=8), (-1._8,0)) - TEST_C8(cos, cos((0.9_8, 1.1_8)), & - (1.03716776530046761450876147137023508548736572265625_8, & - (-1.0462486051241379758636185215436853468418121337890625_8))) - TEST_C8(cosh, cosh((1.1_8, 0.9_8)), & - (1.03716776530046761450876147137023508548736572265625_8, & - (1.0462486051241379758636185215436853468418121337890625_8))) - TEST_C8(exp, exp((0.4_8, 0.8_8)), & - (1.039364276016479404773917849524877965450286865234375_8, & - (1.0701695334073042520373064689920283854007720947265625_8))) - TEST_C8(log, log((1.5_8, 2.5_8)), & - (1.070033081748135384003717263112775981426239013671875_8, & - (1.0303768265243125057395445764996111392974853515625_8))) - TEST_C8(sin, sin((0.7_8, 1.1_8)), & - (1.0748891638565509776270801012287847697734832763671875_8, & - (1.0215595324907689178672853813623078167438507080078125_8))) - TEST_C8(sinh, sinh((1.1_8, 0.7_8)), & - (1.0215595324907689178672853813623078167438507080078125_8, & - (1.0748891638565509776270801012287847697734832763671875_8))) - TEST_C8(sqrt, sqrt((0.1_8, 2.1_8)), & - (1.04937591075907210580453465809114277362823486328125_8, & - (1.0005947241922830059472419228351358112816260614863494993187487125396728515625_8))) - TEST_C8(tan, tan((1.1_8, 0.4_8)), & - (1.07952982287592025301137255155481398105621337890625_8, & - (1.1858270353667335061942367246956564486026763916015625_8))) - TEST_C8(tanh, tanh((0.4_8, 1.1_8)), & - (1.1858270353667335061942367246956564486026763916015625_8, & - (1.07952982287592025301137255155481398105621337890625_8))) - -#ifdef TEST_LIBPGMATH -! Bessel functions and erfc_scaled can only be folded if libpgmath -! is used. - TEST_R4(bessel_j0, bessel_j0(0.5_4), 0.938469827175140380859375_4) - TEST_R4(bessel_j1, bessel_j1(1.8_4), 0.5815169811248779296875_4) - TEST_R4(bessel_jn, bessel_jn(2, 3._4), 0.4860912859439849853515625_4) - TEST_R4(bessel_y0, bessel_y0(2._4), 0.510375678539276123046875_4) - TEST_R4(bessel_y1, bessel_y1(1._4), (-0.78121280670166015625_4)) - TEST_R4(bessel_yn, bessel_yn(2, 1.5_4), (-0.932193756103515625_4)) - TEST_R4(erfc_scaled, erfc_scaled(0.1_4), 0.8964569568634033203125_4) - - TEST_R8(bessel_j0, bessel_j0(0.5_8), & - 0.938469807240812858850631528184749186038970947265625_8) - TEST_R8(bessel_j1, bessel_j1(1.8_8), & - 0.5815169517311653546443039886071346700191497802734375_8) - TEST_R8(bessel_jn, bessel_jn(2, 3._8), & - 0.486091260585891082879328450871980749070644378662109375_8) - TEST_R8(bessel_y0, bessel_y0(2._8), & - 0.51037567264974514902320379405864514410495758056640625_8) - TEST_R8(bessel_y1, bessel_y1(1._8), & - (-0.781212821300288684511770043172873556613922119140625_8)) - TEST_R8(bessel_yn, bessel_yn(2, 1.5_8), & - (-0.93219375976297402797143831776338629424571990966796875_8)) - TEST_R8(erfc_scaled, erfc_scaled(0.1_8), & - 0.89645697996912654392787089818739332258701324462890625_8) -#endif - -! Test exponentiation by real or complex folding (it is using host runtime) - TEST_R4(pow, (0.5_4**3.14_4), 1.134398877620697021484375e-1_4) - TEST_R8(pow, (0.5_8**3.14_8), & - 1.1343989441464509548840311481399112381041049957275390625e-1_8) - TEST_C4(pow, ((0.5_4, 0.6_4)**(0.74_4, -1.1_4)), & - (1.32234990596771240234375_4,1.73712027072906494140625_4)) - TEST_C8(pow, ((0.5_8, 0.6_8)**(0.74_8, -1.1_8)), & - (1.3223499632715445262221010125358588993549346923828125_8, & - 1.7371201007364975854585509296157397329807281494140625_8)) - -end diff --git a/test-lit/Evaluate/folding03.f90 b/test-lit/Evaluate/folding03.f90 deleted file mode 100644 index c5e26faf8327..000000000000 --- a/test-lit/Evaluate/folding03.f90 +++ /dev/null @@ -1,264 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Test operation folding edge case (both expected value and messages) -! These tests make assumptions regarding real(4) and integer(4) extrema. - -#define TEST_ISNAN(v) logical, parameter :: test_##v =.NOT.(v.EQ.v) - -module integer_tests - integer(4), parameter :: i4_pmax = 2147483647_4 - ! Fortran grammar rule R605 prevents from writing -2147483648_4 in an - ! expression because literal-constant are not signed so this would parse - ! to -(2147483648_4) and 2147483648_4 is not accepted as a literal-constant. - ! However, one can reach this value with operations. - integer(4), parameter :: i4_nmax = -2147483647_4 - 1_4 - - ! Integer division by zero are not tested here because they are handled as fatal - ! errors in constants. - - !WARN: INTEGER(4) negation overflowed - logical, parameter :: test_overflow_unary_minus1 = (-i4_nmax).EQ.i4_nmax - logical, parameter :: test_no_overflow_unary_minus1 = (-i4_pmax).EQ.(i4_nmax+1_4) - logical, parameter :: test_no_overflow_unary_plus1 = (+i4_pmax).EQ.i4_pmax - logical, parameter :: test_no_overflow_unary_plus2 = (+i4_nmax).EQ.i4_nmax - - !WARN: INTEGER(4) addition overflowed - logical, parameter :: test_overflow_add1 = (i4_pmax+1_4).EQ.i4_nmax - !WARN: INTEGER(4) addition overflowed - logical, parameter :: test_overflow_add2 = (i4_nmax + (-1_4)).EQ.i4_pmax - !WARN: INTEGER(4) addition overflowed - logical, parameter :: test_overflow_add3 = (i4_pmax + i4_pmax).EQ.(-2_4) - !WARN: INTEGER(4) addition overflowed - logical, parameter :: test_overflow_add4 = (i4_nmax + i4_nmax).EQ.(0_4) - logical, parameter :: test_no_overflow_add1 = (i4_pmax + 0_4).EQ.i4_pmax - logical, parameter :: test_no_overflow_add2 = (i4_nmax + (-0_4)).EQ.i4_nmax - logical, parameter :: test_no_overflow_add3 = (i4_pmax + i4_nmax).EQ.(-1_4) - logical, parameter :: test_no_overflow_add4 = (i4_nmax + i4_pmax).EQ.(-1_4) - - !WARN: INTEGER(4) subtraction overflowed - logical, parameter :: test_overflow_sub1 = (i4_nmax - 1_4).EQ.i4_pmax - !WARN: INTEGER(4) subtraction overflowed - logical, parameter :: test_overflow_sub2 = (i4_pmax - (-1_4)).EQ.i4_nmax - !WARN: INTEGER(4) subtraction overflowed - logical, parameter :: test_overflow_sub3 = (i4_nmax - i4_pmax).EQ.(1_4) - !WARN: INTEGER(4) subtraction overflowed - logical, parameter :: test_overflow_sub4 = (i4_pmax - i4_nmax).EQ.(-1_4) - logical, parameter :: test_no_overflow_sub1 = (i4_nmax - 0_4).EQ.i4_nmax - logical, parameter :: test_no_overflow_sub2 = (i4_pmax - (-0_4)).EQ.i4_pmax - logical, parameter :: test_no_overflow_sub3 = (i4_nmax - i4_nmax).EQ.0_4 - logical, parameter :: test_no_overflow_sub4 = (i4_pmax - i4_pmax).EQ.0_4 - - - !WARN: INTEGER(4) multiplication overflowed - logical, parameter :: test_overflow_mult1 = (i4_pmax*2_4).EQ.(-2_4) - !WARN: INTEGER(4) multiplication overflowed - logical, parameter :: test_overflow_mult2 = (i4_nmax*2_4).EQ.(0_4) - !WARN: INTEGER(4) multiplication overflowed - logical, parameter :: test_overflow_mult3 = (i4_nmax*i4_nmax).EQ.(0_4) - !WARN: INTEGER(4) multiplication overflowed - logical, parameter :: test_overflow_mult4 = (i4_pmax*i4_pmax).EQ.(1_4) - - !WARN: INTEGER(4) division overflowed - logical, parameter :: test_overflow_div1 = (i4_nmax/(-1_4)).EQ.(i4_nmax) - logical, parameter :: test_no_overflow_div1 = (i4_nmax/(-2_4)).EQ.(1_4 + i4_pmax/2_4) - logical, parameter :: test_no_overflow_div2 = (i4_nmax/i4_nmax).EQ.(1_4) - - !WARN: INTEGER(4) power overflowed - logical, parameter :: test_overflow_pow1 = (i4_pmax**2_4).EQ.(1_4) - !WARN: INTEGER(4) power overflowed - logical, parameter :: test_overflow_pow3 = (i4_nmax**2_4).EQ.(0_4) - logical, parameter :: test_no_overflow_pow1 = ((-1_4)**i4_nmax).EQ.(1_4) - logical, parameter :: test_no_overflow_pow2 = ((-1_4)**i4_pmax).EQ.(-1_4) - -end module - -module real_tests - ! Test real(4) operation folding on edge cases (inf and NaN) - - real(4), parameter :: r4_pmax = 3.4028235E38 - real(4), parameter :: r4_nmax = -3.4028235E38 - !WARN: invalid argument on division - real(4), parameter :: r4_nan = 0._4/0._4 - TEST_ISNAN(r4_nan) - !WARN: division by zero on division - real(4), parameter :: r4_pinf = 1._4/0._4 - !WARN: division by zero on division - real(4), parameter :: r4_ninf = -1._4/0._4 - - logical, parameter :: test_r4_nan_parentheses1 = .NOT.(((r4_nan)).EQ.r4_nan) - logical, parameter :: test_r4_nan_parentheses2 = .NOT.(((r4_nan)).NE.r4_nan) - logical, parameter :: test_r4_pinf_parentheses = ((r4_pinf)).EQ.r4_pinf - logical, parameter :: test_r4_ninf_parentheses = ((r4_ninf)).EQ.r4_ninf - - ! No warnings expected - logical, parameter :: test_r4_negation1 = (-r4_pmax).EQ.r4_nmax - logical, parameter :: test_r4_negation2 = (-r4_nmax).EQ.r4_pmax - logical, parameter :: test_r4_negation3 = (-r4_pinf).EQ.r4_ninf - logical, parameter :: test_r4_negation4 = (-r4_ninf).EQ.r4_pinf - logical, parameter :: test_r4_plus1 = (+r4_pmax).EQ.r4_pmax - logical, parameter :: test_r4_plus2 = (+r4_nmax).EQ.r4_nmax - logical, parameter :: test_r4_plus3 = (+r4_pinf).EQ.r4_pinf - logical, parameter :: test_r4_plus4 = (+r4_ninf).EQ.r4_ninf - ! NaN propagation , no warnings expected (quiet) - real(4), parameter :: r4_nan_minus = (-r4_nan) - TEST_ISNAN(r4_nan_minus) - real(4), parameter :: r4_nan_plus = (+r4_nan) - TEST_ISNAN(r4_nan_plus) - - !WARN: overflow on addition - logical, parameter :: test_inf_r4_add9 = (r4_pmax + r4_pmax).eq.(r4_pinf) - !WARN: overflow on addition - logical, parameter :: test_inf_r4_add10 = (r4_nmax + r4_nmax).eq.(r4_ninf) - !WARN: overflow on subtraction - logical, parameter :: test_inf_r4_sub9 = (r4_pmax - r4_nmax).eq.(r4_pinf) - !WARN: overflow on subtraction - logical, parameter :: test_inf_r4_sub10 = (r4_nmax - r4_pmax).eq.(r4_ninf) - - ! No warnings expected below (inf propagation). - logical, parameter :: test_inf_r4_add1 = (r4_pinf + r4_pinf).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_add2 = (r4_ninf + r4_ninf).EQ.(r4_ninf) - logical, parameter :: test_inf_r4_add3 = (r4_pinf + r4_nmax).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_add4 = (r4_pinf + r4_pmax).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_add5 = (r4_ninf + r4_pmax).EQ.(r4_ninf) - logical, parameter :: test_inf_r4_add6 = (r4_ninf + r4_nmax).EQ.(r4_ninf) - logical, parameter :: test_inf_r4_add7 = (r4_ninf + 0._4).EQ.(r4_ninf) - logical, parameter :: test_inf_r4_add8 = (r4_pinf + 0._4).EQ.(r4_pinf) - - !WARN: invalid argument on subtraction - real(4), parameter :: r4_nan_sub1 = r4_pinf - r4_pinf - TEST_ISNAN(r4_nan_sub1) - !WARN: invalid argument on subtraction - real(4), parameter :: r4_nan_sub2 = r4_ninf - r4_ninf - TEST_ISNAN(r4_nan_sub2) - !WARN: invalid argument on addition - real(4), parameter :: r4_nan_add1 = r4_ninf + r4_pinf - TEST_ISNAN(r4_nan_add1) - !WARN: invalid argument on addition - real(4), parameter :: r4_nan_add2 = r4_pinf + r4_ninf - TEST_ISNAN(r4_nan_add2) - - ! No warnings expected here (quite NaN propagation) - real(4), parameter :: r4_nan_sub3 = 0._4 - r4_nan - TEST_ISNAN(r4_nan_sub3) - real(4), parameter :: r4_nan_sub4 = r4_nan - r4_pmax - TEST_ISNAN(r4_nan_sub4) - real(4), parameter :: r4_nan_sub5 = r4_nan - r4_nmax - TEST_ISNAN(r4_nan_sub5) - real(4), parameter :: r4_nan_sub6 = r4_nan - r4_nan - TEST_ISNAN(r4_nan_sub6) - real(4), parameter :: r4_nan_add3 = 0._4 + r4_nan - TEST_ISNAN(r4_nan_add3) - real(4), parameter :: r4_nan_add4 = r4_nan + r4_pmax - TEST_ISNAN(r4_nan_add4) - real(4), parameter :: r4_nan_add5 = r4_nmax + r4_nan - TEST_ISNAN(r4_nan_add5) - real(4), parameter :: r4_nan_add6 = r4_nan + r4_nan - TEST_ISNAN(r4_nan_add6) - - !WARN: overflow on multiplication - logical, parameter :: test_inf_r4_mult1 = (1.5_4*r4_pmax).eq.(r4_pinf) - !WARN: overflow on multiplication - logical, parameter :: test_inf_r4_mult2 = (1.5_4*r4_nmax).eq.(r4_ninf) - !WARN: overflow on division - logical, parameter :: test_inf_r4_div1 = (r4_nmax/(-0.5_4)).eq.(r4_pinf) - !WARN: overflow on division - logical, parameter :: test_inf_r4_div2 = (r4_pmax/(-0.5_4)).eq.(r4_ninf) - - ! No warnings expected below (inf propagation). - logical, parameter :: test_inf_r4_mult3 = (r4_pinf*r4_pinf).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_mult4 = (r4_ninf*r4_ninf).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_mult5 = (r4_pinf*0.1_4).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_mult6 = (r4_ninf*r4_nmax).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_div3 = (r4_pinf/0.).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_div4 = (r4_ninf/0.).EQ.(r4_ninf) - logical, parameter :: test_inf_r4_div5 = (0./r4_pinf).EQ.(0.) - logical, parameter :: test_inf_r4_div6 = (0./r4_ninf).EQ.(0.) - logical, parameter :: test_inf_r4_div7 = (r4_pinf/r4_pmax).EQ.(r4_pinf) - logical, parameter :: test_inf_r4_div8 = (r4_pinf/r4_nmax).EQ.(r4_ninf) - logical, parameter :: test_inf_r4_div9 = (r4_nmax/r4_pinf).EQ.(0.) - logical, parameter :: test_inf_r4_div10 = (r4_nmax/r4_ninf).EQ.(0.) - - !WARN: invalid argument on division - real(4), parameter :: r4_nan_div1 = 0._4/0._4 - TEST_ISNAN(r4_nan_div1) - !WARN: invalid argument on division - real(4), parameter :: r4_nan_div2 = r4_ninf/r4_ninf - TEST_ISNAN(r4_nan_div2) - !WARN: invalid argument on division - real(4), parameter :: r4_nan_div3 = r4_ninf/r4_pinf - TEST_ISNAN(r4_nan_div3) - !WARN: invalid argument on division - real(4), parameter :: r4_nan_div4 = r4_pinf/r4_ninf - TEST_ISNAN(r4_nan_div4) - !WARN: invalid argument on division - real(4), parameter :: r4_nan_div5 = r4_pinf/r4_pinf - TEST_ISNAN(r4_nan_div5) - !WARN: invalid argument on multiplication - real(4), parameter :: r4_nan_mult1 = r4_pinf*0._4 - TEST_ISNAN(r4_nan_mult1) - !WARN: invalid argument on multiplication - real(4), parameter :: r4_nan_mult2 = 0._4*r4_ninf - TEST_ISNAN(r4_nan_mult2) - - ! No warnings expected here (quite NaN propagation) - real(4), parameter :: r4_nan_div6 = 0._4/r4_nan - TEST_ISNAN(r4_nan_div6) - real(4), parameter :: r4_nan_div7 = r4_nan/r4_nan - TEST_ISNAN(r4_nan_div7) - real(4), parameter :: r4_nan_div8 = r4_nan/0._4 - TEST_ISNAN(r4_nan_div8) - real(4), parameter :: r4_nan_div9 = r4_nan/1._4 - TEST_ISNAN(r4_nan_div9) - real(4), parameter :: r4_nan_mult3 = r4_nan*1._4 - TEST_ISNAN(r4_nan_mult3) - real(4), parameter :: r4_nan_mult4 = r4_nan*r4_nan - TEST_ISNAN(r4_nan_mult4) - real(4), parameter :: r4_nan_mult5 = 0._4*r4_nan - TEST_ISNAN(r4_nan_mult5) - - ! TODO: ** operator folding - ! logical, parameter :: test_inf_r4_exp1 = (r4_pmax**2._4).EQ.(r4_pinf) - - ! Relational operator edge cases (No warnings expected?) - logical, parameter :: test_inf_r4_eq1 = r4_pinf.EQ.r4_pinf - logical, parameter :: test_inf_r4_eq2 = r4_ninf.EQ.r4_ninf - logical, parameter :: test_inf_r4_eq3 = .NOT.(r4_pinf.EQ.r4_ninf) - logical, parameter :: test_inf_r4_eq4 = .NOT.(r4_pinf.EQ.r4_pmax) - - logical, parameter :: test_inf_r4_ne1 = .NOT.(r4_pinf.NE.r4_pinf) - logical, parameter :: test_inf_r4_ne2 = .NOT.(r4_ninf.NE.r4_ninf) - logical, parameter :: test_inf_r4_ne3 = r4_pinf.NE.r4_ninf - logical, parameter :: test_inf_r4_ne4 = r4_pinf.NE.r4_pmax - - logical, parameter :: test_inf_r4_gt1 = .NOT.(r4_pinf.GT.r4_pinf) - logical, parameter :: test_inf_r4_gt2 = .NOT.(r4_ninf.GT.r4_ninf) - logical, parameter :: test_inf_r4_gt3 = r4_pinf.GT.r4_ninf - logical, parameter :: test_inf_r4_gt4 = r4_pinf.GT.r4_pmax - - logical, parameter :: test_inf_r4_lt1 = .NOT.(r4_pinf.LT.r4_pinf) - logical, parameter :: test_inf_r4_lt2 = .NOT.(r4_ninf.LT.r4_ninf) - logical, parameter :: test_inf_r4_lt3 = r4_ninf.LT.r4_pinf - logical, parameter :: test_inf_r4_lt4 = r4_pmax.LT.r4_pinf - - logical, parameter :: test_inf_r4_ge1 = r4_pinf.GE.r4_pinf - logical, parameter :: test_inf_r4_ge2 = r4_ninf.GE.r4_ninf - logical, parameter :: test_inf_r4_ge3 = .NOT.(r4_ninf.GE.r4_pinf) - logical, parameter :: test_inf_r4_ge4 = .NOT.(r4_pmax.GE.r4_pinf) - - logical, parameter :: test_inf_r4_le1 = r4_pinf.LE.r4_pinf - logical, parameter :: test_inf_r4_le2 = r4_ninf.LE.r4_ninf - logical, parameter :: test_inf_r4_le3 = .NOT.(r4_pinf.LE.r4_ninf) - logical, parameter :: test_inf_r4_le4 = .NOT.(r4_pinf.LE.r4_pmax) - - ! Invalid relational argument - logical, parameter :: test_nan_r4_eq1 = .NOT.(r4_nan.EQ.r4_nan) - logical, parameter :: test_nan_r4_ne1 = .NOT.(r4_nan.NE.r4_nan) - -end module - -! TODO: edge case conversions -! TODO: complex tests (or is real tests enough?) - -! Logical operation (with logical arguments) cannot overflow or be invalid. -! CHARACTER folding operations may cause host memory exhaustion if the -! string are very large. This will cause a fatal error for the program -! doing folding (e.g. f18), so there is nothing very interesting to test here. diff --git a/test-lit/Evaluate/folding04.f90 b/test-lit/Evaluate/folding04.f90 deleted file mode 100644 index a0e207b375b7..000000000000 --- a/test-lit/Evaluate/folding04.f90 +++ /dev/null @@ -1,46 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Test intrinsic function folding edge case (both expected value and messages) -! These tests make assumptions regarding real(4) extrema. - -#define TEST_ISNAN(v) logical, parameter :: test_##v =.NOT.(v.EQ.v) - - -module real_tests - ! Test real(4) intrinsic folding on edge cases (inf and NaN) - - real(4), parameter :: r4_pmax = 3.4028235E38 - real(4), parameter :: r4_nmax = -3.4028235E38 - !WARN: invalid argument on division - real(4), parameter :: r4_nan = 0._4/0._4 - !WARN: division by zero on division - real(4), parameter :: r4_pinf = 1._4/0._4 - !WARN: division by zero on division - real(4), parameter :: r4_ninf = -1._4/0._4 - - !WARN: invalid argument on intrinsic function - real(4), parameter :: nan_r4_acos1 = acos(1.1) - TEST_ISNAN(nan_r4_acos1) - !WARN: invalid argument on intrinsic function - real(4), parameter :: nan_r4_acos2 = acos(r4_pmax) - TEST_ISNAN(nan_r4_acos2) - !WARN: invalid argument on intrinsic function - real(4), parameter :: nan_r4_acos3 = acos(r4_nmax) - TEST_ISNAN(nan_r4_acos3) - !WARN: invalid argument on intrinsic function - real(4), parameter :: nan_r4_acos4 = acos(r4_ninf) - TEST_ISNAN(nan_r4_acos4) - !WARN: invalid argument on intrinsic function - real(4), parameter :: nan_r4_acos5 = acos(r4_pinf) - TEST_ISNAN(nan_r4_acos5) - - !WARN: overflow on intrinsic function - logical, parameter :: test_exp_overflow = exp(256._4).EQ.r4_pinf -end module - -module parentheses - ! Test parentheses in folding (they are kept around constants to keep the - ! distinction between variable and expressions and require special care). - real(4), parameter :: x_nop = 0.1_4 - real(4), parameter :: x_p = (x_nop) - logical, parameter :: test_parentheses1 = acos(x_p).EQ.acos(x_nop) -end module diff --git a/test-lit/Evaluate/folding05.f90 b/test-lit/Evaluate/folding05.f90 deleted file mode 100644 index 79635e392d77..000000000000 Binary files a/test-lit/Evaluate/folding05.f90 and /dev/null differ diff --git a/test-lit/Evaluate/folding06.f90 b/test-lit/Evaluate/folding06.f90 deleted file mode 100644 index 42dc70d5165e..000000000000 --- a/test-lit/Evaluate/folding06.f90 +++ /dev/null @@ -1,56 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Test transformational intrinsic function folding - -module m - - type A - real(4) x - integer(8) i - end type - - integer(8), parameter :: new_shape(*) = [2, 4] - integer(4), parameter :: order(2) = [2, 1] - - - ! Testing integers (similar to real and complex) - integer(4), parameter :: int_source(*) = [1, 2, 3, 4, 5, 6] - integer(4), parameter :: int_pad(2) = [7, 8] - integer(4), parameter :: int_expected_result(*, *) = reshape([1, 5, 2, 6, 3, 7, 4, 8], new_shape) - integer(4), parameter :: int_result(*, *) = reshape(int_source, new_shape, int_pad, order) - integer(4), parameter :: int_result_long_source(*, *) = reshape([1, 5, 2, 6, 3, 7, 4, 8, 9], new_shape) - logical, parameter :: test_reshape_integer_1 = all(int_expected_result == int_result) - logical, parameter :: test_reshape_integer_2 = all(shape(int_result, 8).EQ.new_shape) - logical, parameter :: test_reshape_integer_3 = all(int_expected_result == int_result_long_source) - - - ! Testing characters - character(kind=1, len=3), parameter ::char_source(*) = ["abc", "def", "ghi", "jkl", "mno", "pqr"] - character(kind=1,len=3), parameter :: char_pad(2) = ["stu", "vxy"] - - character(kind=1, len=3), parameter :: char_expected_result(*, *) = & - reshape(["abc", "mno", "def", "pqr", "ghi", "stu", "jkl", "vxy"], new_shape) - - character(kind=1, len=3), parameter :: char_result(*, *) = & - reshape(char_source, new_shape, char_pad, order) - - logical, parameter :: test_reshape_char_1 = all(char_result == char_expected_result) - logical, parameter :: test_reshape_char_2 = all(shape(char_result, 8).EQ.new_shape) - - - ! Testing derived types - type(A), parameter :: derived_source(*) = & - [A(x=1.5, i=1), A(x=2.5, i=2), A(x=3.5, i=3), A(x=4.5, i=4), A(x=5.5, i=5), A(x=6.5, i=6)] - - type(A), parameter :: derived_pad(2) = [A(x=7.5, i=7), A(x=8.5, i=8)] - - type(A), parameter :: derived_expected_result(*, *) = & - reshape([a::a(x=1.5_4,i=1_8),a(x=5.5_4,i=5_8),a(x=2.5_4,i=2_8), a(x=6.5_4,i=6_8), & - a(x=3.5_4,i=3_8),a(x=7.5_4,i=7_8),a(x=4.5_4,i=4_8),a(x=8.5_4,i=8_8)], new_shape) - - type(A), parameter :: derived_result(*, *) = reshape(derived_source, new_shape, derived_pad, order) - - logical, parameter :: test_reshape_derived_1 = all((derived_result%x.EQ.derived_expected_result%x) & - .AND.(derived_result%i.EQ.derived_expected_result%i)) - - logical, parameter :: test_reshape_derived_2 = all(shape(derived_result).EQ.new_shape) -end module diff --git a/test-lit/Evaluate/folding07.f90 b/test-lit/Evaluate/folding07.f90 deleted file mode 100644 index 9c9c0a40ed61..000000000000 --- a/test-lit/Evaluate/folding07.f90 +++ /dev/null @@ -1,254 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Test numeric model inquiry intrinsics - -module m - - integer, parameter :: & - bs1 = bit_size(0_1), & - bs2 = bit_size(0_2), & - bs4 = bit_size(0_4), & - bs8 = bit_size(0_8), & - bs16 = bit_size(0_16) - logical, parameter :: test_bit_size_1 = bs1 == 8 - logical, parameter :: test_bit_size_2 = bs2 == 16 - logical, parameter :: test_bit_size_4 = bs4 == 32 - logical, parameter :: test_bit_size_8 = bs8 == 64 - logical, parameter :: test_bit_size_16 = bs16 == 128 - - real(2), parameter :: & - eps2 = epsilon(0._2), zeps2 = real(z'1000', kind=2), deps2 = 4.8828125e-4_2 - real(3), parameter :: & - eps3 = epsilon(0._3), zeps3 = real(z'3b80', kind=3), deps3 = 3.90625e-3_3 - real(4), parameter :: & - eps4 = epsilon(0._4), zeps4 = real(z'33800000', kind=4), & - deps4 = 5.9604644775390625e-8_4 - real(8), parameter :: & - eps8 = epsilon(0._8), zeps8 = real(z'3ca0000000000000', kind=8), & - deps8 = 1.1102230246251565404236316680908203125e-16_8 - real(10), parameter :: & - eps10 = epsilon(0._10), zeps10 = real(z'3fbf8000000000000000', kind=10), & - deps10 = 5.42101086242752217003726400434970855712890625e-20_10 - real(16), parameter :: & - eps16 = epsilon(0._16), & - zeps16 = real(z'3f8e0000000000000000000000000000', kind=16), & - deps16 = 9.629649721936179265279889712924636592690508241076940976199693977832794189453125e-35_16 - logical, parameter :: test_eps2 = eps2 == zeps2 .and. eps2 == deps2 - logical, parameter :: test_eps3 = eps3 == zeps3 .and. eps3 == deps3 - logical, parameter :: test_eps4 = eps4 == zeps4 .and. eps4 == deps4 - logical, parameter :: test_eps8 = eps8 == zeps8 .and. eps8 == deps8 - logical, parameter :: test_eps10 = eps10 == zeps10 .and. eps10 == deps10 - logical, parameter :: test_eps16 = eps16 == zeps16 .and. eps16 == deps16 - - integer(1), parameter :: & - ihuge1 = huge(0_1), zihuge1 = int(z'7f', kind=1), dihuge1 = 127_1 - integer(2), parameter :: & - ihuge2 = huge(0_2), zihuge2 = int(z'7fff', kind=2), dihuge2 = 32767_2 - integer(4), parameter :: & - ihuge4 = huge(0_4), zihuge4 = int(z'7fffffff', kind=4), & - dihuge4 = 2147483647_4 - integer(8), parameter :: & - ihuge8 = huge(0_8), zihuge8 = int(z'7fffffffffffffff', kind=8), & - dihuge8 = 9223372036854775807_8 - integer(16), parameter :: & - ihuge16 = huge(0_16), & - zihuge16 = int(z'7fffffffffffffffffffffffffffffff', kind=16), & - dihuge16 = 170141183460469231731687303715884105727_16 - logical, parameter :: test_ihuge1 = ihuge1 == zihuge1 .and. ihuge1 == dihuge1 - logical, parameter :: test_ihuge2 = ihuge2 == zihuge2 .and. ihuge2 == dihuge2 - logical, parameter :: test_ihuge4 = ihuge4 == zihuge4 .and. ihuge4 == dihuge4 - logical, parameter :: test_ihuge8 = ihuge8 == zihuge8 .and. ihuge8 == dihuge8 - logical, parameter :: test_ihuge16 = ihuge16 == zihuge16 .and. ihuge16 == dihuge16 - - real(2), parameter :: & - ahuge2 = huge(0._2), zahuge2 = real(z'7bff', kind=2), dahuge2 = 6.5504e4_2 - real(3), parameter :: & - ahuge3 = huge(0._3), zahuge3 = real(z'7f7f', kind=3), & - dahuge3 = 3.3895313892515354759047080037148786688e38_3 - real(4), parameter :: & - ahuge4 = huge(0._4), zahuge4 = real(z'7f7fffff', kind=4), & - dahuge4 = 3.4028234663852885981170418348451692544e38_4 - real(8), parameter :: & - ahuge8 = huge(0._8), zahuge8 = real(z'7fefffffffffffff', kind=8), & - dahuge8 = 1.7976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817& - &1540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868& - &5084551339423045832369032229481658085593321233482747978262041447231687381771809192998812504040261841& - &24858368e308_8 - real(10), parameter :: & - ahuge10 = huge(0._10), zahuge10 = real(z'7ffeffffffffffffffff', kind=10), & - dahuge10 = 1.1897314953572317650212638530309702051690633222946242004403237338917370055229707226164102903365288828& - &5354569780749557731442744315367028843419812557385374367867359320070697326320191591828296152436552951& - &0646791086614311790632169778838896134786560600399148753433211454911160088679845154866512852340149773& - &0376000091254793939662231513836224178385427439178381387178058894875405751682263476592355769748051137& - &2564902088485522249479139937758502601177354918009979622602685950855888360815984690023564513234659447& - &6384939859276456284579661772930407806609229102715046085388087959327781622986827547830768080040150694& - &9423034117289577771003357140105597752421240573470073862516601108283791196230084692772009651535002084& - &7447079244384854591288672300061908512647211195136146752763351956292759795725027800298079590419313960& - &3021470997035276467445530922022679656280991498232083329641241038509239184734786121921697210543484287& - &0483534081130425730022164213489173471742348007148807510020643905172342476560047217680964861079949434& - &1570347632064355862420744350442438056613601760883747816538902780957697597728686007148702828795556714& - &1404632615832623602762896316173978484254486860609948270867968048078702511858930838546584223040908805& - &9962945945862019037660484467909260022254105307759010657606713472001258464069570302571389609837579989& - &2695455305236856075868317922311363951946885088077187210470520395758748001314313144425494391994017575& - &3169339392366881856189129931729104252921236835159922322050998001677102784035360140829296398115122877& - &7681357060457893435354516965395612540488464471697868932116710872290880827783505182288576460622187397& - &0285165508372099234948333443522898475123275372663606621390228126470623407535207172405866507951821730& - &3463782631353393706774901950197841690441824738063162828586857741432581165364040218402724913393320949& - &2194984224427304270198730445366203502623869578046820036014472919971230955300572061418669748528468561& - &8651483271597448120312194675168637934309618961510733006555242148519520176285859509105183947250286387& - &1632494167613804996319791441870254302706758495192008837915169401581740046711477877201459644461175204& - &0594535047647218079757611117208462736392796003396704700376133745095531841500737964126050479232516613& - &5484129188421134082301547330475406707281876350361733290800595189632520707167390454777712968226520622& - &5651439919376804400292380903112437912614776255964694221981375146967079446870358004392507659451618379& - &8118593920495440361149153107822510726914869798092409467721427270124043771874092167566136349389004512& - &3235166814608932240069799317601780533819184998193300841098599393876029260139091141452600372028487213& - &2411955424282101831204216104467404621635336900583664606591156298764745525068145003932941404131495400& - &6776029510059622530228230036314738246810596484424413248645731374375950964161680480241293518762046681& - &3563687753281467553879887177183651289394719533506188500326760735438867336800207438784965701457609034& - &9857571243045102038730494854256702479339322809110526041538528994849203991091946129912491633289917998& - &0943803378795220931314669461497059396641523759492858909604899161219449899863848370224866722491489246& - &7841020618336462741696957630763248023558797524525373703543388296086275342774001633343405508353704850& - &7374544819754722228975281083020898682633020285259923084168054539687911418297629988964576482765287504& - &5628549242651652177507995162596692291149777889623566709566271384820181913483216879958636526376209782& - &8507009933729439678463987902491451422274252700636394232799848397673998715441855420156224415492665301& - &4515504685489258620276085761837129763358761215382565129633538141663949516556000264159186554850057052& - &6114319529199188079545223946496276356301785808966922264062353828985358675959906470083856871238103295& - &9192649484625076899225841930548076362021508902214922052806984201835084058693849381549890944546197789& - &3029113576516775406232278298314033473276603952231603422824717528181818844304880921321933550869873395& - &8612760736708666523755556758031714901084773200964243187800700087973460329062789435537435644488519071& - &9161645514115576193939969076741515640282654366402676009508752394550734155613586793306603174472092444& - &6513532366647649735400851967040771103640538150073486891798364049570606189535005089840913826869535090& - &0667833244725787121966044152849248400418509328119089636341757398971665960007594878006191640948543387& - &5852065711654107226099628815012314437794400874930194474433078438899570184271000480830501217712356062& - &2895076269042856800047718893158089358515593863176652948089031267747029662545110861548958395087796755& - &4641379448959605279752098748138397625785921057562844017593493241621483395653501891968113890918437957& - &3470326940634289008780584694035245347939808067427323629788710086717580253156130235606487870925986528& - &8416350972529537091114317204887747405539054009425375424119317944175137064689643861517718849867010341& - &5325423859110896247108853858086888377772586485641459342621210866475884892600317623459607695088491496& - &6244415660441955208681198977024e4932_10 - real(16), parameter :: & - ahuge16 = huge(0._16), zahuge16 = real(z'7ffeffffffffffffffffffffffffffff', kind=16), & - dahuge16 = 1.1897314953572317650857593266280070161964690526416940455296988842121635797553123923249740128484620735& - &2590203356474912685975526543357380446267269875194526149085346195872502126284586579940540449357468156& - &6096686172574953791792292256220777095858112702436475442537092608935138247345677279593806773692330094& - &6157461197257841728898925219399207576542048645656733564522472781522888677006389355954564966995114417& - &5290960687851325094831139688610052683309212868397475219226638679188087369434307734815556410166997113& - &8512786874753496996549221727686770196551512812712488289469952298031867469924683981576664562667786719& - &0614996396303416570983054252372208766646300878087672561828032202122199248523759030495209113959109189& - &2120527349676858811903011159301878936803923201167140417584510885470696521560577711351625740481881769& - &5075025715299705916714352103671782759119316034498392169720631800164034124698918142227577300459309880& - &4547151796062998955075830758511951858579711731676769660579988993526318854177162953020146688023840758& - &4603622660648014297759540713505037980864913015716402406031178690879637251033587351277479527574859541& - &7572920936651398752709055215663939505589207804914540432978557623565645991208599669097180808881920063& - &7227714312184890119222096790535459636284173260024397328029395243137866685140273814343210366365711716& - &7042358647275956123197079396783927914728272019537706060212263845788320480934171752680963925353944773& - &0280863675704796054050525162959099932535265586464682793821550087166946662209865086040990507131145474& - &2674110428395423227629949387596131127438371928396826762575553883728144908453957471281620658715882191& - &0888724011665136196205080002917629993882608241754751673226993047313326125892184551681523545535431045& - &8114528303607394526100730578774092094736822286015459361126642549541799645333882549670764145955017051& - &3308000612538651401801532119293614565003435147928902055320217600618822326157365533772949809740595905& - &2018796145979938674151302850593441045360348019238334932111517181105100410859283099181138255290906487& - &3029533418691087118107895004426881765865961841419267486232005929789956207494587649901662172318722999& - &4845123258260870315619363836897406865052797752967893316136838227985970406516005241290251498948731531& - &9694209505667084746692764481259650670012944357951247923062137397808873125708979962290218382410541293& - &0483065603459863120371744282301377070153823878609951218937542956964157950988060608985782910656238116& - &1422035741047574518281708048752574462041283485138290827317223641893804935883389476643706232798207558& - &3164620541748839306283820178954721954319445090211369992596537690819279215212221282457887933650687528& - &8617303469517112245451315447164280392523574962804175375927948971096983905242318797695347043690474223& - &8132665056397611644388442665313646268512196339944341540985621273959361844218214442734315345078601616& - &1428702272098406156966033337278824103713153807737748015267058325792053556997331818811268567331899796& - &7497786786001251403873023920127717626858627038170562807276699687356274072773403132694104831615879354& - &3958115858251128378415632227616233344591881315378823557324830300859768903829697344762145934281912127& - &1714133304757786755221851743106484876037319629031012446614508707837714052853304868420427879959665251& - &4009368964527494988719996088230065668196236298805733689960371306226158464997243490564472254071897564& - &1441285398399860960455632647712855850663041779957201017448443871583297673755604162078008788300720724& - &1390865785566723954636935777578134428819598917631335685641784543423281488674422674670706697975557712& - &1788798468777700116472954103621810567107869855646414713502627836321256957407217461738363552424248762& - &4364780853518109957492932381740813319050481446127009055414257022203025376114948242287653245779337785& - &1981877869734028258091278067497905893806255685600107605770598216668682475603756961576049761981948205& - &2758118532729333127733603742149847001463931981340719681330844408263017545241644293372483217234561694& - &2639378557592944486629790954192274518015884259778696940266014279196551684158959230431151917518727133& - &4609575263460825447598815416225495259785319903964588374219923638761039583094807436598839770784963225& - &2080920941206268114832425403540515474312327876180802357701527842702008781378306569508588571830140611& - &0980426830095308627974030153554643774062498539644810004022317716657008936075218040845236685686491032& - &5886266629337247244143556352059546170104239050079561583450594483732665254246744436486149918427509748& - &5253621979537504128523848241127715641240965261646703516395599407360083455079665191393229410544185167& - &9990997876554244625589008743884056491694537267393122602348155432978423086460721901479480729284567258& - &3503954612118213364077776992584180757905173583882311275962271406750966991364528828189455892561297242& - &5252452248453502562347348900936766966136332741088135837550717443838484760651019872222926016920811114& - &6169371432077434885046020127763642567468723152059526010722289706864609324352227544963417635351891055& - &48847634608972381760403137363968e4932_16 - logical, parameter :: test_ahuge2 = ahuge2 == zahuge2 .and. ahuge2 == dahuge2 - logical, parameter :: test_ahuge3 = ahuge3 == zahuge3 .and. ahuge3 == dahuge3 - logical, parameter :: test_ahuge4 = ahuge4 == zahuge4 .and. ahuge4 == dahuge4 - logical, parameter :: test_ahuge8 = ahuge8 == zahuge8 .and. ahuge8 == dahuge8 - logical, parameter :: test_ahuge10 = ahuge10 == zahuge10 .and. ahuge10 == dahuge10 - logical, parameter :: test_ahuge16 = ahuge16 == zahuge16 .and. ahuge16 == dahuge16 - - real(2), parameter :: tiny2 = tiny(0._2), ztiny2 = real(z'0400', kind=2) - real(3), parameter :: tiny3 = tiny(0._3), ztiny3 = real(z'0080', kind=3) - real(4), parameter :: tiny4 = tiny(0._4), ztiny4 = real(z'00800000', kind=4) - real(8), parameter :: tiny8 = tiny(0._8), ztiny8 = real(z'0010000000000000', kind=8) - real(10), parameter :: tiny10 = tiny(0._10), ztiny10 = real(z'00018000000000000000', kind=10) - real(16), parameter :: tiny16 = tiny(0._16), ztiny16 = real(z'00010000000000000000000000000000', kind=16) - logical, parameter :: test_tiny2 = tiny2 == ztiny2 - logical, parameter :: test_tiny3 = tiny3 == ztiny3 - logical, parameter :: test_tiny4 = tiny4 == ztiny4 - logical, parameter :: test_tiny8 = tiny8 == ztiny8 - logical, parameter :: test_tiny10 = tiny10 == ztiny10 - logical, parameter :: test_tiny16 = tiny16 == ztiny16 - - integer, parameter :: & - max2 = maxexponent(0._2), & - max3 = maxexponent(0._3), & - max4 = maxexponent(0._4), & - max8 = maxexponent(0._8), & - max10 = maxexponent(0._10), & - max16 = maxexponent(0._16) - logical, parameter :: test_max2 = max2 == 15 - logical, parameter :: test_max3 = max3 == 127 - logical, parameter :: test_max4 = max4 == 127 - logical, parameter :: test_max8 = max8 == 1023 - logical, parameter :: test_max10 = max10 == 16383 - logical, parameter :: test_max16 = max16 == 16383 - - integer, parameter :: & - min2 = minexponent(0._2), & - min3 = minexponent(0._3), & - min4 = minexponent(0._4), & - min8 = minexponent(0._8), & - min10 = minexponent(0._10), & - min16 = minexponent(0._16) - logical, parameter :: test_min2 = min2 == -14 - logical, parameter :: test_min3 = min3 == -126 - logical, parameter :: test_min4 = min4 == -126 - logical, parameter :: test_min8 = min8 == -1022 - logical, parameter :: test_min10 = min10 == -16382 - logical, parameter :: test_min16 = min16 == -16382 - - integer, parameter :: & - irange1 = range(0_1), & - irange2 = range(0_2), & - irange4 = range(0_4), & - irange8 = range(0_8), & - irange16 = range(0_16) - logical, parameter :: test_irange1 = irange1 == 2 - logical, parameter :: test_irange2 = irange2 == 4 - logical, parameter :: test_irange4 = irange4 == 9 - logical, parameter :: test_irange8 = irange8 == 18 - logical, parameter :: test_irange16 = irange16 == 38 - - integer, parameter :: & - arange2 = range(0._2), zrange2 = range((0._2,0._2)), & - arange3 = range(0._3), zrange3 = range((0._3, 0._3)), & - arange4 = range(0._4), zrange4 = range((0._4, 0._4)), & - arange8 = range(0._8), zrange8 = range((0._8, 0._8)), & - arange10 = range(0._10), zrange10 = range((0._10, 0._10)), & - arange16 = range(0._16), zrange16 = range((0._16, 0._16)) - logical, parameter :: test_arange2 = arange2 == 4 .and. zrange2 == 4 - logical, parameter :: test_arange3 = arange3 == 37 .and. zrange3 == 37 - logical, parameter :: test_zrange4 = arange4 == 37 .and. zrange4 == 37 - logical, parameter :: test_zrange8 = arange8 == 307 .and. zrange8 == 307 - logical, parameter :: test_zrange10 = arange10 == 4931 .and. zrange10 == 4931 - logical, parameter :: test_zrange16 = arange16 == 4931 .and. zrange16 == 4931 - -end module diff --git a/test-lit/Evaluate/folding08.f90 b/test-lit/Evaluate/folding08.f90 deleted file mode 100644 index 67f435a99f31..000000000000 --- a/test-lit/Evaluate/folding08.f90 +++ /dev/null @@ -1,69 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Test folding of LBOUND and UBOUND - -module m - contains - function foo() - real :: foo(2:3,4:6) - end function - subroutine test(n1,a1,a2) - integer, intent(in) :: n1 - real, intent(in) :: a1(0:n1), a2(0:*) - type :: t - real :: a - end type - type(t) :: ta(0:2) - character(len=2) :: ca(-1:1) - integer, parameter :: lba1(*) = lbound(a1) - logical, parameter :: test_lba1 = all(lba1 == [0]) - integer, parameter :: lba2(*) = lbound(a2) - logical, parameter :: test_lba2 = all(lba2 == [0]) - integer, parameter :: lbtadim(*) = lbound(ta,1) - logical, parameter :: test_lbtadim = lbtadim == 0 - integer, parameter :: ubtadim(*) = ubound(ta,1) - logical, parameter :: test_ubtadim = ubtadim == 2 - integer, parameter :: lbta1(*) = lbound(ta) - logical, parameter :: test_lbta1 = all(lbta1 == [0]) - integer, parameter :: ubta1(*) = ubound(ta) - logical, parameter :: test_ubta1 = all(ubta1 == [2]) - integer, parameter :: lbta2(*) = lbound(ta(:)) - logical, parameter :: test_lbta2 = all(lbta2 == [1]) - integer, parameter :: ubta2(*) = ubound(ta(:)) - logical, parameter :: test_ubta2 = all(ubta2 == [3]) - integer, parameter :: lbta3(*) = lbound(ta%a) - logical, parameter :: test_lbta3 = all(lbta3 == [1]) - integer, parameter :: ubta3(*) = ubound(ta%a) - logical, parameter :: test_ubta3 = all(ubta3 == [3]) - integer, parameter :: lbca1(*) = lbound(ca) - logical, parameter :: test_lbca1 = all(lbca1 == [-1]) - integer, parameter :: ubca1(*) = ubound(ca) - logical, parameter :: test_ubca1 = all(ubca1 == [1]) - integer, parameter :: lbca2(*) = lbound(ca(:)(1:1)) - logical, parameter :: test_lbca2 = all(lbca2 == [1]) - integer, parameter :: ubca2(*) = ubound(ca(:)(1:1)) - logical, parameter :: test_ubca2 = all(ubca2 == [3]) - integer, parameter :: lbfoo(*) = lbound(foo()) - logical, parameter :: test_lbfoo = all(lbfoo == [1,1]) - integer, parameter :: ubfoo(*) = ubound(foo()) - logical, parameter :: test_ubfoo = all(ubfoo == [2,3]) - end subroutine - subroutine test2 - real :: a(2:3,4:6) - associate (b => a) - block - integer, parameter :: lbb(*) = lbound(b) - logical, parameter :: test_lbb = all(lbb == [2,4]) - integer, parameter :: ubb(*) = ubound(b) - logical, parameter :: test_ubb = all(ubb == [3,6]) - end block - end associate - associate (b => a + 0) - block - integer, parameter :: lbb(*) = lbound(b) - logical, parameter :: test_lbb = all(lbb == [1,1]) - integer, parameter :: ubb(*) = ubound(b) - logical, parameter :: test_ubb = all(ubb == [2,3]) - end block - end associate - end subroutine -end diff --git a/test-lit/Evaluate/folding09.f90 b/test-lit/Evaluate/folding09.f90 deleted file mode 100644 index a7510604acca..000000000000 --- a/test-lit/Evaluate/folding09.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_folding.sh %s %flang %t -! Test folding of IS_CONTIGUOUS on simply contiguous items (9.5.4) -! When IS_CONTIGUOUS() is constant, it's .TRUE. - -module m - real, target :: hosted(2) - contains - function f() - real, pointer, contiguous :: f(:) - f => hosted - end function - subroutine test(arr1, arr2, arr3, mat) - real, intent(in) :: arr1(:), arr2(10), mat(10, 10) - real, intent(in), contiguous :: arr3(:) - real :: scalar - logical, parameter :: isc01 = is_contiguous(0) - logical, parameter :: isc02 = is_contiguous(scalar) - logical, parameter :: isc03 = is_contiguous(scalar + scalar) - logical, parameter :: isc04 = is_contiguous([0, 1, 2]) - logical, parameter :: isc05 = is_contiguous(arr1 + 1.0) - logical, parameter :: isc06 = is_contiguous(arr2) - logical, parameter :: isc07 = is_contiguous(mat) - logical, parameter :: isc08 = is_contiguous(mat(1:10,1)) - logical, parameter :: isc09 = is_contiguous(arr2(1:10:1)) - logical, parameter :: isc10 = is_contiguous(arr3) - logical, parameter :: isc11 = is_contiguous(f()) - end subroutine -end module diff --git a/test-lit/Preprocessing/pp001.F b/test-lit/Preprocessing/pp001.F deleted file mode 100644 index 3cbdcb5a6e3e..000000000000 --- a/test-lit/Preprocessing/pp001.F +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -* keyword macros - integer, parameter :: KWM = 666 -#define KWM 777 - if (KWM .eq. 777) then - print *, 'pp001.F pass' - else - print *, 'pp001.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp002.F b/test-lit/Preprocessing/pp002.F deleted file mode 100644 index 1c3fea8341d2..000000000000 --- a/test-lit/Preprocessing/pp002.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* #undef - integer, parameter :: KWM = 777 -#define KWM 666 -#undef KWM - if (KWM .eq. 777) then - print *, 'pp002.F pass' - else - print *, 'pp002.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp003.F b/test-lit/Preprocessing/pp003.F deleted file mode 100644 index aa996a230cea..000000000000 --- a/test-lit/Preprocessing/pp003.F +++ /dev/null @@ -1,16 +0,0 @@ -! RUN: %flang -E %s -* function-like macros - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM(666) - if (res .eq. 777) then - print *, 'pp003.F pass' - else - print *, 'pp003.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp004.F b/test-lit/Preprocessing/pp004.F deleted file mode 100644 index 9ac946701872..000000000000 --- a/test-lit/Preprocessing/pp004.F +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -* KWMs case-sensitive - integer, parameter :: KWM = 777 -#define KWM 666 - if (kwm .eq. 777) then - print *, 'pp004.F pass' - else - print *, 'pp004.F FAIL: ', kwm - end if - end diff --git a/test-lit/Preprocessing/pp005.F b/test-lit/Preprocessing/pp005.F deleted file mode 100644 index 91a6e6bd8ced..000000000000 --- a/test-lit/Preprocessing/pp005.F +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -* KWM split across continuation, implicit padding - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res - res = KW - +M - if (res .eq. 777) then - print *, 'pp005.F pass' - else - print *, 'pp005.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp006.F b/test-lit/Preprocessing/pp006.F deleted file mode 100644 index 79057fe5110e..000000000000 --- a/test-lit/Preprocessing/pp006.F +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %flang -E %s -* ditto, but with intervening *comment line - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res - res = KW -*comment - +M - if (res .eq. 777) then - print *, 'pp006.F pass' - else - print *, 'pp006.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp007.F b/test-lit/Preprocessing/pp007.F deleted file mode 100644 index 56b27b3c6c9f..000000000000 --- a/test-lit/Preprocessing/pp007.F +++ /dev/null @@ -1,16 +0,0 @@ -! RUN: %flang -E %s -* KWM split across continuation, clipped after column 72 - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res -* 'comment' is in column 73 -* 1 2 3 4 5 6 7 -*234567890123456789012345678901234567890123456789012345678901234567890123 - res = KW comment - +M - if (res .eq. 777) then - print *, 'pp007.F pass' - else - print *, 'pp007.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp008.F b/test-lit/Preprocessing/pp008.F deleted file mode 100644 index 0edfc38419b0..000000000000 --- a/test-lit/Preprocessing/pp008.F +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -* KWM with spaces in name at invocation NOT replaced - integer, parameter :: KWM = 777 -#define KWM 666 - integer :: res - res = K W M - if (res .eq. 777) then - print *, 'pp008.F pass' - else - print *, 'pp008.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp009.F b/test-lit/Preprocessing/pp009.F deleted file mode 100644 index ec563ea2828e..000000000000 --- a/test-lit/Preprocessing/pp009.F +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -* FLM call split across continuation, implicit padding - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL - +M(666) - if (res .eq. 777) then - print *, 'pp009.F pass' - else - print *, 'pp009.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp010.F b/test-lit/Preprocessing/pp010.F deleted file mode 100644 index 84f6017eb821..000000000000 --- a/test-lit/Preprocessing/pp010.F +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -* ditto, but with intervening *comment line - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL -*comment - +M(666) - if (res .eq. 777) then - print *, 'pp010.F pass' - else - print *, 'pp010.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp011.F b/test-lit/Preprocessing/pp011.F deleted file mode 100644 index c3e344ccc12b..000000000000 --- a/test-lit/Preprocessing/pp011.F +++ /dev/null @@ -1,20 +0,0 @@ -! RUN: %flang -E %s -* FLM call name split across continuation, clipped - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res -* 'comment' is in column 73 -* 1 2 3 4 5 6 7 -*234567890123456789012345678901234567890123456789012345678901234567890123 - res = IFL comment - +M(666) - if (res .eq. 777) then - print *, 'pp011.F pass' - else - print *, 'pp011.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp012.F b/test-lit/Preprocessing/pp012.F deleted file mode 100644 index d4e1f71aab6f..000000000000 --- a/test-lit/Preprocessing/pp012.F +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -* FLM call name split across continuation - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL - +M(666) - if (res .eq. 777) then - print *, 'pp012.F pass' - else - print *, 'pp012.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp013.F b/test-lit/Preprocessing/pp013.F deleted file mode 100644 index af4dec10b2f2..000000000000 --- a/test-lit/Preprocessing/pp013.F +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -* FLM call split between name and ( - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM - +(666) - if (res .eq. 777) then - print *, 'pp013.F pass' - else - print *, 'pp013.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp014.F b/test-lit/Preprocessing/pp014.F deleted file mode 100644 index 0ba1e62da0ad..000000000000 --- a/test-lit/Preprocessing/pp014.F +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -* FLM call split between name and (, with intervening *comment - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM -*comment - +(666) - if (res .eq. 777) then - print *, 'pp014.F pass' - else - print *, 'pp014.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp015.F b/test-lit/Preprocessing/pp015.F deleted file mode 100644 index aecad2657be8..000000000000 --- a/test-lit/Preprocessing/pp015.F +++ /dev/null @@ -1,20 +0,0 @@ -! RUN: %flang -E %s -* FLM call split between name and (, clipped - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res -* 'comment' is in column 73 -* 1 2 3 4 5 6 7 -*234567890123456789012345678901234567890123456789012345678901234567890123 - res = IFLM comment - +(666) - if (res .eq. 777) then - print *, 'pp015.F pass' - else - print *, 'pp015.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp016.F b/test-lit/Preprocessing/pp016.F deleted file mode 100644 index e7960ac57002..000000000000 --- a/test-lit/Preprocessing/pp016.F +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -* FLM call split between name and ( and in argument - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM - +(66 - +6) - if (res .eq. 777) then - print *, 'pp016.F pass' - else - print *, 'pp016.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp017.F b/test-lit/Preprocessing/pp017.F deleted file mode 100644 index 9708a7b5ead4..000000000000 --- a/test-lit/Preprocessing/pp017.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* KLM rescan - integer, parameter :: KWM = 666, KWM2 = 667 -#define KWM2 777 -#define KWM KWM2 - if (KWM .eq. 777) then - print *, 'pp017.F pass' - else - print *, 'pp017.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp018.F b/test-lit/Preprocessing/pp018.F deleted file mode 100644 index 9a6fbb925cc2..000000000000 --- a/test-lit/Preprocessing/pp018.F +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -* KLM rescan with #undef (so rescan is after expansion) - integer, parameter :: KWM2 = 777, KWM = 667 -#define KWM2 666 -#define KWM KWM2 -#undef KWM2 - if (KWM .eq. 777) then - print *, 'pp018.F pass' - else - print *, 'pp018.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp019.F b/test-lit/Preprocessing/pp019.F deleted file mode 100644 index 278d9fa30320..000000000000 --- a/test-lit/Preprocessing/pp019.F +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -* FLM rescan - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main - integer, parameter :: KWM = 999 -#define KWM 111 -#define IFLM(x) ((x)+KWM) - integer :: res - res = IFLM(666) - if (res .eq. 777) then - print *, 'pp019.F pass' - else - print *, 'pp019.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp020.F b/test-lit/Preprocessing/pp020.F deleted file mode 100644 index f1c3f4dbd0cc..000000000000 --- a/test-lit/Preprocessing/pp020.F +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -* FLM expansion of argument - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main - integer, parameter :: KWM = 999 -#define KWM 111 -#define IFLM(x) ((x)+666) - integer :: res - res = IFLM(KWM) - if (res .eq. 777) then - print *, 'pp020.F pass' - else - print *, 'pp020.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp021.F b/test-lit/Preprocessing/pp021.F deleted file mode 100644 index a4693a92a1d4..000000000000 --- a/test-lit/Preprocessing/pp021.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* KWM NOT expanded in 'literal' -#define KWM 666 - character(len=3) :: ch - ch = 'KWM' - if (ch .eq. 'KWM') then - print *, 'pp021.F pass' - else - print *, 'pp021.F FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp022.F b/test-lit/Preprocessing/pp022.F deleted file mode 100644 index 07f2b1c43220..000000000000 --- a/test-lit/Preprocessing/pp022.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* KWM NOT expanded in "literal" -#define KWM 666 - character(len=3) :: ch - ch = "KWM" - if (ch .eq. 'KWM') then - print *, 'pp022.F pass' - else - print *, 'pp022.F FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp023.F b/test-lit/Preprocessing/pp023.F deleted file mode 100644 index 51794e397c93..000000000000 --- a/test-lit/Preprocessing/pp023.F +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -* KWM NOT expanded in 9HHOLLERITH literal -#define KWM 666 -#define HKWM 667 - character(len=3) :: ch - ch = 3HKWM - if (ch .eq. 'KWM') then - print *, 'pp023.F pass' - else - print *, 'pp023.F FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp024.F b/test-lit/Preprocessing/pp024.F deleted file mode 100644 index aa810c3a1c91..000000000000 --- a/test-lit/Preprocessing/pp024.F +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -* KWM NOT expanded in Hollerith in FORMAT -#define KWM 666 -#define HKWM 667 - character(len=3) :: ch - 100 format(3HKWM) - write(ch, 100) - if (ch .eq. 'KWM') then - print *, 'pp024.F pass' - else - print *, 'pp024.F FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp025.F b/test-lit/Preprocessing/pp025.F deleted file mode 100644 index bd6976d350e8..000000000000 --- a/test-lit/Preprocessing/pp025.F +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -* KWM expansion is before token pasting due to fixed-form space removal - integer, parameter :: IKWM2Z = 777 -#define KWM KWM2 - integer :: res - res = I KWM Z - if (res .eq. 777) then - print *, 'pp025.F pass' - else - print *, 'pp025.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp026.F b/test-lit/Preprocessing/pp026.F deleted file mode 100644 index edbb30fab2ea..000000000000 --- a/test-lit/Preprocessing/pp026.F +++ /dev/null @@ -1,20 +0,0 @@ -! RUN: %flang -E %s -* ## token pasting works in FLM - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main - integer, parameter :: KWM = 668, KWM21 = 111, KWM1 = 669 -#define KWM1 111 -#define KWM2 33 -#define KWM KWM2 -#define IFLM(x) ((x##1)+6##6##6) - integer :: res - res = IFLM(KWM) - if (res .eq. 777) then - print *, 'pp026.F pass' - else - print *, 'pp026.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp027.F b/test-lit/Preprocessing/pp027.F deleted file mode 100644 index f21236b8c762..000000000000 --- a/test-lit/Preprocessing/pp027.F +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -* #DEFINE works in fixed form - integer, parameter :: KWM = 666 -#DEFINE KWM 777 - if (KWM .eq. 777) then - print *, 'pp027.F pass' - else - print *, 'pp027.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp028.F b/test-lit/Preprocessing/pp028.F deleted file mode 100644 index 3e23d9b92041..000000000000 --- a/test-lit/Preprocessing/pp028.F +++ /dev/null @@ -1,15 +0,0 @@ -! RUN: %flang -E %s -* fixed-form clipping done before KWM expansion on source line - integer, parameter :: KW = 777 -#define KWM 666 - integer :: res -* 'M' is in column 73 -* 1 2 3 4 5 6 7 -*234567890123456789012345678901234567890123456789012345678901234567890123 - res = KWM - if (res .eq. 777) then - print *, 'pp028.F pass' - else - print *, 'pp028.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp029.F b/test-lit/Preprocessing/pp029.F deleted file mode 100644 index a3ead5d9e507..000000000000 --- a/test-lit/Preprocessing/pp029.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* \ newline allowed in #define - integer, parameter :: KWM = 666 -#define KWM 77\ - 7 - if (KWM .eq. 777) then - print *, 'pp029.F pass' - else - print *, 'pp029.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp030.F b/test-lit/Preprocessing/pp030.F deleted file mode 100644 index da356e83f56f..000000000000 --- a/test-lit/Preprocessing/pp030.F +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -* /* C comment */ erased from #define - integer, parameter :: KWM = 666 -#define KWM 777 /* C comment */ - if (KWM .eq. 777) then - print *, 'pp030.F pass' - else - print *, 'pp030.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp031.F b/test-lit/Preprocessing/pp031.F deleted file mode 100644 index 6e287662df91..000000000000 --- a/test-lit/Preprocessing/pp031.F +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -* // C++ comment NOT erased from #define - integer, parameter :: KWM = 666 -#define KWM 777 // C comment - if (KWM .eq. 777) then - print *, 'pp031.F FAIL (should not have compiled)' - else - print *, 'pp031.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp032.F b/test-lit/Preprocessing/pp032.F deleted file mode 100644 index b8772d9798ba..000000000000 --- a/test-lit/Preprocessing/pp032.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* /* C comment */ \ newline erased from #define - integer, parameter :: KWM = 666 -#define KWM 77/* C comment */\ -7 - if (KWM .eq. 777) then - print *, 'pp032.F pass' - else - print *, 'pp032.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp033.F b/test-lit/Preprocessing/pp033.F deleted file mode 100644 index 27228aa270f0..000000000000 --- a/test-lit/Preprocessing/pp033.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* /* C comment \ newline */ erased from #define - integer, parameter :: KWM = 666 -#define KWM 77/* C comment \ -*/7 - if (KWM .eq. 777) then - print *, 'pp033.F pass' - else - print *, 'pp033.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp034.F b/test-lit/Preprocessing/pp034.F deleted file mode 100644 index 7f77e1857d6f..000000000000 --- a/test-lit/Preprocessing/pp034.F +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -* \ newline allowed in name on KWM definition - integer, parameter :: KWMC = 666 -#define KWM\ -C 777 - if (KWMC .eq. 777) then - print *, 'pp034.F pass' - else - print *, 'pp034.F FAIL: ', KWMC - end if - end diff --git a/test-lit/Preprocessing/pp035.F b/test-lit/Preprocessing/pp035.F deleted file mode 100644 index c1acd3288533..000000000000 --- a/test-lit/Preprocessing/pp035.F +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %flang -E %s -* #if 2 .LT. 3 works - integer, parameter :: KWM = 666 -#if 2 .LT. 3 -#define KWM 777 -#else -#define KWM 667 -#endif - if (KWM .eq. 777) then - print *, 'pp035.F pass' - else - print *, 'pp035.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp036.F b/test-lit/Preprocessing/pp036.F deleted file mode 100644 index 9327c9af5e10..000000000000 --- a/test-lit/Preprocessing/pp036.F +++ /dev/null @@ -1,9 +0,0 @@ -! RUN: %flang -E %s -* #define FALSE TRUE ... .FALSE. -> .TRUE. -#define FALSE TRUE - if (.FALSE.) then - print *, 'pp036.F pass' - else - print *, 'pp036.F FAIL: ', .FALSE. - end if - end diff --git a/test-lit/Preprocessing/pp037.F b/test-lit/Preprocessing/pp037.F deleted file mode 100644 index 10272a0d6c58..000000000000 --- a/test-lit/Preprocessing/pp037.F +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -* fixed-form clipping NOT applied to #define - integer, parameter :: KWM = 666 -* 1 2 3 4 5 6 7 -*234567890123456789012345678901234567890123456789012345678901234567890123 -#define KWM 7777 - if (KWM .eq. 777) then - print *, 'pp037.F pass' - else - print *, 'pp037.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp038.F b/test-lit/Preprocessing/pp038.F deleted file mode 100644 index 6ec8157bacb2..000000000000 --- a/test-lit/Preprocessing/pp038.F +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -* FLM call with closing ')' on next line (not a continuation) - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM(666 -) - if (res .eq. 777) then - print *, 'pp038.F pass' - else - print *, 'pp038.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp039.F b/test-lit/Preprocessing/pp039.F deleted file mode 100644 index b26cd7df47b8..000000000000 --- a/test-lit/Preprocessing/pp039.F +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -* FLM call with '(' on next line (not a continuation) - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM -(666) - if (res .eq. 777) then - print *, 'pp039.F pass' - else - print *, 'pp039.F FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp040.F b/test-lit/Preprocessing/pp040.F deleted file mode 100644 index f68f7d7895de..000000000000 --- a/test-lit/Preprocessing/pp040.F +++ /dev/null @@ -1,6 +0,0 @@ -! RUN: %flang -E %s -* #define KWM c, then KWM works as comment line initiator -#define KWM c -KWM print *, 'pp040.F FAIL HARD!'; stop - print *, 'pp040.F pass' - end diff --git a/test-lit/Preprocessing/pp041.F b/test-lit/Preprocessing/pp041.F deleted file mode 100644 index 73a2462f6fff..000000000000 --- a/test-lit/Preprocessing/pp041.F +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %flang -E %s -* use KWM expansion as continuation indicators -#define KWM 0 -#define KWM2 1 - integer :: j - j = 666 - KWM j = j + 1 - KWM2 11 - if (j .eq. 777) then - print *, 'pp041.F pass' - else - print *, 'pp041.F FAIL', j - end if - end diff --git a/test-lit/Preprocessing/pp042.F b/test-lit/Preprocessing/pp042.F deleted file mode 100644 index 9e3f97ac4990..000000000000 --- a/test-lit/Preprocessing/pp042.F +++ /dev/null @@ -1,7 +0,0 @@ -! RUN: %flang -E %s -* #define c 1, then use c as label in fixed-form -#define c 1 -c print *, 'pp042.F pass'; goto 2 - print *, 'pp042.F FAIL' -2 continue - end diff --git a/test-lit/Preprocessing/pp043.F b/test-lit/Preprocessing/pp043.F deleted file mode 100644 index 9b5912815a14..000000000000 --- a/test-lit/Preprocessing/pp043.F +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -* #define with # in column 6 is a continuation line in fixed-form - integer, parameter :: defineKWM666 = 555 - integer, parameter :: KWM = - #define KWM 666 - ++222 - if (KWM .eq. 777) then - print *, 'pp043.F pass' - else - print *, 'pp043.F FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp044.F b/test-lit/Preprocessing/pp044.F deleted file mode 100644 index dc409587e0f3..000000000000 --- a/test-lit/Preprocessing/pp044.F +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -* #define directive amid continuations - integer, parameter :: KWM = 222, KWM111 = 333, KWM222 = 555 - integer, parameter :: KWMKWM = 333 - integer, parameter :: z = KWM -#define KWM 111 - +KWM+444 - if (z .EQ. 777) then - print *, 'pass' - else - print *, 'FAIL', z - end if - end diff --git a/test-lit/Preprocessing/pp101.F90 b/test-lit/Preprocessing/pp101.F90 deleted file mode 100644 index 0c7def81978d..000000000000 --- a/test-lit/Preprocessing/pp101.F90 +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -! keyword macros - integer, parameter :: KWM = 666 -#define KWM 777 - if (KWM .eq. 777) then - print *, 'pp101.F90 pass' - else - print *, 'pp101.F90 FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp102.F90 b/test-lit/Preprocessing/pp102.F90 deleted file mode 100644 index cbf6865e06a2..000000000000 --- a/test-lit/Preprocessing/pp102.F90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -! #undef - integer, parameter :: KWM = 777 -#define KWM 666 -#undef KWM - if (KWM .eq. 777) then - print *, 'pp102.F90 pass' - else - print *, 'pp102.F90 FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp103.F90 b/test-lit/Preprocessing/pp103.F90 deleted file mode 100644 index 4bb4a7942f84..000000000000 --- a/test-lit/Preprocessing/pp103.F90 +++ /dev/null @@ -1,16 +0,0 @@ -! RUN: %flang -E %s -! function-like macros - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM(666) - if (res .eq. 777) then - print *, 'pp103.F90 pass' - else - print *, 'pp103.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp104.F90 b/test-lit/Preprocessing/pp104.F90 deleted file mode 100644 index edc9b41a5776..000000000000 --- a/test-lit/Preprocessing/pp104.F90 +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -! KWMs case-sensitive - integer, parameter :: KWM = 777 -#define KWM 666 - if (kwm .eq. 777) then - print *, 'pp104.F90 pass' - else - print *, 'pp104.F90 FAIL: ', kwm - end if - end diff --git a/test-lit/Preprocessing/pp105.F90 b/test-lit/Preprocessing/pp105.F90 deleted file mode 100644 index 2a178652673a..000000000000 --- a/test-lit/Preprocessing/pp105.F90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -! KWM call name split across continuation, with leading & - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res - res = KW& -&M - if (res .eq. 777) then - print *, 'pp105.F90 pass' - else - print *, 'pp105.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp106.F90 b/test-lit/Preprocessing/pp106.F90 deleted file mode 100644 index 74f6e2fc94b2..000000000000 --- a/test-lit/Preprocessing/pp106.F90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -! ditto, with & ! comment - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res - res = KW& ! comment -&M - if (res .eq. 777) then - print *, 'pp106.F90 pass' - else - print *, 'pp106.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp107.F90 b/test-lit/Preprocessing/pp107.F90 deleted file mode 100644 index ac7c15480ce9..000000000000 --- a/test-lit/Preprocessing/pp107.F90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -! KWM call name split across continuation, no leading &, with & ! comment - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res - res = KW& ! comment -M - if (res .eq. 777) then - print *, 'pp107.F90 pass' - else - print *, 'pp107.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp108.F90 b/test-lit/Preprocessing/pp108.F90 deleted file mode 100644 index 78d65b2aa2ef..000000000000 --- a/test-lit/Preprocessing/pp108.F90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -! ditto, but without & ! comment - integer, parameter :: KWM = 666 -#define KWM 777 - integer :: res - res = KW& -M - if (res .eq. 777) then - print *, 'pp108.F90 pass' - else - print *, 'pp108.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp109.F90 b/test-lit/Preprocessing/pp109.F90 deleted file mode 100644 index 8f78fccce539..000000000000 --- a/test-lit/Preprocessing/pp109.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! FLM call name split with leading & - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL& -&M(666) - if (res .eq. 777) then - print *, 'pp109.F90 pass' - else - print *, 'pp109.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp110.F90 b/test-lit/Preprocessing/pp110.F90 deleted file mode 100644 index c822c399c92d..000000000000 --- a/test-lit/Preprocessing/pp110.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! ditto, with & ! comment - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL& ! comment -&M(666) - if (res .eq. 777) then - print *, 'pp110.F90 pass' - else - print *, 'pp110.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp111.F90 b/test-lit/Preprocessing/pp111.F90 deleted file mode 100644 index 3e6f7ab72117..000000000000 --- a/test-lit/Preprocessing/pp111.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! FLM call name split across continuation, no leading &, with & ! comment - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL& ! comment -M(666) - if (res .eq. 777) then - print *, 'pp111.F90 pass' - else - print *, 'pp111.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp112.F90 b/test-lit/Preprocessing/pp112.F90 deleted file mode 100644 index 99a88655f584..000000000000 --- a/test-lit/Preprocessing/pp112.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! ditto, but without & ! comment - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFL& -M(666) - if (res .eq. 777) then - print *, 'pp112.F90 pass' - else - print *, 'pp112.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp113.F90 b/test-lit/Preprocessing/pp113.F90 deleted file mode 100644 index 2f0ec74c2195..000000000000 --- a/test-lit/Preprocessing/pp113.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! FLM call split across continuation between name and (, leading & - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM& -&(666) - if (res .eq. 777) then - print *, 'pp113.F90 pass' - else - print *, 'pp113.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp114.F90 b/test-lit/Preprocessing/pp114.F90 deleted file mode 100644 index 9f314b2b8418..000000000000 --- a/test-lit/Preprocessing/pp114.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! ditto, with & ! comment, leading & - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM& ! comment -&(666) - if (res .eq. 777) then - print *, 'pp114.F90 pass' - else - print *, 'pp114.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp115.F90 b/test-lit/Preprocessing/pp115.F90 deleted file mode 100644 index 0a2be4a950b1..000000000000 --- a/test-lit/Preprocessing/pp115.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! ditto, with & ! comment, no leading & - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM& ! comment -(666) - if (res .eq. 777) then - print *, 'pp115.F90 pass' - else - print *, 'pp115.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp116.F90 b/test-lit/Preprocessing/pp116.F90 deleted file mode 100644 index eb46b804415d..000000000000 --- a/test-lit/Preprocessing/pp116.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! FLM call split between name and (, no leading & - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM& -(666) - if (res .eq. 777) then - print *, 'pp116.F90 pass' - else - print *, 'pp116.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp117.F90 b/test-lit/Preprocessing/pp117.F90 deleted file mode 100644 index 10b0353353de..000000000000 --- a/test-lit/Preprocessing/pp117.F90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -! KWM rescan - integer, parameter :: KWM = 666, KWM2 = 667 -#define KWM2 777 -#define KWM KWM2 - if (KWM .eq. 777) then - print *, 'pp117.F90 pass' - else - print *, 'pp117.F90 FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp118.F90 b/test-lit/Preprocessing/pp118.F90 deleted file mode 100644 index 8c86c16efe13..000000000000 --- a/test-lit/Preprocessing/pp118.F90 +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -! KWM rescan with #undef, proving rescan after expansion - integer, parameter :: KWM2 = 777, KWM = 667 -#define KWM2 666 -#define KWM KWM2 -#undef KWM2 - if (KWM .eq. 777) then - print *, 'pp118.F90 pass' - else - print *, 'pp118.F90 FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp119.F90 b/test-lit/Preprocessing/pp119.F90 deleted file mode 100644 index 1a2775966d19..000000000000 --- a/test-lit/Preprocessing/pp119.F90 +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -! FLM rescan - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main - integer, parameter :: KWM = 999 -#define KWM 111 -#define IFLM(x) ((x)+KWM) - integer :: res - res = IFLM(666) - if (res .eq. 777) then - print *, 'pp119.F90 pass' - else - print *, 'pp119.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp120.F90 b/test-lit/Preprocessing/pp120.F90 deleted file mode 100644 index dccc5c624cc2..000000000000 --- a/test-lit/Preprocessing/pp120.F90 +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %flang -E %s -! FLM expansion of argument - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main - integer, parameter :: KWM = 999 -#define KWM 111 -#define IFLM(x) ((x)+666) - integer :: res - res = IFLM(KWM) - if (res .eq. 777) then - print *, 'pp120.F90 pass' - else - print *, 'pp120.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp121.F90 b/test-lit/Preprocessing/pp121.F90 deleted file mode 100644 index ca6df63feb54..000000000000 --- a/test-lit/Preprocessing/pp121.F90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -! KWM NOT expanded in 'literal' -#define KWM 666 - character(len=3) :: ch - ch = 'KWM' - if (ch .eq. 'KWM') then - print *, 'pp121.F90 pass' - else - print *, 'pp121.F90 FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp122.F90 b/test-lit/Preprocessing/pp122.F90 deleted file mode 100644 index 004340072fa2..000000000000 --- a/test-lit/Preprocessing/pp122.F90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -! KWM NOT expanded in "literal" -#define KWM 666 - character(len=3) :: ch - ch = "KWM" - if (ch .eq. 'KWM') then - print *, 'pp122.F90 pass' - else - print *, 'pp122.F90 FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp123.F90 b/test-lit/Preprocessing/pp123.F90 deleted file mode 100644 index b40fa356a4fb..000000000000 --- a/test-lit/Preprocessing/pp123.F90 +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %flang -E %s -! KWM NOT expanded in Hollerith literal -#define KWM 666 -#define HKWM 667 - character(len=3) :: ch - ch = 3HKWM - if (ch .eq. 'KWM') then - print *, 'pp123.F90 pass' - else - print *, 'pp123.F90 FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp124.F90 b/test-lit/Preprocessing/pp124.F90 deleted file mode 100644 index 8b74ef37c130..000000000000 --- a/test-lit/Preprocessing/pp124.F90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %flang -E %s -! KWM NOT expanded in Hollerith in FORMAT -#define KWM 666 -#define HKWM 667 - character(len=3) :: ch - 100 format(3HKWM) - write(ch, 100) - if (ch .eq. 'KWM') then - print *, 'pp124.F90 pass' - else - print *, 'pp124.F90 FAIL: ', ch - end if - end diff --git a/test-lit/Preprocessing/pp125.F90 b/test-lit/Preprocessing/pp125.F90 deleted file mode 100644 index 0671697f1fe1..000000000000 --- a/test-lit/Preprocessing/pp125.F90 +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %flang -E %s -! #DEFINE works in free form - integer, parameter :: KWM = 666 -#DEFINE KWM 777 - if (KWM .eq. 777) then - print *, 'pp125.F90 pass' - else - print *, 'pp125.F90 FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp126.F90 b/test-lit/Preprocessing/pp126.F90 deleted file mode 100644 index a2180bcc5e4b..000000000000 --- a/test-lit/Preprocessing/pp126.F90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %flang -E %s -! \ newline works in #define - integer, parameter :: KWM = 666 -#define KWM 77\ -7 - if (KWM .eq. 777) then - print *, 'pp126.F90 pass' - else - print *, 'pp126.F90 FAIL: ', KWM - end if - end diff --git a/test-lit/Preprocessing/pp127.F90 b/test-lit/Preprocessing/pp127.F90 deleted file mode 100644 index 842d2bf6954b..000000000000 --- a/test-lit/Preprocessing/pp127.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! FLM call with closing ')' on next line (not a continuation) - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM(666 -) - if (res .eq. 777) then - print *, 'pp127.F90 pass' - else - print *, 'pp127.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp128.F90 b/test-lit/Preprocessing/pp128.F90 deleted file mode 100644 index dc2516e14078..000000000000 --- a/test-lit/Preprocessing/pp128.F90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %flang -E %s -! FLM call with '(' on next line (not a continuation) - integer function IFLM(x) - integer :: x - IFLM = x - end function IFLM - program main -#define IFLM(x) ((x)+111) - integer :: res - res = IFLM -(666) - if (res .eq. 777) then - print *, 'pp128.F90 pass' - else - print *, 'pp128.F90 FAIL: ', res - end if - end diff --git a/test-lit/Preprocessing/pp129.F90 b/test-lit/Preprocessing/pp129.F90 deleted file mode 100644 index b0fe285e4011..000000000000 --- a/test-lit/Preprocessing/pp129.F90 +++ /dev/null @@ -1,6 +0,0 @@ -! RUN: %flang -E %s -! #define KWM !, then KWM works as comment line initiator -#define KWM ! -KWM print *, 'pp129.F90 FAIL HARD!'; stop - print *, 'pp129.F90 pass' - end diff --git a/test-lit/Preprocessing/pp130.F90 b/test-lit/Preprocessing/pp130.F90 deleted file mode 100644 index 3c1baab63b7f..000000000000 --- a/test-lit/Preprocessing/pp130.F90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %flang -E %s -! #define KWM &, use for continuation w/o pasting (ifort and nag seem to continue #define) -#define KWM & - - integer :: j - j = 666 - j = j + KWM -111 - if (j .eq. 777) then - print *, 'pp130.F90 pass' - else - print *, 'pp130.F90 FAIL', j - end if - end diff --git a/test-lit/Semantics/allocate01.f90 b/test-lit/Semantics/allocate01.f90 deleted file mode 100644 index 0948230a3ea2..000000000000 --- a/test-lit/Semantics/allocate01.f90 +++ /dev/null @@ -1,120 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -! Creating a symbol that allocate should accept -module share - real, pointer :: rp -end module share - -module m -! Creating symbols that allocate should not accept - type :: a_type - real, allocatable :: x - contains - procedure, pass :: foo => mfoo - procedure, pass :: bar => mbar - end type - -contains - function mfoo(x) - class(a_type) :: x - class(a_type), allocatable :: foo - foo = x - end function - subroutine mbar(x) - class(a_type) :: x - end subroutine -end module - -subroutine C932(ed1, ed5, ed7, edc9, edc10, okad1, okpd1, okacd5) -! Each allocate-object shall be a data pointer or an allocatable variable. - use :: share - use :: m, only: a_type - type TestType1 - integer, allocatable :: ok(:) - integer :: nok(10) - end type - type TestType2 - integer, pointer :: ok - integer :: nok - end type - interface - function foo(x) - real(4) :: foo, x - end function - subroutine bar() - end subroutine - end interface - real ed1(:), e2 - real, save :: e3[*] - real , target :: e4, ed5(:) - real , parameter :: e6 = 5. - procedure(foo), pointer :: proc_ptr1 => NULL() - procedure(bar), pointer :: proc_ptr2 - type(TestType1) ed7 - type(TestType2) e8 - type(TestType1) edc9[*] - type(TestType2) edc10[*] - class(a_type), allocatable :: a_var - - real, allocatable :: oka1(:, :), okad1(:, :), oka2 - real, pointer :: okp1(:, :), okpd1(:, :), okp2 - real, pointer, save :: okp3 - real, allocatable, save :: oka3, okac4[:,:] - real, allocatable :: okacd5(:, :)[:] - - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(foo) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(bar) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(C932) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(proc_ptr1) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(proc_ptr2) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(a_var%foo) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(a_var%bar) - - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(ed1) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(e2) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(e3) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(e4) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(ed5) - !ERROR: Name in ALLOCATE statement must be a variable name - allocate(e6) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(ed7) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(ed7%nok(2)) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(ed8) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(ed8) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(edc9%nok) - !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute - allocate(edc10) - - ! No errors expected below: - allocate(a_var) - allocate(a_var%x) - allocate(oka1(5, 7), okad1(4, 8), oka2) - allocate(okp1(5, 7), okpd1(4, 8), okp2) - allocate(okp1(5, 7), okpd1(4, 8), okp2) - allocate(okp3, oka3) - allocate(okac4[2:4,4:*]) - allocate(okacd5(1:2,3:4)[5:*]) - allocate(ed7%ok(7)) - allocate(e8%ok) - allocate(edc9%ok(4)) - allocate(edc10%ok) - allocate(rp) -end subroutine diff --git a/test-lit/Semantics/allocate02.f90 b/test-lit/Semantics/allocate02.f90 deleted file mode 100644 index 13a68e811a55..000000000000 --- a/test-lit/Semantics/allocate02.f90 +++ /dev/null @@ -1,49 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - -! Check for semantic errors in ALLOCATE statements - -subroutine C943_C944(src, src2) -! C943 -! No alloc-opt shall appear more than once in a given alloc-opt-list. - character(50) msg - integer stat, stat2 - real src(2:4), src2(2:4) - real mld(2:4), mld2(2:4) - real, allocatable :: x1(:), x2(:), x3(:), x4(:), x5(:), x6(:), x7(:), x8(:), x9(:) - real, allocatable :: y1(:), y2(:), y3(:), y4(:) - real, pointer :: p1, p2 - - !Nominal cases, no error expected - allocate(x1, source=src) - allocate(x2, mold=mld) - allocate(x3(2:4), stat=stat) - allocate(x4(2:4), stat=stat, errmsg=msg) - allocate(x5(2:4), source=src, stat=stat, errmsg=msg) - - !ERROR: STAT may not be duplicated in a ALLOCATE statement - allocate(x6, stat=stat, source=src, stat=stat2) - - !ERROR: SOURCE may not be duplicated in a ALLOCATE statement - allocate(x7, source=src, stat=stat, source=src2) - - !ERROR: MOLD may not be duplicated in a ALLOCATE statement - allocate(x8, mold=mld, stat=stat, mold=mld) - - !ERROR: ERRMSG may not be duplicated in a ALLOCATE statement - allocate(x9, mold=mld, errmsg=msg, stat=stat, errmsg= msg) - -! C944 -! At most one of source-expr and type-spec must appear. - - !Nominal cases already tested in C943 and type-spec tests (e.g C934) - - !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement - allocate(real:: y1, source=src) - !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement - allocate(real:: y2, mold=mld) - !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement - allocate(y3, source=src, stat=stat, errmsg=msg, mold=mld) - !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement - !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement - allocate(real:: y4, source=src, stat=stat, errmsg=msg, mold=mld) -end subroutine diff --git a/test-lit/Semantics/allocate03.f90 b/test-lit/Semantics/allocate03.f90 deleted file mode 100644 index 63598f0786df..000000000000 --- a/test-lit/Semantics/allocate03.f90 +++ /dev/null @@ -1,103 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -subroutine C933_a(b1, ca3, ca4, cp3, cp3mold, cp4, cp7, cp8, bsrc) -! If any allocate-object has a deferred type parameter, is unlimited polymorphic, -! or is of abstract type, either type-spec or source-expr shall appear. - -! Only testing deferred type parameters here. - - type SomeType(k, l1, l2) - integer, kind :: k = 1 - integer, len :: l1 - integer, len :: l2 = 3 - character(len=l2+l1) str - end type - - type B(l) - integer, len :: l - character(:), allocatable :: msg - type(SomeType(4, l, :)), pointer :: something - end type - - character(len=:), allocatable :: ca1, ca2(:) - character(len=*), allocatable :: ca3, ca4(:) - character(len=2), allocatable :: ca5, ca6(:) - character(len=5) mold - - type(SomeType(l1=:,l2=:)), pointer :: cp1, cp2(:) - type(SomeType(l1=3,l2=4)) cp1mold - type(SomeType(1,*,:)), pointer :: cp3, cp4(:) - type(SomeType(1,*,5)) cp3mold - type(SomeType(l1=:)), pointer :: cp5, cp6(:) - type(SomeType(l1=6)) cp5mold - type(SomeType(1,*,*)), pointer :: cp7, cp8(:) - type(SomeType(1, l1=3)), pointer :: cp9, cp10(:) - - type(B(*)) b1 - type(B(:)), allocatable :: b2 - type(B(5)) b3 - - type(SomeType(4, *, 8)) bsrc - - ! Expecting errors: need type-spec/src-expr - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(ca1) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(ca2(4)) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(cp1) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(cp2(2)) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(cp3) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(cp4(2)) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(cp5) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(cp6(2)) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(b1%msg) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(b1%something) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(b2%msg) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(b2%something) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(b3%msg) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object has a deferred type parameters - allocate(b3%something) - - ! Nominal cases, expecting no errors - allocate(character(len=5):: ca2(4)) - allocate(character(len=5):: ca1) - allocate(character*5:: ca1) - allocate(ca2(4), MOLD = "abcde") - allocate(ca2(2), MOLD = (/"abcde", "fghij"/)) - allocate(ca1, MOLD = mold) - allocate(ca2(4), SOURCE = "abcde") - allocate(ca2(2), SOURCE = (/"abcde", "fghij"/)) - allocate(ca1, SOURCE = mold) - allocate(SomeType(l1=1, l2=2):: cp1, cp2(2)) - allocate(SomeType(1,*,5):: cp3, cp4(2)) !OK, but segfaults gfortran - allocate(SomeType(l1=1):: cp5, cp6(2)) - allocate(cp1, cp2(2), mold = cp1mold) - allocate(cp3, cp4(2), mold = cp3mold) - allocate(cp5, cp6(2), mold = cp5mold) - allocate(cp1, cp2(2), source = cp1mold) - allocate(cp3, cp4(2), source = cp3mold) - allocate(cp5, cp6(2), source = cp5mold) - allocate(character(len=10):: b1%msg, b2%msg, b3%msg) - allocate(SomeType(4, b1%l, 9):: b1%something) - allocate(b2%something, source=bsrc) - allocate(SomeType(4, 5, 8):: b3%something) - - ! assumed/explicit length do not need type-spec/mold - allocate(ca3, ca4(4)) - allocate(ca5, ca6(4)) - allocate(cp7, cp8(2)) - allocate(cp9, cp10(2)) - -end subroutine diff --git a/test-lit/Semantics/allocate04.f90 b/test-lit/Semantics/allocate04.f90 deleted file mode 100644 index 40e7562938df..000000000000 --- a/test-lit/Semantics/allocate04.f90 +++ /dev/null @@ -1,79 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - - -subroutine C933_b(n) -! If any allocate-object has a deferred type parameter, is unlimited polymorphic, -! or is of abstract type, either type-spec or source-expr shall appear. - -! only testing unlimited polymorphic and abstract-type here - - type, abstract :: Base - integer x - end type - - type, extends(Base) :: A - integer y - end type - - type, extends(Base) :: B - class(Base), allocatable :: y - end type - - type C - class(*), pointer :: whatever - real, pointer :: y - end type - - integer n - class(*), allocatable :: u1, u2(:) - class(C), allocatable :: n1, n2(:) - class(Base), pointer :: p1, p2(:) - class(B), pointer :: p3, p4(:) - type(A) :: molda = A(1, 2) - - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is unlimited polymorphic - allocate(u1) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is unlimited polymorphic - allocate(u2(2)) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is unlimited polymorphic - allocate(n1%whatever) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is unlimited polymorphic - allocate(n2(2)%whatever) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is of abstract type - allocate(p1) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is of abstract type - allocate(p2(2)) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is of abstract type - allocate(p3%y) - !ERROR: Either type-spec or source-expr must appear in ALLOCATE when allocatable object is of abstract type - allocate(p4(2)%y) - !WRONG allocate(Base:: u1) - - ! No error expected - allocate(real:: u1, u2(2)) - allocate(A:: u1, u2(2)) - allocate(C:: u1, u2(2)) - allocate(character(n):: u1, u2(2)) - allocate(C:: n1%whatever, n2(2)%whatever) - allocate(A:: p1, p2(2)) - allocate(B:: p3%y, p4(2)%y) - allocate(u1, u2(2), MOLD = cos(5.+n)) - allocate(u1, u2(2), MOLD = molda) - allocate(u1, u2(2), MOLD = n1) - allocate(u1, u2(2), MOLD = new_line("a")) - allocate(n1%whatever, MOLD = n2(1)) - allocate(p1, p2(2), MOLD = p3) - allocate(p3%y, p4(2)%y, MOLD = B(5)) - allocate(u1, u2(2), SOURCE = cos(5.+n)) - allocate(u1, u2(2), SOURCE = molda) - allocate(u1, u2(2), SOURCE = n1) - allocate(u1, u2(2), SOURCE = new_line("a")) - allocate(n1%whatever, SOURCE = n2(1)) - allocate(p1, p2(2), SOURCE = p3) - allocate(p3%y, p4(2)%y, SOURCE = B(5)) - - ! OK, not unlimited polymorphic or abstract - allocate(n1, n2(2)) - allocate(p3, p4(2)) -end subroutine diff --git a/test-lit/Semantics/allocate05.f90 b/test-lit/Semantics/allocate05.f90 deleted file mode 100644 index 84814b674735..000000000000 --- a/test-lit/Semantics/allocate05.f90 +++ /dev/null @@ -1,67 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - - -subroutine C934() -! If type-spec appears, it shall specify a type with which each -! allocate-object is type compatible. - - type A - integer i - end type - - type, extends(A) :: B - real, allocatable :: x(:) - end type - - type, extends(B) :: C - character(5) s - end type - - type Unrelated - class(A), allocatable :: polymorph - type(A), allocatable :: notpolymorph - end type - - real, allocatable :: x1, x2(:) - class(A), allocatable :: aa1, aa2(:) - class(B), pointer :: bp1, bp2(:) - class(C), allocatable :: ca1, ca2(:) - class(*), pointer :: up1, up2(:) - type(A), allocatable :: npaa1, npaa2(:) - type(B), pointer :: npbp1, npbp2(:) - type(C), allocatable :: npca1, npca2(:) - class(Unrelated), allocatable :: unrelat - - allocate(real:: x1) - allocate(real:: x2(2)) - allocate(real:: bp2(3)%x(5)) - !OK, type-compatible with A - allocate(A:: aa1, aa2(2), up1, up2(3), & - unrelat%polymorph, unrelat%notpolymorph, npaa1, npaa2(4)) - !OK, type compatible with B - allocate(B:: aa1, aa2(2), up1, up2(3), & - unrelat%polymorph, bp1, bp2(2), npbp1, npbp2(2:4)) - !OK, type compatible with C - allocate(C:: aa1, aa2(2), up1, up2(3), & - unrelat%polymorph, bp1, bp2(2), ca1, ca2(4), & - npca1, npca2(2:4)) - - - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(complex:: x1) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(complex:: x2(2)) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(logical:: bp2(3)%x(5)) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(A:: unrelat) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(B:: unrelat%notpolymorph) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(B:: npaa1) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(B:: npaa2(4)) - !ERROR: Allocatable object in ALLOCATE must be type compatible with type-spec - allocate(C:: npca1, bp1, npbp1) -end subroutine diff --git a/test-lit/Semantics/allocate06.f90 b/test-lit/Semantics/allocate06.f90 deleted file mode 100644 index 1de258ccfb46..000000000000 --- a/test-lit/Semantics/allocate06.f90 +++ /dev/null @@ -1,103 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - - -subroutine C935(l, ac1, ac2, ac3, dc1, dc2, ec1, ec2, aa, ab, ab2, ea, eb, da, db, whatever, something, something_else) -! A type-param-value in a type-spec shall be an asterisk if and only if each -! allocate-object is a dummy argument for which the corresponding type parameter -! is assumed. - - type A(la) - integer, len :: la - integer vector(la) - end type - - type, extends(A) :: B(lb) - integer, len :: lb - integer matrix(lb, lb) - end type - - type, extends(B) :: C(lc1, lc2, lc3) - integer, len :: lc1, lc2, lc3 - integer array(lc1, lc2, lc3) - end type - - integer l - character(len=*), pointer :: ac1, ac2(:) - character*(*), allocatable :: ac3(:) - character*(:), allocatable :: dc1 - character(len=:), pointer :: dc2(:) - character(len=l), pointer :: ec1 - character*5, allocatable :: ec2(:) - - class(A(*)), pointer :: aa - type(B(* , 5)), allocatable :: ab(:) - type(B(* , *)), pointer :: ab2(:) - class(A(l)), allocatable :: ea - type(B(5 , 5)), pointer :: eb(:) - class(A(:)), allocatable :: da - type(B(: , 5)), pointer :: db(:) - class(*), allocatable :: whatever - type(C(la=*, lb=:, lc1=*, lc2=5, lc3=*)), pointer :: something(:) - type(C(la=*, lb=:, lc1=5, lc2=5, lc3=*)), pointer :: something_else(:) - - ! OK - allocate(character(len=*):: ac1, ac3(3)) - allocate(character*(*):: ac2(5)) - allocate(B(*, 5):: aa, ab(2)) !OK but segfault GCC - allocate(B(*, *):: ab2(2)) - allocate(C(la=*, lb=10, lc1=*, lc2=5, lc3=*):: something(5)) - allocate(C(la=*, lb=10, lc1=2, lc2=5, lc3=3):: aa) - allocate(character(5):: whatever) - - ! Not OK - - ! Should be * or no type-spec - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(len=5):: ac1) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(len=5):: ac2(3), ac3) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(len=l):: ac1) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(len=l):: ac2(3), ac3) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(A(5):: aa) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(B(5, 5):: ab(5)) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(B(l, 5):: aa, ab(5)) - - ! Must not be * - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(len=*):: ac1, dc1, ac3(2)) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character*(*):: dc2(5)) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character*(*):: ec1) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(*):: whatever) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(character(len=*):: ac2(5), ec2(5)) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(A(*):: ea) !segfault gfortran - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(B(*, 5):: eb(2)) !segfault gfortran - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(A(*):: da) !segfault gfortran - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(B(*, 5):: db(2)) !segfault gfortran - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(A(*):: aa, whatever) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(B(*, *):: aa) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(C(la=*, lb=10, lc1=*, lc2=5, lc3=*):: something_else(5)) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(C(la=5, lb=10, lc1=4, lc2=5, lc3=3):: aa) - !ERROR: Type parameters in type-spec must be assumed if and only if they are assumed for allocatable object in ALLOCATE - allocate(C(la=*, lb=10, lc1=*, lc2=5, lc3=*):: aa) -end subroutine diff --git a/test-lit/Semantics/allocate07.f90 b/test-lit/Semantics/allocate07.f90 deleted file mode 100644 index 14077a24013e..000000000000 --- a/test-lit/Semantics/allocate07.f90 +++ /dev/null @@ -1,93 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -subroutine C936(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred) -! If type-spec appears, the kind type parameter values of each -! allocate-object shall be the same as the corresponding type -! parameter values of the type-spec. - - real(kind=4), allocatable :: x1, x2(:) - - type WithParam(k1, l1) - integer, kind :: k1=1 - integer, len :: l1=2 - end type - - type, extends(WithParam) :: WithParamExtent(k2, l2) - integer, kind :: k2 - integer, len :: l2 - end type - - type, extends(WithParamExtent) :: WithParamExtent2(k3, l3) - integer, kind :: k3 = 8 - integer, len :: l3 - end type - - type(WithParam(4, 2)), allocatable :: param_ta_4_2 - class(WithParam(4, 2)), pointer :: param_ca_4_2 - - type(WithParam(4, *)), pointer :: param_ta_4_assumed - class(WithParam(4, *)), allocatable :: param_ca_4_assumed - - type(WithParam(4, :)), allocatable :: param_ta_4_deferred - class(WithParam(4, :)), pointer :: param_ca_4_deferred - class(WithParam), allocatable :: param_defaulted - - type(WithParamExtent2(k1=4, l1=:, k2=5, l2=:, l3=8 )), pointer :: extended2 - - class(*), pointer :: whatever - - ! Nominal test cases - allocate(real(kind=4):: x1, x2(10)) - allocate(WithParam(4, 2):: param_ta_4_2, param_ca_4_2) - allocate(WithParamExtent(4, 2, 8, 3):: param_ca_4_2) - allocate(WithParam(4, *):: param_ta_4_assumed, param_ca_4_assumed) - allocate(WithParamExtent(4, *, 8, 3):: param_ca_4_assumed) - allocate(WithParam(4, 2):: param_ta_4_deferred, param_ca_4_deferred) - allocate(WithParamExtent(4, 2, 8, 3):: param_ca_4_deferred) - allocate(WithParamExtent2(k1=4, l1=5, k2=5, l2=6, l3=8 ):: extended2) - allocate(WithParamExtent2(k1=4, l1=2, k2=5, l2=6, k3=5, l3=8 ):: param_ca_4_2) - allocate(WithParam:: param_defaulted) - allocate(WithParam(k1=1, l1=2):: param_defaulted) - allocate(WithParam(k1=1):: param_defaulted) - allocate(WithParamExtent2(k1=1, l1=2, k2=5, l2=6, k3=5, l3=8 ):: param_defaulted) - allocate(WithParamExtent2(k1=1, l1=2, k2=5, l2=6, k3=5, l3=8 ):: whatever) - - - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(real(kind=8):: x1) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(real(kind=8):: x2(10)) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(8, 2):: param_ta_4_2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(8, 2):: param_ca_4_2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent(8, 2, 8, 3):: param_ca_4_2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(8, *):: param_ta_4_assumed) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(8, *):: param_ca_4_assumed) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent(8, *, 8, 3):: param_ca_4_assumed) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(8, 2):: param_ta_4_deferred) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(8, 2):: param_ca_4_deferred) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent(8, 2, 8, 3):: param_ca_4_deferred) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent2(k1=5, l1=5, k2=5, l2=6, l3=8 ):: extended2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent2(k1=5, l1=2, k2=5, l2=6, k3=5, l3=8 ):: param_ca_4_2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent2(k1=4, l1=5, k2=5, l2=6, k3=5, l3=8 ):: extended2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam:: param_ca_4_2) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(k1=2, l1=2):: param_defaulted) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParam(k1=2):: param_defaulted) - !ERROR: Kind type parameters of allocatable object in ALLOCATE must be the same as the corresponding ones in type-spec - allocate(WithParamExtent2(k1=5, l1=2, k2=5, l2=6, k3=5, l3=8 ):: param_defaulted) -end subroutine diff --git a/test-lit/Semantics/allocate08.f90 b/test-lit/Semantics/allocate08.f90 deleted file mode 100644 index 3e235fcc9cdc..000000000000 --- a/test-lit/Semantics/allocate08.f90 +++ /dev/null @@ -1,132 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -subroutine C945_a(srca, srcb, srcc, src_complex, src_logical, & - srca2, srcb2, srcc2, src_complex2, srcx, srcx2) -! If type-spec appears, it shall specify a type with which each -! allocate-object is type compatible. - -!second part C945, specific to SOURCE, is not checked here. - - type A - integer i - end type - - type, extends(A) :: B - real, allocatable :: x(:) - end type - - type, extends(B) :: C - character(5) s - end type - - type Unrelated - class(A), allocatable :: polymorph - type(A), allocatable :: notpolymorph - end type - - real srcx, srcx2(6) - class(A) srca, srca2(5) - type(B) srcb, srcb2(6) - class(C) srcc, srcc2(7) - complex src_complex, src_complex2(8) - complex src_logical(5) - real, allocatable :: x1, x2(:) - class(A), allocatable :: aa1, aa2(:) - class(B), pointer :: bp1, bp2(:) - class(C), allocatable :: ca1, ca2(:) - class(*), pointer :: up1, up2(:) - type(A), allocatable :: npaa1, npaa2(:) - type(B), pointer :: npbp1, npbp2(:) - type(C), allocatable :: npca1, npca2(:) - class(Unrelated), allocatable :: unrelat - - allocate(x1, source=srcx) - allocate(x2, mold=srcx2) - allocate(bp2(3)%x, source=srcx2) - !OK, type-compatible with A - allocate(aa1, up1, unrelat%polymorph, unrelat%notpolymorph, & - npaa1, source=srca) - allocate(aa2, up2, npaa2, source=srca2) - !OK, type compatible with B - allocate(aa1, up1, unrelat%polymorph, bp1, npbp1, mold=srcb) - allocate(aa2, up2, bp2, npbp2, mold=srcb2) - !OK, type compatible with C - allocate(aa1, up1, unrelat%polymorph, bp1, ca1, npca1, mold=srcc) - allocate(aa2, up2, bp2, ca2, npca2, source=srcc2) - - - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(x1, mold=src_complex) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(x2(2), source=src_complex2) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(bp2(3)%x, mold=src_logical) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(unrelat, mold=srca) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(unrelat%notpolymorph, source=srcb) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(npaa1, mold=srcb) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(npaa2, source=srcb2) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(npca1, bp1, npbp1, mold=srcc) -end subroutine - -module m - type :: t - real x(100) - contains - procedure :: f - end type - contains - function f(this) result (x) - class(t) :: this - class(t), allocatable :: x - end function - subroutine bar - type(t) :: o - type(t), allocatable :: p - real, allocatable :: rp - allocate(p, source=o%f()) - !ERROR: Allocatable object in ALLOCATE must be type compatible with source expression from MOLD or SOURCE - allocate(rp, source=o%f()) - end subroutine -end module - -! Related to C945, check typeless expression are caught - -subroutine sub -end subroutine - -function func() result(x) - real :: x -end function - -program test_typeless - class(*), allocatable :: x - interface - subroutine sub - end subroutine - real function func() - end function - end interface - procedure (sub), pointer :: subp => sub - procedure (func), pointer :: funcp => func - - ! OK - allocate(x, mold=func()) - allocate(x, source=funcp()) - - !ERROR: Typeless item not allowed as SOURCE or MOLD in ALLOCATE - allocate(x, mold=x'1') - !ERROR: Typeless item not allowed as SOURCE or MOLD in ALLOCATE - allocate(x, mold=sub) - !ERROR: Typeless item not allowed as SOURCE or MOLD in ALLOCATE - allocate(x, source=subp) - !ERROR: Typeless item not allowed as SOURCE or MOLD in ALLOCATE - allocate(x, mold=func) - !ERROR: Typeless item not allowed as SOURCE or MOLD in ALLOCATE - allocate(x, source=funcp) -end program diff --git a/test-lit/Semantics/allocate09.f90 b/test-lit/Semantics/allocate09.f90 deleted file mode 100644 index 61046fb13ce2..000000000000 --- a/test-lit/Semantics/allocate09.f90 +++ /dev/null @@ -1,130 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -subroutine C946(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred) -! If source-expr appears, the kind type parameters of each allocate-object shall -! have the same values as the corresponding type parameters of source-expr. - - real(kind=4), allocatable :: x1, x2(:) - - type WithParam(k1, l1) - integer, kind :: k1=1 - integer, len :: l1=2 - real x - end type - - type, extends(WithParam) :: WithParamExtent(k2, l2) - integer, kind :: k2 - integer, len :: l2 - end type - - type, extends(WithParamExtent) :: WithParamExtent2(k3, l3) - integer, kind :: k3 = 8 - integer, len :: l3 - end type - - real(kind=4) srcx, srcx_array(10) - real(kind=8) srcx8, srcx8_array(10) - class(WithParam(4, 2)), allocatable :: src_a_4_2 - type(WithParam(8, 2)) src_a_8_2 - class(WithParam(4, :)), allocatable :: src_a_4_def - class(WithParam(8, :)), allocatable :: src_a_8_def - type(WithParamExtent(4, 2, 8, 3)) src_b_4_2_8_3 - class(WithParamExtent(4, :, 8, 3)), allocatable :: src_b_4_def_8_3 - type(WithParamExtent(8, 2, 8, 3)) src_b_8_2_8_3 - class(WithParamExtent(8, :, 8, 3)), allocatable :: src_b_8_def_8_3 - type(WithParamExtent2(k1=4, l1=5, k2=5, l2=6, l3=8 )) src_c_4_5_5_6_8_8 - class(WithParamExtent2(k1=4, l1=2, k2=5, l2=6, k3=5, l3=8)), & - allocatable :: src_c_4_2_5_6_5_8 - class(WithParamExtent2(k2=5, l2=6, k3=5, l3=8)), & - allocatable :: src_c_1_2_5_6_5_8 - type(WithParamExtent2(k1=5, l1=5, k2=5, l2=6, l3=8 )) src_c_5_5_5_6_8_8 - type(WithParamExtent2(k1=5, l1=2, k2=5, l2=6, k3=5, l3=8)) src_c_5_2_5_6_5_8 - - - type(WithParam(4, 2)), allocatable :: param_ta_4_2 - class(WithParam(4, 2)), pointer :: param_ca_4_2 - - type(WithParam(4, *)), pointer :: param_ta_4_assumed - class(WithParam(4, *)), allocatable :: param_ca_4_assumed - - type(WithParam(4, :)), allocatable :: param_ta_4_deferred - class(WithParam(4, :)), pointer :: param_ca_4_deferred - class(WithParam), allocatable :: param_defaulted - integer, allocatable :: integer_default(:) - - type(WithParamExtent2(k1=4, l1=:, k2=5, l2=:, l3=8 )), pointer :: extended2 - - class(*), pointer :: whatever - - ! Nominal test cases - allocate(x1, x2(10), source=srcx) - allocate(x2(10), source=srcx_array) - allocate(param_ta_4_2, param_ca_4_2, mold=src_a_4_2) - allocate(param_ca_4_2, source=src_b_4_2_8_3) - allocate(param_ta_4_2, param_ca_4_2, mold=src_a_4_def) ! no C935 equivalent for source-expr - allocate(param_ca_4_2, source=src_b_4_def_8_3) ! no C935 equivalent for source-expr - allocate(param_ta_4_assumed, param_ca_4_assumed, source=src_a_4_def) - allocate(param_ca_4_assumed, mold=src_b_4_def_8_3) - allocate(param_ta_4_assumed, param_ca_4_assumed, source=src_a_4_2) ! no C935 equivalent for source-expr - allocate(param_ca_4_assumed, mold=src_b_4_2_8_3) ! no C935 equivalent for source-expr - allocate(param_ta_4_deferred, param_ca_4_deferred, source =src_a_4_2) - allocate(param_ca_4_deferred, mold=src_b_4_def_8_3) - - allocate(extended2, source=src_c_4_5_5_6_8_8) - allocate(param_ca_4_2, mold= src_c_4_2_5_6_5_8) - allocate(param_defaulted, mold=WithParam(5)) - allocate(param_defaulted, source=WithParam(k1=1)(x=5)) - allocate(param_defaulted, mold=src_c_1_2_5_6_5_8) - allocate(whatever, source=src_c_1_2_5_6_5_8) - - allocate(integer_default, source=[(i,i=0,9)]) - - - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(x1, source=cos(0._8)) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(x2(10), source=srcx8) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(x2(10), mold=srcx8_array) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ta_4_2, source=src_a_8_2) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_2, mold=src_a_8_2) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ta_4_2, source=src_a_8_def) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_2, source=src_b_8_2_8_3) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_2, mold=src_b_8_def_8_3) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ta_4_assumed, source=src_a_8_def) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ta_4_assumed, mold=src_a_8_2) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_assumed, mold=src_a_8_def) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_assumed, source=src_b_8_2_8_3) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ta_4_deferred, mold=src_a_8_2) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_deferred, source=src_a_8_def) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_deferred, mold=src_b_8_2_8_3) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(extended2, source=src_c_5_5_5_6_8_8) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_2, mold=src_c_5_2_5_6_5_8) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(extended2, source=WithParamExtent2(k1=4, l1=5, k2=5, l2=6, k3=5, l3=8)(x=5)) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_ca_4_2, mold=param_defaulted) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_defaulted, source=param_ca_4_2) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_defaulted, mold=WithParam(k1=2)(x=5)) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(param_defaulted, source=src_c_5_2_5_6_5_8) - !ERROR: Kind type parameters of allocatable object must be the same as the corresponding ones of SOURCE or MOLD expression - allocate(integer_default, source=[(i, integer(8)::i=0,9)]) -end subroutine diff --git a/test-lit/Semantics/allocate10.f90 b/test-lit/Semantics/allocate10.f90 deleted file mode 100644 index c15dc57b4472..000000000000 --- a/test-lit/Semantics/allocate10.f90 +++ /dev/null @@ -1,158 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -!TODO: mixing expr and source-expr? -!TODO: using subcomponent in source expressions - -subroutine C939_C942a_C945b(xsrc1a, xsrc1c, xsrc0, xsrc2a, xsrc2c, pos) -! C939: If an allocate-object is an array, either allocate-shape-spec-list shall -! appear in its allocation, or source-expr shall appear in the ALLOCATE -! statement and have the same rank as the allocate-object. - type A - real, pointer :: x(:) - end type - real, allocatable :: x0 - real, allocatable :: x1(:) - real, pointer :: x2(:, :, :) - type(A) a1 - type(A), allocatable :: a2(:, :) - - real xsrc0 - real xsrc1a(*) - real xsrc1b(2:7) - real, pointer :: xsrc1c(:) - real xsrc2a(4:8, 12, *) - real xsrc2b(2:7, 5, 9) - real, pointer :: xsrc2c(:, :, :) - integer pos - - allocate(x1(5)) - allocate(x1(2:7)) - allocate(x1, SOURCE=xsrc1a(2:7)) - allocate(x1, MOLD=xsrc1b) - allocate(x1, SOURCE=xsrc1c) - - allocate(x2(2,3,4)) - allocate(x2(2:7,3:8,4:9)) - allocate(x2, SOURCE=xsrc2a(4:8, 1:12, 2:5)) - allocate(x2, MOLD=cos(xsrc2b)) - allocate(x2, SOURCE=xsrc2c) - - allocate(x1(5), x2(2,3,4), a1%x(5), a2(1,2)%x(4)) - allocate(x1, a1%x, a2(1,2)%x, SOURCE=xsrc1a(2:7)) - allocate(x1, a1%x, a2(1,2)%x, MOLD=xsrc1b) - allocate(x1, a1%x, a2(1,2)%x, SOURCE=xsrc1c) - - allocate(x0, x1(5), x2(2,3,4), a1%x(5), SOURCE=xsrc0) - - ! There are NO requirements that mold expression rank match the - ! allocated-objects when allocate-shape-spec-lists are given. - ! If it is not needed, the shape of MOLD should be simply ignored. - allocate(x0, x1(5), x2(2,3,4), a1%x(5), MOLD=xsrc0) - allocate(x0, x1(5), x2(2,3,4), a1%x(5), MOLD=xsrc1b) - allocate(x0, x1(5), x2(2,3,4), a1%x(5), MOLD=xsrc2b) - - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x1) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x1, SOURCE=xsrc0) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x1, MOLD=xsrc2c) - - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x2, SOURCE=xsrc1a(2:7)) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x2, MOLD=xsrc1b) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x2, SOURCE=xsrc1c) - - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(a1%x) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(a2(5,3)%x) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x1(5), x2(2,3,4), a1%x, a2(1,2)%x(4)) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(x2, a2(1,2)%x, SOURCE=xsrc2a(4:8, 1:12, 2:5)) - !ERROR: Arrays in ALLOCATE must have a shape specification or an expression of the same rank must appear in SOURCE or MOLD - allocate(a1%x, MOLD=xsrc0) - - !C942a: The number of allocate-shape-specs in an allocate-shape-spec-list shall - !be the same as the rank of the allocate-object. [...] (co-array stuffs). - - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x1(5, 5)) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x1(2:3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2)) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x2(pos)) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x2(2, 3, pos+1, 5)) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x1(5), x2(2,4), a1%x(5), a2(1,2)%x(4)) - - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x1(2), a1%x(2,5), a2(1,2)%x(2)) - - ! Test the check is not influenced by SOURCE - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(a1%x(5, 4, 3), SOURCE=xsrc2a(1:5, 1:4, 1:3)) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x2(5), MOLD=xsrc1a(1:5)) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(a1%x(5, 4, 3), MOLD=xsrc1b) - !ERROR: The number of shape specifications, when they appear, must match the rank of allocatable object - allocate(x2(5), SOURCE=xsrc2b) - - ! C945b: If SOURCE= appears, source-expr shall be a scalar or have the same - ! rank as each allocate-object. - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(x0, SOURCE=xsrc1b) - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(x2(2, 5, 7), SOURCE=xsrc1a(2:7)) - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(x2(2, 5, 7), SOURCE=xsrc1c) - - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(x1(5), SOURCE=xsrc2a(4:8, 1:12, 2:5)) - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(x1(3), SOURCE=cos(xsrc2b)) - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(x1(100), SOURCE=xsrc2c) - - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(a1%x(10), x2(20, 30, 40), a2(1,2)%x(50), SOURCE=xsrc1c) - !ERROR: If SOURCE appears, the related expression must be scalar or have the same rank as each allocatable object in ALLOCATE - allocate(a1%x(25), SOURCE=xsrc2b) - -end subroutine - -subroutine C940(a1, pos) -! If allocate-object is scalar, allocate-shape-spec-list shall not appear. - type A - integer(kind=8), allocatable :: i - end type - - type B(k, l1, l2, l3) - integer, kind :: k - integer, len :: l1, l2, l3 - real(kind=k) x(-1:l1, 0:l2, 1:l3) - end type - - integer pos - class(A), allocatable :: a1(:) - real, pointer :: x - type(B(8,4,5,6)), allocatable :: b1 - - ! Nominal - allocate(x) - allocate(a1(pos)%i) - allocate(b1) - - !ERROR: Shape specifications must not appear when allocatable object is scalar - allocate(x(pos)) - !ERROR: Shape specifications must not appear when allocatable object is scalar - allocate(a1(pos)%i(5:2)) - !ERROR: Shape specifications must not appear when allocatable object is scalar - allocate(b1(1)) -end subroutine diff --git a/test-lit/Semantics/allocate11.f90 b/test-lit/Semantics/allocate11.f90 deleted file mode 100644 index b883edc4980a..000000000000 --- a/test-lit/Semantics/allocate11.f90 +++ /dev/null @@ -1,159 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -! TODO: Function Pointer in allocate and derived types! - -! Rules I should know when working with coarrays and derived type: - -! C736: If EXTENDS appears and the type being defined has a coarray ultimate -! component, its parent type shall have a coarray ultimate component. - -! C746: (R737) If a coarray-spec appears, it shall be a deferred-coshape-spec-list -! and the component shall have the ALLOCATABLE attribute. - -! C747: If a coarray-spec appears, the component shall not be of type C_PTR or -! C_FUNPTR from the intrinsic module ISO_C_BINDING (18.2), or of type TEAM_TYPE from the -! intrinsic module ISO_FORTRAN_ENV (16.10.2). - -! C748: A data component whose type has a coarray ultimate component shall be a -! nonpointer nonallocatable scalar and shall not be a coarray. - -! 7.5.4.3 Coarray components -! 7.5.6 Final subroutines: C786 - - -! C825 An entity whose type has a coarray ultimate component shall be a -! nonpointer nonallocatable scalar, shall not be a coarray, and shall not be a function result. - -! C826 A coarray or an object with a coarray ultimate component shall be an -! associate name, a dummy argument, or have the ALLOCATABLE or SAVE attribute. - -subroutine C937(var) -! Type-spec shall not specify a type that has a coarray ultimate component. - - - type A - real, allocatable :: x[:] - end type - - type B - type(A) y - type(B), pointer :: forward - real :: u - end type - - type C - type(B) z - end type - - type D - type(A), pointer :: potential - end type - - - - class(*), allocatable :: var - ! unlimited polymorphic is the ONLY way to get an allocatable/pointer 'var' that can be - ! allocated with a type-spec T that has coarray ultimate component without - ! violating other rules than C937. - ! Rationale: - ! C934 => var must be type compatible with T. - ! => var type is T, a type P extended by T, or unlimited polymorphic - ! C825 => var cannot be of type T. - ! C736 => all parent types P of T must have a coarray ultimate component - ! => var cannot be of type P (C825) - ! => if var can be defined, it can only be unlimited polymorphic - - ! Also, as per C826 or C852, var can only be an allocatable, not a pointer - - ! OK, x is not an ultimate component - allocate(D:: var) - - !ERROR: Type-spec in ALLOCATE must not specify a type with a coarray ultimate component - allocate(A:: var) - !ERROR: Type-spec in ALLOCATE must not specify a type with a coarray ultimate component - allocate(B:: var) - !ERROR: Type-spec in ALLOCATE must not specify a type with a coarray ultimate component - allocate(C:: var) -end subroutine - -!TODO: type extending team_type !? subcomponents !? - -subroutine C938_C947(var2, ptr, ptr2, fptr, my_team, srca) -! If an allocate-object is a coarray, type-spec shall not specify type C_PTR or -! C_FUNPTR from the intrinsic module ISO_C_BINDING, or type TEAM_TYPE from the intrinsic module -! ISO_FORTRAN_ENV. - use ISO_FORTRAN_ENV - use ISO_C_BINDING - - type A(k, l) - integer, kind :: k - integer, len :: l - real(kind=k) x(l,l) - end type - -! Again, I do not see any other way to violate this rule and not others without -! having var being an unlimited polymorphic. -! Suppose var of type P and T, the type in type-spec -! Per C934, P must be compatible with T. P cannot be a forbidden type per C824. -! Per C728 and 7.5.7.1, P cannot extend a c_ptr or _c_funptr. hence, P has to be -! unlimited polymorphic or a type that extends TEAM_TYPE. - class(*), allocatable :: var[:], var2(:)[:] - class(*), allocatable :: varok, varok2(:) - - Type(C_PTR) :: ptr, ptr2(2:10) - Type(C_FUNPTR) fptr - Type(TEAM_TYPE) my_team - Type(A(4, 10)) :: srca - - ! Valid constructs - allocate(real:: var[5:*]) - allocate(A(4, 10):: var[5:*]) - allocate(TEAM_TYPE:: varok, varok2(2)) - allocate(C_PTR:: varok, varok2(2)) - allocate(C_FUNPTR:: varok, varok2(2)) - - !ERROR: Type-Spec in ALLOCATE must not be TEAM_TYPE from ISO_FORTRAN_ENV when an allocatable object is a coarray - allocate(TEAM_TYPE:: var[5:*]) - !ERROR: Type-Spec in ALLOCATE must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(C_PTR:: varok, var[5:*]) - !ERROR: Type-Spec in ALLOCATE must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(C_FUNPTR:: var[5:*]) - !ERROR: Type-Spec in ALLOCATE must not be TEAM_TYPE from ISO_FORTRAN_ENV when an allocatable object is a coarray - allocate(TEAM_TYPE:: var2(2)[5:*]) - !ERROR: Type-Spec in ALLOCATE must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(C_PTR:: var2(2)[5:*]) - !ERROR: Type-Spec in ALLOCATE must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(C_FUNPTR:: varok2(2), var2(2)[5:*]) - - -! C947: The declared type of source-expr shall not be C_PTR or C_FUNPTR from the -! intrinsic module ISO_C_BINDING, or TEAM_TYPE from the intrinsic module -! ISO_FORTRAN_ENV, if an allocateobject is a coarray. -! -! ! Valid constructs - allocate(var[5:*], SOURCE=cos(0.5_4)) - allocate(var[5:*], MOLD=srca) - allocate(varok, varok2(2), SOURCE=ptr) - allocate(varok2, MOLD=ptr2) - allocate(varok, varok2(2), SOURCE=my_team) - allocate(varok, varok2(2), MOLD=fptr) - - !ERROR: SOURCE or MOLD expression type must not be TEAM_TYPE from ISO_FORTRAN_ENV when an allocatable object is a coarray - allocate(var[5:*], SOURCE=my_team) - !ERROR: SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(var[5:*], SOURCE=ptr) - !ERROR: SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(varok, var[5:*], MOLD=ptr2(1)) - !ERROR: SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(var[5:*], MOLD=fptr) - !ERROR: SOURCE or MOLD expression type must not be TEAM_TYPE from ISO_FORTRAN_ENV when an allocatable object is a coarray - allocate(var2(2)[5:*], MOLD=my_team) - !ERROR: SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(var2(2)[5:*], MOLD=ptr) - !ERROR: SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(var2(2)[5:*], SOURCE=ptr2) - !ERROR: SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray - allocate(varok2(2), var2(2)[5:*], SOURCE=fptr) - -end subroutine diff --git a/test-lit/Semantics/allocate12.f90 b/test-lit/Semantics/allocate12.f90 deleted file mode 100644 index 41de8edc83ed..000000000000 --- a/test-lit/Semantics/allocate12.f90 +++ /dev/null @@ -1,118 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -subroutine C941_C942b_C950(xsrc, x1, a2, b2, cx1, ca2, cb1, cb2, c1) -! C941: An allocate-coarray-spec shall appear if and only if the allocate-object -! is a coarray. - type type0 - real, allocatable :: array(:) - end type - type type1 - class(type0), pointer :: t0 - end type - - type type2 - type(type1), pointer :: t1(:) - end type - - type A - real x(10) - end type - - type B - real, allocatable :: x(:) - end type - - type C - class(type2), allocatable :: ct2(:, :)[:, :, :] - class(A), allocatable :: cx(:, :)[:, :, :] - class(A), allocatable :: x(:, :) - end type - - real :: xsrc(10) - real, allocatable :: x1, x2(:) - class(A), pointer :: a1, a2(:) - - real, allocatable :: cx1[:], cx2(:)[:, :] - class(A), allocatable :: ca1[:, :], ca2(:)[:] - - type(B) :: b1, b2(*) - type(B) :: cb1[5:*], cb2(*)[2, -1:*] - - type(C) :: c1 - - class(*), allocatable :: var(:), cvar(:)[:] - - ! Valid constructs - allocate(x1, x2(10), cx1[*], cx2(10)[2, -1:*]) - allocate(a1, a2(10), ca1[2, -1:*], ca2(10)[*]) - allocate(b1%x, b2(1)%x, cb1%x, cb2(1)%x, SOURCE=xsrc) - allocate(c1%x(-1:10, 1:5), c1%cx(-1:10, 1:5)[-1:5, 1:2, 2:*]) - allocate(A:: var(5), cvar(10)[*]) - - - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(x1[*]) - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(x2(10)[*]) - !ERROR: Coarray specification must appear in ALLOCATE when allocatable object is a coarray - allocate(cx1) - !ERROR: Coarray specification must appear in ALLOCATE when allocatable object is a coarray - allocate(cx2(10)) - - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(cx1[*], a1[*]) - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(cx1[*], a2(10)[*]) - !ERROR: Coarray specification must appear in ALLOCATE when allocatable object is a coarray - allocate(x1, ca1) - !ERROR: Coarray specification must appear in ALLOCATE when allocatable object is a coarray - allocate(ca1[2, -1:*], ca2(10)) - - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(b1%x[5:*] , SOURCE=xsrc) - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(b2(1)%x[2, -1:*], SOURCE=xsrc) - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(cb1%x[5:*] , SOURCE=xsrc) - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(cb2(1)%x[2, -1:*], SOURCE=xsrc) - - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(c1%x(-1:10, 1:5)[-1:5, 1:2, 2:*]) - !ERROR: Coarray specification must appear in ALLOCATE when allocatable object is a coarray - allocate(c1%cx(-1:10, 1:5)) - - !ERROR: Coarray specification must not appear in ALLOCATE when allocatable object is not a coarray - allocate(A:: var(5)[*], cvar(10)[*]) - !ERROR: Coarray specification must appear in ALLOCATE when allocatable object is a coarray - allocate(A:: var(5), cvar(10)) - -! C942b: [... (shape related stuff not tested here) ...]. The number of -! allocate-coshape-specs in an allocate-coarray-spec shall be one less -! than the corank of the allocate-object. - - ! Valid constructs already tested above - - !ERROR: Corank of coarray specification in ALLOCATE must match corank of alloctable coarray - allocate(cx1[2,-1:*], cx2(10)[2, -1:*]) - !ERROR: Corank of coarray specification in ALLOCATE must match corank of alloctable coarray - allocate(ca1[*], ca2(10)[*]) - !ERROR: Corank of coarray specification in ALLOCATE must match corank of alloctable coarray - allocate(c1%cx(-1:10, 1:5)[-1:5, 1:*]) - !ERROR: Corank of coarray specification in ALLOCATE must match corank of alloctable coarray - allocate(A:: cvar(10)[2,2,*]) - -! C950: An allocate-object shall not be a coindexed object. - - ! Valid construct - allocate(c1%ct2(2,5)%t1(2)%t0%array(10)) - - !ERROR: Allocatable object must not be coindexed in ALLOCATE - allocate(b1%x, b2(1)%x, cb1[2]%x, SOURCE=xsrc) - !ERROR: Allocatable object must not be coindexed in ALLOCATE - allocate(b1%x, b2(1)%x, cb2(1)[2,-1]%x, MOLD=xsrc) - !ERROR: Allocatable object must not be coindexed in ALLOCATE - allocate(c1%ct2(2,5)[1,1,1]%t1(2)%t0%array(10)) - -end subroutine diff --git a/test-lit/Semantics/allocate13.f90 b/test-lit/Semantics/allocate13.f90 deleted file mode 100644 index b7010f5b0c89..000000000000 --- a/test-lit/Semantics/allocate13.f90 +++ /dev/null @@ -1,173 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in ALLOCATE statements - -module not_iso_fortran_env - type event_type - end type - type lock_type - end type -end module - -subroutine C948_a() -! If SOURCE= appears, the declared type of source-expr shall not be EVENT_TYPE -! or LOCK_-TYPE from the intrinsic module ISO_FORTRAN_ENV, or have a potential subobject -! component of type EVENT_TYPE or LOCK_TYPE. - use iso_fortran_env - - type oktype1 - type(event_type), pointer :: event - type(lock_type), pointer :: lock - end type - - type oktype2 - class(oktype1), allocatable :: t1a - type(oktype1) :: t1b - end type - - type, extends(oktype1) :: oktype3 - real, allocatable :: x(:) - end type - - type noktype1 - type(event_type), allocatable :: event - end type - - type noktype2 - type(event_type) :: event - end type - - type noktype3 - type(lock_type), allocatable :: lock - end type - - type noktype4 - type(lock_type) :: lock - end type - - type, extends(noktype4) :: noktype5 - real, allocatable :: x(:) - end type - - type, extends(event_type) :: noktype6 - real, allocatable :: x(:) - end type - - type recursiveType - real x(10) - type(recursiveType), allocatable :: next - end type - - type recursiveTypeNok - real x(10) - type(recursiveType), allocatable :: next - type(noktype5), allocatable :: trouble - end type - - ! variable with event_type or lock_type have to be coarrays - ! see C1604 and 1608. - type(oktype1), allocatable :: okt1[:] - class(oktype2), allocatable :: okt2(:)[:] - type(oktype3), allocatable :: okt3[:] - type(noktype1), allocatable :: nokt1[:] - type(noktype2), allocatable :: nokt2[:] - class(noktype3), allocatable :: nokt3[:] - type(noktype4), allocatable :: nokt4[:] - type(noktype5), allocatable :: nokt5[:] - class(noktype6), allocatable :: nokt6(:)[:] - type(event_type), allocatable :: event[:] - type(lock_type), allocatable :: lock(:)[:] - class(recursiveType), allocatable :: recok - type(recursiveTypeNok), allocatable :: recnok[:] - class(*), allocatable :: whatever[:] - - type(oktype1), allocatable :: okt1src[:] - class(oktype2), allocatable :: okt2src(:)[:] - type(oktype3), allocatable :: okt3src[:] - class(noktype1), allocatable :: nokt1src[:] - type(noktype2), allocatable :: nokt2src[:] - type(noktype3), allocatable :: nokt3src[:] - class(noktype4), allocatable :: nokt4src[:] - type(noktype5), allocatable :: nokt5src[:] - class(noktype6), allocatable :: nokt6src(:)[:] - type(event_type), allocatable :: eventsrc[:] - type(lock_type), allocatable :: locksrc(:)[:] - type(recursiveType), allocatable :: recoksrc - class(recursiveTypeNok), allocatable :: recnoksrc[:] - - ! Valid constructs - allocate(okt1[*], SOURCE=okt1src) - allocate(okt2[*], SOURCE=okt2src) - allocate(okt3[*], SOURCE=okt3src) - allocate(whatever[*], SOURCE=okt3src) - allocate(recok, SOURCE=recoksrc) - - allocate(nokt1[*]) - allocate(nokt2[*]) - allocate(nokt3[*]) - allocate(nokt4[*]) - allocate(nokt5[*]) - allocate(nokt6(10)[*]) - allocate(lock(10)[*]) - allocate(event[*]) - allocate(recnok[*]) - - allocate(nokt1[*], MOLD=nokt1src) - allocate(nokt2[*], MOLD=nokt2src) - allocate(nokt3[*], MOLD=nokt3src) - allocate(nokt4[*], MOLD=nokt4src) - allocate(nokt5[*], MOLD=nokt5src) - allocate(nokt6[*], MOLD=nokt6src) - allocate(lock[*], MOLD=locksrc) - allocate(event[*], MOLD=eventsrc) - allocate(recnok[*],MOLD=recnoksrc) - allocate(whatever[*],MOLD=nokt6src) - - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(nokt1[*], SOURCE=nokt1src) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(nokt2[*], SOURCE=nokt2src) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(nokt3[*], SOURCE=nokt3src) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(nokt4[*], SOURCE=nokt4src) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(nokt5[*], SOURCE=nokt5src) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(nokt6[*], SOURCE=nokt6src) - !ERROR: SOURCE expression type must not be EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(lock[*], SOURCE=locksrc) - !ERROR: SOURCE expression type must not be EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(event[*], SOURCE=eventsrc) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(recnok[*],SOURCE=recnoksrc) - !ERROR: SOURCE expression type must not have potential subobject component of type EVENT_TYPE or LOCK_TYPE from ISO_FORTRAN_ENV - allocate(whatever[*],SOURCE=nokt5src) -end subroutine - - -subroutine C948_b() - use not_iso_fortran_env !type restriction do not apply - - type oktype1 - type(event_type), allocatable :: event - end type - - type oktype2 - type(lock_type) :: lock - end type - - type(oktype1), allocatable :: okt1[:] - class(oktype2), allocatable :: okt2[:] - type(event_type), allocatable :: team[:] - class(lock_type), allocatable :: lock[:] - - type(oktype1), allocatable :: okt1src[:] - class(oktype2), allocatable :: okt2src[:] - class(event_type), allocatable :: teamsrc[:] - type(lock_type), allocatable :: locksrc[:] - - allocate(okt1[*], SOURCE=okt1src) - allocate(okt2[*], SOURCE=okt2src) - allocate(team[*], SOURCE=teamsrc) - allocate(lock[*], SOURCE=locksrc) -end subroutine diff --git a/test-lit/Semantics/altreturn01.f90 b/test-lit/Semantics/altreturn01.f90 deleted file mode 100644 index 0449ff774c36..000000000000 --- a/test-lit/Semantics/altreturn01.f90 +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check calls with alt returns - - CALL TEST (N, *100, *200 ) - PRINT *,'Normal return' - STOP -100 PRINT *,'First alternate return' - STOP -200 PRINT *,'Secondnd alternate return' - END diff --git a/test-lit/Semantics/altreturn02.f90 b/test-lit/Semantics/altreturn02.f90 deleted file mode 100644 index 74ff96933a83..000000000000 --- a/test-lit/Semantics/altreturn02.f90 +++ /dev/null @@ -1,8 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check subroutine with alt return - - SUBROUTINE TEST (N, *, *) - IF ( N .EQ. 0 ) RETURN - IF ( N .EQ. 1 ) RETURN 1 - RETURN 2 - END diff --git a/test-lit/Semantics/altreturn03.f90 b/test-lit/Semantics/altreturn03.f90 deleted file mode 100644 index 73a63860efc7..000000000000 --- a/test-lit/Semantics/altreturn03.f90 +++ /dev/null @@ -1,22 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for various alt return error conditions - - SUBROUTINE TEST (N, *, *) - REAL :: R - COMPLEX :: Z - INTEGER, DIMENSION(2) :: B - IF ( N .EQ. 0 ) RETURN - IF ( N .EQ. 1 ) RETURN 1 - IF ( N .EQ. 2 ) RETURN 2 - IF ( N .EQ. 3 ) RETURN 3 - IF ( N .EQ. 4 ) RETURN N - IF ( N .EQ. 5 ) RETURN N * N - IF ( N .EQ. 6 ) RETURN B(N) - !ERROR: Must be a scalar value, but is a rank-1 array - IF ( N .EQ. 7 ) RETURN B - !ERROR: Must have INTEGER type, but is REAL(4) - IF ( N .EQ. 8 ) RETURN R - !ERROR: Must have INTEGER type, but is COMPLEX(4) - IF ( N .EQ. 9 ) RETURN Z - RETURN 2 - END diff --git a/test-lit/Semantics/altreturn04.f90 b/test-lit/Semantics/altreturn04.f90 deleted file mode 100644 index e3714fb92223..000000000000 --- a/test-lit/Semantics/altreturn04.f90 +++ /dev/null @@ -1,7 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Functions cannot use alt return - -REAL FUNCTION altreturn01(X) -!ERROR: RETURN with expression is only allowed in SUBROUTINE subprogram - RETURN 1 -END diff --git a/test-lit/Semantics/altreturn05.f90 b/test-lit/Semantics/altreturn05.f90 deleted file mode 100644 index cbd222cba9e7..000000000000 --- a/test-lit/Semantics/altreturn05.f90 +++ /dev/null @@ -1,7 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test extension: RETURN from main program - -return !ok -!ERROR: RETURN with expression is only allowed in SUBROUTINE subprogram -return 0 -end diff --git a/test-lit/Semantics/assign01.f90 b/test-lit/Semantics/assign01.f90 deleted file mode 100644 index bd41a5b5cc9f..000000000000 --- a/test-lit/Semantics/assign01.f90 +++ /dev/null @@ -1,54 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! 10.2.3.1(2) All masks and LHS of assignments in a WHERE must conform - -subroutine s1 - integer :: a1(10), a2(10) - logical :: m1(10), m2(5,5) - m1 = .true. - m2 = .false. - a1 = [((i),i=1,10)] - where (m1) - a2 = 1 - !ERROR: Must have rank 1 to match prior mask or assignment of WHERE construct - elsewhere (m2) - a2 = 2 - elsewhere - a2 = 3 - end where -end - -subroutine s2 - logical, allocatable :: m1(:), m4(:,:) - logical :: m2(2), m3(3) - where(m1) - where(m2) - end where - !ERROR: Dimension 1 must have extent 2 to match prior mask or assignment of WHERE construct - where(m3) - end where - !ERROR: Must have rank 1 to match prior mask or assignment of WHERE construct - where(m4) - end where - endwhere - where(m1) - where(m3) - end where - !ERROR: Dimension 1 must have extent 3 to match prior mask or assignment of WHERE construct - elsewhere(m2) - end where -end - -subroutine s3 - logical, allocatable :: m1(:,:) - logical :: m2(4,2) - real :: x(4,4), y(4,4) - real :: a(4,5), b(4,5) - where(m1) - x = y - !ERROR: Dimension 2 must have extent 4 to match prior mask or assignment of WHERE construct - a = b - !ERROR: Dimension 2 must have extent 4 to match prior mask or assignment of WHERE construct - where(m2) - end where - end where -end diff --git a/test-lit/Semantics/assign02.f90 b/test-lit/Semantics/assign02.f90 deleted file mode 100644 index e97be64d6aab..000000000000 --- a/test-lit/Semantics/assign02.f90 +++ /dev/null @@ -1,194 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Pointer assignment constraints 10.2.2.2 - -module m1 - type :: t(k) - integer, kind :: k - end type - type t2 - sequence - end type -contains - - ! C853 - subroutine s0 - !ERROR: 'p1' may not have both the POINTER and TARGET attributes - real, pointer :: p1, p3 - allocatable :: p2 - !ERROR: 'sin' may not have both the POINTER and INTRINSIC attributes - real, intrinsic, pointer :: sin - target :: p1 - !ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes - pointer :: p2 - !ERROR: 'a' may not have the POINTER attribute because it is a coarray - real, pointer :: a(:)[*] - end - - ! C1015 - subroutine s1 - real, target :: r - real(8), target :: r8 - logical, target :: l - real, pointer :: p - p => r - !ERROR: Target type REAL(8) is not compatible with pointer type REAL(4) - p => r8 - !ERROR: Target type LOGICAL(4) is not compatible with pointer type REAL(4) - p => l - end - - ! C1019 - subroutine s2 - real, target :: r1(4), r2(4,4) - real, pointer :: p(:) - p => r1 - !ERROR: Pointer has rank 1 but target has rank 2 - p => r2 - end - - ! C1015 - subroutine s3 - type(t(1)), target :: x1 - type(t(2)), target :: x2 - type(t(1)), pointer :: p - p => x1 - !ERROR: Target type t(k=2_4) is not compatible with pointer type t(k=1_4) - p => x2 - end - - ! C1016 - subroutine s4(x) - class(*), target :: x - type(t(1)), pointer :: p1 - type(t2), pointer :: p2 - class(*), pointer :: p3 - real, pointer :: p4 - p2 => x ! OK - not extensible - p3 => x ! OK - unlimited polymorphic - !ERROR: Pointer type must be unlimited polymorphic or non-extensible derived type when target is unlimited polymorphic - p1 => x - !ERROR: Pointer type must be unlimited polymorphic or non-extensible derived type when target is unlimited polymorphic - p4 => x - end - - ! C1020 - subroutine s5 - real, target :: x[*] - real, target, volatile :: y[*] - real, pointer :: p - real, pointer, volatile :: q - p => x - !ERROR: Pointer must be VOLATILE when target is a VOLATILE coarray - p => y - !ERROR: Pointer may not be VOLATILE when target is a non-VOLATILE coarray - q => x - q => y - end - - ! C1021, C1023 - subroutine s6 - real, target :: x - real :: p - type :: tp - real, pointer :: a - real :: b - end type - type(tp) :: y - !ERROR: 'p' is not a pointer - p => x - y%a => x - !ERROR: 'b' is not a pointer - y%b => x - end - - !C1025 (R1037) The expr shall be a designator that designates a - !variable with either the TARGET or POINTER attribute and is not - !an array section with a vector subscript, or it shall be a reference - !to a function that returns a data pointer. - subroutine s7 - real, target :: a - real, pointer :: b - real, pointer :: c - real :: d - b => a - c => b - !ERROR: In assignment to object pointer 'b', the target 'd' is not an object with POINTER or TARGET attributes - b => d - end - - ! C1025 - subroutine s8 - real :: a(10) - integer :: b(10) - real, pointer :: p(:) - !ERROR: An array section with a vector subscript may not be a pointer target - p => a(b) - end - - ! C1025 - subroutine s9 - real, target :: x - real, pointer :: p - p => f1() - !ERROR: pointer 'p' is associated with the result of a reference to function 'f2' that is a not a pointer - p => f2() - contains - function f1() - real, pointer :: f1 - f1 => x - end - function f2() - real :: f2 - f2 = x - end - end - - ! C1026 (R1037) A data-target shall not be a coindexed object. - subroutine s10 - real, target :: a[*] - real, pointer :: b - !ERROR: A coindexed object may not be a pointer target - b => a[1] - end - -end - -module m2 - type :: t1 - real :: a - end type - type :: t2 - type(t1) :: b - type(t1), pointer :: c - real :: d - end type -end - -subroutine s2 - use m2 - real, pointer :: p - type(t2), target :: x - type(t2) :: y - !OK: x has TARGET attribute - p => x%b%a - !OK: c has POINTER attribute - p => y%c%a - !ERROR: In assignment to object pointer 'p', the target 'y%b%a' is not an object with POINTER or TARGET attributes - p => y%b%a - associate(z => x%b) - !OK: x has TARGET attribute - p => z%a - end associate - associate(z => y%c) - !OK: c has POINTER attribute - p => z%a - end associate - associate(z => y%b) - !ERROR: In assignment to object pointer 'p', the target 'z%a' is not an object with POINTER or TARGET attributes - p => z%a - end associate - associate(z => y%b%a) - !ERROR: In assignment to object pointer 'p', the target 'z' is not an object with POINTER or TARGET attributes - p => z - end associate -end diff --git a/test-lit/Semantics/assign03.f90 b/test-lit/Semantics/assign03.f90 deleted file mode 100644 index 53c69f583649..000000000000 --- a/test-lit/Semantics/assign03.f90 +++ /dev/null @@ -1,196 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Pointer assignment constraints 10.2.2.2 (see also assign02.f90) - -module m - interface - subroutine s(i) - integer i - end - end interface - type :: t - procedure(s), pointer, nopass :: p - real, pointer :: q - end type -contains - ! C1027 - subroutine s1 - type(t), allocatable :: a(:) - type(t), allocatable :: b[:] - a(1)%p => s - !ERROR: Procedure pointer may not be a coindexed object - b[1]%p => s - end - ! C1028 - subroutine s2 - type(t) :: a - a%p => s - !ERROR: In assignment to object pointer 'q', the target 's' is a procedure designator - a%q => s - end - ! C1029 - subroutine s3 - type(t) :: a - a%p => f() ! OK: pointer-valued function - !ERROR: Subroutine pointer 'p' may not be associated with function designator 'f' - a%p => f - contains - function f() - procedure(s), pointer :: f - f => s - end - end - - ! C1030 and 10.2.2.4 - procedure names as target of procedure pointer - subroutine s4(s_dummy) - procedure(s), intent(in) :: s_dummy - procedure(s), pointer :: p, q - procedure(), pointer :: r - integer :: i - external :: s_external - p => s_dummy - p => s_internal - p => s_module - q => p - r => s_external - contains - subroutine s_internal(i) - integer i - end - end - subroutine s_module(i) - integer i - end - - ! 10.2.2.4(3) - subroutine s5 - procedure(f_pure), pointer :: p_pure - procedure(f_impure), pointer :: p_impure - !ERROR: Procedure pointer 'p_elemental' may not be ELEMENTAL - procedure(f_elemental), pointer :: p_elemental - p_pure => f_pure - p_impure => f_impure - p_impure => f_pure - !ERROR: PURE procedure pointer 'p_pure' may not be associated with non-PURE procedure designator 'f_impure' - p_pure => f_impure - contains - pure integer function f_pure() - f_pure = 1 - end - integer function f_impure() - f_impure = 1 - end - elemental integer function f_elemental() - f_elemental = 1 - end - end - - ! 10.2.2.4(4) - subroutine s6 - procedure(s), pointer :: p, q - procedure(), pointer :: r - external :: s_external - !ERROR: Procedure pointer 'p' with explicit interface may not be associated with procedure designator 's_external' with implicit interface - p => s_external - !ERROR: Procedure pointer 'r' with implicit interface may not be associated with procedure designator 's_module' with explicit interface - r => s_module - end - - ! 10.2.2.4(5) - subroutine s7 - procedure(real) :: f_external - external :: s_external - procedure(), pointer :: p_s - procedure(real), pointer :: p_f - p_f => f_external - p_s => s_external - !ERROR: Subroutine pointer 'p_s' may not be associated with function designator 'f_external' - p_s => f_external - !ERROR: Function pointer 'p_f' may not be associated with subroutine designator 's_external' - p_f => s_external - end - - ! C1017: bounds-spec - subroutine s8 - real, target :: x(10, 10) - real, pointer :: p(:, :) - p(2:,3:) => x - !ERROR: Pointer 'p' has rank 2 but the number of bounds specified is 1 - p(2:) => x - end - - ! bounds-remapping - subroutine s9 - real, target :: x(10, 10), y(100) - real, pointer :: p(:, :) - ! C1018 - !ERROR: Pointer 'p' has rank 2 but the number of bounds specified is 1 - p(1:100) => x - ! 10.2.2.3(9) - !ERROR: Pointer bounds remapping target must have rank 1 or be simply contiguous - p(1:5,1:5) => x(1:10,::2) - ! 10.2.2.3(9) - !ERROR: Pointer bounds require 25 elements but target has only 20 - p(1:5,1:5) => x(:,1:2) - !OK - rhs has rank 1 and enough elements - p(1:5,1:5) => y(1:100:2) - end - - subroutine s10 - integer, pointer :: p(:) - type :: t - integer :: a(4, 4) - integer :: b - end type - type(t), target :: x - type(t), target :: y(10,10) - integer :: v(10) - p(1:16) => x%a - p(1:8) => x%a(:,3:4) - p(1:1) => x%b ! We treat scalars as simply contiguous - p(1:1) => x%a(1,1) - p(1:1) => y(1,1)%a(1,1) - p(1:1) => y(:,1)%a(1,1) ! Rank 1 RHS - !ERROR: Pointer bounds remapping target must have rank 1 or be simply contiguous - p(1:4) => x%a(::2,::2) - !ERROR: Pointer bounds remapping target must have rank 1 or be simply contiguous - p(1:100) => y(:,:)%b - !ERROR: Pointer bounds remapping target must have rank 1 or be simply contiguous - p(1:100) => y(:,:)%a(1,1) - !ERROR: Pointer bounds remapping target must have rank 1 or be simply contiguous - !ERROR: An array section with a vector subscript may not be a pointer target - p(1:4) => x%a(:,v) - end - - subroutine s11 - complex, target :: x(10,10) - complex, pointer :: p(:) - real, pointer :: q(:) - p(1:100) => x(:,:) - q(1:10) => x(1,:)%im - !ERROR: Pointer bounds remapping target must have rank 1 or be simply contiguous - q(1:100) => x(:,:)%re - end - - ! Check is_contiguous, which is usually the same as when pointer bounds - ! remapping is used. If it's not simply contiguous it's not constant so - ! an error is reported. - subroutine s12 - integer, pointer :: p(:) - type :: t - integer :: a(4, 4) - integer :: b - end type - type(t), target :: x - type(t), target :: y(10,10) - integer :: v(10) - logical, parameter :: l1 = is_contiguous(x%a(:,:)) - logical, parameter :: l2 = is_contiguous(y(1,1)%a(1,1)) - !ERROR: Must be a constant value - logical, parameter :: l3 = is_contiguous(y(:,1)%a(1,1)) - !ERROR: Must be a constant value - logical, parameter :: l4 = is_contiguous(x%a(:,v)) - !ERROR: Must be a constant value - logical, parameter :: l5 = is_contiguous(y(v,1)%a(1,1)) - end - -end diff --git a/test-lit/Semantics/bad-forward-type.f90 b/test-lit/Semantics/bad-forward-type.f90 deleted file mode 100644 index 62ad9d4b2b4c..000000000000 --- a/test-lit/Semantics/bad-forward-type.f90 +++ /dev/null @@ -1,70 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Forward references to derived types (error cases) - -!ERROR: The derived type 'undef' was forward-referenced but not defined -type(undef) function f1() - call sub(f1) -end function - -!ERROR: The derived type 'undef' was forward-referenced but not defined -type(undef) function f2() result(r) - call sub(r) -end function - -!ERROR: The derived type 'undefpdt' was forward-referenced but not defined -type(undefpdt(1)) function f3() - call sub(f3) -end function - -!ERROR: The derived type 'undefpdt' was forward-referenced but not defined -type(undefpdt(1)) function f4() result(r) - call sub(f4) -end function - -!ERROR: 'bad' is not the name of a parameter for derived type 'pdt' -type(pdt(bad=1)) function f5() - type :: pdt(good) - integer, kind :: good = kind(0) - integer(kind=good) :: n - end type -end function - -subroutine s1(q1) - !ERROR: The derived type 'undef' was forward-referenced but not defined - implicit type(undef)(q) -end subroutine - -subroutine s2(q1) - !ERROR: The derived type 'undefpdt' was forward-referenced but not defined - implicit type(undefpdt(1))(q) -end subroutine - -subroutine s3 - type :: t1 - !ERROR: Derived type 'undef' not found - type(undef) :: x - end type -end subroutine - -subroutine s4 - type :: t1 - !ERROR: Derived type 'undefpdt' not found - type(undefpdt(1)) :: x - end type -end subroutine - -subroutine s5(x) - !ERROR: Derived type 'undef' not found - type(undef) :: x -end subroutine - -subroutine s6(x) - !ERROR: Derived type 'undefpdt' not found - type(undefpdt(1)) :: x -end subroutine - -subroutine s7(x) - !ERROR: Derived type 'undef' not found - type, extends(undef) :: t - end type -end subroutine diff --git a/test-lit/Semantics/bindings01.f90 b/test-lit/Semantics/bindings01.f90 deleted file mode 100644 index 54aaacd2e9f8..000000000000 --- a/test-lit/Semantics/bindings01.f90 +++ /dev/null @@ -1,114 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Confirm enforcement of constraints and restrictions in 7.5.7.3 -! and C779-C785. - -module m - !ERROR: An ABSTRACT derived type must be extensible - type, abstract, bind(c) :: badAbstract1 - end type - !ERROR: An ABSTRACT derived type must be extensible - type, abstract :: badAbstract2 - sequence - end type - type, abstract :: abstract - contains - !ERROR: DEFERRED is required when an interface-name is provided - procedure(s1), pass :: ab1 - !ERROR: Type-bound procedure 'ab3' may not be both DEFERRED and NON_OVERRIDABLE - procedure(s1), deferred, non_overridable :: ab3 - !ERROR: DEFERRED is only allowed when an interface-name is provided - procedure, deferred, non_overridable :: ab4 => s1 - end type - type :: nonoverride - contains - procedure, non_overridable, nopass :: no1 => s1 - end type - type, extends(nonoverride) :: nonoverride2 - end type - type, extends(nonoverride2) :: nonoverride3 - contains - !ERROR: Override of NON_OVERRIDABLE 'no1' is not permitted - procedure, nopass :: no1 => s1 - end type - type, abstract :: missing - contains - procedure(s4), deferred :: am1 - end type - !ERROR: Non-ABSTRACT extension of ABSTRACT derived type 'missing' lacks a binding for DEFERRED procedure 'am1' - type, extends(missing) :: concrete - end type - type, extends(missing) :: intermediate - contains - procedure :: am1 => s7 - end type - type, extends(intermediate) :: concrete2 ! ensure no false missing binding error - end type - type, bind(c) :: inextensible1 - end type - !ERROR: The parent type is not extensible - type, extends(inextensible1) :: badExtends1 - end type - type :: inextensible2 - sequence - end type - !ERROR: The parent type is not extensible - type, extends(inextensible2) :: badExtends2 - end type - !ERROR: Derived type 'real' not found - type, extends(real) :: badExtends3 - end type - type :: base - real :: component - contains - !ERROR: Procedure bound to non-ABSTRACT derived type 'base' may not be DEFERRED - procedure(s2), deferred :: bb1 - !ERROR: DEFERRED is only allowed when an interface-name is provided - procedure, deferred :: bb2 => s2 - end type - type, extends(base) :: extension - contains - !ERROR: A type-bound procedure binding may not have the same name as a parent component - procedure :: component => s3 - end type - type :: nopassBase - contains - procedure, nopass :: tbp => s1 - end type - type, extends(nopassBase) :: passExtends - contains - !ERROR: A passed-argument type-bound procedure may not override a NOPASS procedure - procedure :: tbp => s5 - end type - type :: passBase - contains - procedure :: tbp => s6 - end type - type, extends(passBase) :: nopassExtends - contains - !ERROR: A NOPASS type-bound procedure may not override a passed-argument procedure - procedure, nopass :: tbp => s1 - end type - contains - subroutine s1(x) - class(abstract), intent(in) :: x - end subroutine s1 - subroutine s2(x) - class(base), intent(in) :: x - end subroutine s2 - subroutine s3(x) - class(extension), intent(in) :: x - end subroutine s3 - subroutine s4(x) - class(missing), intent(in) :: x - end subroutine s4 - subroutine s5(x) - class(passExtends), intent(in) :: x - end subroutine s5 - subroutine s6(x) - class(passBase), intent(in) :: x - end subroutine s6 - subroutine s7(x) - class(intermediate), intent(in) :: x - end subroutine s7 -end module - diff --git a/test-lit/Semantics/block-data01.f90 b/test-lit/Semantics/block-data01.f90 deleted file mode 100644 index 164709118f6f..000000000000 --- a/test-lit/Semantics/block-data01.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test BLOCK DATA subprogram (14.3) -block data foo - !ERROR: IMPORT is not allowed in a BLOCK DATA subprogram - import - real :: pi = asin(-1.0) ! ok - !ERROR: An initialized variable in BLOCK DATA must be in a COMMON block - integer :: notInCommon = 1 - integer :: uninitialized ! ok - !ERROR: 'p' may not appear in a BLOCK DATA subprogram - procedure(sin), pointer :: p => cos - !ERROR: 'p' is already declared as a procedure - common /block/ pi, p - real :: inBlankCommon - data inBlankCommon / 1.0 / - common inBlankCommon - !ERROR: An initialized variable in BLOCK DATA must be in a COMMON block - integer :: inDataButNotCommon - data inDataButNotCommon /1/ - !ERROR: Two objects in the same EQUIVALENCE set may not be members of distinct COMMON blocks - integer :: inCommonA, inCommonB - common /a/ inCommonA, /b/ inCommonB - equivalence(inCommonA, inCommonB) - integer :: inCommonD, initialized ! ok - common /d/ inCommonD - equivalence(inCommonD, initialized) - data initialized /2/ -end block data diff --git a/test-lit/Semantics/blockconstruct01.f90 b/test-lit/Semantics/blockconstruct01.f90 deleted file mode 100644 index 7f7eec5b56c3..000000000000 --- a/test-lit/Semantics/blockconstruct01.f90 +++ /dev/null @@ -1,66 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1107 -- COMMON, EQUIVALENCE, INTENT, NAMELIST, OPTIONAL, VALUE or -! STATEMENT FUNCTIONS not allow in specification part - -subroutine s1_c1107 - common /nl/x - block - !ERROR: COMMON statement is not allowed in a BLOCK construct - common /nl/y - end block -end - -subroutine s2_c1107 - real x(100), i(5) - integer y(100), j(5) - equivalence (x, y) - block - !ERROR: EQUIVALENCE statement is not allowed in a BLOCK construct - equivalence (i, j) - end block -end - -subroutine s3_c1107(x_in, x_out) - integer x_in, x_out - intent(in) x_in - block - !ERROR: INTENT statement is not allowed in a BLOCK construct - intent(out) x_out - end block -end - -subroutine s4_c1107 - namelist /nl/x - block - !ERROR: NAMELIST statement is not allowed in a BLOCK construct - namelist /nl/y - end block -end - -subroutine s5_c1107(x,y) - integer x, y - value x - block - !ERROR: VALUE statement is not allowed in a BLOCK construct - value y - end block -end - -subroutine s6_c1107(x, y) - integer x, y - optional x - block - !ERROR: OPTIONAL statement is not allowed in a BLOCK construct - optional y - end block -end - -subroutine s7_c1107 - integer x - inc(x) = x + 1 - block - !ERROR: STATEMENT FUNCTION statement is not allowed in a BLOCK construct - dec(x) = x - 1 - end block -end - diff --git a/test-lit/Semantics/blockconstruct02.f90 b/test-lit/Semantics/blockconstruct02.f90 deleted file mode 100644 index 2a1a95f312bf..000000000000 --- a/test-lit/Semantics/blockconstruct02.f90 +++ /dev/null @@ -1,15 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1108 -- Save statement in a BLOCK construct shall not conatin a -! saved-entity-list that does not specify a common-block-name - -program main - integer x, y, z - real r, s, t - common /argmnt2/ r, s, t - !ERROR: 'argmnt1' appears as a COMMON block in a SAVE statement but not in a COMMON statement - save /argmnt1/ - block - !ERROR: SAVE statement in BLOCK construct may not contain a common block name 'argmnt2' - save /argmnt2/ - end block -end program diff --git a/test-lit/Semantics/blockconstruct03.f90 b/test-lit/Semantics/blockconstruct03.f90 deleted file mode 100644 index df5aff7699ea..000000000000 --- a/test-lit/Semantics/blockconstruct03.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Tests implemented for this standard: -! Block Construct -! C1109 - -subroutine s5_c1109 - b1:block - !ERROR: BLOCK construct name mismatch - end block b2 -end - diff --git a/test-lit/Semantics/c_f_pointer.f90 b/test-lit/Semantics/c_f_pointer.f90 deleted file mode 100644 index 1064461c509d..000000000000 --- a/test-lit/Semantics/c_f_pointer.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Enforce 18.2.3.3 - -program test - use iso_c_binding, only: c_ptr, c_f_pointer - type(c_ptr) :: scalarC, arrayC(1) - type :: with_pointer - integer, pointer :: p - end type - type(with_pointer) :: coindexed[*] - integer, pointer :: scalarIntF, arrayIntF(:) - character(len=:), pointer :: charDeferredF - integer :: j - call c_f_pointer(scalarC, scalarIntF) ! ok - call c_f_pointer(scalarC, arrayIntF, [1_8]) ! ok - call c_f_pointer(shape=[1_8], cptr=scalarC, fptr=arrayIntF) ! ok - call c_f_pointer(scalarC, shape=[1_8], fptr=arrayIntF) ! ok - !ERROR: A positional actual argument may not appear after any keyword arguments - call c_f_pointer(scalarC, fptr=arrayIntF, [1_8]) - !ERROR: CPTR= argument to C_F_POINTER() must be a C_PTR - call c_f_pointer(j, scalarIntF) - !ERROR: CPTR= argument to C_F_POINTER() must be scalar - call c_f_pointer(arrayC, scalarIntF) - !ERROR: SHAPE= argument to C_F_POINTER() must appear when FPTR= is an array - call c_f_pointer(scalarC, arrayIntF) - !ERROR: SHAPE= argument to C_F_POINTER() may not appear when FPTR= is scalar - call c_f_pointer(scalarC, scalarIntF, [1_8]) - !ERROR: FPTR= argument to C_F_POINTER() may not have a deferred type parameter - call c_f_pointer(scalarC, charDeferredF) - !ERROR: FPTR= argument to C_F_POINTER() may not be a coindexed object - call c_f_pointer(scalarC, coindexed[0]%p) -end program diff --git a/test-lit/Semantics/call01.f90 b/test-lit/Semantics/call01.f90 deleted file mode 100644 index 88274dd42844..000000000000 --- a/test-lit/Semantics/call01.f90 +++ /dev/null @@ -1,117 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Confirm enforcement of constraints and restrictions in 15.6.2.1 - -non_recursive function f01(n) result(res) - integer, value :: n - integer :: res - if (n <= 0) then - res = n - else - !ERROR: NON_RECURSIVE procedure 'f01' cannot call itself - res = n * f01(n-1) ! 15.6.2.1(3) - end if -end function - -non_recursive function f02(n) result(res) - integer, value :: n - integer :: res - if (n <= 0) then - res = n - else - res = nested() - end if - contains - integer function nested - !ERROR: NON_RECURSIVE procedure 'f02' cannot call itself - nested = n * f02(n-1) ! 15.6.2.1(3) - end function nested -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot be RECURSIVE -recursive character(*) function f03(n) ! C723 - integer, value :: n - f03 = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot be RECURSIVE -recursive function f04(n) result(res) ! C723 - integer, value :: n - character(*) :: res - res = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot return an array -character(*) function f05() - dimension :: f05(1) ! C723 - f05(1) = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot return an array -function f06() - character(*) :: f06(1) ! C723 - f06(1) = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot return a POINTER -character(*) function f07() - pointer :: f07 ! C723 - character, target :: a = ' ' - f07 => a -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot return a POINTER -function f08() - character(*), pointer :: f08 ! C723 - character, target :: a = ' ' - f08 => a -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot be PURE -pure character(*) function f09() ! C723 - f09 = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot be PURE -pure function f10() - character(*) :: f10 ! C723 - f10 = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot be ELEMENTAL -elemental character(*) function f11(n) ! C723 - integer, value :: n - f11 = '' -end function - -!ERROR: An assumed-length CHARACTER(*) function cannot be ELEMENTAL -elemental function f12(n) - character(*) :: f12 ! C723 - integer, value :: n - f12 = '' -end function - -function f13(n) result(res) - integer, value :: n - character(*) :: res - if (n <= 0) then - res = '' - else - !ERROR: Assumed-length CHARACTER(*) function 'f13' cannot call itself - res = f13(n-1) ! 15.6.2.1(3) - end if -end function - -function f14(n) result(res) - integer, value :: n - character(*) :: res - if (n <= 0) then - res = '' - else - res = nested() - end if - contains - character(1) function nested - !ERROR: Assumed-length CHARACTER(*) function 'f14' cannot call itself - nested = f14(n-1) ! 15.6.2.1(3) - end function nested -end function diff --git a/test-lit/Semantics/call02.f90 b/test-lit/Semantics/call02.f90 deleted file mode 100644 index 2d23274da1b0..000000000000 --- a/test-lit/Semantics/call02.f90 +++ /dev/null @@ -1,67 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! 15.5.1 procedure reference constraints and restrictions - -subroutine s01(elem, subr) - interface - elemental real function elem(x) - real, intent(in), value :: x - end function - subroutine subr(dummy) - procedure(sin) :: dummy - end subroutine - !ERROR: A dummy procedure may not be ELEMENTAL - subroutine badsubr(dummy) - import :: elem - procedure(elem) :: dummy - end subroutine - end interface - call subr(cos) ! not an error - !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument - call subr(elem) ! C1533 -end subroutine - -module m01 - procedure(sin) :: elem01 - interface - elemental real function elem02(x) - real, value :: x - end function - subroutine callme(f) - external f - end subroutine - end interface - contains - elemental real function elem03(x) - real, value :: x - end function - subroutine test - call callme(cos) ! not an error - !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument - call callme(elem01) ! C1533 - !ERROR: Non-intrinsic ELEMENTAL procedure 'elem02' may not be passed as an actual argument - call callme(elem02) ! C1533 - !ERROR: Non-intrinsic ELEMENTAL procedure 'elem03' may not be passed as an actual argument - call callme(elem03) ! C1533 - !ERROR: Non-intrinsic ELEMENTAL procedure 'elem04' may not be passed as an actual argument - call callme(elem04) ! C1533 - contains - elemental real function elem04(x) - real, value :: x - end function - end subroutine -end module - -module m02 - type :: t - integer, pointer :: ptr - end type - type(t) :: coarray[*] - contains - subroutine callee(x) - type(t), intent(in) :: x - end subroutine - subroutine test - !ERROR: Coindexed object 'coarray' with POINTER ultimate component '%ptr' cannot be associated with dummy argument 'x=' - call callee(coarray[1]) ! C1537 - end subroutine -end module diff --git a/test-lit/Semantics/call03.f90 b/test-lit/Semantics/call03.f90 deleted file mode 100644 index 098106aed45e..000000000000 --- a/test-lit/Semantics/call03.f90 +++ /dev/null @@ -1,312 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.5.2.4 constraints and restrictions for non-POINTER non-ALLOCATABLE -! dummy arguments. - -module m01 - type :: t - end type - type :: pdt(n) - integer, len :: n - end type - type :: tbp - contains - procedure :: binding => subr01 - end type - type :: final - contains - final :: subr02 - end type - type :: alloc - real, allocatable :: a(:) - end type - type :: ultimateCoarray - real, allocatable :: a[:] - end type - - contains - - subroutine subr01(this) - class(tbp), intent(in) :: this - end subroutine - subroutine subr02(this) - class(final), intent(in) :: this - end subroutine - - subroutine poly(x) - class(t), intent(in) :: x - end subroutine - subroutine polyassumedsize(x) - class(t), intent(in) :: x(*) - end subroutine - subroutine assumedsize(x) - real :: x(*) - end subroutine - subroutine assumedrank(x) - real :: x(..) - end subroutine - subroutine assumedtypeandsize(x) - type(*) :: x(*) - end subroutine - subroutine assumedshape(x) - real :: x(:) - end subroutine - subroutine contiguous(x) - real, contiguous :: x(:) - end subroutine - subroutine intentout(x) - real, intent(out) :: x - end subroutine - subroutine intentinout(x) - real, intent(in out) :: x - end subroutine - subroutine asynchronous(x) - real, asynchronous :: x - end subroutine - subroutine asynchronousValue(x) - real, asynchronous, value :: x - end subroutine - subroutine volatile(x) - real, volatile :: x - end subroutine - subroutine pointer(x) - real, pointer :: x(:) - end subroutine - subroutine valueassumedsize(x) - real, intent(in) :: x(*) - end subroutine - subroutine volatileassumedsize(x) - real, volatile :: x(*) - end subroutine - subroutine volatilecontiguous(x) - real, volatile :: x(*) - end subroutine - - subroutine test01(x) ! 15.5.2.4(2) - class(t), intent(in) :: x[*] - !ERROR: Coindexed polymorphic object may not be associated with a polymorphic dummy argument 'x=' - call poly(x[1]) - end subroutine - - subroutine mono(x) - type(t), intent(in) :: x - end subroutine - subroutine test02(x) ! 15.5.2.4(2) - class(t), intent(in) :: x(*) - !ERROR: Assumed-size polymorphic array may not be associated with a monomorphic dummy argument 'x=' - call mono(x) - end subroutine - - subroutine typestar(x) - type(*), intent(in) :: x - end subroutine - subroutine test03 ! 15.5.2.4(2) - type(pdt(0)) :: x - !ERROR: Actual argument associated with TYPE(*) dummy argument 'x=' may not have a parameterized derived type - call typestar(x) - end subroutine - - subroutine test04 ! 15.5.2.4(2) - type(tbp) :: x - !ERROR: Actual argument associated with TYPE(*) dummy argument 'x=' may not have type-bound procedure 'binding' - call typestar(x) - end subroutine - - subroutine test05 ! 15.5.2.4(2) - type(final) :: x - !ERROR: Actual argument associated with TYPE(*) dummy argument 'x=' may not have FINAL subroutine 'subr02' - call typestar(x) - end subroutine - - subroutine ch2(x) - character(2), intent(in out) :: x - end subroutine - subroutine test06 ! 15.5.2.4(4) - character :: ch1 - ! The actual argument is converted to a padded expression. - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call ch2(ch1) - end subroutine - - subroutine out01(x) - type(alloc) :: x - end subroutine - subroutine test07(x) ! 15.5.2.4(6) - type(alloc) :: x[*] - !ERROR: Coindexed actual argument with ALLOCATABLE ultimate component '%a' must be associated with a dummy argument 'x=' with VALUE or INTENT(IN) attributes - call out01(x[1]) - end subroutine - - subroutine test08(x) ! 15.5.2.4(13) - real :: x(1)[*] - !ERROR: Coindexed scalar actual argument must be associated with a scalar dummy argument 'x=' - call assumedsize(x(1)[1]) - end subroutine - - subroutine charray(x) - character :: x(10) - end subroutine - subroutine test09(ashape, polyarray, c) ! 15.5.2.4(14), 15.5.2.11 - real :: x, arr(10) - real, pointer :: p(:) - real :: ashape(:) - class(t) :: polyarray(*) - character(10) :: c(:) - !ERROR: Whole scalar actual argument may not be associated with a dummy argument 'x=' array - call assumedsize(x) - !ERROR: Scalar POINTER target may not be associated with a dummy argument 'x=' array - call assumedsize(p(1)) - !ERROR: Element of assumed-shape array may not be associated with a dummy argument 'x=' array - call assumedsize(ashape(1)) - !ERROR: Polymorphic scalar may not be associated with a dummy argument 'x=' array - call polyassumedsize(polyarray(1)) - call charray(c(1:1)) ! not an error if character - call assumedsize(arr(1)) ! not an error if element in sequence - call assumedrank(x) ! not an error - call assumedtypeandsize(x) ! not an error - end subroutine - - subroutine test10(a) ! 15.5.2.4(16) - real :: scalar, matrix(2,3) - real :: a(*) - !ERROR: Scalar actual argument may not be associated with assumed-shape dummy argument 'x=' - call assumedshape(scalar) - !ERROR: Rank of dummy argument is 1, but actual argument has rank 2 - call assumedshape(matrix) - !ERROR: Assumed-size array may not be associated with assumed-shape dummy argument 'x=' - call assumedshape(a) - end subroutine - - subroutine test11(in) ! C15.5.2.4(20) - real, intent(in) :: in - real :: x - x = 0. - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call intentout(in) - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call intentout(3.14159) - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call intentout(in + 1.) - call intentout(x) ! ok - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call intentout((x)) - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call intentinout(in) - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call intentinout(3.14159) - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call intentinout(in + 1.) - call intentinout(x) ! ok - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call intentinout((x)) - end subroutine - - subroutine test12 ! 15.5.2.4(21) - real :: a(1) - integer :: j(1) - j(1) = 1 - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call intentout(a(j)) - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call intentinout(a(j)) - !ERROR: Actual argument associated with ASYNCHRONOUS dummy argument 'x=' must be definable - call asynchronous(a(j)) - !ERROR: Actual argument associated with VOLATILE dummy argument 'x=' must be definable - call volatile(a(j)) - end subroutine - - subroutine coarr(x) - type(ultimateCoarray):: x - end subroutine - subroutine volcoarr(x) - type(ultimateCoarray), volatile :: x - end subroutine - subroutine test13(a, b) ! 15.5.2.4(22) - type(ultimateCoarray) :: a - type(ultimateCoarray), volatile :: b - call coarr(a) ! ok - call volcoarr(b) ! ok - !ERROR: VOLATILE attribute must match for dummy argument 'x=' when actual argument has a coarray ultimate component '%a' - call coarr(b) - !ERROR: VOLATILE attribute must match for dummy argument 'x=' when actual argument has a coarray ultimate component '%a' - call volcoarr(a) - end subroutine - - subroutine test14(a,b,c,d) ! C1538 - real :: a[*] - real, asynchronous :: b[*] - real, volatile :: c[*] - real, asynchronous, volatile :: d[*] - call asynchronous(a[1]) ! ok - call volatile(a[1]) ! ok - call asynchronousValue(b[1]) ! ok - call asynchronousValue(c[1]) ! ok - call asynchronousValue(d[1]) ! ok - !ERROR: Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with dummy argument 'x=' with ASYNCHRONOUS or VOLATILE attributes unless VALUE - call asynchronous(b[1]) - !ERROR: Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with dummy argument 'x=' with ASYNCHRONOUS or VOLATILE attributes unless VALUE - call volatile(b[1]) - !ERROR: Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with dummy argument 'x=' with ASYNCHRONOUS or VOLATILE attributes unless VALUE - call asynchronous(c[1]) - !ERROR: Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with dummy argument 'x=' with ASYNCHRONOUS or VOLATILE attributes unless VALUE - call volatile(c[1]) - !ERROR: Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with dummy argument 'x=' with ASYNCHRONOUS or VOLATILE attributes unless VALUE - call asynchronous(d[1]) - !ERROR: Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with dummy argument 'x=' with ASYNCHRONOUS or VOLATILE attributes unless VALUE - call volatile(d[1]) - end subroutine - - subroutine test15() ! C1539 - real, pointer :: a(:) - real, asynchronous :: b(10) - real, volatile :: c(10) - real, asynchronous, volatile :: d(10) - call assumedsize(a(::2)) ! ok - call contiguous(a(::2)) ! ok - call valueassumedsize(a(::2)) ! ok - call valueassumedsize(b(::2)) ! ok - call valueassumedsize(c(::2)) ! ok - call valueassumedsize(d(::2)) ! ok - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatileassumedsize(b(::2)) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatilecontiguous(b(::2)) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatileassumedsize(c(::2)) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatilecontiguous(c(::2)) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatileassumedsize(d(::2)) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatilecontiguous(d(::2)) - end subroutine - - subroutine test16() ! C1540 - real, pointer :: a(:) - real, asynchronous, pointer :: b(:) - real, volatile, pointer :: c(:) - real, asynchronous, volatile, pointer :: d(:) - call assumedsize(a) ! ok - call contiguous(a) ! ok - call pointer(a) ! ok - call pointer(b) ! ok - call pointer(c) ! ok - call pointer(d) ! ok - call valueassumedsize(a) ! ok - call valueassumedsize(b) ! ok - call valueassumedsize(c) ! ok - call valueassumedsize(d) ! ok - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatileassumedsize(b) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatilecontiguous(b) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatileassumedsize(c) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatilecontiguous(c) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatileassumedsize(d) - !ERROR: ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous dummy argument 'x=' - call volatilecontiguous(d) - end subroutine - -end module diff --git a/test-lit/Semantics/call04.f90 b/test-lit/Semantics/call04.f90 deleted file mode 100644 index 3064fee5decc..000000000000 --- a/test-lit/Semantics/call04.f90 +++ /dev/null @@ -1,62 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 8.5.10 & 8.5.18 constraints on dummy argument declarations - -module m - - type :: hasCoarray - real, allocatable :: a(:)[:] - end type - type, extends(hasCoarray) :: extendsHasCoarray - end type - type :: hasCoarray2 - type(hasCoarray) :: x - end type - type, extends(hasCoarray2) :: extendsHasCoarray2 - end type - - real, allocatable :: coarray(:)[:] - - contains - - subroutine s01a(x) - real, allocatable, intent(out) :: x(:) - end subroutine - subroutine s01b ! C846 - can only be caught at a call via explicit interface - !ERROR: ALLOCATABLE coarray 'coarray' may not be associated with INTENT(OUT) dummy argument 'x=' - !ERROR: ALLOCATABLE dummy argument 'x=' has corank 0 but actual argument has corank 1 - call s01a(coarray) - end subroutine - - subroutine s02(x) ! C846 - !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray - type(hasCoarray), intent(out) :: x - end subroutine - - subroutine s03(x) ! C846 - !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray - type(extendsHasCoarray), intent(out) :: x - end subroutine - - subroutine s04(x) ! C846 - !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray - type(hasCoarray2), intent(out) :: x - end subroutine - - subroutine s05(x) ! C846 - !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray - type(extendsHasCoarray2), intent(out) :: x - end subroutine - -end module - -subroutine s06(x) ! C847 - use ISO_FORTRAN_ENV, only: lock_type - !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE - type(lock_type), intent(out) :: x -end subroutine - -subroutine s07(x) ! C847 - use ISO_FORTRAN_ENV, only: event_type - !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE - type(event_type), intent(out) :: x -end subroutine diff --git a/test-lit/Semantics/call05.f90 b/test-lit/Semantics/call05.f90 deleted file mode 100644 index 80f1874ff2d5..000000000000 --- a/test-lit/Semantics/call05.f90 +++ /dev/null @@ -1,120 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.5.2.5 constraints and restrictions for POINTER & ALLOCATABLE -! arguments when both sides of the call have the same attributes. - -module m - - type :: t - end type - type, extends(t) :: t2 - end type - type :: pdt(n) - integer, len :: n - end type - - type(t), pointer :: mp(:), mpmat(:,:) - type(t), allocatable :: ma(:), mamat(:,:) - class(t), pointer :: pp(:) - class(t), allocatable :: pa(:) - class(t2), pointer :: pp2(:) - class(t2), allocatable :: pa2(:) - class(*), pointer :: up(:) - class(*), allocatable :: ua(:) - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - type(pdt(*)), pointer :: amp(:) - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - type(pdt(*)), allocatable :: ama(:) - type(pdt(:)), pointer :: dmp(:) - type(pdt(:)), allocatable :: dma(:) - type(pdt(1)), pointer :: nmp(:) - type(pdt(1)), allocatable :: nma(:) - - contains - - subroutine smp(x) - type(t), pointer :: x(:) - end subroutine - subroutine sma(x) - type(t), allocatable :: x(:) - end subroutine - subroutine spp(x) - class(t), pointer :: x(:) - end subroutine - subroutine spa(x) - class(t), allocatable :: x(:) - end subroutine - subroutine sup(x) - class(*), pointer :: x(:) - end subroutine - subroutine sua(x) - class(*), allocatable :: x(:) - end subroutine - subroutine samp(x) - type(pdt(*)), pointer :: x(:) - end subroutine - subroutine sama(x) - type(pdt(*)), allocatable :: x(:) - end subroutine - subroutine sdmp(x) - type(pdt(:)), pointer :: x(:) - end subroutine - subroutine sdma(x) - type(pdt(:)), allocatable :: x(:) - end subroutine - subroutine snmp(x) - type(pdt(1)), pointer :: x(:) - end subroutine - subroutine snma(x) - type(pdt(1)), allocatable :: x(:) - end subroutine - - subroutine test - call smp(mp) ! ok - call sma(ma) ! ok - call spp(pp) ! ok - call spa(pa) ! ok - !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both must be so - call smp(pp) - !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both must be so - call sma(pa) - !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both must be so - call spp(mp) - !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both must be so - call spa(ma) - !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both must be so - call sup(pp) - !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both must be so - call sua(pa) - !ERROR: Actual argument type 'CLASS(*)' is not compatible with dummy argument type 't' - call spp(up) - !ERROR: Actual argument type 'CLASS(*)' is not compatible with dummy argument type 't' - call spa(ua) - !ERROR: POINTER or ALLOCATABLE dummy and actual arguments must have the same declared type - call spp(pp2) - !ERROR: POINTER or ALLOCATABLE dummy and actual arguments must have the same declared type - call spa(pa2) - !ERROR: Rank of dummy argument is 1, but actual argument has rank 2 - call smp(mpmat) - !ERROR: Rank of dummy argument is 1, but actual argument has rank 2 - call sma(mamat) - call sdmp(dmp) ! ok - call sdma(dma) ! ok - call snmp(nmp) ! ok - call snma(nma) ! ok - call samp(nmp) ! ok - call sama(nma) ! ok - !ERROR: Dummy and actual arguments must defer the same type parameters when POINTER or ALLOCATABLE - call sdmp(nmp) - !ERROR: Dummy and actual arguments must defer the same type parameters when POINTER or ALLOCATABLE - call sdma(nma) - !ERROR: Dummy and actual arguments must defer the same type parameters when POINTER or ALLOCATABLE - call snmp(dmp) - !ERROR: Dummy and actual arguments must defer the same type parameters when POINTER or ALLOCATABLE - call snma(dma) - !ERROR: Dummy and actual arguments must defer the same type parameters when POINTER or ALLOCATABLE - call samp(dmp) - !ERROR: Dummy and actual arguments must defer the same type parameters when POINTER or ALLOCATABLE - call sama(dma) - end subroutine - -end module diff --git a/test-lit/Semantics/call06.f90 b/test-lit/Semantics/call06.f90 deleted file mode 100644 index eb4bd3755f87..000000000000 --- a/test-lit/Semantics/call06.f90 +++ /dev/null @@ -1,56 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.5.2.6 constraints and restrictions for ALLOCATABLE -! dummy arguments. - -module m - - real, allocatable :: cov[:], com[:,:] - - contains - - subroutine s01(x) - real, allocatable :: x - end subroutine - subroutine s02(x) - real, allocatable :: x[:] - end subroutine - subroutine s03(x) - real, allocatable :: x[:,:] - end subroutine - subroutine s04(x) - real, allocatable, intent(in) :: x - end subroutine - subroutine s05(x) - real, allocatable, intent(out) :: x - end subroutine - subroutine s06(x) - real, allocatable, intent(in out) :: x - end subroutine - function allofunc() - real, allocatable :: allofunc - end function - - subroutine test(x) - real :: scalar - real, allocatable, intent(in) :: x - !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument - call s01(scalar) - !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument - call s01(1.) - !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument - call s01(allofunc()) ! subtle: ALLOCATABLE function result isn't - call s02(cov) ! ok - call s03(com) ! ok - !ERROR: ALLOCATABLE dummy argument 'x=' has corank 1 but actual argument has corank 2 - call s02(com) - !ERROR: ALLOCATABLE dummy argument 'x=' has corank 2 but actual argument has corank 1 - call s03(cov) - call s04(cov[1]) ! ok - !ERROR: ALLOCATABLE dummy argument 'x=' must have INTENT(IN) to be associated with a coindexed actual argument - call s01(cov[1]) - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call s05(x) - !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable - call s06(x) - end subroutine -end module diff --git a/test-lit/Semantics/call07.f90 b/test-lit/Semantics/call07.f90 deleted file mode 100644 index f596e3600288..000000000000 --- a/test-lit/Semantics/call07.f90 +++ /dev/null @@ -1,42 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments. - -module m - real :: coarray(10)[*] - contains - - subroutine s01(p) - real, pointer, contiguous, intent(in) :: p(:) - end subroutine - subroutine s02(p) - real, pointer :: p(:) - end subroutine - subroutine s03(p) - real, pointer, intent(in) :: p(:) - end subroutine - - subroutine test - !ERROR: CONTIGUOUS POINTER must be an array - real, pointer, contiguous :: a01 ! C830 - real, pointer :: a02(:) - real, target :: a03(10) - real :: a04(10) ! not TARGET - call s01(a03) ! ok - !ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous - call s01(a02) - !ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous - call s01(a03(::2)) - call s02(a02) ! ok - call s03(a03) ! ok - !ERROR: Actual argument associated with POINTER dummy argument 'p=' must also be POINTER unless INTENT(IN) - call s02(a03) - !ERROR: An array section with a vector subscript may not be a pointer target - call s03(a03([1,2,4])) - !ERROR: A coindexed object may not be a pointer target - call s03(coarray(:)[1]) - !ERROR: Target associated with dummy argument 'p=' must be a designator or a call to a pointer-valued function - call s03([1.]) - !ERROR: In assignment to object dummy argument 'p=', the target 'a04' is not an object with POINTER or TARGET attributes - call s03(a04) - end subroutine -end module diff --git a/test-lit/Semantics/call08.f90 b/test-lit/Semantics/call08.f90 deleted file mode 100644 index 88ec7e3b4cca..000000000000 --- a/test-lit/Semantics/call08.f90 +++ /dev/null @@ -1,48 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.5.2.8 coarray dummy arguments - -module m - - real :: c1[*] - real, volatile :: c2[*] - - contains - - subroutine s01(x) - real :: x[*] - end subroutine - subroutine s02(x) - real, volatile :: x[*] - end subroutine - subroutine s03(x) - real, contiguous :: x(:)[*] - end subroutine - subroutine s04(x) - real :: x(*)[*] - end subroutine - - subroutine test(x,c3,c4) - real :: scalar - real :: x(:)[*] - real, intent(in) :: c3(:)[*] - real, contiguous, intent(in) :: c4(:)[*] - call s01(c1) ! ok - call s02(c2) ! ok - call s03(c4) ! ok - call s04(c4) ! ok - !ERROR: Actual argument associated with coarray dummy argument 'x=' must be a coarray - call s01(scalar) - !ERROR: VOLATILE coarray may not be associated with non-VOLATILE coarray dummy argument 'x=' - call s01(c2) - !ERROR: non-VOLATILE coarray may not be associated with VOLATILE coarray dummy argument 'x=' - call s02(c1) - !ERROR: Actual argument associated with a CONTIGUOUS coarray dummy argument 'x=' must be simply contiguous - call s03(c3) - !ERROR: Actual argument associated with a CONTIGUOUS coarray dummy argument 'x=' must be simply contiguous - call s03(x) - !ERROR: Actual argument associated with coarray dummy argument 'x=' (not assumed shape or rank) must be simply contiguous - call s04(c3) - !ERROR: Actual argument associated with coarray dummy argument 'x=' (not assumed shape or rank) must be simply contiguous - call s04(x) - end subroutine -end module diff --git a/test-lit/Semantics/call09.f90 b/test-lit/Semantics/call09.f90 deleted file mode 100644 index e27c78e4281f..000000000000 --- a/test-lit/Semantics/call09.f90 +++ /dev/null @@ -1,164 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.5.2.9(2,3,5) dummy procedure requirements - -module m - contains - - integer function intfunc(x) - integer, intent(in) :: x - intfunc = x - end function - real function realfunc(x) - real, intent(in) :: x - realfunc = x - end function - - subroutine s01(p) - procedure(realfunc), pointer, intent(in) :: p - end subroutine - subroutine s02(p) - procedure(realfunc), pointer :: p - end subroutine - - subroutine selemental1(p) - procedure(cos) :: p ! ok - end subroutine - - real elemental function elemfunc(x) - real, intent(in) :: x - elemfunc = x - end function - !ERROR: A dummy procedure may not be ELEMENTAL - subroutine selemental2(p) - procedure(elemfunc) :: p - end subroutine - - function procptr() - procedure(realfunc), pointer :: procptr - procptr => realfunc - end function - function intprocptr() - procedure(intfunc), pointer :: intprocptr - intprocptr => intfunc - end function - - subroutine test1 ! 15.5.2.9(5) - procedure(realfunc), pointer :: p - procedure(intfunc), pointer :: ip - p => realfunc - ip => intfunc - call s01(realfunc) ! ok - !ERROR: Actual argument procedure has interface incompatible with dummy argument 'p=' - call s01(intfunc) - call s01(p) ! ok - call s01(procptr()) ! ok - !ERROR: Actual argument procedure has interface incompatible with dummy argument 'p=' - call s01(intprocptr()) - call s01(null()) ! ok - call s01(null(p)) ! ok - !ERROR: Actual argument procedure has interface incompatible with dummy argument 'p=' - call s01(null(ip)) - call s01(sin) ! ok - !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) - call s02(realfunc) - call s02(p) ! ok - !ERROR: Actual argument procedure has interface incompatible with dummy argument 'p=' - call s02(ip) - !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) - call s02(procptr()) - !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) - call s02(null()) - !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) - call s02(null(p)) - !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) - call s02(sin) - end subroutine - - subroutine callsub(s) - call s - end subroutine - subroutine takesrealfunc1(f) - external f - real f - end subroutine - subroutine takesrealfunc2(f) - x = f(1) - end subroutine - subroutine forwardproc(p) - implicit none - external :: p ! function or subroutine not known - call foo(p) - end subroutine - - subroutine test2(unknown,ds,drf,dif) ! 15.5.2.9(2,3) - external :: unknown, ds, drf, dif - real :: drf - integer :: dif - procedure(callsub), pointer :: ps - procedure(realfunc), pointer :: prf - procedure(intfunc), pointer :: pif - call ds ! now we know that's it's a subroutine - call callsub(callsub) ! ok apart from infinite recursion - call callsub(unknown) ! ok - call callsub(ds) ! ok - call callsub(ps) ! ok - call takesrealfunc1(realfunc) ! ok - call takesrealfunc1(unknown) ! ok - call takesrealfunc1(drf) ! ok - call takesrealfunc1(prf) ! ok - call takesrealfunc2(realfunc) ! ok - call takesrealfunc2(unknown) ! ok - call takesrealfunc2(drf) ! ok - call takesrealfunc2(prf) ! ok - call forwardproc(callsub) ! ok - call forwardproc(realfunc) ! ok - call forwardproc(intfunc) ! ok - call forwardproc(unknown) ! ok - call forwardproc(ds) ! ok - call forwardproc(drf) ! ok - call forwardproc(dif) ! ok - call forwardproc(ps) ! ok - call forwardproc(prf) ! ok - call forwardproc(pif) ! ok - !ERROR: Actual argument associated with procedure dummy argument 's=' is a function but must be a subroutine - call callsub(realfunc) - !ERROR: Actual argument associated with procedure dummy argument 's=' is a function but must be a subroutine - call callsub(intfunc) - !ERROR: Actual argument associated with procedure dummy argument 's=' is a function but must be a subroutine - call callsub(drf) - !ERROR: Actual argument associated with procedure dummy argument 's=' is a function but must be a subroutine - call callsub(dif) - !ERROR: Actual argument associated with procedure dummy argument 's=' is a function but must be a subroutine - call callsub(prf) - !ERROR: Actual argument associated with procedure dummy argument 's=' is a function but must be a subroutine - call callsub(pif) - !ERROR: Actual argument associated with procedure dummy argument 'f=' is a subroutine but must be a function - call takesrealfunc1(callsub) - !ERROR: Actual argument associated with procedure dummy argument 'f=' is a subroutine but must be a function - call takesrealfunc1(ds) - !ERROR: Actual argument associated with procedure dummy argument 'f=' is a subroutine but must be a function - call takesrealfunc1(ps) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc1(intfunc) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc1(dif) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc1(pif) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc1(intfunc) - !ERROR: Actual argument associated with procedure dummy argument 'f=' is a subroutine but must be a function - call takesrealfunc2(callsub) - !ERROR: Actual argument associated with procedure dummy argument 'f=' is a subroutine but must be a function - call takesrealfunc2(ds) - !ERROR: Actual argument associated with procedure dummy argument 'f=' is a subroutine but must be a function - call takesrealfunc2(ps) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc2(intfunc) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc2(dif) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc2(pif) - !ERROR: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type - call takesrealfunc2(intfunc) - end subroutine -end module diff --git a/test-lit/Semantics/call10.f90 b/test-lit/Semantics/call10.f90 deleted file mode 100644 index 52983c9f18a0..000000000000 --- a/test-lit/Semantics/call10.f90 +++ /dev/null @@ -1,214 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.7 (C1583-C1590, C1592-C1599) constraints and restrictions -! for pure procedures. -! (C1591 is tested in call11.f90; C1594 in call12.f90.) - -module m - - type :: impureFinal - contains - final :: impure - end type - type :: t - end type - type :: polyAlloc - class(t), allocatable :: a - end type - - real, volatile, target :: volatile - - contains - - subroutine impure(x) - type(impureFinal) :: x - end subroutine - integer impure function notpure(n) - integer, value :: n - notpure = n - end function - - pure real function f01(a) - real, intent(in) :: a ! ok - end function - pure real function f02(a) - real, value :: a ! ok - end function - pure real function f03(a) ! C1583 - !ERROR: non-POINTER dummy argument of pure function must be INTENT(IN) or VALUE - real :: a - end function - pure real function f03a(a) - real, pointer :: a ! ok - end function - pure real function f04(a) ! C1583 - !ERROR: non-POINTER dummy argument of pure function must be INTENT(IN) or VALUE - real, intent(out) :: a - end function - pure real function f04a(a) - real, pointer, intent(out) :: a ! ok if pointer - end function - pure real function f05(a) ! C1583 - real, value :: a ! weird, but ok (VALUE without INTENT) - end function - pure function f06() ! C1584 - !ERROR: Result of pure function may not have an impure FINAL subroutine - type(impureFinal) :: f06 - end function - pure function f07() ! C1585 - !ERROR: Result of pure function may not be both polymorphic and ALLOCATABLE - class(t), allocatable :: f07 - end function - pure function f08() ! C1585 - !ERROR: Result of pure function may not have polymorphic ALLOCATABLE ultimate component '%a' - type(polyAlloc) :: f08 - end function - - pure subroutine s01(a) ! C1586 - !ERROR: non-POINTER dummy argument of pure subroutine must have INTENT() or VALUE attribute - real :: a - end subroutine - pure subroutine s01a(a) - real, pointer :: a - end subroutine - pure subroutine s02(a) ! C1587 - !ERROR: An INTENT(OUT) dummy argument of a pure subroutine may not have an impure FINAL subroutine - type(impureFinal), intent(out) :: a - end subroutine - pure subroutine s03(a) ! C1588 - !ERROR: An INTENT(OUT) dummy argument of a pure subroutine may not be polymorphic - class(t), intent(out) :: a - end subroutine - pure subroutine s04(a) ! C1588 - !ERROR: An INTENT(OUT) dummy argument of a pure subroutine may not have a polymorphic ultimate component - type(polyAlloc), intent(out) :: a - end subroutine - pure subroutine s05 ! C1589 - !ERROR: A pure subprogram may not have a variable with the SAVE attribute - real, save :: v1 - !ERROR: A pure subprogram may not have a variable with the SAVE attribute - real :: v2 = 0. - !TODO: once we have DATA: !ERROR: A pure subprogram may not have a variable with the SAVE attribute - real :: v3 - data v3/0./ - !ERROR: A pure subprogram may not have a variable with the SAVE attribute - real :: v4 - common /blk/ v4 - save /blk/ - block - !ERROR: A pure subprogram may not have a variable with the SAVE attribute - real, save :: v5 - !ERROR: A pure subprogram may not have a variable with the SAVE attribute - real :: v6 = 0. - end block - end subroutine - pure subroutine s06 ! C1589 - !ERROR: A pure subprogram may not have a variable with the VOLATILE attribute - real, volatile :: v1 - block - !ERROR: A pure subprogram may not have a variable with the VOLATILE attribute - real, volatile :: v2 - end block - end subroutine - !ERROR: A dummy procedure of a pure subprogram must be pure - pure subroutine s07(p) ! C1590 - procedure(impure) :: p - end subroutine - ! C1591 is tested in call11.f90. - pure subroutine s08 ! C1592 - contains - pure subroutine pure ! ok - end subroutine - !ERROR: An internal subprogram of a pure subprogram must also be pure - subroutine impure1 - end subroutine - !ERROR: An internal subprogram of a pure subprogram must also be pure - impure subroutine impure2 - end subroutine - end subroutine - pure subroutine s09 ! C1593 - real :: x - !ERROR: VOLATILE variable 'volatile' may not be referenced in pure subprogram 's09' - x = volatile - end subroutine - ! C1594 is tested in call12.f90. - pure subroutine s10 ! C1595 - integer :: n - !ERROR: Procedure 'notpure' referenced in pure subprogram 's10' must be pure too - n = notpure(1) - end subroutine - pure subroutine s11(to) ! C1596 - ! Implicit deallocation at the end of the subroutine - !ERROR: Deallocation of polymorphic object 'auto%a' is not permitted in a pure subprogram - type(polyAlloc) :: auto - type(polyAlloc), intent(in out) :: to - !ERROR: Deallocation of polymorphic non-coarray component '%a' is not permitted in a pure subprogram - to = auto - end subroutine - pure subroutine s12 - character(20) :: buff - real :: x - write(buff, *) 1.0 ! ok - read(buff, *) x ! ok - !ERROR: External I/O is not allowed in a pure subprogram - print *, 'hi' ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - open(1, file='launch-codes') ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - close(1) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - backspace(1) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - endfile(1) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - rewind(1) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - flush(1) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - wait(1) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - inquire(1, name=buff) ! C1597 - !ERROR: External I/O is not allowed in a pure subprogram - read(5, *) x ! C1598 - !ERROR: External I/O is not allowed in a pure subprogram - read(*, *) x ! C1598 - !ERROR: External I/O is not allowed in a pure subprogram - write(6, *) ! C1598 - !ERROR: External I/O is not allowed in a pure subprogram - write(*, *) ! C1598 - end subroutine - pure subroutine s13 - !ERROR: An image control statement may not appear in a pure subprogram - sync all ! C1599 - end subroutine - pure subroutine s14 - integer :: img, nimgs, i[*], tmp - ! implicit sync all - !ERROR: Procedure 'this_image' referenced in pure subprogram 's14' must be pure too - img = this_image() - !ERROR: Procedure 'num_images' referenced in pure subprogram 's14' must be pure too - nimgs = num_images() - i = img ! i is ready to use - - if ( img .eq. 1 ) then - !ERROR: An image control statement may not appear in a pure subprogram - sync images( nimgs ) ! explicit sync 1 with last img - tmp = i[ nimgs ] - !ERROR: An image control statement may not appear in a pure subprogram - sync images( nimgs ) ! explicit sync 2 with last img - i = tmp - end if - - if ( img .eq. nimgs ) then - !ERROR: An image control statement may not appear in a pure subprogram - sync images( 1 ) ! explicit sync 1 with img 1 - tmp = i[ 1 ] - !ERROR: An image control statement may not appear in a pure subprogram - sync images( 1 ) ! explicit sync 2 with img 1 - i = tmp - end if - !ERROR: External I/O is not allowed in a pure subprogram - write (*,*) img, i - ! all other images wait here - ! TODO others from 11.6.1 (many) - end subroutine -end module diff --git a/test-lit/Semantics/call11.f90 b/test-lit/Semantics/call11.f90 deleted file mode 100644 index b53b40334e93..000000000000 --- a/test-lit/Semantics/call11.f90 +++ /dev/null @@ -1,83 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.7 C1591 & others: contexts requiring pure subprograms - -module m - - type :: t - contains - procedure, nopass :: tbp_pure => pure - procedure, nopass :: tbp_impure => impure - end type - type, extends(t) :: t2 - contains - !ERROR: An overridden pure type-bound procedure binding must also be pure - procedure, nopass :: tbp_pure => impure ! 7.5.7.3 - end type - - contains - - pure integer function pure(n) - integer, value :: n - pure = n - end function - impure integer function impure(n) - integer, value :: n - impure = n - end function - - subroutine test - real :: a(pure(1)) ! ok - !ERROR: Invalid specification expression: reference to impure function 'impure' - real :: b(impure(1)) ! 10.1.11(4) - forall (j=1:1) - !ERROR: Impure procedure 'impure' may not be referenced in a FORALL - a(j) = impure(j) ! C1037 - end forall - forall (j=1:1) - !ERROR: Impure procedure 'impure' may not be referenced in a FORALL - a(j) = pure(impure(j)) ! C1037 - end forall - !ERROR: DO CONCURRENT mask expression may not reference impure procedure 'impure' - do concurrent (j=1:1, impure(j) /= 0) ! C1121 - !ERROR: Call to an impure procedure is not allowed in DO CONCURRENT - a(j) = impure(j) ! C1139 - end do - end subroutine - - subroutine test2 - type(t) :: x - real :: a(x%tbp_pure(1)) ! ok - !ERROR: Invalid specification expression: reference to impure function 'impure' - real :: b(x%tbp_impure(1)) - forall (j=1:1) - a(j) = x%tbp_pure(j) ! ok - end forall - forall (j=1:1) - !ERROR: Impure procedure 'impure' may not be referenced in a FORALL - a(j) = x%tbp_impure(j) ! C1037 - end forall - do concurrent (j=1:1, x%tbp_pure(j) /= 0) ! ok - a(j) = x%tbp_pure(j) ! ok - end do - !ERROR: DO CONCURRENT mask expression may not reference impure procedure 'impure' - do concurrent (j=1:1, x%tbp_impure(j) /= 0) ! C1121 - !ERROR: Call to an impure procedure component is not allowed in DO CONCURRENT - a(j) = x%tbp_impure(j) ! C1139 - end do - end subroutine - - subroutine test3 - type :: t - integer :: i - end type - type(t) :: a(10), b - forall (i=1:10) - a(i) = t(pure(i)) ! OK - end forall - forall (i=1:10) - !ERROR: Impure procedure 'impure' may not be referenced in a FORALL - a(i) = t(impure(i)) ! C1037 - end forall - end subroutine - -end module diff --git a/test-lit/Semantics/call12.f90 b/test-lit/Semantics/call12.f90 deleted file mode 100644 index 3ce0812560ac..000000000000 --- a/test-lit/Semantics/call12.f90 +++ /dev/null @@ -1,75 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.7 C1594 - prohibited assignments in pure subprograms - -module used - real :: useassociated -end module - -module m - type :: t - sequence - real :: a - end type - type(t), target :: x - type :: hasPtr - real, pointer :: p - end type - type :: hasCoarray - real :: co[*] - end type - contains - pure function test(ptr, in, hpd) - use used - type(t), pointer :: ptr, ptr2 - type(t), target, intent(in) :: in - type(t), target :: y, z - type(hasPtr) :: hp - type(hasPtr), intent(in) :: hpd - type(hasPtr), allocatable :: alloc - type(hasCoarray), pointer :: hcp - integer :: n - common /block/ y - !ERROR: Pure subprogram 'test' may not define 'x' because it is host-associated - x%a = 0. - !ERROR: Pure subprogram 'test' may not define 'y' because it is in a COMMON block - y%a = 0. ! C1594(1) - !ERROR: Pure subprogram 'test' may not define 'useassociated' because it is USE-associated - useassociated = 0. ! C1594(1) - !ERROR: Pure subprogram 'test' may not define 'ptr' because it is a POINTER dummy argument of a pure function - ptr%a = 0. ! C1594(1) - !ERROR: Pure subprogram 'test' may not define 'in' because it is an INTENT(IN) dummy argument - in%a = 0. ! C1594(1) - !ERROR: A pure subprogram may not define a coindexed object - hcp%co[1] = 0. ! C1594(1) - !ERROR: Pure subprogram 'test' may not define 'ptr' because it is a POINTER dummy argument of a pure function - ptr => z ! C1594(2) - !ERROR: Pure subprogram 'test' may not define 'ptr' because it is a POINTER dummy argument of a pure function - nullify(ptr) ! C1594(2), 19.6.8 - !ERROR: A pure subprogram may not use 'ptr' as the target of pointer assignment because it is a POINTER dummy argument of a pure function - ptr2 => ptr ! C1594(3) - !ERROR: A pure subprogram may not use 'in' as the target of pointer assignment because it is an INTENT(IN) dummy argument - ptr2 => in ! C1594(3) - !ERROR: A pure subprogram may not use 'y' as the target of pointer assignment because it is in a COMMON block - ptr2 => y ! C1594(2) - !ERROR: Externally visible object 'block' may not be associated with pointer component 'p' in a pure procedure - n = size([hasPtr(y%a)]) ! C1594(4) - !ERROR: Externally visible object 'x' may not be associated with pointer component 'p' in a pure procedure - n = size([hasPtr(x%a)]) ! C1594(4) - !ERROR: Externally visible object 'ptr' may not be associated with pointer component 'p' in a pure procedure - n = size([hasPtr(ptr%a)]) ! C1594(4) - !ERROR: Externally visible object 'in' may not be associated with pointer component 'p' in a pure procedure - n = size([hasPtr(in%a)]) ! C1594(4) - !ERROR: A pure subprogram may not copy the value of 'hpd' because it is an INTENT(IN) dummy argument and has the POINTER component '%p' - hp = hpd ! C1594(5) - !ERROR: A pure subprogram may not copy the value of 'hpd' because it is an INTENT(IN) dummy argument and has the POINTER component '%p' - allocate(alloc, source=hpd) - contains - pure subroutine internal - type(hasPtr) :: localhp - !ERROR: Pure subprogram 'internal' may not define 'z' because it is host-associated - z%a = 0. - !ERROR: Externally visible object 'z' may not be associated with pointer component 'p' in a pure procedure - localhp = hasPtr(z%a) - end subroutine - end function -end module diff --git a/test-lit/Semantics/call13.f90 b/test-lit/Semantics/call13.f90 deleted file mode 100644 index 952a7d0c8b1d..000000000000 --- a/test-lit/Semantics/call13.f90 +++ /dev/null @@ -1,43 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 15.4.2.2 constraints and restrictions for calls to implicit -! interfaces - -subroutine s(assumedRank, coarray, class, classStar, typeStar) - type :: t - end type - - real :: assumedRank(..), coarray[*] - class(t) :: class - class(*) :: classStar - type(*) :: typeStar - - type :: pdt(len) - integer, len :: len - end type - type(pdt(1)) :: pdtx - - !ERROR: Invalid specification expression: reference to impure function 'implicit01' - real :: array(implicit01()) ! 15.4.2.2(2) - !ERROR: Keyword 'keyword=' may not appear in a reference to a procedure with an implicit interface - call implicit10(1, 2, keyword=3) ! 15.4.2.2(1) - !ERROR: Assumed rank argument requires an explicit interface - call implicit11(assumedRank) ! 15.4.2.2(3)(c) - !ERROR: Coarray argument requires an explicit interface - call implicit12(coarray) ! 15.4.2.2(3)(d) - !ERROR: Parameterized derived type argument requires an explicit interface - call implicit13(pdtx) ! 15.4.2.2(3)(e) - !ERROR: Polymorphic argument requires an explicit interface - call implicit14(class) ! 15.4.2.2(3)(f) - !ERROR: Polymorphic argument requires an explicit interface - call implicit15(classStar) ! 15.4.2.2(3)(f) - !ERROR: Assumed type argument requires an explicit interface - call implicit16(typeStar) ! 15.4.2.2(3)(f) - !ERROR: TYPE(*) dummy argument may only be used as an actual argument - if (typeStar) then - endif - !ERROR: TYPE(*) dummy argument may only be used as an actual argument - classStar = typeStar ! C710 - !ERROR: TYPE(*) dummy argument may only be used as an actual argument - typeStar = classStar ! C710 -end subroutine - diff --git a/test-lit/Semantics/call14.f90 b/test-lit/Semantics/call14.f90 deleted file mode 100644 index e25620b2694b..000000000000 --- a/test-lit/Semantics/call14.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test 8.5.18 constraints on the VALUE attribute - -module m - type :: hasCoarray - real :: coarray[*] - end type - contains - !ERROR: VALUE attribute may apply only to a dummy data object - subroutine C863(notData,assumedSize,coarray,coarrayComponent) - external :: notData - !ERROR: VALUE attribute may apply only to a dummy argument - real, value :: notADummy - value :: notData - !ERROR: VALUE attribute may not apply to an assumed-size array - real, value :: assumedSize(10,*) - !ERROR: VALUE attribute may not apply to a coarray - real, value :: coarray[*] - !ERROR: VALUE attribute may not apply to a type with a coarray ultimate component - type(hasCoarray), value :: coarrayComponent - end subroutine - subroutine C864(allocatable, inout, out, pointer, volatile) - !ERROR: VALUE attribute may not apply to an ALLOCATABLE - real, value, allocatable :: allocatable - !ERROR: VALUE attribute may not apply to an INTENT(IN OUT) argument - real, value, intent(in out) :: inout - !ERROR: VALUE attribute may not apply to an INTENT(OUT) argument - real, value, intent(out) :: out - !ERROR: VALUE attribute may not apply to a POINTER - real, value, pointer :: pointer - !ERROR: VALUE attribute may not apply to a VOLATILE - real, value, volatile :: volatile - end subroutine - subroutine C865(optional) bind(c) - !ERROR: VALUE attribute may not apply to an OPTIONAL in a BIND(C) procedure - real, value, optional :: optional - end subroutine -end module diff --git a/test-lit/Semantics/call15.f90 b/test-lit/Semantics/call15.f90 deleted file mode 100644 index 04ee9e88c153..000000000000 --- a/test-lit/Semantics/call15.f90 +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C711 An assumed-type actual argument that corresponds to an assumed-rank -! dummy argument shall be assumed-shape or assumed-rank. -subroutine s(arg1, arg2, arg3) - type(*), dimension(..) :: arg1 ! assumed rank - type(*), dimension(:) :: arg2 ! assumed shape - type(*) :: arg3 - - call inner(arg1) ! OK, assumed rank - call inner(arg2) ! OK, assumed shape - !ERROR: Assumed-type TYPE(*) 'arg3' must be either assumed shape or assumed rank to be associated with TYPE(*) dummy argument 'dummy=' - call inner(arg3) - - contains - subroutine inner(dummy) - type(*), dimension(..) :: dummy - end subroutine inner -end subroutine s diff --git a/test-lit/Semantics/canondo01.f90 b/test-lit/Semantics/canondo01.f90 deleted file mode 100644 index 51060f8a5f1d..000000000000 --- a/test-lit/Semantics/canondo01.f90 +++ /dev/null @@ -1,15 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: end do - -SUBROUTINE sub00(a,b,n,m) - INTEGER n,m - REAL a(n,m), b(n,m) - - DO 10 j = 1,m - DO 10 i = 1,n - g = a(i,j) - b(i,j) -10 PRINT *, g -END SUBROUTINE sub00 diff --git a/test-lit/Semantics/canondo02.f90 b/test-lit/Semantics/canondo02.f90 deleted file mode 100644 index 62dbd4b0a024..000000000000 --- a/test-lit/Semantics/canondo02.f90 +++ /dev/null @@ -1,15 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: end do - -SUBROUTINE sub00(a,b,n,m) - INTEGER n,m - REAL a(n,m), b(n,m) - - i = n-1 - DO 10 j = 1,m - g = a(i,j) - b(i,j) -10 PRINT *, g -END SUBROUTINE sub00 diff --git a/test-lit/Semantics/canondo03.f90 b/test-lit/Semantics/canondo03.f90 deleted file mode 100644 index 4be30775221e..000000000000 --- a/test-lit/Semantics/canondo03.f90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: 10 continue -! CHECK: end do - -SUBROUTINE sub00(a,b,n,m) - INTEGER n,m - REAL a(n,m), b(n,m) - - i = n-1 - DO 10 j = 1,m - g = a(i,j) - b(i,j) - PRINT *, g -10 END DO -END SUBROUTINE sub00 diff --git a/test-lit/Semantics/canondo04.f90 b/test-lit/Semantics/canondo04.f90 deleted file mode 100644 index 452d77d0559e..000000000000 --- a/test-lit/Semantics/canondo04.f90 +++ /dev/null @@ -1,56 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK-NOT: do [1-9] - -! Figure out how to also execute this test. - -program main - integer :: results(100) - integer :: count - count = 0 - if (.true.) then - do 1 j1=1,2 - count = count + 1 - results(count) = j1 -1 continue - end if - do 2 j1=3,4 - do 2 j2=1,2 - if (j1 == j2) then - do 3 j3=1,2 - count = count + 1 - results(count) = 100*j1 + 10*j2 + j3 - do 3 j4=1,2 - do - count = count + 1 - results(count) = 10*j3 + j4 - exit - end do -3 end do - else - do - do 4 j3=3,4 - count = count + 1 - results(count) = 100*j1 + 10*j2 + j3 - do 4 j4=3,4 - count = count + 1 - results(count) = 10*j3 + j4 -4 end do - exit - end do - end if - count = count + 1 - results(count) = 10*j1 + j2 -2 continue - do 5 j1=5,6 ! adjacent non-block DO loops - count = count + 1 -5 results(count) = j1 - do 6 j1=7,8 ! non-block DO loop at end of execution part - count = count + 1 -6 results(count) = j1 - if (count == 34 .and. sum(results(1:count)) == 3739) then - print *, 'pass' - else - print *, 'FAIL:', count, sum(results(1:count)), results(1:count) - end if -end diff --git a/test-lit/Semantics/canondo05.f90 b/test-lit/Semantics/canondo05.f90 deleted file mode 100644 index 4550e9849fc4..000000000000 --- a/test-lit/Semantics/canondo05.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! XXXEXEC: ${F18} -fopenmp -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK-NOT: do *[1-9] - -program P -implicit none -integer OMP_GET_NUM_THREADS, OMP_GET_THREAD_NUM -integer NUMTHRDS, TID -integer N, CSZ, CNUM, I -parameter (N=100) -parameter (CSZ=10) -real A(N), B(N), C(N) - -do 10 I = 1, N - A(I) = I * 1.0 -10 continue - -B = A -CNUM = CSZ - -!$OMP PARALLEL SHARED(A,B,C,NUMTHRDS,CNUM) PRIVATE(I,TID) -TID = OMP_GET_THREAD_NUM() -if (TID .EQ. 0) then - NUMTHRDS = OMP_GET_NUM_THREADS() - print *, "Number of threads =", NUMTHRDS -end if -print *, "Thread", TID, " is starting..." - -!$OMP DO SCHEDULE(DYNAMIC,CNUM) -do 20 I = 1, N - C(I) = A(I) + B(I) - write (*,100) TID, I, C(I) -20 continue -!$OMP END DO NOWAIT - -print *, "Thread", TID, " done." - -!$OMP END PARALLEL -100 format(" Thread", I2, ": C(", I3, ")=", F8.2) -end program P diff --git a/test-lit/Semantics/canondo06.f90 b/test-lit/Semantics/canondo06.f90 deleted file mode 100644 index 0aea3daed4f9..000000000000 --- a/test-lit/Semantics/canondo06.f90 +++ /dev/null @@ -1,26 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -fopenmp -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK-NOT: do *[1-9] -! CHECK: omp simd - -program P -implicit none -integer N, I -parameter (N=100) -real A(N), B(N), C(N) - -!$OMP SIMD -do 10 I = 1, N - A(I) = I * 1.0 -10 continue - -B = A - -!$OMP SIMD -do 20 I = 1, N - C(I) = A(I) + B(I) - write (*,100) I, C(I) -20 continue - -100 format(" C(", I3, ")=", F8.2) -end program P diff --git a/test-lit/Semantics/canondo07.f90 b/test-lit/Semantics/canondo07.f90 deleted file mode 100644 index f5a0feef93d0..000000000000 --- a/test-lit/Semantics/canondo07.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1131 - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -program endDo - do 10 i = 1, 5 -10 print *, "in loop" -end program endDo diff --git a/test-lit/Semantics/canondo08.f90 b/test-lit/Semantics/canondo08.f90 deleted file mode 100644 index c5bfb56f1288..000000000000 --- a/test-lit/Semantics/canondo08.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo1() - do 01 k=1,2 - do i=3,4 - print*, i+k -01 end do -end subroutine diff --git a/test-lit/Semantics/canondo09.f90 b/test-lit/Semantics/canondo09.f90 deleted file mode 100644 index 99956a03fe3d..000000000000 --- a/test-lit/Semantics/canondo09.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo0() - do 01 j=1,2 - if (.true.) then -01 end if -end subroutine diff --git a/test-lit/Semantics/canondo10.f90 b/test-lit/Semantics/canondo10.f90 deleted file mode 100644 index 93d060dd9aaa..000000000000 --- a/test-lit/Semantics/canondo10.f90 +++ /dev/null @@ -1,29 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo2() - do 01 l=1,2 - do 01 m=1,2 - select case (l) - case default - print*, "default", m, l - case (1) - print*, "start" -01 end select -end subroutine diff --git a/test-lit/Semantics/canondo11.f90 b/test-lit/Semantics/canondo11.f90 deleted file mode 100644 index 8e98a24bb87f..000000000000 --- a/test-lit/Semantics/canondo11.f90 +++ /dev/null @@ -1,26 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo3() - real :: a(10, 10), b(10, 10) = 1.0 - do 01 k=1,4 - associate (x=>a(k+1, 2*k), y=>b(k, 2*k-1)) - x = 4*x*x + x*y -2*y -01 end associate -end subroutine diff --git a/test-lit/Semantics/canondo12.f90 b/test-lit/Semantics/canondo12.f90 deleted file mode 100644 index 48fde32faf99..000000000000 --- a/test-lit/Semantics/canondo12.f90 +++ /dev/null @@ -1,27 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo4() - real :: a(10, 10), b(10, 10) = 1.0 - do 01 k=1,4 - block - real b - b = a(k, k) - a(k, k) = k*b -01 end block -end subroutine diff --git a/test-lit/Semantics/canondo13.f90 b/test-lit/Semantics/canondo13.f90 deleted file mode 100644 index b317d7963aa3..000000000000 --- a/test-lit/Semantics/canondo13.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo5() - real :: a(10, 10), b(10, 10) = 1.0 - do 01 k=1,4 - critical - b(k+1, k) = a(k, k+1) -01 end critical -end subroutine diff --git a/test-lit/Semantics/canondo14.f90 b/test-lit/Semantics/canondo14.f90 deleted file mode 100644 index 69bd748212be..000000000000 --- a/test-lit/Semantics/canondo14.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo6(a) - type whatever - class(*), allocatable :: x - end type - type(whatever) :: a(10) - do 01 k=1,10 - select type (ax => a(k)%x) - type is (integer) - print*, "integer: ", ax - class default - print*, "not useable" -01 end select -end subroutine diff --git a/test-lit/Semantics/canondo15.f90 b/test-lit/Semantics/canondo15.f90 deleted file mode 100644 index f58959898345..000000000000 --- a/test-lit/Semantics/canondo15.f90 +++ /dev/null @@ -1,30 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo7(a) - integer :: a(..) - do 01 k=1,10 - select rank (a) - rank (0) - a = a+k - rank (1) - a(k) = a(k)+k - rank default - print*, "error" -01 end select -end subroutine diff --git a/test-lit/Semantics/canondo16.f90 b/test-lit/Semantics/canondo16.f90 deleted file mode 100644 index d5c5db464930..000000000000 --- a/test-lit/Semantics/canondo16.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard -I../../tools/f18/include %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo8() - use iso_fortran_env, only : team_type - type(team_type) :: odd_even - do 01 k=1,10 - change team (odd_even) -01 end team -end subroutine diff --git a/test-lit/Semantics/canondo17.f90 b/test-lit/Semantics/canondo17.f90 deleted file mode 100644 index a687fb2fefac..000000000000 --- a/test-lit/Semantics/canondo17.f90 +++ /dev/null @@ -1,26 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo9() - real :: a(10, 10), b(10, 10) = 1.0 - do 01 k=1,2 - forall (i = 1:10, j = 1:10, b(i, j) /= 0.0) - a(i, j) = real (i + j - k) - b(i, j) = a(i, j) + b(i, j) * real (i * j) -01 end forall -end subroutine diff --git a/test-lit/Semantics/canondo18.f90 b/test-lit/Semantics/canondo18.f90 deleted file mode 100644 index 3e3f18b05174..000000000000 --- a/test-lit/Semantics/canondo18.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Error test -- DO loop uses obsolete loop termination statement -! See R1131 and C1133 - -! By default, this is not an error and label do are rewritten to non-label do. -! A warning is generated with -Mstandard - -! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s - -! CHECK: end do - -! The following CHECK-NOT actively uses the fact that the leading zero of labels -! would be removed in the unparse but not the line linked to warnings. We do -! not want to see label do in the unparse only. -! CHECK-NOT: do [1-9] - -! CHECK: A DO loop should terminate with an END DO or CONTINUE - -subroutine foo10() - real :: a(10, 10), b(10, 10) = 1.0 - do 01 k=1,4 - where (a&1 | ${FileCheck} %s - -! CHECK: end do -! CHECK: 2 do -! CHECK: mainloop: do -! CHECK: end do mainloop - -! CHECK-NOT: do [1-9] - -subroutine foo() - do 1 i=1,2 - goto 2 -1 continue -2 do 3 i=1,2 -3 continue - - mainloop : do 4 i=1,100 - do j=1,20 - if (j==i) then - ! cycle mainloop: TODO: fix invalid complaints that mainloop construct - ! is not in scope. - end if - end do -4 end do mainloop -end subroutine diff --git a/test-lit/Semantics/coarrays01.f90 b/test-lit/Semantics/coarrays01.f90 deleted file mode 100644 index 3e8e1672a47b..000000000000 --- a/test-lit/Semantics/coarrays01.f90 +++ /dev/null @@ -1,77 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test selector and team-value in CHANGE TEAM statement - -! OK -subroutine s1 - use iso_fortran_env, only: team_type - type(team_type) :: t - real :: y[10,*] - change team(t, x[10,*] => y) - end team - form team(1, t) -end - -subroutine s2 - use iso_fortran_env - type(team_type) :: t - real :: y[10,*], y2[*], x[*] - ! C1113 - !ERROR: Selector 'y' was already used as a selector or coarray in this statement - change team(t, x[10,*] => y, x2[*] => y) - end team - !ERROR: Selector 'x' was already used as a selector or coarray in this statement - change team(t, x[10,*] => y, x2[*] => x) - end team - !ERROR: Coarray 'y' was already used as a selector or coarray in this statement - change team(t, x[10,*] => y, y[*] => y2) - end team -end - -subroutine s3 - type :: team_type - end type - type :: foo - real :: a - end type - type(team_type) :: t1 - type(foo) :: t2 - type(team_type) :: t3(3) - real :: y[10,*] - ! C1114 - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - change team(t1, x[10,*] => y) - end team - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - change team(t2, x[10,*] => y) - end team - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - change team(t2%a, x[10,*] => y) - end team - !ERROR: Must be a scalar value, but is a rank-1 array - change team(t3, x[10,*] => y) - end team - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - form team(1, t1) - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - form team(2, t2) - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - form team(2, t2%a) - !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV - form team(3, t3(2)) - !ERROR: Must be a scalar value, but is a rank-1 array - form team(3, t3) -end - -subroutine s4 - use iso_fortran_env, only: team_type - complex :: z - integer :: i, j(10) - type(team_type) :: t, t2(2) - form team(i, t) - !ERROR: Must be a scalar value, but is a rank-1 array - form team(1, t2) - !ERROR: Must have INTEGER type, but is COMPLEX(4) - form team(z, t) - !ERROR: Must be a scalar value, but is a rank-1 array - form team(j, t) -end diff --git a/test-lit/Semantics/complex01.f90 b/test-lit/Semantics/complex01.f90 deleted file mode 100644 index c70f0defad6a..000000000000 --- a/test-lit/Semantics/complex01.f90 +++ /dev/null @@ -1,33 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C718 Each named constant in a complex literal constant shall be of type -! integer or real. -subroutine s() - integer :: ivar = 35 - integer, parameter :: iconst = 35 - real :: rvar = 68.9 - real, parameter :: rconst = 68.9 - character :: cvar = 'hello' - character, parameter :: cconst = 'hello' - logical :: lvar = .true. - logical, parameter :: lconst = .true. - complex :: cvar1 = (1, 1) - complex :: cvar2 = (1.0, 1.0) - complex :: cvar3 = (1.0, 1) - complex :: cvar4 = (1, 1.0) - complex :: cvar5 = (iconst, 1.0) - complex :: cvar6 = (iconst, rconst) - complex :: cvar7 = (rconst, iconst) - - !ERROR: must be a constant - complex :: cvar8 = (ivar, 1.0) - !ERROR: must be a constant - !ERROR: must be a constant - complex :: cvar9 = (ivar, rvar) - !ERROR: must be a constant - !ERROR: must be a constant - complex :: cvar10 = (rvar, ivar) - !ERROR: operands must be INTEGER or REAL - complex :: cvar11 = (cconst, 1.0) - !ERROR: operands must be INTEGER or REAL - complex :: cvar12 = (lconst, 1.0) -end subroutine s diff --git a/test-lit/Semantics/computed-goto01.f90 b/test-lit/Semantics/computed-goto01.f90 deleted file mode 100644 index 9f24996f41a0..000000000000 --- a/test-lit/Semantics/computed-goto01.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check that a basic computed goto compiles - -INTEGER, DIMENSION (2) :: B - -GOTO (100) 1 -GOTO (100) I -GOTO (100) I+J -GOTO (100) B(1) - -GOTO (100, 200) 1 -GOTO (100, 200) I -GOTO (100, 200) I+J -GOTO (100, 200) B(1) - -GOTO (100, 200, 300) 1 -GOTO (100, 200, 300) I -GOTO (100, 200, 300) I+J -GOTO (100, 200, 300) B(1) - -100 CONTINUE -200 CONTINUE -300 CONTINUE -END diff --git a/test-lit/Semantics/computed-goto02.f90 b/test-lit/Semantics/computed-goto02.f90 deleted file mode 100644 index eea61a827052..000000000000 --- a/test-lit/Semantics/computed-goto02.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check that computed goto express must be a scalar integer expression -! TODO: PGI, for example, accepts a float & converts the value to int. - -REAL R -COMPLEX Z -LOGICAL L -INTEGER, DIMENSION (2) :: B - -!ERROR: Must have INTEGER type, but is REAL(4) -GOTO (100) 1.5 -!ERROR: Must have INTEGER type, but is LOGICAL(4) -GOTO (100) .TRUE. -!ERROR: Must have INTEGER type, but is REAL(4) -GOTO (100) R -!ERROR: Must have INTEGER type, but is COMPLEX(4) -GOTO (100) Z -!ERROR: Must be a scalar value, but is a rank-1 array -GOTO (100) B - -100 CONTINUE - -END diff --git a/test-lit/Semantics/critical01.f90 b/test-lit/Semantics/critical01.f90 deleted file mode 100644 index 5ca97ade6998..000000000000 --- a/test-lit/Semantics/critical01.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!C1117 - -subroutine test1(a, i) - integer i - real a(10) - one: critical - if (a(i) < 0.0) then - a(i) = 20.20 - end if - !ERROR: CRITICAL construct name mismatch - end critical two -end subroutine test1 - -subroutine test2(a, i) - integer i - real a(10) - critical - if (a(i) < 0.0) then - a(i) = 20.20 - end if - !ERROR: CRITICAL construct name unexpected - end critical two -end subroutine test2 diff --git a/test-lit/Semantics/critical02.f90 b/test-lit/Semantics/critical02.f90 deleted file mode 100644 index ba5e0f4c55a7..000000000000 --- a/test-lit/Semantics/critical02.f90 +++ /dev/null @@ -1,122 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!C1118 - -subroutine test1 - critical - !ERROR: RETURN statement is not allowed in a CRITICAL construct - return - end critical -end subroutine test1 - -subroutine test2() - implicit none - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - SYNC ALL - end critical -end subroutine test2 - -subroutine test3() - use iso_fortran_env, only: team_type - implicit none - type(team_type) :: j - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - sync team (j) - end critical -end subroutine test3 - -subroutine test4() - integer, allocatable, codimension[:] :: ca - - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - allocate(ca[*]) - end critical - - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - deallocate(ca) - end critical -end subroutine test4 - -subroutine test5() - use iso_fortran_env, only: team_type - implicit none - type(team_type) :: j - critical - change team (j) - !ERROR: An image control statement is not allowed in a CRITICAL construct - end team - end critical -end subroutine test5 - -subroutine test6 - critical - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - end critical - end critical -end subroutine test6 - -subroutine test7() - use iso_fortran_env - type(event_type) :: x, y - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - event post (x) - !ERROR: An image control statement is not allowed in a CRITICAL construct - event wait (y) - end critical -end subroutine test7 - -subroutine test8() - use iso_fortran_env - type(team_type) :: t - - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - form team(1, t) - end critical -end subroutine test8 - -subroutine test9() - use iso_fortran_env - type(lock_type) :: l - - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - lock(l) - !ERROR: An image control statement is not allowed in a CRITICAL construct - unlock(l) - end critical -end subroutine test9 - -subroutine test10() - use iso_fortran_env - integer, allocatable, codimension[:] :: ca - allocate(ca[*]) - - critical - block - integer, allocatable, codimension[:] :: cb - cb = ca - !TODO: Deallocation of this coarray is not currently caught - end block - end critical -end subroutine test10 - -subroutine test11() - integer, allocatable, codimension[:] :: ca, cb - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - call move_alloc(cb, ca) - end critical -end subroutine test11 - -subroutine test12() - critical - !ERROR: An image control statement is not allowed in a CRITICAL construct - stop - end critical -end subroutine test12 diff --git a/test-lit/Semantics/critical03.f90 b/test-lit/Semantics/critical03.f90 deleted file mode 100644 index 2ab60e5d59a9..000000000000 --- a/test-lit/Semantics/critical03.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!C1119 - -subroutine test1(a, i) - integer i - real a(10) - critical - if (a(i) < 0.0) then - a(i) = 20.20 - !ERROR: Control flow escapes from CRITICAL - goto 20 - end if - end critical -20 a(i) = -a(i) -end subroutine test1 - -subroutine test2(i) - integer i - critical - !ERROR: Control flow escapes from CRITICAL - if (i) 10, 10, 20 - 10 i = i + 1 - end critical -20 i = i - 1 -end subroutine test2 - -subroutine test3(i) - integer i - critical - !ERROR: Control flow escapes from CRITICAL - goto (10, 10, 20) i - 10 i = i + 1 - end critical -20 i = i - 1 -end subroutine test3 diff --git a/test-lit/Semantics/critical04.f90 b/test-lit/Semantics/critical04.f90 deleted file mode 100644 index 136e31baa621..000000000000 --- a/test-lit/Semantics/critical04.f90 +++ /dev/null @@ -1,33 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK-NOT: Control flow escapes from CRITICAL - -subroutine test1(a, i) - integer i - real a(10) - critical - if (a(i) < 0.0) then - a(i) = 20.20 - goto 20 - end if -20 a(i) = -a(i) - end critical -end subroutine test1 - -subroutine test2(i) - integer i - critical - if (i) 10, 10, 20 -10 i = i + 1 -20 i = i - 1 - end critical -end subroutine test2 - -subroutine test3(i) - integer i - critical - goto (10, 10, 20) i -10 i = i + 1 -20 i = i - 1 - end critical -end subroutine test3 diff --git a/test-lit/Semantics/data01.f90 b/test-lit/Semantics/data01.f90 deleted file mode 100644 index 4bdf7ea9dd4a..000000000000 --- a/test-lit/Semantics/data01.f90 +++ /dev/null @@ -1,62 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!Test for checking data constraints, C882-C887 -module m1 - type person - integer :: age - character(len=25) :: name - end type - integer, parameter::digits(5) = ( /-11,-22,-33,44,55/ ) - integer ::notConstDigits(5) = ( /-11,-22,-33,44,55/ ) - real, parameter::numbers(5) = ( /-11.11,-22.22,-33.33,44.44,55.55/ ) - integer, parameter :: repeat = -1 - integer :: myAge = 2 - type(person) myName -end - -subroutine CheckRepeat - use m1 - !C882 - !ERROR: Missing initialization for parameter 'uninitialized' - integer, parameter :: uninitialized - !C882 - !ERROR: Repeat count for data value must not be negative - DATA myName%age / repeat * 35 / - !C882 - !ERROR: Repeat count for data value must not be negative - DATA myName%age / digits(1) * 35 / - !C882 - !ERROR: Must be a constant value - DATA myName%age / repet * 35 / - !C885 - !ERROR: Must have INTEGER type, but is REAL(4) - DATA myName%age / numbers(1) * 35 / - !C886 - !ERROR: Must be a constant value - DATA myName%age / notConstDigits(1) * 35 / - !C887 - !ERROR: Must be a constant value - DATA myName%age / digits(myAge) * 35 / -end - -subroutine CheckValue - use m1 - !OK: constant structure constructor - data myname / person(1, 'Abcd Ijkl') / - !C883 - !ERROR: 'persn' is not an array - data myname / persn(2, 'Abcd Efgh') / - !C884 - !ERROR: Structure constructor in data value must be a constant expression - data myname / person(myAge, 'Abcd Ijkl') / - integer, parameter :: a(5) =(/11, 22, 33, 44, 55/) - integer :: b(5) =(/11, 22, 33, 44, 55/) - integer :: i - integer :: x - !OK: constant array element - data x / a(1) / - !C886, C887 - !ERROR: Must be a constant value - data x / a(i) / - !ERROR: Must be a constant value - data x / b(1) / -end diff --git a/test-lit/Semantics/data02.f90 b/test-lit/Semantics/data02.f90 deleted file mode 100644 index ac6902622d83..000000000000 --- a/test-lit/Semantics/data02.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check that expressions are analyzed in data statements - -subroutine s1 - type :: t - character(1) :: c - end type - type(t) :: x - !ERROR: Value in structure constructor of type INTEGER(4) is incompatible with component 'c' of type CHARACTER(KIND=1,LEN=1_4) - data x /t(1)/ -end - -subroutine s2 - real :: x1, x2 - integer :: i1, i2 - !ERROR: Unsupported REAL(KIND=99) - data x1 /1.0_99/ - !ERROR: Unsupported REAL(KIND=99) - data x2 /-1.0_99/ - !ERROR: INTEGER(KIND=99) is not a supported type - data i1 /1_99/ - !ERROR: INTEGER(KIND=99) is not a supported type - data i2 /-1_99/ -end - -subroutine s3 - complex :: z1, z2 - !ERROR: Unsupported REAL(KIND=99) - data z1 /(1.0, 2.0_99)/ - !ERROR: Unsupported REAL(KIND=99) - data z2 /-(1.0, 2.0_99)/ -end diff --git a/test-lit/Semantics/deallocate01.f90 b/test-lit/Semantics/deallocate01.f90 deleted file mode 100644 index 8aaf14496d71..000000000000 --- a/test-lit/Semantics/deallocate01.f90 +++ /dev/null @@ -1,48 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test that DEALLOCATE works - -INTEGER, PARAMETER :: maxvalue=1024 - -Type dt - Integer :: l = 3 -End Type -Type t - Type(dt),Pointer :: p -End Type - -Type(t),Allocatable :: x(:) -Type(t),Pointer :: y(:) -Type(t),Pointer :: z -Integer :: s -CHARACTER(256) :: e - -Integer, Pointer :: pi - -Allocate(pi) -Allocate(x(3)) - -Deallocate(x(2)%p) - -Deallocate(y(2)%p) - -Deallocate(pi) - -Deallocate(z%p) - -Deallocate(x%p, stat=s, errmsg=e) -Deallocate(x%p, errmsg=e) -Deallocate(x%p, stat=s) - -Deallocate(y%p, stat=s, errmsg=e) -Deallocate(y%p, errmsg=e) -Deallocate(y%p, stat=s) - -Deallocate(z, stat=s, errmsg=e) -Deallocate(z, errmsg=e) -Deallocate(z, stat=s) - -Deallocate(z, y%p, stat=s, errmsg=e) -Deallocate(z, y%p, errmsg=e) -Deallocate(z, y%p, stat=s) - -End Program diff --git a/test-lit/Semantics/deallocate04.f90 b/test-lit/Semantics/deallocate04.f90 deleted file mode 100644 index 2a1ad62b9920..000000000000 --- a/test-lit/Semantics/deallocate04.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for type errors in DEALLOCATE statements - -INTEGER, PARAMETER :: maxvalue=1024 - -Type dt - Integer :: l = 3 -End Type -Type t - Type(dt) :: p -End Type - -Type(t),Allocatable :: x - -Real :: r -Integer :: s -Integer :: e -Integer :: pi -Character(256) :: ee -Procedure(Real) :: prp - -Allocate(x) - -!ERROR: Must have CHARACTER type, but is INTEGER(4) -Deallocate(x, stat=s, errmsg=e) - -!ERROR: Must have INTEGER type, but is REAL(4) -!ERROR: Must have CHARACTER type, but is INTEGER(4) -Deallocate(x, stat=r, errmsg=e) - -End Program diff --git a/test-lit/Semantics/deallocate05.f90 b/test-lit/Semantics/deallocate05.f90 deleted file mode 100644 index fdc66004e2ce..000000000000 --- a/test-lit/Semantics/deallocate05.f90 +++ /dev/null @@ -1,66 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in DEALLOCATE statements - -Module share - Real, Pointer :: rp -End Module share - -Program deallocatetest -Use share - -INTEGER, PARAMETER :: maxvalue=1024 - -Type dt - Integer :: l = 3 -End Type -Type t - Type(dt) :: p -End Type - -Type(t),Allocatable :: x(:) - -Real :: r -Integer :: s -Integer :: e -Integer :: pi -Character(256) :: ee -Procedure(Real) :: prp - -Allocate(rp) -Deallocate(rp) - -Allocate(x(3)) - -!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute -Deallocate(x(2)%p) - -!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute -Deallocate(pi) - -!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute -!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute -Deallocate(x(2)%p, pi) - -!ERROR: name in DEALLOCATE statement must be a variable name -Deallocate(prp) - -!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute -!ERROR: name in DEALLOCATE statement must be a variable name -Deallocate(pi, prp) - -!ERROR: name in DEALLOCATE statement must be a variable name -Deallocate(maxvalue) - -!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute -Deallocate(x%p) - -!ERROR: STAT may not be duplicated in a DEALLOCATE statement -Deallocate(x, stat=s, stat=s) -!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement -Deallocate(x, errmsg=ee, errmsg=ee) -!ERROR: STAT may not be duplicated in a DEALLOCATE statement -Deallocate(x, stat=s, errmsg=ee, stat=s) -!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement -Deallocate(x, stat=s, errmsg=ee, errmsg=ee) - -End Program deallocatetest diff --git a/test-lit/Semantics/doconcurrent01.f90 b/test-lit/Semantics/doconcurrent01.f90 deleted file mode 100644 index a4161a5c3073..000000000000 --- a/test-lit/Semantics/doconcurrent01.f90 +++ /dev/null @@ -1,242 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1141 -! A reference to the procedure IEEE_SET_HALTING_MODE ! from the intrinsic -! module IEEE_EXCEPTIONS, shall not ! appear within a DO CONCURRENT construct. -! -! C1137 -! An image control statement shall not appear within a DO CONCURRENT construct. -! -! C1136 -! A RETURN statement shall not appear within a DO CONCURRENT construct. -! -! (11.1.7.5), paragraph 4 -! In a DO CONCURRENT, can't have an i/o statement with an ADVANCE= specifier - -subroutine do_concurrent_test1(i,n) - implicit none - integer :: i, n - do 10 concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - SYNC ALL -!ERROR: An image control statement is not allowed in DO CONCURRENT - SYNC IMAGES (*) -!ERROR: An image control statement is not allowed in DO CONCURRENT - SYNC MEMORY -!ERROR: RETURN is not allowed in DO CONCURRENT - return -10 continue -end subroutine do_concurrent_test1 - -subroutine do_concurrent_test2(i,j,n,flag) - use ieee_exceptions - use iso_fortran_env, only: team_type - implicit none - integer :: i, n - type(ieee_flag_type) :: flag - logical :: flagValue, halting - type(team_type) :: j - type(ieee_status_type) :: status - do concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - sync team (j) -!ERROR: An image control statement is not allowed in DO CONCURRENT - change team (j) -!ERROR: An image control statement is not allowed in DO CONCURRENT - critical -!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT - call ieee_get_status(status) -!ERROR: IEEE_SET_HALTING_MODE is not allowed in DO CONCURRENT - call ieee_set_halting_mode(flag, halting) - end critical - end team -!ERROR: ADVANCE specifier is not allowed in DO CONCURRENT - write(*,'(a35)',advance='no') - end do - -! The following is OK - do concurrent (i = 1:n) - call ieee_set_flag(flag, flagValue) - end do -end subroutine do_concurrent_test2 - -subroutine s1() - use iso_fortran_env - type(event_type) :: x - do concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - event post (x) - end do -end subroutine s1 - -subroutine s2() - use iso_fortran_env - type(event_type) :: x - do concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - event wait (x) - end do -end subroutine s2 - -subroutine s3() - use iso_fortran_env - type(team_type) :: t - - do concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - form team(1, t) - end do -end subroutine s3 - -subroutine s4() - use iso_fortran_env - type(lock_type) :: l - - do concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - lock(l) -!ERROR: An image control statement is not allowed in DO CONCURRENT - unlock(l) - end do -end subroutine s4 - -subroutine s5() - do concurrent (i = 1:n) -!ERROR: An image control statement is not allowed in DO CONCURRENT - stop - end do -end subroutine s5 - -subroutine s6() - type :: type0 - integer, allocatable, dimension(:) :: type0_field - integer, allocatable, dimension(:), codimension[:] :: coarray_type0_field - end type - - type :: type1 - type(type0) :: type1_field - end type - - type(type1) :: pvar; - type(type1) :: qvar; - integer, allocatable, dimension(:) :: array1 - integer, allocatable, dimension(:) :: array2 - integer, allocatable, codimension[:] :: ca, cb - integer, allocatable :: aa, ab - - ! All of the following are allowable outside a DO CONCURRENT - allocate(array1(3), pvar%type1_field%type0_field(3), array2(9)) - allocate(pvar%type1_field%coarray_type0_field(3)[*]) - allocate(ca[*]) - allocate(ca[*], pvar%type1_field%coarray_type0_field(3)[*]) - - do concurrent (i = 1:10) - allocate(pvar%type1_field%type0_field(3)) - end do - - do concurrent (i = 1:10) -!ERROR: An image control statement is not allowed in DO CONCURRENT - allocate(ca[*]) - end do - - do concurrent (i = 1:10) -!ERROR: An image control statement is not allowed in DO CONCURRENT - deallocate(ca) - end do - - do concurrent (i = 1:10) -!ERROR: An image control statement is not allowed in DO CONCURRENT - allocate(pvar%type1_field%coarray_type0_field(3)[*]) - end do - - do concurrent (i = 1:10) -!ERROR: An image control statement is not allowed in DO CONCURRENT - deallocate(pvar%type1_field%coarray_type0_field) - end do - - do concurrent (i = 1:10) -!ERROR: An image control statement is not allowed in DO CONCURRENT - allocate(ca[*], pvar%type1_field%coarray_type0_field(3)[*]) - end do - - do concurrent (i = 1:10) -!ERROR: An image control statement is not allowed in DO CONCURRENT - deallocate(ca, pvar%type1_field%coarray_type0_field) - end do - -! Call to MOVE_ALLOC of a coarray outside a DO CONCURRENT. This is OK. -call move_alloc(ca, cb) - -! Note that the errors below relating to MOVE_ALLOC() bing impure are bogus. -! They're the result of the fact that access to the move_alloc() instrinsic -! is not yet possible. - - allocate(aa) - do concurrent (i = 1:10) -!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT - call move_alloc(aa, ab) - end do - -! Call to MOVE_ALLOC with non-coarray arguments in a DO CONCURRENT. This is OK. - - do concurrent (i = 1:10) -!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT -!ERROR: An image control statement is not allowed in DO CONCURRENT - call move_alloc(ca, cb) - end do - - do concurrent (i = 1:10) -!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT -!ERROR: An image control statement is not allowed in DO CONCURRENT - call move_alloc(pvar%type1_field%coarray_type0_field, qvar%type1_field%coarray_type0_field) - end do -end subroutine s6 - -subroutine s7() - interface - pure integer function pf() - end function pf - end interface - - type :: procTypeNotPure - procedure(notPureFunc), pointer, nopass :: notPureProcComponent - end type procTypeNotPure - - type :: procTypePure - procedure(pf), pointer, nopass :: pureProcComponent - end type procTypePure - - type(procTypeNotPure) :: procVarNotPure - type(procTypePure) :: procVarPure - integer :: ivar - - procVarPure%pureProcComponent => pureFunc - - do concurrent (i = 1:10) - print *, "hello" - end do - - do concurrent (i = 1:10) - ivar = pureFunc() - end do - - ! This should not generate errors - do concurrent (i = 1:10) - ivar = procVarPure%pureProcComponent() - end do - - ! This should generate an error - do concurrent (i = 1:10) -!ERROR: Call to an impure procedure component is not allowed in DO CONCURRENT - ivar = procVarNotPure%notPureProcComponent() - end do - - contains - integer function notPureFunc() - notPureFunc = 2 - end function notPureFunc - - pure integer function pureFunc() - pureFunc = 3 - end function pureFunc - -end subroutine s7 diff --git a/test-lit/Semantics/doconcurrent02.f90 b/test-lit/Semantics/doconcurrent02.f90 deleted file mode 100644 index db120b62bc45..000000000000 --- a/test-lit/Semantics/doconcurrent02.f90 +++ /dev/null @@ -1,42 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative tests: we don't want DO CONCURRENT semantics constraints checked -! when the loops are not DO CONCURRENT - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK-NOT: image control statement not allowed in DO CONCURRENT -! CHECK-NOT: RETURN not allowed in DO CONCURRENT -! CHECK-NOT: call to impure procedure in DO CONCURRENT not allowed -! CHECK-NOT: IEEE_GET_FLAG not allowed in DO CONCURRENT -! CHECK-NOT: ADVANCE specifier not allowed in DO CONCURRENT -! CHECK-NOT: SYNC ALL -! CHECK-NOT: SYNC IMAGES - -module ieee_exceptions - interface - subroutine ieee_get_flag(i, j) - integer :: i, j - end subroutine ieee_get_flag - end interface -end module ieee_exceptions - -subroutine do_concurrent_test1(i,n) - implicit none - integer :: i, n - do 10 i = 1,n - SYNC ALL - SYNC IMAGES (*) - return -10 continue -end subroutine do_concurrent_test1 - -subroutine do_concurrent_test2(i,j,n,flag) - use ieee_exceptions - implicit none - integer :: i, j, n, flag, flag2 - do i = 1,n - change team (j) - call ieee_get_flag(flag, flag2) - end team - write(*,'(a35)',advance='no') - end do -end subroutine do_concurrent_test2 diff --git a/test-lit/Semantics/doconcurrent03.f90 b/test-lit/Semantics/doconcurrent03.f90 deleted file mode 100644 index cfefd92cc3b0..000000000000 --- a/test-lit/Semantics/doconcurrent03.f90 +++ /dev/null @@ -1,21 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: Control flow escapes from DO CONCURRENT -! CHECK: branch into loop body from outside -! CHECK: the loop branched into - -subroutine s(a) - integer i - real a(10) - do 10 concurrent (i = 1:10) - if (a(i) < 0.0) then - goto 20 - end if -30 continue - a(i) = 1.0 -10 end do - goto 40 -20 a(i) = -a(i) - goto 30 -40 continue -end subroutine s diff --git a/test-lit/Semantics/doconcurrent04.f90 b/test-lit/Semantics/doconcurrent04.f90 deleted file mode 100644 index 51ec5737a154..000000000000 --- a/test-lit/Semantics/doconcurrent04.f90 +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! C1122 The index-name shall be a named scalar variable of type integer. -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: Must have INTEGER type, but is REAL\\(4\\) - -subroutine do_concurrent_test1(n) - implicit none - integer :: n - real :: j - do 20 concurrent (j = 1:n) -20 enddo -end subroutine do_concurrent_test1 diff --git a/test-lit/Semantics/doconcurrent05.f90 b/test-lit/Semantics/doconcurrent05.f90 deleted file mode 100644 index d92ef6d18322..000000000000 --- a/test-lit/Semantics/doconcurrent05.f90 +++ /dev/null @@ -1,54 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if -! it belongs to that construct or an outer construct. - -subroutine do_concurrent_test1(n) - implicit none - integer :: n - integer :: j,k - mydoc: do concurrent(j=1:n) - mydo: do k=1,n -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (k==5) exit mydoc - if (j==10) exit mydo - end do mydo - end do mydoc -end subroutine do_concurrent_test1 - -subroutine do_concurrent_test2(n) - implicit none - integer :: j,k,n - mydoc: do concurrent(j=1:n) -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (k==5) exit - end do mydoc -end subroutine do_concurrent_test2 - -subroutine do_concurrent_test3(n) - implicit none - integer :: j,k,n - mytest3: if (n>0) then - mydoc: do concurrent(j=1:n) - do k=1,n -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (j==10) exit mytest3 - end do - end do mydoc - end if mytest3 -end subroutine do_concurrent_test3 - -subroutine do_concurrent_test4(n) - implicit none - integer :: j,k,n - mytest4: if (n>0) then - mydoc: do concurrent(j=1:n) - do concurrent(k=1:n) -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (k==5) exit -!ERROR: EXIT must not leave a DO CONCURRENT statement -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (j==10) exit mytest4 - end do - end do mydoc - end if mytest4 -end subroutine do_concurrent_test4 diff --git a/test-lit/Semantics/doconcurrent06.f90 b/test-lit/Semantics/doconcurrent06.f90 deleted file mode 100644 index f178b7a11640..000000000000 --- a/test-lit/Semantics/doconcurrent06.f90 +++ /dev/null @@ -1,70 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if -! it belongs to that construct or an outer construct. - -subroutine do_concurrent_test1(n) - implicit none - integer :: i1,i2,i3,i4,i5,i6,n - mytest1: if (n>0) then - nc1: do concurrent(i1=1:n) - nc2: do i2=1,n - nc3: do concurrent(i3=1:n) - nc4: do i4=1,n - nc5: do concurrent(i5=1:n) - nc6: do i6=1,n -!ERROR: EXIT must not leave a DO CONCURRENT statement -!ERROR: EXIT must not leave a DO CONCURRENT statement -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (i6==10) exit mytest1 - end do nc6 - end do nc5 - end do nc4 - end do nc3 - end do nc2 - end do nc1 - end if mytest1 -end subroutine do_concurrent_test1 - -subroutine do_concurrent_test2(n) - implicit none - integer :: i1,i2,i3,i4,i5,i6,n - mytest2: if (n>0) then - nc1: do concurrent(i1=1:n) - nc2: do i2=1,n - nc3: do concurrent(i3=1:n) - nc4: do i4=1,n - nc5: do concurrent(i5=1:n) - nc6: do i6=1,n -!ERROR: EXIT must not leave a DO CONCURRENT statement -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (i6==10) exit nc3 - end do nc6 - end do nc5 - end do nc4 - end do nc3 - end do nc2 - end do nc1 - end if mytest2 -end subroutine do_concurrent_test2 - -subroutine do_concurrent_test3(n) - implicit none - integer :: i1,i2,i3,i4,i5,i6,n - mytest3: if (n>0) then - nc1: do concurrent(i1=1:n) - nc2: do i2=1,n - nc3: do concurrent(i3=1:n) -!ERROR: EXIT must not leave a DO CONCURRENT statement - if (i3==4) exit nc2 - nc4: do i4=1,n - nc5: do concurrent(i5=1:n) - nc6: do i6=1,n - if (i6==10) print *, "hello" - end do nc6 - end do nc5 - end do nc4 - end do nc3 - end do nc2 - end do nc1 - end if mytest3 -end subroutine do_concurrent_test3 diff --git a/test-lit/Semantics/doconcurrent07.f90 b/test-lit/Semantics/doconcurrent07.f90 deleted file mode 100644 index 661d51a71be5..000000000000 --- a/test-lit/Semantics/doconcurrent07.f90 +++ /dev/null @@ -1,43 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK-NOT: exit from DO CONCURRENT construct - -subroutine do_concurrent_test1(n) - implicit none - integer :: j,k,l,n - mytest: if (n>0) then - mydoc: do concurrent(j=1:n) - mydo: do k=1,n - if (k==5) exit - if (k==6) exit mydo - end do mydo - do concurrent(l=1:n) - if (l==5) print *, "test" - end do - end do mydoc - do k=1,n - if (k==5) exit mytest - end do - end if mytest -end subroutine do_concurrent_test1 - -subroutine do_concurrent_test2(n) - implicit none - integer :: i1,i2,i3,i4,i5,i6,n - mytest2: if (n>0) then - nc1: do concurrent(i1=1:n) - nc2: do i2=1,n - nc3: do concurrent(i3=1:n) - nc4: do i4=1,n - if (i3==4) exit nc4 - nc5: do concurrent(i5=1:n) - nc6: do i6=1,n - if (i6==10) print *, "hello" - end do nc6 - end do nc5 - end do nc4 - end do nc3 - end do nc2 - end do nc1 - end if mytest2 -end subroutine do_concurrent_test2 diff --git a/test-lit/Semantics/doconcurrent08.f90 b/test-lit/Semantics/doconcurrent08.f90 deleted file mode 100644 index 91a077fade49..000000000000 --- a/test-lit/Semantics/doconcurrent08.f90 +++ /dev/null @@ -1,276 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1140 -- A statement that might result in the deallocation of a polymorphic -! entity shall not appear within a DO CONCURRENT construct. -module m1 - ! Base type with scalar components - type :: Base - integer :: baseField1 - end type - - ! Child type so we can allocate polymorphic entities - type, extends(Base) :: ChildType - integer :: childField - end type - - ! Type with a polymorphic, allocatable component - type, extends(Base) :: HasAllocPolyType - class(Base), allocatable :: allocPolyField - end type - - ! Type with a allocatable, coarray component - type :: HasAllocCoarrayType - type(Base), allocatable, codimension[:] :: allocCoarrayField - end type - - ! Type with a polymorphic, allocatable, coarray component - type :: HasAllocPolyCoarrayType - class(Base), allocatable, codimension[:] :: allocPolyCoarrayField - end type - - ! Type with a polymorphic, pointer component - type, extends(Base) :: HasPointerPolyType - class(Base), pointer :: pointerPolyField - end type - - class(Base), allocatable :: baseVar1 - type(Base) :: baseVar2 -end module m1 - -subroutine s1() - ! Test deallocation of polymorphic entities caused by block exit - use m1 - - block - ! The following should not cause problems - integer :: outerInt - - ! The following are OK since they're not in a DO CONCURRENT - class(Base), allocatable :: outerAllocatablePolyVar - class(Base), allocatable, codimension[:] :: outerAllocatablePolyCoarray - type(HasAllocPolyType), allocatable :: outerAllocatableWithAllocPoly - type(HasAllocPolyCoarrayType), allocatable :: outerAllocWithAllocPolyCoarray - - do concurrent (i = 1:10) - ! The following should not cause problems - block - integer, allocatable :: blockInt - end block - block - ! Test polymorphic entities - ! OK because it's a pointer to a polymorphic entity - class(Base), pointer :: pointerPoly - - ! OK because it's not polymorphic - integer, allocatable :: intAllocatable - - ! OK because it's not polymorphic - type(Base), allocatable :: allocatableNonPolyBlockVar - - ! Bad because it's polymorphic and allocatable - class(Base), allocatable :: allocatablePoly - - ! OK because it has the SAVE attribute - class(Base), allocatable, save :: allocatablePolySave - - ! Bad because it's polymorphic and allocatable - class(Base), allocatable, codimension[:] :: allocatablePolyCoarray - - ! OK because it's not polymorphic and allocatable - type(Base), allocatable, codimension[:] :: allocatableCoarray - - ! Bad because it has a allocatable polymorphic component - type(HasAllocPolyType), allocatable :: allocatableWithAllocPoly - - ! OK because the declared variable is not allocatable - type(HasAllocPolyType) :: nonAllocatableWithAllocPoly - - ! OK because the declared variable is not allocatable - type(HasAllocPolyCoarrayType) :: nonAllocatableWithAllocPolyCoarray - - ! Bad because even though the declared the allocatable component is a coarray - type(HasAllocPolyCoarrayType), allocatable :: allocWithAllocPolyCoarray - - ! OK since it has no polymorphic component - type(HasAllocCoarrayType) :: nonAllocWithAllocCoarray - - ! OK since it has no component that's polymorphic, oops - type(HasPointerPolyType), allocatable :: allocatableWithPointerPoly - -!ERROR: Deallocation of a polymorphic entity caused by block exit not allowed in DO CONCURRENT -!ERROR: Deallocation of a polymorphic entity caused by block exit not allowed in DO CONCURRENT -!ERROR: Deallocation of a polymorphic entity caused by block exit not allowed in DO CONCURRENT -!ERROR: Deallocation of a polymorphic entity caused by block exit not allowed in DO CONCURRENT - end block - end do - end block - -end subroutine s1 - -subroutine s2() - ! Test deallocation of a polymorphic entity cause by intrinsic assignment - use m1 - - class(Base), allocatable :: localVar - class(Base), allocatable :: localVar1 - type(Base), allocatable :: localVar2 - - type(HasAllocPolyType), allocatable :: polyComponentVar - type(HasAllocPolyType), allocatable :: polyComponentVar1 - - type(HasAllocPolyType) :: nonAllocPolyComponentVar - type(HasAllocPolyType) :: nonAllocPolyComponentVar1 - class(HasAllocPolyCoarrayType), allocatable :: allocPolyCoarray - class(HasAllocPolyCoarrayType), allocatable :: allocPolyCoarray1 - - class(Base), allocatable, codimension[:] :: allocPolyComponentVar - class(Base), allocatable, codimension[:] :: allocPolyComponentVar1 - - allocate(ChildType :: localVar) - allocate(ChildType :: localVar1) - allocate(Base :: localVar2) - allocate(polyComponentVar) - allocate(polyComponentVar1) - allocate(allocPolyCoarray) - allocate(allocPolyCoarray1) - - ! These are OK because they're not in a DO CONCURRENT - localVar = localVar1 - nonAllocPolyComponentVar = nonAllocPolyComponentVar1 - polyComponentVar = polyComponentVar1 - allocPolyCoarray = allocPolyCoarray1 - - do concurrent (i = 1:10) - ! Test polymorphic entities - ! Bad because localVar is allocatable and polymorphic, 10.2.1.3, par. 3 -!ERROR: Deallocation of a polymorphic entity caused by assignment not allowed in DO CONCURRENT - localVar = localVar1 - - ! The next one should be OK since localVar2 is not polymorphic - localVar2 = localVar1 - - ! Bad because the copying of the components causes deallocation -!ERROR: Deallocation of a polymorphic entity caused by assignment not allowed in DO CONCURRENT - nonAllocPolyComponentVar = nonAllocPolyComponentVar1 - - ! Bad because possible deallocation a variable with a polymorphic component -!ERROR: Deallocation of a polymorphic entity caused by assignment not allowed in DO CONCURRENT - polyComponentVar = polyComponentVar1 - - ! Bad because deallocation upon assignment happens with allocatable - ! entities, even if they're coarrays. The noncoarray restriction only - ! applies to components -!ERROR: Deallocation of a polymorphic entity caused by assignment not allowed in DO CONCURRENT - allocPolyCoarray = allocPolyCoarray1 - - end do -end subroutine s2 - -subroutine s3() - ! Test direct deallocation - use m1 - - class(Base), allocatable :: polyVar - type(Base), allocatable :: nonPolyVar - type(HasAllocPolyType), allocatable :: polyComponentVar - type(HasAllocPolyType), pointer :: pointerPolyComponentVar - - allocate(ChildType:: polyVar) - allocate(nonPolyVar) - allocate(polyComponentVar) - allocate(pointerPolyComponentVar) - - ! These are all good because they're not in a do concurrent - deallocate(polyVar) - allocate(polyVar) - deallocate(polyComponentVar) - allocate(polyComponentVar) - deallocate(pointerPolyComponentVar) - allocate(pointerPolyComponentVar) - - do concurrent (i = 1:10) - ! Bad because deallocation of a polymorphic entity -!ERROR: Deallocation of a polymorphic entity caused by a DEALLOCATE statement not allowed in DO CONCURRENT - deallocate(polyVar) - - ! Bad, deallocation of an entity with a polymorphic component -!ERROR: Deallocation of a polymorphic entity caused by a DEALLOCATE statement not allowed in DO CONCURRENT - deallocate(polyComponentVar) - - ! Bad, deallocation of a pointer to an entity with a polymorphic component -!ERROR: Deallocation of a polymorphic entity caused by a DEALLOCATE statement not allowed in DO CONCURRENT - deallocate(pointerPolyComponentVar) - - ! Deallocation of a nonpolymorphic entity - deallocate(nonPolyVar) - end do -end subroutine s3 - -module m2 - type :: impureFinal - contains - final :: impureSub - end type - - type :: pureFinal - contains - final :: pureSub - end type - - contains - - impure subroutine impureSub(x) - type(impureFinal), intent(in) :: x - end subroutine - - pure subroutine pureSub(x) - type(pureFinal), intent(in) :: x - end subroutine - - subroutine s4() - type(impureFinal), allocatable :: ifVar, ifvar1 - type(pureFinal), allocatable :: pfVar - allocate(ifVar) - allocate(ifVar1) - allocate(pfVar) - - ! OK for an ordinary DO loop - do i = 1,10 - if (i .eq. 1) deallocate(ifVar) - end do - - ! OK to invoke a PURE FINAL procedure in a DO CONCURRENT - ! This case does not work currently because the compiler's test for - ! HasImpureFinal() in .../lib/Semantics/tools.cc doesn't work correctly -! do concurrent (i = 1:10) -! if (i .eq. 1) deallocate(pfVar) -! end do - - ! Error to invoke an IMPURE FINAL procedure in a DO CONCURRENT - do concurrent (i = 1:10) - !ERROR: Deallocation of an entity with an IMPURE FINAL procedure caused by a DEALLOCATE statement not allowed in DO CONCURRENT - if (i .eq. 1) deallocate(ifVar) - end do - - do concurrent (i = 1:10) - if (i .eq. 1) then - block - type(impureFinal), allocatable :: ifVar - allocate(ifVar) - ! Error here because exiting this scope causes the finalization of - !ifvar which causes the invocation of an IMPURE FINAL procedure - !ERROR: Deallocation of an entity with an IMPURE FINAL procedure caused by block exit not allowed in DO CONCURRENT - end block - end if - end do - - do concurrent (i = 1:10) - if (i .eq. 1) then - ! Error here because the assignment statement causes the finalization - ! of ifvar which causes the invocation of an IMPURE FINAL procedure -!ERROR: Deallocation of an entity with an IMPURE FINAL procedure caused by assignment not allowed in DO CONCURRENT - ifvar = ifvar1 - end if - end do - end subroutine s4 - -end module m2 diff --git a/test-lit/Semantics/dosemantics01.f90 b/test-lit/Semantics/dosemantics01.f90 deleted file mode 100644 index 2261f184e3cc..000000000000 --- a/test-lit/Semantics/dosemantics01.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1131 -- check valid and invalid DO loop naming - -PROGRAM C1131 - IMPLICIT NONE - ! Valid construct - validDo: DO WHILE (.true.) - PRINT *, "Hello" - END DO ValidDo - - ! Missing name on END DO - missingEndDo: DO WHILE (.true.) - PRINT *, "Hello" -!ERROR: DO construct name required but missing - END DO - - ! Missing name on DO - DO WHILE (.true.) - PRINT *, "Hello" -!ERROR: DO construct name unexpected - END DO missingDO - -END PROGRAM C1131 diff --git a/test-lit/Semantics/dosemantics02.f90 b/test-lit/Semantics/dosemantics02.f90 deleted file mode 100644 index 96047f0a3678..000000000000 --- a/test-lit/Semantics/dosemantics02.f90 +++ /dev/null @@ -1,42 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1121 -- any procedure referenced in a concurrent header must be pure - -! Also, check that the step expressions are not zero. This is prohibited by -! Section 11.1.7.4.1, paragraph 1. - -SUBROUTINE do_concurrent_c1121(i,n) - IMPLICIT NONE - INTEGER :: i, n, flag - !ERROR: DO CONCURRENT mask expression may not reference impure procedure 'random' - DO CONCURRENT (i = 1:n, random() < 3) - flag = 3 - END DO - - CONTAINS - IMPURE FUNCTION random() RESULT(i) - INTEGER :: i - i = 35 - END FUNCTION random -END SUBROUTINE do_concurrent_c1121 - -SUBROUTINE s1() - INTEGER, PARAMETER :: constInt = 0 - - ! Warn on this one for backwards compatibility - DO 10 I = 1, 10, 0 - 10 CONTINUE - - ! Warn on this one for backwards compatibility - DO 20 I = 1, 10, 5 - 5 - 20 CONTINUE - - ! Error, no compatibility requirement for DO CONCURRENT - !ERROR: DO CONCURRENT step expression may not be zero - DO CONCURRENT (I = 1 : 10 : 0) - END DO - - ! Error, this time with an integer constant - !ERROR: DO CONCURRENT step expression may not be zero - DO CONCURRENT (I = 1 : 10 : constInt) - END DO -end subroutine s1 diff --git a/test-lit/Semantics/dosemantics03.f90 b/test-lit/Semantics/dosemantics03.f90 deleted file mode 100644 index c063a7b8c854..000000000000 --- a/test-lit/Semantics/dosemantics03.f90 +++ /dev/null @@ -1,290 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Issue 458 -- semantic checks for a normal DO loop. The DO variable -! and the initial, final, and step expressions must be INTEGER if the -! options for standard conformance and turning warnings into errors -! are both in effect. This test turns on the options for standards -! conformance and turning warnings into errors. This produces error -! messages for the cases where REAL and DOUBLE PRECISION variables -! and expressions are used in the DO controls. - -!OPTIONS: -Mstandard -Werror - -! C1120 -- DO variable (and associated expressions) must be INTEGER. -! This is extended by allowing REAL and DOUBLE PRECISION - -MODULE share - INTEGER :: intvarshare - REAL :: realvarshare - DOUBLE PRECISION :: dpvarshare -END MODULE share - -PROGRAM do_issue_458 - USE share - IMPLICIT NONE - INTEGER :: ivar - REAL :: rvar - DOUBLE PRECISION :: dvar - LOGICAL :: lvar - COMPLEX :: cvar - CHARACTER :: chvar - INTEGER, DIMENSION(3) :: avar - TYPE derived - REAL :: first - INTEGER :: second - END TYPE derived - TYPE(derived) :: devar - INTEGER, POINTER :: pivar - REAL, POINTER :: prvar - DOUBLE PRECISION, POINTER :: pdvar - LOGICAL, POINTER :: plvar - INTERFACE - SUBROUTINE sub() - END SUBROUTINE sub - FUNCTION ifunc() - END FUNCTION ifunc - END INTERFACE - PROCEDURE(ifunc), POINTER :: pifunc => NULL() - -! DO variables -! INTEGER DO variable - DO ivar = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! REAL DO variable - DO rvar = 1, 10, 3 - PRINT *, "rvar is: ", rvar - END DO - -! DOUBLE PRECISISON DO variable - DO dvar = 1, 10, 3 - PRINT *, "dvar is: ", dvar - END DO - -! Pointer to INTEGER DO variable - ALLOCATE(pivar) - DO pivar = 1, 10, 3 - PRINT *, "pivar is: ", pivar - END DO - -! Pointer to REAL DO variable - ALLOCATE(prvar) - DO prvar = 1, 10, 3 - PRINT *, "prvar is: ", prvar - END DO - -! Pointer to DOUBLE PRECISION DO variable - ALLOCATE(pdvar) - DO pdvar = 1, 10, 3 - PRINT *, "pdvar is: ", pdvar - END DO - -! CHARACTER DO variable -!ERROR: DO controls should be INTEGER - DO chvar = 1, 10, 3 - PRINT *, "chvar is: ", chvar - END DO - -! LOGICAL DO variable -!ERROR: DO controls should be INTEGER - DO lvar = 1, 10, 3 - PRINT *, "lvar is: ", lvar - END DO - -! COMPLEX DO variable -!ERROR: DO controls should be INTEGER - DO cvar = 1, 10, 3 - PRINT *, "cvar is: ", cvar - END DO - -! Derived type DO variable -!ERROR: DO controls should be INTEGER - DO devar = 1, 10, 3 - PRINT *, "devar is: ", devar - END DO - -! Pointer to LOGICAL DO variable - ALLOCATE(plvar) -!ERROR: DO controls should be INTEGER - DO plvar = 1, 10, 3 - PRINT *, "plvar is: ", plvar - END DO - -! SUBROUTINE DO variable -!ERROR: DO control must be an INTEGER variable - DO sub = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! FUNCTION DO variable -!ERROR: DO control must be an INTEGER variable - DO ifunc = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! POINTER to FUNCTION DO variable -!ERROR: DO control must be an INTEGER variable - DO pifunc = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Array DO variable -!ERROR: Must be a scalar value, but is a rank-1 array - DO avar = 1, 10, 3 - PRINT *, "plvar is: ", plvar - END DO - -! Undeclared DO variable -!ERROR: No explicit type declared for 'undeclared' - DO undeclared = 1, 10, 3 - PRINT *, "plvar is: ", plvar - END DO - -! Shared association INTEGER DO variable - DO intvarshare = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Shared association REAL DO variable - DO realvarshare = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Shared association DOUBLE PRECISION DO variable - DO dpvarshare = 1, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Initial expressions -! REAL initial expression - DO ivar = rvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! DOUBLE PRECISION initial expression - DO ivar = dvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to INTEGER initial expression - DO ivar = pivar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to REAL initial expression - DO ivar = prvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to DOUBLE PRECISION initial expression - DO ivar = pdvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! LOGICAL initial expression -!ERROR: DO controls should be INTEGER - DO ivar = lvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! COMPLEX initial expression -!ERROR: DO controls should be INTEGER - DO ivar = cvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Derived type initial expression -!ERROR: DO controls should be INTEGER - DO ivar = devar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to LOGICAL initial expression -!ERROR: DO controls should be INTEGER - DO ivar = plvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Invalid initial expression -!ERROR: Integer literal is too large for INTEGER(KIND=4) - DO ivar = -2147483648_4, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Final expression -! REAL final expression - DO ivar = 1, rvar, 3 - PRINT *, "ivar is: ", ivar - END DO - -! DOUBLE PRECISION final expression - DO ivar = 1, dvar, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to INTEGER final expression - DO ivar = 1, pivar, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to REAL final expression - DO ivar = 1, prvar, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to DOUBLE PRECISION final expression - DO ivar = pdvar, 10, 3 - PRINT *, "ivar is: ", ivar - END DO - -! COMPLEX final expression -!ERROR: DO controls should be INTEGER - DO ivar = 1, cvar, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Invalid final expression -!ERROR: Integer literal is too large for INTEGER(KIND=4) - DO ivar = 1, -2147483648_4, 3 - PRINT *, "ivar is: ", ivar - END DO - -! Step expression -! REAL step expression - DO ivar = 1, 10, rvar - PRINT *, "ivar is: ", ivar - END DO - -! DOUBLE PRECISION step expression - DO ivar = 1, 10, dvar - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to INTEGER step expression - DO ivar = 1, 10, pivar - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to REAL step expression - DO ivar = 1, 10, prvar - PRINT *, "ivar is: ", ivar - END DO - -! Pointer to DOUBLE PRECISION step expression - DO ivar = 1, 10, pdvar - PRINT *, "ivar is: ", ivar - END DO - -! COMPLEX Step expression -!ERROR: DO controls should be INTEGER - DO ivar = 1, 10, cvar - PRINT *, "ivar is: ", ivar - END DO - -! Invalid step expression -!ERROR: Integer literal is too large for INTEGER(KIND=4) - DO ivar = 1, 10, -2147483648_4 - PRINT *, "ivar is: ", ivar - END DO - -END PROGRAM do_issue_458 diff --git a/test-lit/Semantics/dosemantics04.f90 b/test-lit/Semantics/dosemantics04.f90 deleted file mode 100644 index 35a3c9493ca2..000000000000 --- a/test-lit/Semantics/dosemantics04.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1123 -- Expressions in DO CONCURRENT header cannot reference variables -! declared in the same header -PROGRAM dosemantics04 - IMPLICIT NONE - INTEGER :: a, i, j, k, n - - !ERROR: DO CONCURRENT mask expression references variable 'n' in LOCAL locality-spec - DO CONCURRENT (INTEGER *2 :: i = 1:10, i < j + n) LOCAL(n) - PRINT *, "hello" - END DO - - !ERROR: DO CONCURRENT mask expression references variable 'a' in LOCAL locality-spec - DO 30 CONCURRENT (i = 1:n:1, j=1:n:2, k=1:n:3, a<3) LOCAL (a) - PRINT *, "hello" -30 END DO - -! Initial expression - !ERROR: DO CONCURRENT limit expression may not reference index variable 'j' - DO CONCURRENT (i = j:3, j=1:3) - END DO - -! Final expression - !ERROR: DO CONCURRENT limit expression may not reference index variable 'j' - DO CONCURRENT (i = 1:j, j=1:3) - END DO - -! Step expression - !ERROR: DO CONCURRENT step expression may not reference index variable 'j' - DO CONCURRENT (i = 1:3:j, j=1:3) - END DO - - !ERROR: DO CONCURRENT limit expression may not reference index variable 'i' - DO CONCURRENT (INTEGER*2 :: i = 1:3, j=i:3) - END DO - -END PROGRAM dosemantics04 diff --git a/test-lit/Semantics/dosemantics05.f90 b/test-lit/Semantics/dosemantics05.f90 deleted file mode 100644 index f565f9b71679..000000000000 --- a/test-lit/Semantics/dosemantics05.f90 +++ /dev/null @@ -1,99 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test DO loop semantics for constraint C1130 -- -! The constraint states that "If the locality-spec DEFAULT ( NONE ) appears in a -! DO CONCURRENT statement; a variable that is a local or construct entity of a -! scope containing the DO CONCURRENT construct; and that appears in the block of -! the construct; shall have its locality explicitly specified by that -! statement." - -module m - real :: mvar -end module m - -subroutine s1() - use m - integer :: i, ivar, jvar, kvar - real :: x - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: c - class(point), pointer :: p_or_c - - p_or_c => c - - jvar = 5 - - ! References in this DO CONCURRENT are OK since there's no DEFAULT(NONE) - ! locality-spec - associate (avar => ivar) - do concurrent (i = 1:2) shared(jvar) - ivar = 3 - ivar = ivar + i - block - real :: bvar - avar = 4 - x = 3.5 - bvar = 3.5 + i - end block - jvar = 5 - mvar = 3.5 - end do - end associate - - associate (avar => ivar) -!ERROR: DO CONCURRENT step expression may not be zero - do concurrent (i = 1:2:0) default(none) shared(jvar) local(kvar) -!ERROR: Variable 'ivar' from an enclosing scope referenced in DO CONCURRENT with DEFAULT(NONE) must appear in a locality-spec - ivar = & -!ERROR: Variable 'ivar' from an enclosing scope referenced in DO CONCURRENT with DEFAULT(NONE) must appear in a locality-spec - ivar + i - block - real :: bvar -!ERROR: Variable 'avar' from an enclosing scope referenced in DO CONCURRENT with DEFAULT(NONE) must appear in a locality-spec - avar = 4 -!ERROR: Variable 'x' from an enclosing scope referenced in DO CONCURRENT with DEFAULT(NONE) must appear in a locality-spec - x = 3.5 - bvar = 3.5 + i ! OK, bvar's scope is within the DO CONCURRENT - end block - jvar = 5 ! OK, jvar appears in a locality spec - kvar = 5 ! OK, kvar appears in a locality spec - -!ERROR: Variable 'mvar' from an enclosing scope referenced in DO CONCURRENT with DEFAULT(NONE) must appear in a locality-spec - mvar = 3.5 - end do - end associate - - select type ( a => p_or_c ) - type is ( point ) - do concurrent (i=1:5) local(a) - ! C1130 This is OK because there's no DEFAULT(NONE) locality spec - a%x = 3.5 - end do - end select - - select type ( a => p_or_c ) - type is ( point ) - do concurrent (i=1:5) default (none) -!ERROR: Variable 'a' from an enclosing scope referenced in DO CONCURRENT with DEFAULT(NONE) must appear in a locality-spec - a%x = 3.5 - end do - end select - - select type ( a => p_or_c ) - type is ( point ) - do concurrent (i=1:5) default (none) local(a) - ! C1130 This is OK because 'a' is in a locality-spec - a%x = 3.5 - end do - end select - - x = 5.0 ! OK, we're not in a DO CONCURRENT - -end subroutine s1 diff --git a/test-lit/Semantics/dosemantics06.f90 b/test-lit/Semantics/dosemantics06.f90 deleted file mode 100644 index 41b9598970b5..000000000000 --- a/test-lit/Semantics/dosemantics06.f90 +++ /dev/null @@ -1,42 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1131, C1133 -- check valid and invalid DO loop naming -! C1131 (R1119) If the do-stmt of a do-construct specifies a do-construct-name, -! the corresponding end-do shall be an end-do-stmt specifying the same -! do-construct-name. If the do-stmt of a do-construct does not specify a -! do-construct-name, the corresponding end-do shall not specify a -! do-construct-name. -! -! C1133 (R1119) If the do-stmt is a label-do-stmt, the corresponding end-do -! shall be identified with the same label. - -subroutine s1() - implicit none - ! Valid construct - validdo: do while (.true.) - print *, "hello" - cycle validdo - print *, "Weird to get here" - end do validdo - - validdo: do while (.true.) - print *, "Hello" - end do validdo - - ! Missing name on initial DO - do while (.true.) - print *, "Hello" -!ERROR: DO construct name unexpected - end do formerlabelmissing - - dolabel: do while (.true.) - print *, "Hello" -!ERROR: DO construct name mismatch - end do differentlabel - - dowithcycle: do while (.true.) - print *, "Hello" -!ERROR: CYCLE construct-name is not in scope - cycle validdo - end do dowithcycle - -end subroutine s1 diff --git a/test-lit/Semantics/dosemantics07.f90 b/test-lit/Semantics/dosemantics07.f90 deleted file mode 100644 index f1450dda31eb..000000000000 --- a/test-lit/Semantics/dosemantics07.f90 +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!C1132 -! If the do-stmt is a nonlabel-do-stmt, the corresponding end-do shall be an -! end-do-stmt. -subroutine s1() - do while (.true.) - print *, "Hello" - continue -!ERROR: expected 'END DO' -end subroutine s1 diff --git a/test-lit/Semantics/dosemantics08.f90 b/test-lit/Semantics/dosemantics08.f90 deleted file mode 100644 index 388fb75254f8..000000000000 --- a/test-lit/Semantics/dosemantics08.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1138 -- -! A branch (11.2) within a DO CONCURRENT construct shall not have a branch -! target that is outside the construct. - -subroutine s1() - do concurrent (i=1:10) -!ERROR: Control flow escapes from DO CONCURRENT - goto 99 - end do - -99 print *, "Hello" - -end subroutine s1 diff --git a/test-lit/Semantics/dosemantics09.f90 b/test-lit/Semantics/dosemantics09.f90 deleted file mode 100644 index 46136f29c74e..000000000000 --- a/test-lit/Semantics/dosemantics09.f90 +++ /dev/null @@ -1,106 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!C1129 -!A variable that is referenced by the scalar-mask-expr of a -!concurrent-header or by any concurrent-limit or concurrent-step in that -!concurrent-header shall not appear in a LOCAL locality-spec in the same DO -!CONCURRENT statement. - -subroutine s1() - -!ERROR: 'i' is already declared in this scoping unit - do concurrent (i=1:10) local(i) - end do -end subroutine s1 - -subroutine s2() -!ERROR: 'i' is already declared in this scoping unit - do concurrent (i=1:10) local_init(i) - end do -end subroutine s2 - -subroutine s4() -!ERROR: DO CONCURRENT expression references variable 'i' in LOCAL locality-spec - do concurrent (j=i:10) local(i) - end do -end subroutine s4 - -subroutine s5() - !OK because the locality-spec is local_init - do concurrent (j=i:10) local_init(i) - end do -end subroutine s5 - -subroutine s6() - !OK because the locality-spec is shared - do concurrent (j=i:10) shared(i) - end do -end subroutine s6 - -subroutine s7() -!ERROR: DO CONCURRENT expression references variable 'i' in LOCAL locality-spec - do concurrent (j=1:i) local(i) - end do -end subroutine s7 - -subroutine s8() - !OK because the locality-spec is local_init - do concurrent (j=1:i) local_init(i) - end do -end subroutine s8 - -subroutine s9() - !OK because the locality-spec is shared - do concurrent (j=1:i) shared(i) - end do -end subroutine s9 - -subroutine s10() -!ERROR: DO CONCURRENT expression references variable 'i' in LOCAL locality-spec - do concurrent (j=1:10:i) local(i) - end do -end subroutine s10 - -subroutine s11() - !OK because the locality-spec is local_init - do concurrent (j=1:10:i) local_init(i) - end do -end subroutine s11 - -subroutine s12() - !OK because the locality-spec is shared - do concurrent (j=1:10:i) shared(i) - end do -end subroutine s12 - -subroutine s13() - ! Test construct-association, in this case, established by the "shared" - integer :: ivar - associate (avar => ivar) -!ERROR: DO CONCURRENT expression references variable 'ivar' in LOCAL locality-spec - do concurrent (j=1:10:avar) local(avar) - end do - end associate -end subroutine s13 - -module m1 - integer :: mvar -end module m1 -subroutine s14() - ! Test use-association, in this case, established by the "shared" - use m1 - -!ERROR: DO CONCURRENT expression references variable 'mvar' in LOCAL locality-spec - do concurrent (k=mvar:10) local(mvar) - end do -end subroutine s14 - -subroutine s15() - ! Test host-association, in this case, established by the "shared" - ! locality-spec - ivar = 3 - do concurrent (j=ivar:10) shared(ivar) -!ERROR: DO CONCURRENT expression references variable 'ivar' in LOCAL locality-spec - do concurrent (k=ivar:10) local(ivar) - end do - end do -end subroutine s15 diff --git a/test-lit/Semantics/dosemantics10.f90 b/test-lit/Semantics/dosemantics10.f90 deleted file mode 100644 index 561f9b7fb7ea..000000000000 --- a/test-lit/Semantics/dosemantics10.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1134 A CYCLE statement must be within a DO construct -! -! C1166 An EXIT statement must be within a DO construct - -subroutine s1() -! this one's OK - do i = 1,10 - cycle - end do - -! this one's OK - do i = 1,10 - exit - end do - -! all of these are OK - outer: do i = 1,10 - cycle - inner: do j = 1,10 - cycle - end do inner - cycle - end do outer - -!ERROR: No matching DO construct for CYCLE statement - cycle - -!ERROR: No matching construct for EXIT statement - exit - -!ERROR: No matching DO construct for CYCLE statement - if(.true.) cycle - -!ERROR: No matching construct for EXIT statement - if(.true.) exit - -end subroutine s1 diff --git a/test-lit/Semantics/dosemantics11.f90 b/test-lit/Semantics/dosemantics11.f90 deleted file mode 100644 index 760f9f5f9b60..000000000000 --- a/test-lit/Semantics/dosemantics11.f90 +++ /dev/null @@ -1,328 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1135 A cycle-stmt shall not appear within a CHANGE TEAM, CRITICAL, or DO -! CONCURRENT construct if it belongs to an outer construct. -! -! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if -! it belongs to that construct or an outer construct. -! -! C1168 -- An exit-stmt shall not appear within a CHANGE TEAM or CRITICAL -! construct if it belongs to an outer construct. - -subroutine s1() -!ERROR: No matching DO construct for CYCLE statement - cycle -end subroutine s1 - -subroutine s2() -!ERROR: No matching construct for EXIT statement - exit -end subroutine s2 - -subroutine s3() - level0: block -!ERROR: No matching DO construct for CYCLE statement - cycle level0 - end block level0 -end subroutine s3 - -subroutine s4() - level0: do i = 1, 10 - level1: do concurrent (j = 1:20) -!ERROR: CYCLE must not leave a DO CONCURRENT statement - cycle level0 - end do level1 - end do level0 -end subroutine s4 - -subroutine s5() - level0: do i = 1, 10 - level1: do concurrent (j = 1:20) -!ERROR: EXIT must not leave a DO CONCURRENT statement - exit level0 - end do level1 - end do level0 -end subroutine s5 - -subroutine s6() - level0: do i = 1, 10 - level1: critical -!ERROR: CYCLE must not leave a CRITICAL statement - cycle level0 - end critical level1 - end do level0 -end subroutine s6 - -subroutine s7() - level0: do i = 1, 10 - level1: critical -!ERROR: EXIT must not leave a CRITICAL statement - exit level0 - end critical level1 - end do level0 -end subroutine s7 - -subroutine s8() - use :: iso_fortran_env - type(team_type) team_var - - level0: do i = 1, 10 - level1: change team(team_var) -!ERROR: CYCLE must not leave a CHANGE TEAM statement - cycle level0 - end team level1 - end do level0 -end subroutine s8 - -subroutine s9() - use :: iso_fortran_env - type(team_type) team_var - - level0: do i = 1, 10 - level1: change team(team_var) -!ERROR: EXIT must not leave a CHANGE TEAM statement - exit level0 - end team level1 - end do level0 -end subroutine s9 - -subroutine s10(table) -! A complex, but all legal example - - integer :: table(..) - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: target_var - class(point), pointer :: p_or_c - - p_or_c => target_var - level0: do i = 1, 10 - level1: associate (avar => ivar) - level2: block - level3: select case (l) - case default - print*, "default" - case (1) - level4: if (.true.) then - level5: select rank(table) - rank default - level6: select type ( a => p_or_c ) - type is ( point ) - cycle level0 - end select level6 - end select level5 - end if level4 - end select level3 - end block level2 - end associate level1 - end do level0 -end subroutine s10 - -subroutine s11(table) -! A complex, but all legal example with a CYCLE statement - - integer :: table(..) - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: target_var - class(point), pointer :: p_or_c - - p_or_c => target_var - level0: do i = 1, 10 - level1: associate (avar => ivar) - level2: block - level3: select case (l) - case default - print*, "default" - case (1) - level4: if (.true.) then - level5: select rank(table) - rank default - level6: select type ( a => p_or_c ) - type is ( point ) - cycle level0 - end select level6 - end select level5 - end if level4 - end select level3 - end block level2 - end associate level1 - end do level0 -end subroutine s11 - -subroutine s12(table) -! A complex, but all legal example with an EXIT statement - - integer :: table(..) - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: target_var - class(point), pointer :: p_or_c - - p_or_c => target_var - level0: do i = 1, 10 - level1: associate (avar => ivar) - level2: block - level3: select case (l) - case default - print*, "default" - case (1) - level4: if (.true.) then - level5: select rank(table) - rank default - level6: select type ( a => p_or_c ) - type is ( point ) - exit level0 - end select level6 - end select level5 - end if level4 - end select level3 - end block level2 - end associate level1 - end do level0 -end subroutine s12 - -subroutine s13(table) -! Similar example without construct names - - integer :: table(..) - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: target_var - class(point), pointer :: p_or_c - - p_or_c => target_var - do i = 1, 10 - associate (avar => ivar) - block - select case (l) - case default - print*, "default" - case (1) - if (.true.) then - select rank(table) - rank default - select type ( a => p_or_c ) - type is ( point ) - cycle - end select - end select - end if - end select - end block - end associate - end do -end subroutine s13 - -subroutine s14(table) - - integer :: table(..) - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: target_var - class(point), pointer :: p_or_c - - p_or_c => target_var - do i = 1, 10 - associate (avar => ivar) - block - critical - select case (l) - case default - print*, "default" - case (1) - if (.true.) then - select rank(table) - rank default - select type ( a => p_or_c ) - type is ( point ) -!ERROR: CYCLE must not leave a CRITICAL statement - cycle -!ERROR: EXIT must not leave a CRITICAL statement - exit - end select - end select - end if - end select - end critical - end block - end associate - end do -end subroutine s14 - -subroutine s15(table) -! Illegal EXIT to an intermediated construct - - integer :: table(..) - - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: target_var - class(point), pointer :: p_or_c - - p_or_c => target_var - level0: do i = 1, 10 - level1: associate (avar => ivar) - level2: block - level3: select case (l) - case default - print*, "default" - case (1) - level4: if (.true.) then - level5: critical - level6: select rank(table) - rank default - level7: select type ( a => p_or_c ) - type is ( point ) - exit level6 -!ERROR: EXIT must not leave a CRITICAL statement - exit level4 - end select level7 - end select level6 - end critical level5 - end if level4 - end select level3 - end block level2 - end associate level1 - end do level0 -end subroutine s15 diff --git a/test-lit/Semantics/dosemantics12.f90 b/test-lit/Semantics/dosemantics12.f90 deleted file mode 100644 index 48ecd14feda5..000000000000 --- a/test-lit/Semantics/dosemantics12.f90 +++ /dev/null @@ -1,467 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. -! -! Licensed under the Apache License, Version 2.0 (the "License"); -! you may not use this file except in compliance with the License. -! You may obtain a copy of the License at -! -! http://www.apache.org/licenses/LICENSE-2.0 -! -! Unless required by applicable law or agreed to in writing, software -! distributed under the License is distributed on an "AS IS" BASIS, -! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -! See the License for the specific language governing permissions and -! limitations under the License. -! -!Section 11.1.7.4.3, paragraph 2 states: -! Except for the incrementation of the DO variable that occurs in step (3), -! the DO variable shall neither be redefined nor become undefined while the -! DO construct is active. - -subroutine s1() - - ! Redefinition via intrinsic assignment (section 19.6.5, case (1)) - do ivar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - ivar = 99 - end do - - ! Redefinition in the presence of a construct association - associate (avar => ivar) - do ivar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - avar = 99 - end do - end associate - - ivar = 99 - - ! Redefinition via intrinsic assignment (section 19.6.5, case (1)) - do concurrent (ivar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - ivar = 99 - end do - - ivar = 99 - -end subroutine s1 - -subroutine s2() - - integer :: ivar - - read '(I10)', ivar - - ! Redefinition via an input statement (section 19.6.5, case (3)) - do ivar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - read '(I10)', ivar - end do - - ! Redefinition via an input statement (section 19.6.5, case (3)) - do concurrent (ivar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - read '(I10)', ivar - end do - -end subroutine s2 - -subroutine s3() - - integer :: ivar - - ! Redefinition via use as a DO variable (section 19.6.5, case (4)) - do ivar = 1,10 -!ERROR: Cannot redefine DO variable 'ivar' - do ivar = 1,20 -!ERROR: Cannot redefine DO variable 'ivar' - do ivar = 1,30 - print *, "hello" - end do - end do - end do - - ! This one's OK, even though we used ivar previously as a DO variable - ! since it's not a redefinition - do ivar = 1,40 - print *, "hello" - end do - - ! Redefinition via use as a DO variable (section 19.6.5, case (4)) - do concurrent (ivar = 1:10) -!ERROR: Cannot redefine DO variable 'ivar' - do ivar = 1,20 - print *, "hello" - end do - end do - -end subroutine s3 - -subroutine s4() - - integer :: ivar - real :: x(10) - - print '(f10.5)', (x(ivar), ivar = 1, 10) - - ! Redefinition via use as a DO variable (section 19.6.5, case (5)) - do ivar = 1,20 -!ERROR: Cannot redefine DO variable 'ivar' - print '(f10.5)', (x(ivar), ivar = 1, 10) - end do - - ! Redefinition via use as a DO variable (section 19.6.5, case (5)) - do concurrent (ivar = 1:10) -!ERROR: Cannot redefine DO variable 'ivar' - print '(f10.5)', (x(ivar), ivar = 1, 10) - end do - -end subroutine s4 - -subroutine s5() - - integer :: ivar - real :: x - - read (3, '(f10.5)', iostat = ivar) x - - ! Redefinition via use in IOSTAT specifier (section 19.6.5, case (7)) - do ivar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - read (3, '(f10.5)', iostat = ivar) x - end do - - ! Redefinition via use in IOSTAT specifier (section 19.6.5, case (7)) - do concurrent (ivar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - read (3, '(f10.5)', iostat = ivar) x - end do - -end subroutine s5 - -subroutine s6() - - character (len=3) :: key - integer :: chars - integer :: ivar - real :: x - - read (3, '(a3)', advance='no', size = chars) key - - ! Redefinition via use in SIZE specifier (section 19.6.5, case (9)) - do ivar = 1,20 -!ERROR: Cannot redefine DO variable 'ivar' - read (3, '(a3)', advance='no', size = ivar) key - print *, "hello" - end do - - ! Redefinition via use in SIZE specifier (section 19.6.5, case (9)) - do concurrent (ivar = 1:10) -!ERROR: ADVANCE specifier is not allowed in DO CONCURRENT -!ERROR: Cannot redefine DO variable 'ivar' - read (3, '(a3)', advance='no', size = ivar) key - print *, "hello" - end do - -end subroutine s6 - -subroutine s7() - - integer :: iostatVar, nextrecVar, numberVar, posVar, reclVar, sizeVar - - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - - ! Redefinition via use in IOSTAT specifier (section 19.6.5, case (10)) - do iostatVar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'iostatvar' - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in IOSTAT specifier (section 19.6.5, case (10)) - do concurrent (iostatVar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'iostatvar' - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in NEXTREC specifier (section 19.6.5, case (10)) - do nextrecVar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'nextrecvar' - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in NEXTREC specifier (section 19.6.5, case (10)) - do concurrent (nextrecVar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'nextrecvar' - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in NUMBER specifier (section 19.6.5, case (10)) - do numberVar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'numbervar' - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in NUMBER specifier (section 19.6.5, case (10)) - do concurrent (numberVar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'numbervar' - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in RECL specifier (section 19.6.5, case (10)) - do reclVar = 1,20 - print *, "hello" - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & -!ERROR: Cannot redefine DO variable 'reclvar' - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in RECL specifier (section 19.6.5, case (10)) - do concurrent (reclVar = 1:10) - print *, "hello" - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & -!ERROR: Cannot redefine DO variable 'reclvar' - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in POS specifier (section 19.6.5, case (10)) - do posVar = 1,20 - print *, "hello" - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & -!ERROR: Cannot redefine DO variable 'posvar' - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in POS specifier (section 19.6.5, case (10)) - do concurrent (posVar = 1:10) - print *, "hello" - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & -!ERROR: Cannot redefine DO variable 'posvar' - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in SIZE specifier (section 19.6.5, case (10)) - do sizeVar = 1,20 - print *, "hello" - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & -!ERROR: Cannot redefine DO variable 'sizevar' - pos=posVar, recl=reclVar, size=sizeVar) - end do - - ! Redefinition via use in SIZE specifier (section 19.6.5, case (10)) - do concurrent (sizeVar = 1:10) - print *, "hello" - inquire(3, iostat=iostatVar, nextrec=nextrecVar, number=numberVar, & -!ERROR: Cannot redefine DO variable 'sizevar' - pos=posVar, recl=reclVar, size=sizeVar) - end do - -end subroutine s7 - -subroutine s8() - - Integer :: ivar - integer, pointer :: ip - - allocate(ip, stat = ivar) - - ! Redefinition via a STAT= specifier (section 19.6.5, case (16)) - do ivar = 1,20 -!ERROR: Cannot redefine DO variable 'ivar' - allocate(ip, stat = ivar) - print *, "hello" - end do - - ! Redefinition via a STAT= specifier (section 19.6.5, case (16)) - do concurrent (ivar = 1:10) -!ERROR: Cannot redefine DO variable 'ivar' - allocate(ip, stat = ivar) - print *, "hello" - end do - -end subroutine s8 - -subroutine s9() - - Integer :: ivar - - ! OK since the DO CONCURRENT index-name exists only in the scope of the - ! DO CONCURRENT construct - do ivar = 1,20 - print *, "hello" - do concurrent (ivar = 1:10) - print *, "hello" - end do - end do - - ! OK since the DO CONCURRENT index-name exists only in the scope of the - ! DO CONCURRENT construct - do concurrent (ivar = 1:10) - print *, "hello" - do concurrent (ivar = 1:10) - print *, "hello" - end do - end do - -end subroutine s9 - -subroutine s10() - - Integer :: ivar - open(file="abc", newunit=ivar) - - ! Redefinition via NEWUNIT specifier (section 19.6.5, case (29)) - do ivar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - open(file="abc", newunit=ivar) - end do - - ! Redefinition via NEWUNIT specifier (section 19.6.5, case (29)) - do concurrent (ivar = 1:10) - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - open(file="abc", newunit=ivar) - end do - -end subroutine s10 - -subroutine s11() - - Integer, allocatable :: ivar - - allocate(ivar) - - ! This look is OK - do ivar = 1,20 - print *, "hello" - end do - - ! Redefinition via deallocation (section 19.6.6, case (10)) - do ivar = 1,20 - print *, "hello" -!ERROR: Cannot redefine DO variable 'ivar' - deallocate(ivar) - end do - - ! This case is not applicable since the version of "ivar" that's inside the - ! DO CONCURRENT has the scope of the DO CONCURRENT construct. Within that - ! scope, it does not have the "allocatable" attribute, so the following test - ! fails because you can only deallocate a variable that's allocatable. - do concurrent (ivar = 1:10) - print *, "hello" -!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute - deallocate(ivar) - end do - -end subroutine s11 - -subroutine s12() - - Integer :: ivar, jvar - - call intentInSub(jvar, ivar) - do ivar = 1,10 - call intentInSub(jvar, ivar) - end do - - call intentOutSub(jvar, ivar) - do ivar = 1,10 -!ERROR: Cannot redefine DO variable 'ivar' - call intentOutSub(jvar, ivar) - end do - - call intentInOutSub(jvar, ivar) - do ivar = 1,10 - call intentInOutSub(jvar, ivar) - end do - -contains - subroutine intentInSub(arg1, arg2) - integer, intent(in) :: arg1 - integer, intent(in) :: arg2 - end subroutine intentInSub - - subroutine intentOutSub(arg1, arg2) - integer, intent(in) :: arg1 - integer, intent(out) :: arg2 - end subroutine intentOutSub - - subroutine intentInOutSub(arg1, arg2) - integer, intent(in) :: arg1 - integer, intent(inout) :: arg2 - end subroutine intentInOutSub - -end subroutine s12 - -subroutine s13() - - Integer :: ivar, jvar - - ! This one is OK - do ivar = 1, 10 - jvar = intentInFunc(ivar) - end do - - ! Error for passing a DO variable to an INTENT(OUT) dummy - do ivar = 1, 10 -!ERROR: Cannot redefine DO variable 'ivar' - jvar = intentOutFunc(ivar) - end do - - ! Error for passing a DO variable to an INTENT(OUT) dummy, more complex - ! expression - do ivar = 1, 10 -!ERROR: Cannot redefine DO variable 'ivar' - jvar = 83 + intentInFunc(intentOutFunc(ivar)) - end do - - ! Warning for passing a DO variable to an INTENT(INOUT) dummy - do ivar = 1, 10 - jvar = intentInOutFunc(ivar) - end do - -contains - function intentInFunc(dummyArg) - integer, intent(in) :: dummyArg - integer :: intentInFunc - - intentInFunc = 343 - end function intentInFunc - - function intentOutFunc(dummyArg) - integer, intent(out) :: dummyArg - integer :: intentOutFunc - - dummyArg = 216 - intentOutFunc = 343 - end function intentOutFunc - - function intentInOutFunc(dummyArg) - integer, intent(inout) :: dummyArg - integer :: intentInOutFunc - - dummyArg = 216 - intentInOutFunc = 343 - end function intentInOutFunc - -end subroutine s13 diff --git a/test-lit/Semantics/equivalence01.f90 b/test-lit/Semantics/equivalence01.f90 deleted file mode 100644 index 31b561e33b0d..000000000000 --- a/test-lit/Semantics/equivalence01.f90 +++ /dev/null @@ -1,177 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - integer i, j - real r(2) - !ERROR: Equivalence set must have more than one object - equivalence(i, j),(r(1)) -end - -subroutine s2 - integer i - type t - integer :: a - integer :: b(10) - end type - type(t) :: x - !ERROR: Derived type component 'x%a' is not allowed in an equivalence set - equivalence(x%a, i) - !ERROR: Derived type component 'x%b(2)' is not allowed in an equivalence set - equivalence(i, x%b(2)) -end - -integer function f3(x) - real x - !ERROR: Dummy argument 'x' is not allowed in an equivalence set - equivalence(i, x) - !ERROR: Function result 'f3' is not allow in an equivalence set - equivalence(f3, i) -end - -subroutine s4 - integer :: y - !ERROR: Pointer 'x' is not allowed in an equivalence set - !ERROR: Allocatable variable 'y' is not allowed in an equivalence set - equivalence(x, y) - real, pointer :: x - allocatable :: y -end - -subroutine s5 - integer, parameter :: k = 123 - real :: x(10) - real, save :: y[1:*] - !ERROR: Coarray 'y' is not allowed in an equivalence set - equivalence(x, y) - !ERROR: Variable 'z' with BIND attribute is not allowed in an equivalence set - equivalence(x, z) - !ERROR: Variable 'z' with BIND attribute is not allowed in an equivalence set - equivalence(x(2), z(3)) - real, bind(C) :: z(10) - !ERROR: Named constant 'k' is not allowed in an equivalence set - equivalence(x(2), k) - !ERROR: Variable 'w' in common block with BIND attribute is not allowed in an equivalence set - equivalence(x(10), w) - logical :: w(10) - bind(C, name="c") /c/ - common /c/ w - integer, target :: u - !ERROR: Variable 'u' with TARGET attribute is not allowed in an equivalence set - equivalence(x(1), u) -end - -subroutine s6 - type t1 - sequence - real, pointer :: p - end type - type :: t2 - sequence - type(t1) :: b - end type - real :: x0 - type(t1) :: x1 - type(t2) :: x2 - !ERROR: Derived type object 'x1' with pointer ultimate component is not allowed in an equivalence set - equivalence(x0, x1) - !ERROR: Derived type object 'x2' with pointer ultimate component is not allowed in an equivalence set - equivalence(x0, x2) -end - -subroutine s7 - type t1 - end type - real :: x0 - type(t1) :: x1 - !ERROR: Nonsequence derived type object 'x1' is not allowed in an equivalence set - equivalence(x0, x1) -end - -module m8 - real :: x - real :: y(10) -end -subroutine s8 - use m8 - !ERROR: Use-associated variable 'x' is not allowed in an equivalence set - equivalence(x, z) - !ERROR: Use-associated variable 'y' is not allowed in an equivalence set - equivalence(y(1), z) -end - -subroutine s9 - character(10) :: c - real :: d(10) - integer, parameter :: n = 2 - integer :: i, j - !ERROR: Substring with nonconstant bound 'n+j' is not allowed in an equivalence set - equivalence(c(n+1:n+j), i) - !ERROR: Substring with zero length is not allowed in an equivalence set - equivalence(c(n:1), i) - !ERROR: Array with nonconstant subscript 'j-1' is not allowed in an equivalence set - equivalence(d(j-1), i) - !ERROR: Array section 'd(1:n)' is not allowed in an equivalence set - equivalence(d(1:n), i) - character(4) :: a(10) - equivalence(c, a(10)(1:2)) - !ERROR: 'a(10)' and 'a(10)(2:)' cannot have the same first storage unit - equivalence(c, a(10)(2:3)) -end - -subroutine s10 - integer, parameter :: i(4) = [1, 2, 3, 4] - real :: x(10) - real :: y(4) - !ERROR: Array with vector subscript 'i' is not allowed in an equivalence set - equivalence(x(i), y) -end - -subroutine s11(n) - integer :: n - real :: x(n), y - !ERROR: Automatic array 'x' is not allowed in an equivalence set - equivalence(x(1), y) -end - -module s12 - real, protected :: a - integer :: b - !ERROR: Equivalence set cannot contain 'a' with PROTECTED attribute and 'b' without - equivalence(a, b) - !ERROR: Equivalence set cannot contain 'a' with PROTECTED attribute and 'b' without - equivalence(b, a) -end - -module s13 - logical(8) :: a - character(4) :: b - type :: t1 - sequence - complex :: z - end type - type :: t2 - sequence - type(t1) :: w - end type - type(t2) :: c - !ERROR: Equivalence set cannot contain 'b' that is character sequence type and 'a' that is not - equivalence(a, b) - !ERROR: Equivalence set cannot contain 'c' that is numeric sequence type and 'a' that is not - equivalence(c, a) - double precision :: d - double complex :: e - !OK: d and e are considered to be a default kind numeric type - equivalence(c, d, e) -end - -module s14 - real :: a(10), b, c, d - !ERROR: 'a(1)' and 'a(2)' cannot have the same first storage unit - equivalence(a(1), a(2)) - equivalence(b, a(3)) - !ERROR: 'a(3)' and 'a(4)' cannot have the same first storage unit - equivalence(a(4), b) - equivalence(c, a(5)) - equivalence(a(6), d) - !ERROR: 'a(5)' and 'a(6)' cannot have the same first storage unit - equivalence(c, d) -end diff --git a/test-lit/Semantics/expr-errors01.f90 b/test-lit/Semantics/expr-errors01.f90 deleted file mode 100644 index a479e863dcaf..000000000000 --- a/test-lit/Semantics/expr-errors01.f90 +++ /dev/null @@ -1,27 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1003 - can't parenthesize function call returning procedure pointer -module m1 - type :: dt - procedure(frpp), pointer, nopass :: pp - end type dt - contains - subroutine boring - end subroutine boring - function frpp - procedure(boring), pointer :: frpp - frpp => boring - end function frpp - subroutine tests - procedure(boring), pointer :: mypp - type(dt) :: dtinst - mypp => boring ! legal - mypp => (boring) ! legal, not a function reference - !ERROR: A function reference that returns a procedure pointer may not be parenthesized - mypp => (frpp()) ! C1003 - mypp => frpp() ! legal, not parenthesized - dtinst%pp => frpp - mypp => dtinst%pp() ! legal - !ERROR: A function reference that returns a procedure pointer may not be parenthesized - mypp => (dtinst%pp()) - end subroutine tests -end module m1 diff --git a/test-lit/Semantics/expr-errors02.f90 b/test-lit/Semantics/expr-errors02.f90 deleted file mode 100644 index d1aac68bf008..000000000000 --- a/test-lit/Semantics/expr-errors02.f90 +++ /dev/null @@ -1,58 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test specification expressions - -module m - type :: t(n) - integer, len :: n = 1 - character(len=n) :: c - end type - interface - integer function foo() - end function - pure real function realfunc(x) - real, intent(in) :: x - end function - pure integer function hasProcArg(p) - import realfunc - procedure(realfunc) :: p - end function - end interface - integer :: coarray[*] - contains - pure integer function modulefunc1(n) - integer, value :: n - modulefunc1 = n - end function - subroutine test(out, optional) - !ERROR: Invalid specification expression: reference to impure function 'foo' - type(t(foo())) :: x1 - integer :: local - !ERROR: Invalid specification expression: reference to local entity 'local' - type(t(local)) :: x2 - !ERROR: The internal function 'internal' cannot be referenced in a specification expression - type(t(internal(0))) :: x3 - integer, intent(out) :: out - !ERROR: Invalid specification expression: reference to INTENT(OUT) dummy argument 'out' - type(t(out)) :: x4 - integer, intent(in), optional :: optional - !ERROR: Invalid specification expression: reference to OPTIONAL dummy argument 'optional' - type(t(optional)) :: x5 - !ERROR: Invalid specification expression: dummy procedure argument - type(t(hasProcArg(realfunc))) :: x6 - !ERROR: Invalid specification expression: coindexed reference - type(t(coarray[1])) :: x7 - type(t(kind(foo()))) :: x101 ! ok - type(t(modulefunc1(0))) :: x102 ! ok - !ERROR: The module function 'modulefunc2' must have been previously defined when referenced in a specification expression - type(t(modulefunc2(0))) :: x103 ! ok - contains - pure integer function internal(n) - integer, value :: n - internal = n - end function - end subroutine - pure integer function modulefunc2(n) - integer, value :: n - modulefunc2 = n - end function -end module diff --git a/test-lit/Semantics/forall01.f90 b/test-lit/Semantics/forall01.f90 deleted file mode 100644 index ecb243bc2a09..000000000000 --- a/test-lit/Semantics/forall01.f90 +++ /dev/null @@ -1,106 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine forall1 - real :: a(9) - !ERROR: 'i' is already declared in this scoping unit - !ERROR: Cannot redefine FORALL variable 'i' - forall (i=1:8, i=1:9) a(i) = i - !ERROR: 'i' is already declared in this scoping unit - !ERROR: Cannot redefine FORALL variable 'i' - forall (i=1:8, i=1:9) - a(i) = i - end forall - forall (j=1:8) - !ERROR: 'j' is already declared in this scoping unit - !ERROR: Cannot redefine FORALL variable 'j' - forall (j=1:9) - end forall - end forall -end - -subroutine forall2 - integer, pointer :: a(:) - integer, target :: b(10,10) - forall (i=1:10) - !ERROR: Impure procedure 'f_impure' may not be referenced in a FORALL - a(f_impure(i):) => b(i,:) - end forall - !ERROR: FORALL mask expression may not reference impure procedure 'f_impure' - forall (j=1:10, f_impure(1)>2) - end forall -contains - impure integer function f_impure(i) - f_impure = i - end -end - -subroutine forall3 - real :: x - forall(i=1:10) - !ERROR: Cannot redefine FORALL variable 'i' - i = 1 - end forall - forall(i=1:10) - forall(j=1:10) - !ERROR: Cannot redefine FORALL variable 'i' - i = 1 - end forall - end forall - !ERROR: Cannot redefine FORALL variable 'i' - forall(i=1:10) i = 1 -end - -subroutine forall4 - integer, parameter :: zero = 0 - integer :: a(10) - - !ERROR: FORALL limit expression may not reference index variable 'i' - forall(i=1:i) - a(i) = i - end forall - !ERROR: FORALL step expression may not reference index variable 'i' - forall(i=1:10:i) - a(i) = i - end forall - !ERROR: FORALL step expression may not be zero - forall(i=1:10:zero) - a(i) = i - end forall - - !ERROR: FORALL limit expression may not reference index variable 'i' - forall(i=1:i) a(i) = i - !ERROR: FORALL step expression may not reference index variable 'i' - forall(i=1:10:i) a(i) = i - !ERROR: FORALL step expression may not be zero - forall(i=1:10:zero) a(i) = i -end - -! Note: this gets warnings but not errors -subroutine forall5 - real, target :: x(10), y(10) - forall(i=1:10) - x(i) = y(i) - end forall - forall(i=1:10) - x = y ! warning: i not used on LHS - forall(j=1:10) - x(i) = y(i) ! warning: j not used on LHS - x(j) = y(j) ! warning: i not used on LHS - endforall - endforall - do concurrent(i=1:10) - x = y - forall(i=1:10) x = y - end do -end - -subroutine forall6 - type t - real, pointer :: p - end type - type(t) :: a(10) - real, target :: b(10) - forall(i=1:10) - a(i)%p => b(i) - a(1)%p => b(i) ! warning: i not used on LHS - end forall -end diff --git a/test-lit/Semantics/getdefinition01.f90 b/test-lit/Semantics/getdefinition01.f90 deleted file mode 100644 index 4a2fdd760568..000000000000 --- a/test-lit/Semantics/getdefinition01.f90 +++ /dev/null @@ -1,28 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-definition returning source position of symbol definition. -module m1 - private :: f -contains - pure subroutine s (x, yyy) bind(c) - intent(in) :: x - intent(inout) :: yyy - contains - pure subroutine ss - end subroutine - end subroutine - recursive pure function f() result(x) - real, allocatable :: x - x = 1.0 - end function -end module - -! EXEC: echo %t 1>&2; -! EXEC: ${F18} -fget-definition 7 17 18 -fparse-only %s > %t; -! EXEC: ${F18} -fget-definition 8 20 23 -fparse-only %s >> %t; -! EXEC: ${F18} -fget-definition 15 3 4 -fparse-only %s >> %t; -! EXEC: ${F18} -fget-definition -fparse-only %s >> %t 2>&1; -! EXEC: cat %t | ${FileCheck} %s -! CHECK:x:.*getdefinition01.f90, 6, 21-22 -! CHECK:yyy:.*getdefinition01.f90, 6, 24-27 -! CHECK:x:.*getdefinition01.f90, 14, 24-25 -! CHECK:Invalid argument to -fget-definitions diff --git a/test-lit/Semantics/getdefinition02.f b/test-lit/Semantics/getdefinition02.f deleted file mode 100644 index 58391a27d530..000000000000 --- a/test-lit/Semantics/getdefinition02.f +++ /dev/null @@ -1,26 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-definition with fixed form. - module m2 - private :: f - contains - pure subroutine s (x, yyy) bind(c) - intent(in) :: - * x - intent(inout) :: yyy - contains - pure subroutine ss - end subroutine - end subroutine - recursive pure function f() result(x) - real, allocatable :: x - x = 1.0 - end function - end module - -! EXEC: ${F18} -fget-definition 8 9 10 -fparse-only %s > %t; -! EXEC: ${F18} -fget-definition 9 26 29 -fparse-only %s >> %t; -! EXEC: ${F18} -fget-definition 16 9 10 -fparse-only %s >> %t; -! EXEC: cat %t | ${FileCheck} %s -! CHECK:x:.*getdefinition02.f, 6, 27-28 -! CHECK:yyy:.*getdefinition02.f, 6, 30-33 -! CHECK:x:.*getdefinition02.f, 15, 30-31 diff --git a/test-lit/Semantics/getdefinition03-a.f90 b/test-lit/Semantics/getdefinition03-a.f90 deleted file mode 100644 index 81ad276ec29a..000000000000 --- a/test-lit/Semantics/getdefinition03-a.f90 +++ /dev/null @@ -1,15 +0,0 @@ -! Tests -fget-definition with INCLUDE -!RUN: %S/test_any.sh %s %flang %t -INCLUDE "Inputs/getdefinition03-b.f90" - -program main - use m3 - integer :: x - x = f -end program - -! EXEC: ${F18} -fget-definition 8 6 7 -fparse-only %s > %t; -! EXEC: ${F18} -fget-definition 8 2 3 -fparse-only %s >> %t; -! EXEC: cat %t | ${FileCheck} %s; -! CHECK:f:.*getdefinition03-b.f90, 2, 12-13 -! CHECK:x:.*getdefinition03-a.f90, 7, 13-14 diff --git a/test-lit/Semantics/getdefinition04.f90 b/test-lit/Semantics/getdefinition04.f90 deleted file mode 100644 index aa143a161852..000000000000 --- a/test-lit/Semantics/getdefinition04.f90 +++ /dev/null @@ -1,11 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-definition with COMMON block with same name as variable. -program main - integer :: x - integer :: y - common /x/ y - x = y -end program - -! EXEC: ${F18} -fget-definition 7 3 4 -fparse-only %s | ${FileCheck} %s -! CHECK:x:.*getdefinition04.f90, 4, 14-15 diff --git a/test-lit/Semantics/getdefinition05.f90 b/test-lit/Semantics/getdefinition05.f90 deleted file mode 100644 index e1115a245611..000000000000 --- a/test-lit/Semantics/getdefinition05.f90 +++ /dev/null @@ -1,21 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-symbols-sources with BLOCK that contains same variable name as -! another in an outer scope. -program main - integer :: x - integer :: y - block - integer :: x - integer :: y - x = y - end block - x = y -end program - -!! Inner x -! EXEC: ${F18} -fget-definition 10 5 6 -fparse-only %s > %t; -! CHECK:x:.*getdefinition05.f90, 8, 16-17 -!! Outer y -! EXEC: ${F18} -fget-definition 12 7 8 -fparse-only %s >> %t; -! CHECK:y:.*getdefinition05.f90, 6, 14-15 -! EXEC: cat %t | ${FileCheck} %s; diff --git a/test-lit/Semantics/getsymbols01.f90 b/test-lit/Semantics/getsymbols01.f90 deleted file mode 100644 index d102807ed482..000000000000 --- a/test-lit/Semantics/getsymbols01.f90 +++ /dev/null @@ -1,26 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-symbols-sources finding all symbols in file. -module mm1 - private :: f -contains - pure subroutine s (x, y) bind(c) - intent(in) :: x - intent(inout) :: y - contains - pure subroutine ss - end subroutine - end subroutine - recursive pure function f() result(x) - real, allocatable :: x - x = 1.0 - end function -end module - -! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s -! CHECK-ONCE:mm1:.*getsymbols01.f90, 3, 8-11 -! CHECK-ONCE:f:.*getsymbols01.f90, 13, 26-27 -! CHECK-ONCE:s:.*getsymbols01.f90, 6, 18-19 -! CHECK-ONCE:ss:.*getsymbols01.f90, 10, 19-21 -! CHECK-ONCE:x:.*getsymbols01.f90, 6, 21-22 -! CHECK-ONCE:y:.*getsymbols01.f90, 6, 24-25 -! CHECK-ONCE:x:.*getsymbols01.f90, 14, 24-25 diff --git a/test-lit/Semantics/getsymbols02-a.f90 b/test-lit/Semantics/getsymbols02-a.f90 deleted file mode 100644 index f571783e6140..000000000000 --- a/test-lit/Semantics/getsymbols02-a.f90 +++ /dev/null @@ -1,13 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -fparse-only %s - -module mm2a -implicit none -private - public :: get5 -contains - function get5() result(ret) - integer :: ret - ret = 5 - end function get5 -end module mm2a diff --git a/test-lit/Semantics/getsymbols03-a.f90 b/test-lit/Semantics/getsymbols03-a.f90 deleted file mode 100644 index 5616f97629ce..000000000000 --- a/test-lit/Semantics/getsymbols03-a.f90 +++ /dev/null @@ -1,15 +0,0 @@ -! Tests -fget-symbols with INCLUDE -!RUN: %S/test_any.sh %s %flang %t -INCLUDE "Inputs/getsymbols03-b.f90" - -program main - use mm3 - integer :: x - x = f -end program - -! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s -! CHECK:mm3:.*getsymbols03-b.f90, 1, 8-11 -! CHECK:f:.*getsymbols03-b.f90, 2, 12-13 -! CHECK:main:.*getsymbols03-a.f90, 5, 9-13 -! CHECK:x:.*getsymbols03-a.f90, 7, 13-14 diff --git a/test-lit/Semantics/getsymbols04.f90 b/test-lit/Semantics/getsymbols04.f90 deleted file mode 100644 index 06f739c71137..000000000000 --- a/test-lit/Semantics/getsymbols04.f90 +++ /dev/null @@ -1,13 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-symbols-sources with COMMON. -program main - integer :: x - integer :: y - common /x/ y - x = y -end program - -! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s -! CHECK:x:.*getsymbols04.f90, 4, 14-15 -! CHECK:y:.*getsymbols04.f90, 5, 14-15 -! CHECK:x:.*getsymbols04.f90, 6, 11-12 diff --git a/test-lit/Semantics/getsymbols05.f90 b/test-lit/Semantics/getsymbols05.f90 deleted file mode 100644 index f905313675cd..000000000000 --- a/test-lit/Semantics/getsymbols05.f90 +++ /dev/null @@ -1,16 +0,0 @@ -!RUN: %S/test_any.sh %s %flang %t -! Tests -fget-symbols-sources with COMMON. -program main - integer :: x - integer :: y - block - integer :: x - x = y - end block - x = y -end program - -! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s -! CHECK:x:.*getsymbols05.f90, 4, 14-15 -! CHECK:y:.*getsymbols05.f90, 5, 14-15 -! CHECK:x:.*getsymbols05.f90, 7, 16-17 diff --git a/test-lit/Semantics/if_arith01.f90 b/test-lit/Semantics/if_arith01.f90 deleted file mode 100644 index 5ec06b47485d..000000000000 --- a/test-lit/Semantics/if_arith01.f90 +++ /dev/null @@ -1,8 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check that a basic arithmetic if compiles. - -if ( A ) 100, 200, 300 -100 CONTINUE -200 CONTINUE -300 CONTINUE -END diff --git a/test-lit/Semantics/if_arith02.f90 b/test-lit/Semantics/if_arith02.f90 deleted file mode 100644 index f8e24b42dffa..000000000000 --- a/test-lit/Semantics/if_arith02.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check that only labels are allowed in arithmetic if statements. -! TODO: Revisit error message "expected 'ASSIGN'" etc. -! TODO: Revisit error message "expected one of '0123456789'" - -! TODO: BUG: Note that labels 500 and 600 do not exist and -! ought to be flagged as errors. This oversight may be the -! result of disabling semantic checking after syntax errors. - -if ( A ) 500, 600, 600 -100 CONTINUE -200 CONTINUE -300 CONTINUE - -!ERROR: expected 'ASSIGN' -!ERROR: expected 'ALLOCATE (' -!ERROR: expected '=>' -!ERROR: expected '(' -!ERROR: expected '=' -if ( B ) A, 101, 301 -101 CONTINUE -201 CONTINUE -301 CONTINUE - -!ERROR: expected one of '0123456789' -if ( B ) 102, A, 302 -102 CONTINUE -202 CONTINUE -302 CONTINUE - -!ERROR: expected one of '0123456789' -if ( B ) 103, 103, A -103 CONTINUE -203 CONTINUE -303 CONTINUE - -END diff --git a/test-lit/Semantics/if_arith03.f90 b/test-lit/Semantics/if_arith03.f90 deleted file mode 100644 index 1e5eb67d184c..000000000000 --- a/test-lit/Semantics/if_arith03.f90 +++ /dev/null @@ -1,22 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - - -!ERROR: label '600' was not found -if ( A ) 100, 200, 600 -100 CONTINUE -200 CONTINUE -300 CONTINUE - -!ERROR: label '601' was not found -if ( A ) 101, 601, 301 -101 CONTINUE -201 CONTINUE -301 CONTINUE - -!ERROR: label '602' was not found -if ( A ) 602, 202, 302 -102 CONTINUE -202 CONTINUE -302 CONTINUE - -END diff --git a/test-lit/Semantics/if_arith04.f90 b/test-lit/Semantics/if_arith04.f90 deleted file mode 100644 index 9a436cd5eb67..000000000000 --- a/test-lit/Semantics/if_arith04.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Make sure arithmetic if expressions are non-complex numeric exprs. - -INTEGER I -COMPLEX Z -LOGICAL L -INTEGER, DIMENSION (2) :: B - -if ( I ) 100, 200, 300 -100 CONTINUE -200 CONTINUE -300 CONTINUE - -!ERROR: ARITHMETIC IF expression must not be a COMPLEX expression -if ( Z ) 101, 201, 301 -101 CONTINUE -201 CONTINUE -301 CONTINUE - -!ERROR: ARITHMETIC IF expression must be a numeric expression -if ( L ) 102, 202, 302 -102 CONTINUE -202 CONTINUE -302 CONTINUE - -!ERROR: ARITHMETIC IF expression must be a scalar expression -if ( B ) 103, 203, 303 -103 CONTINUE -203 CONTINUE -303 CONTINUE - -END diff --git a/test-lit/Semantics/if_construct01.f90 b/test-lit/Semantics/if_construct01.f90 deleted file mode 100644 index c133b7d8cc9f..000000000000 --- a/test-lit/Semantics/if_construct01.f90 +++ /dev/null @@ -1,52 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Simple check that if constructs are ok. - -if (a < b) then - a = 1 -end if - -if (a < b) then - a = 2 -else - a = 3 -endif - -if (a < b) then - a = 4 -else if(a == b) then - a = 5 -end if - -if (a < b) then - a = 6 -else if(a == b) then - a = 7 -elseif(a > b) then - a = 8 -end if - -if (a < b) then - a = 9 -else if(a == b) then - a = 10 -else - a = 11 -end if - -if (a < b) then - a = 12 -else if(a == b) then - a = 13 -else if(a > b) then - a = 14 -end if - -if (f()) then - a = 15 -end if - -contains - logical function f() - f = .true. - end -end diff --git a/test-lit/Semantics/if_construct02.f90 b/test-lit/Semantics/if_construct02.f90 deleted file mode 100644 index 9ba6caa45355..000000000000 --- a/test-lit/Semantics/if_construct02.f90 +++ /dev/null @@ -1,122 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! 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 diff --git a/test-lit/Semantics/if_stmt01.f90 b/test-lit/Semantics/if_stmt01.f90 deleted file mode 100644 index 51454a9d2116..000000000000 --- a/test-lit/Semantics/if_stmt01.f90 +++ /dev/null @@ -1,5 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Simple check that if statements are ok. - -IF (A > 0.0) A = LOG (A) -END diff --git a/test-lit/Semantics/if_stmt02.f90 b/test-lit/Semantics/if_stmt02.f90 deleted file mode 100644 index 71c458381ac2..000000000000 --- a/test-lit/Semantics/if_stmt02.f90 +++ /dev/null @@ -1,4 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!ERROR: IF statement is not allowed in IF statement -IF (A > 0.0) IF (B < 0.0) A = LOG (A) -END diff --git a/test-lit/Semantics/if_stmt03.f90 b/test-lit/Semantics/if_stmt03.f90 deleted file mode 100644 index 2a2595404960..000000000000 --- a/test-lit/Semantics/if_stmt03.f90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check that non-logical expressions are not allowed. -! Check that non-scalar expressions are not allowed. -! TODO: Insure all non-logicals are prohibited. - -LOGICAL, DIMENSION (2) :: B - -!ERROR: Must have LOGICAL type, but is REAL(4) -IF (A) A = LOG (A) -!ERROR: Must be a scalar value, but is a rank-1 array -IF (B) A = LOG (A) - -END diff --git a/test-lit/Semantics/implicit01.f90 b/test-lit/Semantics/implicit01.f90 deleted file mode 100644 index f0893f7ed33f..000000000000 --- a/test-lit/Semantics/implicit01.f90 +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - implicit none - !ERROR: More than one IMPLICIT NONE statement - implicit none(type) -end subroutine - -subroutine s2 - implicit none(external) - !ERROR: More than one IMPLICIT NONE statement - implicit none -end subroutine diff --git a/test-lit/Semantics/implicit02.f90 b/test-lit/Semantics/implicit02.f90 deleted file mode 100644 index 5d2b6e09474f..000000000000 --- a/test-lit/Semantics/implicit02.f90 +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - implicit none - !ERROR: IMPLICIT statement after IMPLICIT NONE or IMPLICIT NONE(TYPE) statement - implicit integer(a-z) -end subroutine - -subroutine s2 - implicit none(type) - !ERROR: IMPLICIT statement after IMPLICIT NONE or IMPLICIT NONE(TYPE) statement - implicit integer(a-z) -end subroutine diff --git a/test-lit/Semantics/implicit03.f90 b/test-lit/Semantics/implicit03.f90 deleted file mode 100644 index 9636743233a3..000000000000 --- a/test-lit/Semantics/implicit03.f90 +++ /dev/null @@ -1,12 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - implicit integer(a-z) - !ERROR: IMPLICIT NONE statement after IMPLICIT statement - implicit none -end subroutine - -subroutine s2 - implicit integer(a-z) - !ERROR: IMPLICIT NONE(TYPE) after IMPLICIT statement - implicit none(type) -end subroutine diff --git a/test-lit/Semantics/implicit04.f90 b/test-lit/Semantics/implicit04.f90 deleted file mode 100644 index 86adb95f9852..000000000000 --- a/test-lit/Semantics/implicit04.f90 +++ /dev/null @@ -1,6 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s - parameter(a=1.0) - !ERROR: IMPLICIT NONE statement after PARAMETER statement - implicit none -end subroutine diff --git a/test-lit/Semantics/implicit05.f90 b/test-lit/Semantics/implicit05.f90 deleted file mode 100644 index 7649c228fa44..000000000000 --- a/test-lit/Semantics/implicit05.f90 +++ /dev/null @@ -1,5 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s - !ERROR: 'a' does not follow 'b' alphabetically - implicit integer(b-a) -end diff --git a/test-lit/Semantics/implicit06.f90 b/test-lit/Semantics/implicit06.f90 deleted file mode 100644 index 3f6672008d53..000000000000 --- a/test-lit/Semantics/implicit06.f90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - implicit integer(a-c) - !ERROR: More than one implicit type specified for 'c' - implicit real(c-g) -end - -subroutine s2 - implicit integer(a-c) - implicit real(8)(d) - !ERROR: More than one implicit type specified for 'a' - implicit integer(f), real(a) -end diff --git a/test-lit/Semantics/implicit07.f90 b/test-lit/Semantics/implicit07.f90 deleted file mode 100644 index 68fa37de8ce7..000000000000 --- a/test-lit/Semantics/implicit07.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -implicit none(external) -external x -call x -!ERROR: 'y' is an external procedure without the EXTERNAL attribute in a scope with IMPLICIT NONE(EXTERNAL) -call y -block - !ERROR: 'z' is an external procedure without the EXTERNAL attribute in a scope with IMPLICIT NONE(EXTERNAL) - call z -end block -end diff --git a/test-lit/Semantics/implicit08.f90 b/test-lit/Semantics/implicit08.f90 deleted file mode 100644 index 44e96d89855e..000000000000 --- a/test-lit/Semantics/implicit08.f90 +++ /dev/null @@ -1,7 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - block - !ERROR: IMPLICIT statement is not allowed in a BLOCK construct - implicit logical(a) - end block -end subroutine diff --git a/test-lit/Semantics/init01.f90 b/test-lit/Semantics/init01.f90 deleted file mode 100644 index 1fc1ed877fa3..000000000000 --- a/test-lit/Semantics/init01.f90 +++ /dev/null @@ -1,26 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Object pointer initializer error tests - -subroutine test(j) - integer, intent(in) :: j - real, allocatable, target, save :: x1 - real, codimension[*], target, save :: x2 - real, save :: x3 - real, target :: x4 - real, target, save :: x5(10) -!ERROR: An initial data target may not be a reference to an ALLOCATABLE 'x1' - real, pointer :: p1 => x1 -!ERROR: An initial data target may not be a reference to a coarray 'x2' - real, pointer :: p2 => x2 -!ERROR: An initial data target may not be a reference to an object 'x3' that lacks the TARGET attribute - real, pointer :: p3 => x3 -!ERROR: An initial data target may not be a reference to an object 'x4' that lacks the SAVE attribute - real, pointer :: p4 => x4 -!ERROR: Pointer 'p5' cannot be initialized with a reference to a designator with non-constant subscripts - real, pointer :: p5 => x5(j) -!ERROR: Pointer 'p6' of rank 0 cannot be initialized with a target of different rank (1) - real, pointer :: p6 => x5 - -!TODO: type incompatibility, non-deferred type parameter values, contiguity - -end subroutine test diff --git a/test-lit/Semantics/int-literals.f90 b/test-lit/Semantics/int-literals.f90 deleted file mode 100644 index 3c48b7e1b7da..000000000000 --- a/test-lit/Semantics/int-literals.f90 +++ /dev/null @@ -1,53 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Fortran syntax considers signed int literals in complex literals -! to be a distinct production, not an application of unary +/- to -! an unsigned int literal, so they're used here to test overflow -! on signed int literal constants. The literals are tested here -! as part of expressions that name resolution must analyze. - -complex, parameter :: okj1 = 127_1, okz1 = (+127_1, -128_1) -!ERROR: Integer literal is too large for INTEGER(KIND=1) -complex, parameter :: badj1 = 128_1 -!ERROR: Integer literal is too large for INTEGER(KIND=1) -complex, parameter :: badz1 = (+128_1, 0) -complex, parameter :: okj1a = 128_2 -complex, parameter :: okz1a = (+128_2, 0) - -complex, parameter :: okj2 = 32767_2, okz2 = (+32767_2, -32768_2) -!ERROR: Integer literal is too large for INTEGER(KIND=2) -complex, parameter :: badj2 = 32768_2 -!ERROR: Integer literal is too large for INTEGER(KIND=2) -complex, parameter :: badz2 = (+32768_2, 0) -complex, parameter :: okj2a = 32768_4 -complex, parameter :: okz2a = (+32768_4, 0) - -complex, parameter :: okj4 = 2147483647_4, okz4 = (+2147483647_4, -2147483648_4) -!ERROR: Integer literal is too large for INTEGER(KIND=4) -complex, parameter :: badj4 = 2147483648_4 -!ERROR: Integer literal is too large for INTEGER(KIND=4) -complex, parameter :: badz4 = (+2147483648_4, 0) -complex, parameter :: okj4a = 2147483648_8 -complex, parameter :: okz4a = (+2147483648_8, 0) - -complex, parameter :: okj4d = 2147483647, okz4d = (+2147483647, -2147483648) -!WARNING: Integer literal is too large for default INTEGER(KIND=4); assuming INTEGER(KIND=8) -complex, parameter :: badj4dext = 2147483648 -!WARNING: Integer literal is too large for default INTEGER(KIND=4); assuming INTEGER(KIND=8) -complex, parameter :: badz4dext = (+2147483648, 0) - -complex, parameter :: okj8 = 9223372036854775807_8, okz8 = (+9223372036854775807_8, -9223372036854775808_8) -!ERROR: Integer literal is too large for INTEGER(KIND=8) -complex, parameter :: badj8 = 9223372036854775808_8 -!ERROR: Integer literal is too large for INTEGER(KIND=8) -complex, parameter :: badz8 = (+9223372036854775808_8, 0) -complex, parameter :: okj8a = 9223372036854775808_16 -complex, parameter :: okz8a = (+9223372036854775808_16, 0) - -complex, parameter :: okj16 = 170141183460469231731687303715884105727_16 -complex, parameter :: okz16 = (+170141183460469231731687303715884105727_16, -170141183460469231731687303715884105728_16) -!ERROR: Integer literal is too large for INTEGER(KIND=16) -complex, parameter :: badj16 = 170141183460469231731687303715884105728_16 -!ERROR: Integer literal is too large for INTEGER(KIND=16) -complex, parameter :: badz16 = (+170141183460469231731687303715884105728_16, 0) - -end diff --git a/test-lit/Semantics/io01.f90 b/test-lit/Semantics/io01.f90 deleted file mode 100644 index 81b537d7e4c5..000000000000 --- a/test-lit/Semantics/io01.f90 +++ /dev/null @@ -1,126 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - character(len=20) :: access = "direcT" - character(len=20) :: access_(2) = (/"direcT", "streaM"/) - character(len=20) :: action_(2) = (/"reaD ", "writE"/) - character(len=20) :: asynchronous_(2) = (/"nO ", "yeS"/) - character(len=20) :: blank_(2) = (/"nulL", "zerO"/) - character(len=20) :: decimal_(2) = (/'commA', 'poinT'/) - character(len=20) :: delim_(2) = (/"nonE ", "quotE"/) - character(len=20) :: encoding_(2) = (/"defaulT", "utF-8 "/) - character(len=20) :: form_(2) = (/"formatteD ", "unformatteD"/) - character(len=20) :: pad_(2) = (/"nO ", "yeS"/) - character(len=20) :: position_(3) = (/"appenD", "asiS ", "rewinD"/) - character(len=20) :: round_(2) = (/"dowN", "zerO"/) - character(len=20) :: sign_(2) = (/"pluS ", "suppresS"/) - character(len=20) :: status_(2) = (/"neW", "olD"/) - character(len=20) :: convert_(2) = (/"big_endiaN", "nativE "/) - character(len=20) :: dispose_(2) = (/ "deletE", "keeP "/) - character(len=66) :: cc, msg - - integer :: new_unit - integer :: unit10 = 10 - integer :: unit11 = 11 - integer :: n = 40 - - integer(kind=1) :: stat1 - integer(kind=2) :: stat2 - integer(kind=4) :: stat4 - integer(kind=8) :: stat8 - - cc = 'scratch' - - open(unit10) - open(blank='null', unit=unit10, pad='no') - open(unit=unit11, err=3) -3 continue - - open(20, access='sequential') - open(21, access=access, recl=n) - open(22, access=access_(2), iostat=stat1, iomsg=msg) - - open(30, action='readwrite', asynchronous='n'//'o', blank='zero') - open(31, action=action_(2), asynchronous=asynchronous_(2), blank=blank_(2)) - - open(unit=40, decimal="comma", delim="apostrophe", encoding="utf-8") - open(unit=41, decimal=decimal_(2), delim=delim_(2), encoding=encoding_(2)) - - open(50, file='abc', status='unknown', form='formatted') - open(51, file=access, status=status_(2), form=form_(2)) - - open(newunit=new_unit, pad=pad_(2), status='scr'//'atch'//'') - open(newunit=new_unit, pad=pad_(2), status=cc) - - open(unit=60, position='rewind', recl=(30+20/2), round='zero') - open(position=position_(1), recl=n, round=round_(2), unit=61) - - open(unit=70, sign='suppress', & - status='unknown', iostat=stat2) - open(unit=70, sign=sign_(2), status=status_(2)) - - open(80, convert='big_endian', dispose='delete') - open(81, convert=convert_(2), dispose=dispose_(2)) - - open(access='STREAM', 90) ! nonstandard - - !ERROR: OPEN statement must have a UNIT or NEWUNIT specifier - !ERROR: If ACCESS='DIRECT' appears, RECL must also appear - open(access='direct') - - !ERROR: If STATUS='STREAM' appears, RECL must not appear - open(10, access='st'//'ream', recl=13) - - !ERROR: Duplicate NEWUNIT specifier - !ERROR: If NEWUNIT appears, FILE or STATUS must also appear - open(newunit=n, newunit=nn, iostat=stat4) - - !ERROR: Duplicate UNIT specifier - open(unit=100, unit=100) - - !ERROR: Duplicate UNIT specifier - open(101, delim=delim_(1), unit=102) - - !ERROR: Duplicate UNIT specifier - open(unit=103, & - unit=104, iostat=stat8) - - !ERROR: Duplicate UNIT specifier - !ERROR: If ACCESS='DIRECT' appears, RECL must also appear - open(access='dir'//'ect', 9, 9) ! nonstandard - - !ERROR: Duplicate ROUND specifier - open(105, round=round_(1), pad='no', round='nearest') - - !ERROR: If NEWUNIT appears, UNIT must not appear - !ERROR: If NEWUNIT appears, FILE or STATUS must also appear - open(106, newunit=n) - - !ERROR: RECL value (-30) must be positive - open(107, recl=40-70) - - !ERROR: RECL value (-36) must be positive - open(108, recl=- - (-36)) ! nonstandard - - !ERROR: Invalid ACTION value 'reedwrite' - open(109, access=Access, action='reedwrite', recl=77) - - !ERROR: Invalid ACTION value 'nonsense' - open(110, action=''//'non'//'sense', recl=77) - - !ERROR: Invalid STATUS value 'cold' - open(111, status='cold') - - !ERROR: Invalid STATUS value 'Keep' - open(112, status='Keep') - - !ERROR: If STATUS='NEW' appears, FILE must also appear - open(113, status='new') - - !ERROR: If STATUS='REPLACE' appears, FILE must also appear - open(114, status='replace') - - !ERROR: If STATUS='SCRATCH' appears, FILE must not appear - open(115, file='abc', status='scratch') - - !ERROR: If NEWUNIT appears, FILE or STATUS='SCRATCH' must also appear - open(newunit=nn, status='old') -end diff --git a/test-lit/Semantics/io02.f90 b/test-lit/Semantics/io02.f90 deleted file mode 100644 index 7cb901d34027..000000000000 --- a/test-lit/Semantics/io02.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - integer :: unit10 = 10 - integer :: unit11 = 11 - - integer(kind=1) :: stat1 - integer(kind=8) :: stat8 - - character(len=55) :: msg - - close(unit10) - close(unit=unit11, err=9, iomsg=msg, iostat=stat1) - close(12, status='Keep') - - close(iostat=stat8, 11) ! nonstandard - - !ERROR: CLOSE statement must have a UNIT number specifier - close(iostat=stat1) - - !ERROR: Duplicate UNIT specifier - close(13, unit=14, err=9) - - !ERROR: Duplicate ERR specifier - close(err=9, unit=15, err=9, iostat=stat8) - - !ERROR: Invalid STATUS value 'kept' - close(status='kept', unit=16) - - !ERROR: Invalid STATUS value 'old' - close(status='old', unit=17) - -9 continue -end diff --git a/test-lit/Semantics/io03.f90 b/test-lit/Semantics/io03.f90 deleted file mode 100644 index a6696176b126..000000000000 --- a/test-lit/Semantics/io03.f90 +++ /dev/null @@ -1,138 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - character(kind=1,len=50) internal_file - character(kind=2,len=50) internal_file2 - character(kind=4,len=50) internal_file4 - character(kind=1,len=111) msg - character(20) advance - integer*1 stat1 - integer*2 stat2, id2 - integer*8 stat8 - integer :: iunit = 10 - integer, parameter :: junit = 11 - - namelist /mmm/ mm1, mm2 - namelist /nnn/ nn1, nn2 - - advance='no' - - open(10) - - read* - print*, 'Ok' - read(*) - read*, jj - read(*, *) jj - read(unit=*, *) jj - read(*, fmt=*) jj - read(*, '(I4)') jj - read(*, fmt='(I4)') jj - read(fmt='(I4)', unit=*) jj - read(iunit, *) jj - read(junit, *) jj - read(10, *) jj - read(internal_file, *) jj - read(10, nnn) - read(internal_file, nnn) - read(internal_file, nml=nnn) - read(fmt=*, unit=internal_file) - read(nml=nnn, unit=internal_file) - read(iunit, nnn) - read(10, nml=nnn) - read(10, asynchronous='no') jj - read(10, asynchronous='yes') jj - read(10, eor=9, advance='no', fmt='(I4)') jj - read(10, eor=9, advance='no', fmt='(I4)') jj - read(10, asynchronous='yes', id=id) jj - read(10, '(I4)', advance='no', asynchronous='yes', blank='null', & - decimal='comma', end=9, eor=9, err=9, id=id, iomsg=msg, iostat=stat2, & - pad='no', round='processor_defined', size=kk) jj - - !ERROR: Invalid character kind for an internal file variable - read(internal_file2, *) jj - - !ERROR: Invalid character kind for an internal file variable - read(internal_file4, *) jj - - !ERROR: Duplicate IOSTAT specifier - read(11, pos=ipos, iostat=stat1, iostat=stat2) - - !ERROR: Duplicate END specifier - read(11, end=9, pos=ipos, end=9) - - !ERROR: Duplicate NML specifier - read(10, nml=mmm, nml=nnn) - - !ERROR: READ statement must have a UNIT specifier - read(err=9, iostat=stat8) jj - - !ERROR: READ statement must not have a DELIM specifier - !ERROR: READ statement must not have a SIGN specifier - read(10, delim='quote', sign='plus') jj - - !ERROR: If NML appears, REC must not appear - read(10, nnn, rec=nn) - - !ERROR: If NML appears, FMT must not appear - !ERROR: If NML appears, a data list must not appear - read(10, fmt=*, nml=nnn) jj - - !ERROR: If UNIT=* appears, REC must not appear - read(*, rec=13) - - !ERROR: If UNIT=* appears, POS must not appear - read(*, pos=13) - - !ERROR: If UNIT=internal-file appears, REC must not appear - read(internal_file, rec=13) - - !ERROR: If UNIT=internal-file appears, POS must not appear - read(internal_file, pos=13) - - !ERROR: If REC appears, END must not appear - read(10, fmt='(I4)', end=9, rec=13) jj - - !ERROR: If REC appears, FMT=* must not appear - read(10, *, rec=13) jj - - !ERROR: If ADVANCE appears, UNIT=internal-file must not appear - read(internal_file, '(I4)', eor=9, advance='no') jj - - !ERROR: If ADVANCE appears, an explicit format must also appear - !ERROR: If EOR appears, ADVANCE with value 'NO' must also appear - read(10, eor=9, advance='yes') - - !ERROR: If EOR appears, ADVANCE with value 'NO' must also appear - read(10, eor=9) - - !ERROR: Invalid ASYNCHRONOUS value 'nay' - read(10, asynchronous='nay') ! prog req - - !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear - read(*, asynchronous='yes') - - !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear - read(internal_file, asynchronous='y'//'es') - - !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear - read(10, id=id) - - !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear - read(10, asynchronous='n'//'o', id=id) - - !ERROR: If POS appears, REC must not appear - read(10, pos=13, rec=13) jj - - !ERROR: If DECIMAL appears, FMT or NML must also appear - !ERROR: If BLANK appears, FMT or NML must also appear - !ERROR: Invalid DECIMAL value 'Punkt' - read(10, decimal='Punkt', blank='null') jj - - !ERROR: If ROUND appears, FMT or NML must also appear - !ERROR: If PAD appears, FMT or NML must also appear - read(10, pad='no', round='nearest') jj - - !ERROR: ID kind (2) is smaller than default INTEGER kind (4) - read(10, id=id2, asynchronous='yes') jj - -9 continue -end diff --git a/test-lit/Semantics/io04.f90 b/test-lit/Semantics/io04.f90 deleted file mode 100644 index 09776ef94ab1..000000000000 --- a/test-lit/Semantics/io04.f90 +++ /dev/null @@ -1,125 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - character(kind=1,len=50) internal_file - character(kind=1,len=100) msg - character(20) sign - integer*1 stat1, id1 - integer*2 stat2 - integer*4 stat4 - integer*8 stat8 - integer :: iunit = 10 - integer, parameter :: junit = 11 - integer, pointer :: a(:) - - namelist /nnn/ nn1, nn2 - - sign = 'suppress' - - open(10) - - write(*) - write(*, *) - write(*) - write(*, *) - write(unit=*) 'Ok' - write(unit=iunit) - write(unit=junit) - write(unit=iunit, *) - write(unit=junit, *) - write(10) - write(unit=10) 'Ok' - write(*, nnn) - write(10, nnn) - write(internal_file) - write(internal_file, *) - write(internal_file, fmt=*) - write(internal_file, fmt=1) 'Ok' - write(internal_file, nnn) - write(internal_file, nml=nnn) - write(unit=internal_file, *) - write(fmt=*, unit=internal_file) - write(10, advance='yes', fmt=1) 'Ok' - write(10, *, delim='quote', sign='plus') jj - write(10, '(A)', advance='no', asynchronous='yes', decimal='comma', & - err=9, id=id, iomsg=msg, iostat=stat2, round='processor_defined', & - sign=sign) 'Ok' - - print* - print*, 'Ok' - - allocate(a(2), stat=stat2) - allocate(a(8), stat=stat8) - - !ERROR: Duplicate UNIT specifier - write(internal_file, unit=*) - - !ERROR: WRITE statement must have a UNIT specifier - write(nml=nnn) - - !ERROR: WRITE statement must not have a BLANK specifier - !ERROR: WRITE statement must not have a END specifier - !ERROR: WRITE statement must not have a EOR specifier - !ERROR: WRITE statement must not have a PAD specifier - write(*, eor=9, blank='zero', end=9, pad='no') - - !ERROR: If NML appears, REC must not appear - !ERROR: If NML appears, FMT must not appear - !ERROR: If NML appears, a data list must not appear - write(10, nnn, rec=40, fmt=1) 'Ok' - - !ERROR: If UNIT=* appears, POS must not appear - write(*, pos=n, nml=nnn) - - !ERROR: If UNIT=* appears, REC must not appear - write(*, rec=n) - - !ERROR: If UNIT=internal-file appears, POS must not appear - write(internal_file, err=9, pos=n, nml=nnn) - - !ERROR: If UNIT=internal-file appears, REC must not appear - write(internal_file, rec=n, err=9) - - !ERROR: If UNIT=* appears, REC must not appear - write(*, rec=13) 'Ok' - - !ERROR: If ADVANCE appears, UNIT=internal-file must not appear - write(internal_file, advance='yes', fmt=1) 'Ok' - - !ERROR: If ADVANCE appears, an explicit format must also appear - write(10, advance='yes') 'Ok' - - !ERROR: Invalid ASYNCHRONOUS value 'non' - write(*, asynchronous='non') - - !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear - write(*, asynchronous='yes') - - !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear - write(internal_file, asynchronous='yes') - - !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear - write(10, *, id=id) "Ok" - - !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear - write(10, *, id=id, asynchronous='no') "Ok" - - !ERROR: If POS appears, REC must not appear - write(10, pos=13, rec=13) 'Ok' - - !ERROR: If DECIMAL appears, FMT or NML must also appear - !ERROR: If ROUND appears, FMT or NML must also appear - !ERROR: If SIGN appears, FMT or NML must also appear - !ERROR: Invalid DECIMAL value 'Komma' - write(10, decimal='Komma', sign='plus', round='down') jj - - !ERROR: If DELIM appears, FMT=* or NML must also appear - !ERROR: Invalid DELIM value 'Nix' - write(delim='Nix', fmt='(A)', unit=10) 'Ok' - - !ERROR: ID kind (1) is smaller than default INTEGER kind (4) - write(id=id1, unit=10, asynchronous='Yes') 'Ok' - - write(*, '(X)') - -1 format (A) -9 continue -end diff --git a/test-lit/Semantics/io05.f90 b/test-lit/Semantics/io05.f90 deleted file mode 100644 index 1df878197237..000000000000 --- a/test-lit/Semantics/io05.f90 +++ /dev/null @@ -1,60 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - character*20 c(25), cv - character(kind=1,len=59) msg - logical*2 v(5), lv - integer*1 stat1 - integer*2 stat4 - integer*8 stat8, iv - - inquire(10) - inquire(file='abc') - inquire(10, pos=ipos, iomsg=msg, iostat=stat1) - inquire(file='abc', & - access=c(1), action=c(2), asynchronous=c(3), blank=c(4), decimal=c(5), & - delim=c(6), direct=c(7), encoding=c(8), form=c(9), formatted=c(10), & - name=c(11), pad=c(12), position=c(13), read=c(14), readwrite=c(15), & - round=c(16), sequential=c(17), sign=c(18), stream=c(19), & - unformatted=c(20), write=c(21), & - err=9, & - nextrec=nextrec, number=number, pos=jpos, recl=jrecl, size=jsize, & - iomsg=msg, & - iostat=stat4, & - exist=v(1), named=v(2), opened=v(3), pending=v(4)) - inquire(pending=v(5), file='abc') - inquire(10, id=id, pending=v(5)) - - ! using variable 'cv' multiple times seems to be allowed - inquire(file='abc', & - access=cv, action=cv, asynchronous=cv, blank=cv, decimal=cv, & - delim=cv, direct=cv, encoding=cv, form=cv, formatted=cv, & - name=cv, pad=cv, position=cv, read=cv, readwrite=cv, & - round=cv, sequential=cv, sign=cv, stream=cv, & - unformatted=cv, write=cv, & - nextrec=iv, number=iv, pos=iv, recl=iv, size=iv, & - exist=lv, named=lv, opened=lv, pending=lv) - - !ERROR: INQUIRE statement must have a UNIT number or FILE specifier - inquire(err=9) - - !ERROR: If FILE appears, UNIT must not appear - inquire(10, file='abc', blank=c(22), iostat=stat8) - - !ERROR: Duplicate FILE specifier - inquire(file='abc', file='xyz') - - !ERROR: Duplicate FORM specifier - inquire(form=c(1), iostat=stat1, form=c(2), file='abc') - - !ERROR: Duplicate SIGN specifier - !ERROR: Duplicate READ specifier - !ERROR: Duplicate WRITE specifier - inquire(1, read=c(1), write=c(2), sign=c(3), sign=c(4), read=c(5), write=c(1)) - - !ERROR: Duplicate IOMSG specifier - inquire(10, iomsg=msg, pos=ipos, iomsg=msg) - - !ERROR: If ID appears, PENDING must also appear - inquire(file='abc', id=id) - -9 continue -end diff --git a/test-lit/Semantics/io06.f90 b/test-lit/Semantics/io06.f90 deleted file mode 100644 index eba437c86c86..000000000000 --- a/test-lit/Semantics/io06.f90 +++ /dev/null @@ -1,45 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - character(kind=1,len=100) msg1 - character(kind=2,len=200) msg2 - integer(1) stat1 - integer(2) stat2 - integer(8) stat8 - - open(10) - - backspace(10) - backspace(10, iomsg=msg1, iostat=stat1, err=9) - - endfile(unit=10) - endfile(iostat=stat2, err=9, unit=10, iomsg=msg1) - - rewind(10) - rewind(iomsg=msg1, iostat=stat2, err=9, unit=10) - - flush(10) - flush(iomsg=msg1, unit=10, iostat=stat8, err=9) - - wait(10) - wait(99, id=id1, end=9, eor=9, err=9, iostat=stat1, iomsg=msg1) - - !ERROR: Duplicate UNIT specifier - backspace(10, unit=11) - - !ERROR: Duplicate IOSTAT specifier - endfile(iostat=stat2, err=9, unit=10, iostat=stat8, iomsg=msg1) - - !ERROR: REWIND statement must have a UNIT number specifier - rewind(iostat=stat2) - - !ERROR: Duplicate ERR specifier - !ERROR: Duplicate ERR specifier - flush(err=9, unit=10, & - err=9, & - err=9) - - !ERROR: Duplicate ID specifier - !ERROR: WAIT statement must have a UNIT number specifier - wait(id=id2, eor=9, id=id3) - -9 continue -end diff --git a/test-lit/Semantics/io07.f90 b/test-lit/Semantics/io07.f90 deleted file mode 100644 index 9462a099d67e..000000000000 --- a/test-lit/Semantics/io07.f90 +++ /dev/null @@ -1,77 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -1001 format(A) - - !ERROR: Format statement must be labeled - format(A) - -2001 format(3I8, 3Z8) -2002 format(3I8, Z8) -2003 format( 3 I 8 , 3 Z 8 ) -2004 format(20PF10.2) -2005 format(20P,F10.2) -2006 format(20P7F10.2) -2007 format(1X/) -2008 format(/02x) -2009 format(1x/02x) -2010 format(2L2:) -2011 format(:2L2) -2012 format(2L2 : 2L2) - - ! C1302 warnings; no errors -2051 format(1X3/) -2052 format(1X003/) -2053 format(3P7I2) -2054 format(3PI2) - - !ERROR: Expected ',' or ')' in format expression -2101 format(3I83Z8, 'abc') - - !ERROR: Expected ',' or ')' in format expression -2102 format( 3 I 8 3 Z 8 ) - - !ERROR: Expected ',' or ')' in format expression -2103 format(3I8 3Z8) - - !ERROR: Expected ',' or ')' in format expression -2104 format(3I8 Z8) - -3001 format(*(I3)) -3002 format(5X,*(2(A))) - - !ERROR: Unlimited format item list must contain a data edit descriptor -3101 format(*(X)) - - !ERROR: Unlimited format item list must contain a data edit descriptor -3102 format(5X,*(2(/))) - - !ERROR: Unlimited format item list must contain a data edit descriptor -3103 format(5X, 'abc', *((:))) - -4001 format(2(X)) - - !ERROR: List repeat specifier must be positive - !ERROR: 'DT' edit descriptor repeat specifier must be positive -4101 format(0(X), 0dt) - -6001 format(((I0, B0))) - - !ERROR: 'A' edit descriptor 'w' value must be positive - !ERROR: 'L' edit descriptor 'w' value must be positive -6101 format((A0), ((L0))) - - !ERROR: 'L' edit descriptor 'w' value must be positive -6102 format((3(((L 0 0 0))))) - -7001 format(17G8.1, 17G8.1e3) - - !ERROR: Expected 'G' edit descriptor '.d' value -7101 format(17G8) - -8001 format(9G0.5) - - !ERROR: Unexpected 'e' in 'G0' edit descriptor -8101 format(9(G0.5e1)) - - !ERROR: Unexpected 'e' in 'G0' edit descriptor -8102 format(9(G0.5 E 1)) -end diff --git a/test-lit/Semantics/io08.f90 b/test-lit/Semantics/io08.f90 deleted file mode 100644 index 1b75e8094a9a..000000000000 --- a/test-lit/Semantics/io08.f90 +++ /dev/null @@ -1,309 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - write(*,*) - write(*,'()') - write(*,'(A)') - write(*,'(2X:2X)') - write(*,'(2X/2X)') - write(*,'(3/2X)') - write(*,'(3PF5.2)') - write(*,'(+3PF5.2)') - write(*,'(-3PF5.2)') - write(*,'(000p,10p,0p)') - write(*,'(3P7D5.2)') - write(*,'(3P,7F5.2)') - write(*,'(2X,(i3))') - write(*,'(5X,*(2X,I2))') - write(*,'(5X,*(2X,DT))') - write(*,'(*(DT))') - write(*,'(*(DT"value"))') - write(*,'(*(DT(+1,0,-1)))') - write(*,'(*(DT"value"(+1,000,-1)))') - write(*,'(*(DT(0)))') - write(*,'(S,(RZ),2E10.3)') - write(*,'(7I2)') - write(*,'(07I02)') - write(*,'(07I02.01)') - write(*,'(07I02.02)') - write(*,'(I0)') - write(*,'(G4.2)') - write(*,'(G0.8)') - write(*,'(T3)') - write(*,'("abc")') - write(*,'("""abc""")') - write(*,'("a""""bc", 2x)') - write(*,'(3Habc)') - write(*,'(3Habc, 2X, 3X)') - write(*,'(987654321098765432X)') - write(*,'($)') - write(*,'(\)') - write(*,'(RZ,RU,RP,RN,RD,RC,SS,SP,S,3G15.3e2)') - - ! C1302 warnings; no errors - write(*,'(3P7I2)') - write(*,'(5X i3)') - write(*,'(XEN)') - - !ERROR: Empty format expression - write(*,"") - - !ERROR: Empty format expression - write(*,"" // '' // "") - - !ERROR: Format expression must have an initial '(' - write(*,'I3') - - !ERROR: Unexpected '+' in format expression - write(*,'(+7I2)') - - !ERROR: Unexpected '-' in format expression - write(*,'(-7I2)') - - !ERROR: 'P' edit descriptor must have a scale factor - write(*,'(P7F5.2)') - - !ERROR: 'P' edit descriptor must have a scale factor - write(*,'(P7F' // '5.2)') - - !ERROR: Unexpected integer constant - write(*,'(X,3,3L4)') - - !ERROR: Unexpected ',' before ')' in format expression - write(*,'(X,i3,)') - - !ERROR: Unexpected ',' in format expression - write(*,'(X,i3,,)') - - !ERROR: Unexpected ',' in format expression - !ERROR: Unexpected ',' before ')' in format expression - write(*,'(X,i3,,,)') - - !ERROR: Unexpected ',' before ')' in format expression - write(*,'(X,(i3,))') - - !ERROR: Unexpected '*' in format expression - write(*,'(*)') - - !ERROR: Expected integer constant in 'DT' edit descriptor v-list - write(*,'(*(DT(+1,0,=1)))') - - !ERROR: Expected integer constant in 'DT' edit descriptor v-list - write(*,'(DT(1,0,+))') - - !ERROR: Expected integer constant in 'DT' edit descriptor v-list - write(*,'(DT(1,0,*))') - - !ERROR: Expected ',' or ')' in 'DT' edit descriptor v-list - write(*,'(DT(1,0,2*))') - - !ERROR: Expected ',' or ')' in 'DT' edit descriptor v-list - write(*,'(DT(1,0,2*,+,?))') - - !ERROR: Expected integer constant in 'DT' edit descriptor v-list - !ERROR: Unterminated format expression - write(*,'(DT(1,0,*)') - - !ERROR: Expected ',' or ')' in 'DT' edit descriptor v-list - !ERROR: Unterminated format expression - write(*,'(DT(1,0,2*,+,?)') - - !ERROR: Unexpected '?' in format expression - !ERROR: Unexpected ',' in format expression - write(*,'(?,*(DT(+1,,1)))') - - !ERROR: Repeat specifier before unlimited format item list - !ERROR: Unlimited format item list must contain a data edit descriptor - write(*,'(5X,3*(2(X)))') - - !ERROR: Nested unlimited format item list - write(*,'(D12.2,(*(F10.2)))') - - !ERROR: Unlimited format item list must contain a data edit descriptor - write(*,'(5X,*(2(X)))') - - !ERROR: Character in format after unlimited format item list - write(*,'(*(Z5),*(2F20.3))') - - !ERROR: Character in format after unlimited format item list - write(*,'(*(B5),*(2(I5)))') - - !ERROR: Character in format after unlimited format item list - write(*,'(*(I5), D12.7)') - - !ERROR: 'I' edit descriptor 'm' value is greater than 'w' value - write(*,'(07I02.0 3)') - - !ERROR: 'Z' edit descriptor 'm' value is greater than 'w' value - write(*,'(07Z02.4)') - - !ERROR: 'I' edit descriptor repeat specifier must be positive - write(*,'(0I2)') - - !ERROR: List repeat specifier must be positive - write(*,'(0(I2))') - - !ERROR: List repeat specifier must be positive - write(*,'(000(I2))') - - !ERROR: List repeat specifier must be positive - !ERROR: 'I' edit descriptor repeat specifier must be positive - write(*,'(0(0I2))') - - !ERROR: Kind parameter '_' character in format expression - write(*,'(5_4X)') - - !ERROR: Unexpected '+' in format expression - write(*,'(I+3)') - - !ERROR: Unexpected '-' in format expression - write(*,'(I-3)') - - !ERROR: Unexpected '-' in format expression - write(*,'(I-3, X)') - - !ERROR: 'X' edit descriptor must have a positive position value - write(*,'(0X)') - - !ERROR: Unexpected 'Y' in format expression - write(*,'(XY)') - - !ERROR: Unexpected 'Y' in format expression - write(*,'(XYM)') - - !ERROR: Unexpected 'M' in format expression - write(*,'(MXY)') - - !ERROR: Unexpected 'R' in format expression - !ERROR: Unexpected 'R' in format expression - write(*,"(RR, RV)") - - !ERROR: Unexpected '-' in format expression - !ERROR: Unexpected 'Y' in format expression - write(*,'(I-3, XY)') - - !ERROR: 'A' edit descriptor 'w' value must be positive - write(*,'(A0)') - - !ERROR: 'L' edit descriptor 'w' value must be positive - write(*,'(L0)') - - !ERROR: Expected 'G' edit descriptor '.d' value - write(*,'(G4)') - - !ERROR: Unexpected 'e' in 'G0' edit descriptor - write(*,'(G0.8e)') - - !ERROR: Unexpected 'e' in 'G0' edit descriptor - write(*,'(G0.8e2)') - - !ERROR: Kind parameter '_' character in format expression - write(*,'(I5_4)') - - !ERROR: Kind parameter '_' character in format expression - write(*,'(5_4P)') - - !ERROR: 'T' edit descriptor must have a positive position value - write(*,'(T0)') - - !ERROR: 'T' edit descriptor must have a positive position value - !ERROR: Unterminated format expression - write(*,'(T0') - - !ERROR: 'TL' edit descriptor must have a positive position value - !ERROR: 'T' edit descriptor must have a positive position value - !ERROR: Expected 'EN' edit descriptor 'd' value after '.' - write(*,'(TL0,T0,EN12.)') - - !ERROR: Expected 'EX' edit descriptor 'e' value after 'E' - write(*,'(EX12.3e2, EX12.3e)') - - !ERROR: 'TL' edit descriptor must have a positive position value - !ERROR: 'T' edit descriptor must have a positive position value - !ERROR: Unterminated format expression - write(*,'(TL00,T000') - - !ERROR: Unterminated format expression - write(*,'(') - - !ERROR: Unterminated format expression - write(*,'(-') - - !ERROR: Unterminated format expression - write(*,'(I3+') - - !ERROR: Unterminated format expression - write(*,'(I3,-') - - !ERROR: Unexpected integer constant - write(*,'(3)') - - !ERROR: Unexpected ',' before ')' in format expression - write(*,'(3,)') - - !ERROR: Unexpected ',' in format expression - write(*,'(,3)') - - !ERROR: Unexpected ',' before ')' in format expression - write(*,'(,)') - - !ERROR: Unterminated format expression - write(*,'(X') - - !ERROR: Unterminated format expression - write(*,'(XX') ! C1302 warning is not an error - - !ERROR: Unexpected '@' in format expression - !ERROR: Unexpected '#' in format expression - !ERROR: Unexpected '&' in format expression - write(*,'(@@, # ,&&& &&, ignore error 4)') - - !ERROR: Repeat specifier before 'TR' edit descriptor - write(*,'(3TR0)') - - !ERROR: 'TR' edit descriptor must have a positive position value - write(*,'(TR0)') - - !ERROR: Kind parameter '_' character in format expression - write(*,'(3_4X)') - - !ERROR: Kind parameter '_' character in format expression - write(*,'(1_"abc")') - - !ERROR: Unterminated string - !ERROR: Unterminated format expression - write(*,'("abc)') - - !ERROR: Unexpected '_' in format expression - write(*,'("abc"_1)') - - !ERROR: Unexpected '@' in format expression - write(*,'(3Habc, 3@, X)') - - !ERROR: Unterminated format expression - write(*,'(4Habc)') - - !ERROR: Unterminated 'H' edit descriptor - !ERROR: Unterminated format expression - write(*,'(5Habc)') - - !ERROR: Unterminated 'H' edit descriptor - !ERROR: Unterminated format expression - write(*,'(50Habc)') - - !ERROR: Integer overflow in format expression - write(*,'(9876543210987654321X)') - - !ERROR: Integer overflow in format expression - write(*,'(98765432109876543210X)') - - !ERROR: Integer overflow in format expression - write(*,'(I98765432109876543210)') - - !ERROR: Integer overflow in format expression - write(*,'(45I20.98765432109876543210, 45I20)') - - !ERROR: Integer overflow in format expression - write(*,'(45' // ' I20.9876543' // '2109876543210, 45I20)') - - !ERROR: Repeat specifier before '$' edit descriptor - write(*,'(7$)') -end diff --git a/test-lit/Semantics/io09.f90 b/test-lit/Semantics/io09.f90 deleted file mode 100644 index 5f50e4e0151e..000000000000 --- a/test-lit/Semantics/io09.f90 +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t - !ERROR: String edit descriptor in READ format expression - read(*,'("abc")') - - !ERROR: String edit descriptor in READ format expression - !ERROR: Unterminated format expression - read(*,'("abc)') - - !ERROR: 'H' edit descriptor in READ format expression - read(*,'(3Habc)') - - !ERROR: 'H' edit descriptor in READ format expression - !ERROR: Unterminated format expression - read(*,'(5Habc)') - - !ERROR: 'I' edit descriptor 'w' value must be positive - read(*,'(I0)') -end diff --git a/test-lit/Semantics/io10.f90 b/test-lit/Semantics/io10.f90 deleted file mode 100644 index 90ae8b194330..000000000000 --- a/test-lit/Semantics/io10.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -Mstandard - - write(*, '(B0)') - write(*, '(B3)') - - !WARNING: Expected 'B' edit descriptor 'w' value - write(*, '(B)') - - !WARNING: Expected 'EN' edit descriptor 'w' value - !WARNING: Non-standard '$' edit descriptor - write(*, '(EN,$)') - - !WARNING: Expected 'G' edit descriptor 'w' value - write(*, '(3G)') - - !WARNING: Non-standard '\' edit descriptor - write(*,'(A, \)') 'Hello' - - !WARNING: 'X' edit descriptor must have a positive position value - write(*, '(X)') - - !WARNING: Legacy 'H' edit descriptor - write(*, '(3Habc)') - - !WARNING: 'X' edit descriptor must have a positive position value - !WARNING: Expected ',' or ')' in format expression - !WARNING: 'X' edit descriptor must have a positive position value - write(*,'(XX)') - - !WARNING: Expected ',' or ')' in format expression - write(*,'(RZEN8.2)') - - !WARNING: Expected ',' or ')' in format expression - write(*,'(3P7I2)') - - !WARNING: Expected ',' or ')' in format expression - write(*,'(5X i3)') -end diff --git a/test-lit/Semantics/kinds01.f90 b/test-lit/Semantics/kinds01.f90 deleted file mode 100644 index 388ca2342167..000000000000 --- a/test-lit/Semantics/kinds01.f90 +++ /dev/null @@ -1,82 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t - !DEF: /MainProgram1/jk1 ObjectEntity INTEGER(1) - integer(kind=1) jk1 - !DEF: /MainProgram1/js1 ObjectEntity INTEGER(1) - integer*1 js1 - !DEF: /MainProgram1/jk2 ObjectEntity INTEGER(2) - integer(kind=2) jk2 - !DEF: /MainProgram1/js2 ObjectEntity INTEGER(2) - integer*2 js2 - !DEF: /MainProgram1/jk4 ObjectEntity INTEGER(4) - integer(kind=4) jk4 - !DEF: /MainProgram1/js4 ObjectEntity INTEGER(4) - integer*4 js4 - !DEF: /MainProgram1/jk8 ObjectEntity INTEGER(8) - integer(kind=8) jk8 - !DEF: /MainProgram1/js8 ObjectEntity INTEGER(8) - integer*8 js8 - !DEF: /MainProgram1/jk16 ObjectEntity INTEGER(16) - integer(kind=16) jk16 - !DEF: /MainProgram1/js16 ObjectEntity INTEGER(16) - integer*16 js16 - !DEF: /MainProgram1/ak2 ObjectEntity REAL(2) - real(kind=2) ak2 - !DEF: /MainProgram1/as2 ObjectEntity REAL(2) - real*2 as2 - !DEF: /MainProgram1/ak4 ObjectEntity REAL(4) - real(kind=4) ak4 - !DEF: /MainProgram1/as4 ObjectEntity REAL(4) - real*4 as4 - !DEF: /MainProgram1/ak8 ObjectEntity REAL(8) - real(kind=8) ak8 - !DEF: /MainProgram1/as8 ObjectEntity REAL(8) - real*8 as8 - !DEF: /MainProgram1/dp ObjectEntity REAL(8) - double precision dp - !DEF: /MainProgram1/ak10 ObjectEntity REAL(10) - real(kind=10) ak10 - !DEF: /MainProgram1/as10 ObjectEntity REAL(10) - real*10 as10 - !DEF: /MainProgram1/ak16 ObjectEntity REAL(16) - real(kind=16) ak16 - !DEF: /MainProgram1/as16 ObjectEntity REAL(16) - real*16 as16 - !DEF: /MainProgram1/zk2 ObjectEntity COMPLEX(2) - complex(kind=2) zk2 - !DEF: /MainProgram1/zs2 ObjectEntity COMPLEX(2) - complex*4 zs2 - !DEF: /MainProgram1/zk4 ObjectEntity COMPLEX(4) - complex(kind=4) zk4 - !DEF: /MainProgram1/zs4 ObjectEntity COMPLEX(4) - complex*8 zs4 - !DEF: /MainProgram1/zk8 ObjectEntity COMPLEX(8) - complex(kind=8) zk8 - !DEF: /MainProgram1/zs8 ObjectEntity COMPLEX(8) - complex*16 zs8 - !DEF: /MainProgram1/zdp ObjectEntity COMPLEX(8) - double complex zdp - !DEF: /MainProgram1/zk10 ObjectEntity COMPLEX(10) - complex(kind=10) zk10 - !DEF: /MainProgram1/zs10 ObjectEntity COMPLEX(10) - complex*20 zs10 - !DEF: /MainProgram1/zk16 ObjectEntity COMPLEX(16) - complex(kind=16) zk16 - !DEF: /MainProgram1/zs16 ObjectEntity COMPLEX(16) - complex*32 zs16 - !DEF: /MainProgram1/lk1 ObjectEntity LOGICAL(1) - logical(kind=1) lk1 - !DEF: /MainProgram1/ls1 ObjectEntity LOGICAL(1) - logical*1 ls1 - !DEF: /MainProgram1/lk2 ObjectEntity LOGICAL(2) - logical(kind=2) lk2 - !DEF: /MainProgram1/ls2 ObjectEntity LOGICAL(2) - logical*2 ls2 - !DEF: /MainProgram1/lk4 ObjectEntity LOGICAL(4) - logical(kind=4) lk4 - !DEF: /MainProgram1/ls4 ObjectEntity LOGICAL(4) - logical*4 ls4 - !DEF: /MainProgram1/lk8 ObjectEntity LOGICAL(8) - logical(kind=8) lk8 - !DEF: /MainProgram1/ls8 ObjectEntity LOGICAL(8) - logical*8 ls8 -end program diff --git a/test-lit/Semantics/kinds02.f90 b/test-lit/Semantics/kinds02.f90 deleted file mode 100644 index 0983be564738..000000000000 --- a/test-lit/Semantics/kinds02.f90 +++ /dev/null @@ -1,71 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C712 The value of scalar-int-constant-expr shall be nonnegative and -! shall specify a representation method that exists on the processor. -! C714 The value of kind-param shall be nonnegative. -! C715 The value of kind-param shall specify a representation method that -! exists on the processor. -! C719 The value of scalar-int-constant-expr shall be nonnegative and shall -! specify a representation method that exists on the processor. -! C725 The optional comma in a length-selector is permitted only if no -! double-colon separator appears in the typedeclaration- stmt. -! C727 The value of kind-param shall specify a representation method that -! exists on the processor. -! -!ERROR: INTEGER(KIND=0) is not a supported type -integer(kind=0) :: j0 -!ERROR: INTEGER(KIND=-1) is not a supported type -integer(kind=-1) :: jm1 -!ERROR: INTEGER(KIND=3) is not a supported type -integer(kind=3) :: j3 -!ERROR: INTEGER(KIND=32) is not a supported type -integer(kind=32) :: j32 -!ERROR: REAL(KIND=0) is not a supported type -real(kind=0) :: a0 -!ERROR: REAL(KIND=-1) is not a supported type -real(kind=-1) :: am1 -!ERROR: REAL(KIND=1) is not a supported type -real(kind=1) :: a1 -!ERROR: REAL(KIND=7) is not a supported type -real(kind=7) :: a7 -!ERROR: REAL(KIND=32) is not a supported type -real(kind=32) :: a32 -!ERROR: COMPLEX(KIND=0) is not a supported type -complex(kind=0) :: z0 -!ERROR: COMPLEX(KIND=-1) is not a supported type -complex(kind=-1) :: zm1 -!ERROR: COMPLEX(KIND=1) is not a supported type -complex(kind=1) :: z1 -!ERROR: COMPLEX(KIND=7) is not a supported type -complex(kind=7) :: z7 -!ERROR: COMPLEX(KIND=32) is not a supported type -complex(kind=32) :: z32 -!ERROR: COMPLEX*1 is not a supported type -complex*1 :: zs1 -!ERROR: COMPLEX*2 is not a supported type -complex*2 :: zs2 -!ERROR: COMPLEX*64 is not a supported type -complex*64 :: zs64 -!ERROR: LOGICAL(KIND=0) is not a supported type -logical(kind=0) :: l0 -!ERROR: LOGICAL(KIND=-1) is not a supported type -logical(kind=-1) :: lm1 -!ERROR: LOGICAL(KIND=3) is not a supported type -logical(kind=3) :: l3 -!ERROR: LOGICAL(KIND=16) is not a supported type -logical(kind=16) :: l16 -character (len=99, kind=1) :: cvar1 -character (len=99, kind=2) :: cvar2 -character *4, cvar3 -character *(5), cvar4 -!ERROR: KIND value (3) not valid for CHARACTER -character (len=99, kind=3) :: cvar5 -!ERROR: KIND value (-1) not valid for CHARACTER -character (len=99, kind=-1) :: cvar6 -character(len=*), parameter :: cvar7 = 1_"abcd" -character(len=*), parameter :: cvar8 = 2_"abcd" -!ERROR: CHARACTER(KIND=3) is not a supported type -character(len=*), parameter :: cvar9 = 3_"abcd" -character(len=*), parameter :: cvar10 = 4_"abcd" -!ERROR: CHARACTER(KIND=8) is not a supported type -character(len=*), parameter :: cvar11 = 8_"abcd" -end program diff --git a/test-lit/Semantics/kinds03.f90 b/test-lit/Semantics/kinds03.f90 deleted file mode 100644 index b4ba7e67bb6c..000000000000 --- a/test-lit/Semantics/kinds03.f90 +++ /dev/null @@ -1,95 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t - !DEF: /MainProgram1/ipdt DerivedType - !DEF: /MainProgram1/ipdt/k TypeParam INTEGER(4) - type :: ipdt(k) - !REF: /MainProgram1/ipdt/k - integer, kind :: k - !REF: /MainProgram1/ipdt/k - !DEF: /MainProgram1/ipdt/x ObjectEntity INTEGER(int(k,kind=8)) - integer(kind=k) :: x - end type ipdt - !DEF: /MainProgram1/rpdt DerivedType - !DEF: /MainProgram1/rpdt/k TypeParam INTEGER(4) - type :: rpdt(k) - !REF: /MainProgram1/rpdt/k - integer, kind :: k - !REF: /MainProgram1/rpdt/k - !DEF: /MainProgram1/rpdt/x ObjectEntity REAL(int(k,kind=8)) - real(kind=k) :: x - end type rpdt - !DEF: /MainProgram1/zpdt DerivedType - !DEF: /MainProgram1/zpdt/k TypeParam INTEGER(4) - type :: zpdt(k) - !REF: /MainProgram1/zpdt/k - integer, kind :: k - !REF: /MainProgram1/zpdt/k - !DEF: /MainProgram1/zpdt/x ObjectEntity COMPLEX(int(k,kind=8)) - complex(kind=k) :: x - end type zpdt - !DEF: /MainProgram1/lpdt DerivedType - !DEF: /MainProgram1/lpdt/k TypeParam INTEGER(4) - type :: lpdt(k) - !REF: /MainProgram1/lpdt/k - integer, kind :: k - !REF: /MainProgram1/lpdt/k - !DEF: /MainProgram1/lpdt/x ObjectEntity LOGICAL(int(k,kind=8)) - logical(kind=k) :: x - end type lpdt - !REF: /MainProgram1/ipdt - !DEF: /MainProgram1/i1 ObjectEntity TYPE(ipdt(k=1_4)) - type(ipdt(1)) :: i1 - !REF: /MainProgram1/ipdt - !DEF: /MainProgram1/i2 ObjectEntity TYPE(ipdt(k=2_4)) - type(ipdt(2)) :: i2 - !REF: /MainProgram1/ipdt - !DEF: /MainProgram1/i4 ObjectEntity TYPE(ipdt(k=4_4)) - type(ipdt(4)) :: i4 - !REF: /MainProgram1/ipdt - !DEF: /MainProgram1/i8 ObjectEntity TYPE(ipdt(k=8_4)) - type(ipdt(8)) :: i8 - !REF: /MainProgram1/ipdt - !DEF: /MainProgram1/i16 ObjectEntity TYPE(ipdt(k=16_4)) - type(ipdt(16)) :: i16 - !REF: /MainProgram1/rpdt - !DEF: /MainProgram1/a2 ObjectEntity TYPE(rpdt(k=2_4)) - type(rpdt(2)) :: a2 - !REF: /MainProgram1/rpdt - !DEF: /MainProgram1/a4 ObjectEntity TYPE(rpdt(k=4_4)) - type(rpdt(4)) :: a4 - !REF: /MainProgram1/rpdt - !DEF: /MainProgram1/a8 ObjectEntity TYPE(rpdt(k=8_4)) - type(rpdt(8)) :: a8 - !REF: /MainProgram1/rpdt - !DEF: /MainProgram1/a10 ObjectEntity TYPE(rpdt(k=10_4)) - type(rpdt(10)) :: a10 - !REF: /MainProgram1/rpdt - !DEF: /MainProgram1/a16 ObjectEntity TYPE(rpdt(k=16_4)) - type(rpdt(16)) :: a16 - !REF: /MainProgram1/zpdt - !DEF: /MainProgram1/z2 ObjectEntity TYPE(zpdt(k=2_4)) - type(zpdt(2)) :: z2 - !REF: /MainProgram1/zpdt - !DEF: /MainProgram1/z4 ObjectEntity TYPE(zpdt(k=4_4)) - type(zpdt(4)) :: z4 - !REF: /MainProgram1/zpdt - !DEF: /MainProgram1/z8 ObjectEntity TYPE(zpdt(k=8_4)) - type(zpdt(8)) :: z8 - !REF: /MainProgram1/zpdt - !DEF: /MainProgram1/z10 ObjectEntity TYPE(zpdt(k=10_4)) - type(zpdt(10)) :: z10 - !REF: /MainProgram1/zpdt - !DEF: /MainProgram1/z16 ObjectEntity TYPE(zpdt(k=16_4)) - type(zpdt(16)) :: z16 - !REF: /MainProgram1/lpdt - !DEF: /MainProgram1/l1 ObjectEntity TYPE(lpdt(k=1_4)) - type(lpdt(1)) :: l1 - !REF: /MainProgram1/lpdt - !DEF: /MainProgram1/l2 ObjectEntity TYPE(lpdt(k=2_4)) - type(lpdt(2)) :: l2 - !REF: /MainProgram1/lpdt - !DEF: /MainProgram1/l4 ObjectEntity TYPE(lpdt(k=4_4)) - type(lpdt(4)) :: l4 - !REF: /MainProgram1/lpdt - !DEF: /MainProgram1/l8 ObjectEntity TYPE(lpdt(k=8_4)) - type(lpdt(8)) :: l8 -end program diff --git a/test-lit/Semantics/kinds04.f90 b/test-lit/Semantics/kinds04.f90 deleted file mode 100644 index af6a8965ca65..000000000000 --- a/test-lit/Semantics/kinds04.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C716 If both kind-param and exponent-letter appear, exponent-letter -! shall be E. -! C717 The value of kind-param shall specify an approximation method that -! exists on the processor. -subroutine s(var) - real :: realvar1 = 4.0E6_4 - real :: realvar2 = 4.0D6 - real :: realvar3 = 4.0Q6 - real :: realvar4 = 4.0D6_8 - real :: realvar5 = 4.0Q6_16 - real :: realvar6 = 4.0E6_8 - real :: realvar7 = 4.0E6_10 - real :: realvar8 = 4.0E6_16 - !ERROR: Unsupported REAL(KIND=32) - real :: realvar9 = 4.0E6_32 - - double precision :: doublevar1 = 4.0E6_4 - double precision :: doublevar2 = 4.0D6 - double precision :: doublevar3 = 4.0Q6 - double precision :: doublevar4 = 4.0D6_8 - double precision :: doublevar5 = 4.0Q6_16 - double precision :: doublevar6 = 4.0E6_8 - double precision :: doublevar7 = 4.0E6_10 - double precision :: doublevar8 = 4.0E6_16 - !ERROR: Unsupported REAL(KIND=32) - double precision :: doublevar9 = 4.0E6_32 -end subroutine s diff --git a/test-lit/Semantics/label01.F90 b/test-lit/Semantics/label01.F90 deleted file mode 100644 index e63bd547ee75..000000000000 --- a/test-lit/Semantics/label01.F90 +++ /dev/null @@ -1,228 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s -o /dev/null 2>&1 | grep -v 'procedure conflicts' | ${FileCheck} %s -! CHECK-NOT: error:[[:space:]] - -! FIXME: filter out the array/function syntax issues (procedure conflicts) -! for now... - -! these are the conformance tests -! define STRICT_F18 to eliminate tests of features not in F18 -! define ARCHAIC_FORTRAN to add test of feature found in Fortran before F95 - - -subroutine sub00(a,b,n,m) - integer :: n, m - real a(n) - real :: b(m) -1 print *, n, m -1234 print *, a(n), b(1) -99999 print *, a(1), b(m) -end subroutine sub00 - -subroutine do_loop01(a,n) - integer :: n - real, dimension(n) :: a - do 10 i = 1, n - print *, i, a(i) -10 continue -end subroutine do_loop01 - -subroutine do_loop02(a,n) - integer :: n - real, dimension(n,n) :: a - do 10 j = 1, n - do 10 i = 1, n - print *, i, j, a(i, j) -10 continue -end subroutine do_loop02 - -#ifndef STRICT_F18 -subroutine do_loop03(a,n) - integer :: n - real, dimension(n) :: a - do 10 i = 1, n -10 print *, i, a(i) ! extension (not f18) -end subroutine do_loop03 - -subroutine do_loop04(a,n) - integer :: n - real :: a(n,n) - do 10 j = 1, n - do 10 i = 1, n -10 print *, i, j, a(i, j) ! extension (not f18) -end subroutine do_loop04 - -subroutine do_loop05(a,n) - integer :: n - real a(n,n,n) - do 10 k = 1, n - do 10 j = 1, n - do 10 i = 1, n -10 print *, a(i, j, k) ! extension (not f18) -end subroutine do_loop05 -#endif - -subroutine do_loop06(a,n) - integer :: n - real, dimension(n) :: a - loopname: do i = 1, n - print *, i, a(i) - if (i .gt. 50) then -678 exit - end if - end do loopname -end subroutine do_loop06 - -subroutine do_loop07(a,n) - integer :: n - real, dimension(n,n) :: a - loopone: do j = 1, n - looptwo: do i = 1, n - print *, i, j, a(i, j) - end do looptwo - end do loopone -end subroutine do_loop07 - -subroutine do_loop08(a,b,n,m,nn) - integer :: n, m, nn - real, dimension(n,n) :: a - real b(m,nn) - loopone: do j = 1, n - condone: if (m .lt. n) then - looptwo: do i = 1, m - condtwo: if (n .lt. nn) then - b(m-i,j) = s(m-i,j) - if (i .eq. j) then - goto 111 - end if - else - cycle loopone - end if condtwo - end do looptwo - else if (n .lt. m) then - loopthree: do i = 1, n - condthree: if (n .lt. nn) then - a(i,j) = b(i,j) - if (i .eq. j) then - return - end if - else - exit loopthree - end if condthree - end do loopthree - end if condone - end do loopone -111 print *, "done" -end subroutine do_loop08 - -#ifndef STRICT_F18 -! extended ranges supported by PGI, gfortran gives warnings -subroutine do_loop09(a,n,j) - integer :: n - real a(n) - goto 400 -200 print *, "found the index", j - print *, "value at", j, "is", a(j) - goto 300 -400 do 100 i = 1, n - if (i .eq. j) then - goto 200 ! extension: extended GOTO ranges -300 continue - else - print *, a(i) - end if -100 end do -500 continue -end subroutine do_loop09 -#endif - -subroutine goto10(a,b,n) - dimension :: a(3), b(3) - goto 10 -10 print *,"x" -4 labelit: if (a(n-1) .ne. b(n-2)) then - goto 567 - end if labelit -567 end subroutine goto10 - -subroutine computed_goto11(i,j,k) - goto (100,110,120) i -100 print *, j - goto 200 -110 print *, k - goto 200 -120 print *, -1 -200 end subroutine computed_goto11 - -#ifndef STRICT_F18 -subroutine arith_if12(i) - if (i) 300,310,320 -300 continue - print *,"<" - goto 340 -310 print *,"==" -340 goto 330 -320 print *,">" -330 goto 350 -350 continue -end subroutine arith_if12 -#endif - -#if 0 -subroutine alt_return_spec13(i,*,*,*) -9 continue -8 labelme: if (i .lt. 42) then -7 return 1 -6 else if (i .lt. 94) then -5 return 2 -4 else if (i .lt. 645) then -3 return 3 -2 end if labelme -1 end subroutine alt_return_spec13 - -subroutine alt_return_spec14(i) - call alt_return_spec13(i,*6000,*6130,*6457) - print *, "Hi!" -6000 continue -6100 print *,"123" -6130 continue -6400 print *,"abc" -6457 continue -6650 print *,"!@#" -end subroutine alt_return_spec14 -#endif - -subroutine specifiers15(a,b,x) - integer x - OPEN (10, file="myfile.dat", err=100) - READ (10,20,end=200,size=x,advance='no',eor=300) a - goto 99 -99 CLOSE (10) - goto 40 -100 print *,"error opening" -101 return -200 print *,"end of file" -202 return -300 print *, "end of record" -303 return -20 FORMAT (1x,F5.1) -30 FORMAT (2x,F6.2) -40 OPEN (11, file="myfile2.dat", err=100) - goto 50 -50 WRITE (11,30,err=100) b - CLOSE (11) -end subroutine specifiers15 - -#if !defined(STRICT_F18) && defined(ARCHAIC_FORTRAN) -! assigned goto was deleted in F95. PGI supports, gfortran gives warnings -subroutine assigned_goto16 - assign 10 to i - goto i (10, 20, 30) -10 continue - assign 20 to i -20 continue - assign 30 to i -30 pause - print *, "archaic feature!" -end subroutine assigned_goto16 -#endif diff --git a/test-lit/Semantics/label02.f90 b/test-lit/Semantics/label02.f90 deleted file mode 100644 index 6aa052d52d66..000000000000 --- a/test-lit/Semantics/label02.f90 +++ /dev/null @@ -1,19 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: label '0' is out of range -! CHECK: label '100000' is out of range -! CHECK: label '123456' is out of range -! CHECK: label '123456' was not found -! CHECK: label '1000' is not distinct - -subroutine sub00(a,b,n,m) - real a(n) - real :: b(m) -0 print *, "error" -100000 print *, n - goto 123456 -1000 print *, m -1000 print *, m+1 -end subroutine sub00 diff --git a/test-lit/Semantics/label03.f90 b/test-lit/Semantics/label03.f90 deleted file mode 100644 index a33b2f33a9b3..000000000000 --- a/test-lit/Semantics/label03.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: DO loop doesn't properly nest -! CHECK: DO loop conflicts -! CHECK: label '30' cannot be found -! CHECK: label '40' cannot be found -! CHECK: label '50' doesn't lexically follow DO stmt - -subroutine sub00(a,b,n,m) - real a(n,m) - real b(n,m) - do 10 i = 1, m - do 20 j = 1, n - a(i,j) = b(i,j) + 2.0 -10 continue -20 continue -end subroutine sub00 - -subroutine sub01(a,b,n,m) - real a(n,m) - real b(n,m) - do 30 i = 1, m - do 40 j = 1, n - a(i,j) = b(i,j) + 10.0 -35 continue -45 continue -end subroutine sub01 - -subroutine sub02(a,b,n,m) - real a(n,m) - real b(n,m) -50 continue - do 50 i = 1, m - do 60 j = 1, n - a(i,j) = b(i,j) + 20.0 -60 continue -end subroutine sub02 diff --git a/test-lit/Semantics/label04.f90 b/test-lit/Semantics/label04.f90 deleted file mode 100644 index a3f3586763ee..000000000000 --- a/test-lit/Semantics/label04.f90 +++ /dev/null @@ -1,21 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: branch into loop body from outside -! CHECK: do 10 i = 1, m -! CHECK: the loop branched into -! CHECK: do 20 j = 1, n - -subroutine sub00(a,b,n,m) - real a(n,m) - real b(n,m) - if (n .ne. m) then - goto 50 - end if - do 10 i = 1, m - do 20 j = 1, n -50 a(i,j) = b(i,j) + 2.0 -20 continue -10 continue -end subroutine sub00 diff --git a/test-lit/Semantics/label05.f90 b/test-lit/Semantics/label05.f90 deleted file mode 100644 index 09bd9fa2b0f0..000000000000 --- a/test-lit/Semantics/label05.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: label '50' was not found -! CHECK: label '55' is not in scope -! CHECK: '70' not a branch target -! CHECK: control flow use of '70' - -subroutine sub00(a,b,n,m) - real a(n,m) - real b(n,m) - if (n .ne. m) then - goto 50 - end if -6 n = m -end subroutine sub00 - -subroutine sub01(a,b,n,m) - real a(n,m) - real b(n,m) - if (n .ne. m) then - goto 55 - else -55 continue - end if -60 n = m -end subroutine sub01 - -subroutine sub02(a,b,n,m) - real a(n,m) - real b(n,m) - if (n .ne. m) then - goto 70 - else - return - end if -70 FORMAT (1x,i6) -end subroutine sub02 diff --git a/test-lit/Semantics/label06.f90 b/test-lit/Semantics/label06.f90 deleted file mode 100644 index 4e633d3df552..000000000000 --- a/test-lit/Semantics/label06.f90 +++ /dev/null @@ -1,27 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: label '10' is not in scope -! CHECK: label '20' was not found -! CHECK: '30' not a branch target -! CHECK: control flow use of '30' -! CHECK: label '40' is not in scope -! CHECK: label '50' is not in scope - -subroutine sub00(n) - GOTO (10,20,30) n - if (n .eq. 1) then -10 print *, "xyz" - end if -30 FORMAT (1x,i6) -end subroutine sub00 - -subroutine sub01(n) - real n - GOTO (40,50,60) n - if (n .eq. 1) then -40 print *, "xyz" -50 end if -60 continue -end subroutine sub01 diff --git a/test-lit/Semantics/label07.f90 b/test-lit/Semantics/label07.f90 deleted file mode 100644 index 62755082e030..000000000000 --- a/test-lit/Semantics/label07.f90 +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: '30' not a branch target -! CHECK: control flow use of '30' -! CHECK: label '10' is not in scope -! CHECK: label '20' was not found -! CHECK: label '60' was not found - -subroutine sub00(n,m) -30 format (i6,f6.2) - if (n .eq. m) then -10 print *,"equal" - end if - call sub01(n,*10,*20,*30) - write (*,60) n, m -end subroutine sub00 diff --git a/test-lit/Semantics/label08.f90 b/test-lit/Semantics/label08.f90 deleted file mode 100644 index 140ceb33ec68..000000000000 --- a/test-lit/Semantics/label08.f90 +++ /dev/null @@ -1,22 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! negative test -- invalid labels, out of range - -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: CYCLE construct-name is not in scope -! CHECK: IF construct name unexpected -! CHECK: unnamed IF statement -! CHECK: DO construct name mismatch -! CHECK: should be - -subroutine sub00(a,b,n,m) - real a(n,m) - real b(n,m) - labelone: do i = 1, m - labeltwo: do j = 1, n -50 a(i,j) = b(i,j) + 2.0 - if (n .eq. m) then - cycle label3 - end if label3 -60 end do labeltwo - end do label1 -end subroutine sub00 diff --git a/test-lit/Semantics/label09.f90 b/test-lit/Semantics/label09.f90 deleted file mode 100644 index a74263d58315..000000000000 --- a/test-lit/Semantics/label09.f90 +++ /dev/null @@ -1,8 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: label '60' was not found - -subroutine s(a) - real a(10) - write(*,60) "Hi there" -end subroutine s diff --git a/test-lit/Semantics/label10.f90 b/test-lit/Semantics/label10.f90 deleted file mode 100644 index 377108c95dd5..000000000000 --- a/test-lit/Semantics/label10.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: '60' not a FORMAT -! CHECK: data transfer use of '60' - -subroutine s(a) - real a(10) - write(*,60) "Hi there" -60 continue -70 format (i8) -end subroutine s diff --git a/test-lit/Semantics/label11.f90 b/test-lit/Semantics/label11.f90 deleted file mode 100644 index 924356615e3b..000000000000 --- a/test-lit/Semantics/label11.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: BLOCK DATA subprogram name mismatch -! CHECK: should be -! CHECK: FUNCTION name mismatch -! CHECK: SUBROUTINE name mismatch -! CHECK: PROGRAM name mismatch -! CHECK: SUBMODULE name mismatch -! CHECK: INTERFACE generic-name .t7. mismatch -! CHECK: mismatched INTERFACE -! CHECK: derived type definition name mismatch -! CHECK: MODULE PROCEDURE name mismatch -! CHECK: MODULE name mismatch - -block data t1 -end block data t2 - -function t3 -end function t4 - -subroutine t9 -end subroutine t10 - -program t13 -end program t14 - -submodule (mod) t15 -end submodule t16 - -module t5 - interface t7 - end interface t8 - type t17 - end type t18 -contains - module procedure t11 - end procedure t12 -end module mox diff --git a/test-lit/Semantics/label12.f90 b/test-lit/Semantics/label12.f90 deleted file mode 100644 index 96607bc8e8f0..000000000000 --- a/test-lit/Semantics/label12.f90 +++ /dev/null @@ -1,9 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: expected end of statement - -subroutine s - do 10 i = 1, 10 -5 end do -10 end do -end subroutine s diff --git a/test-lit/Semantics/label13.f90 b/test-lit/Semantics/label13.f90 deleted file mode 100644 index 61501804d270..000000000000 --- a/test-lit/Semantics/label13.f90 +++ /dev/null @@ -1,20 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! CHECK: branch into loop body from outside -! CHECK: the loop branched into - -subroutine s(a) - integer i - real a(10) - do 10 i = 1,10 - if (a(i) < 0.0) then - goto 20 - end if -30 continue - a(i) = 1.0 -10 end do - goto 40 -20 a(i) = -a(i) - goto 30 -40 continue -end subroutine s diff --git a/test-lit/Semantics/label14.f90 b/test-lit/Semantics/label14.f90 deleted file mode 100644 index e6eb744f50e3..000000000000 --- a/test-lit/Semantics/label14.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_any.sh %s %flang %t -! Tests implemented for this standard -! 11.1.4 - 4 It is permissible to branch to and end-block-stmt only withinh its -! Block Construct - -! EXEC: ${F18} %s 2>&1 | ${FileCheck} %s -! CHECK: label '20' is not in scope - -subroutine s1 - block - goto (10) 1 -10 end block - - block -20 end block -end - -subroutine s2 - block - goto (20) 1 -10 end block - - block -20 end block -end - -subroutine s3 - block - block - goto (10) 1 -10 end block -20 end block -end - -subroutine s4 - block - block - goto (20) 1 -10 end block -20 end block -end diff --git a/test-lit/Semantics/misc-declarations.f90 b/test-lit/Semantics/misc-declarations.f90 deleted file mode 100644 index 9103ad7bcf7d..000000000000 --- a/test-lit/Semantics/misc-declarations.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Miscellaneous constraint and requirement checking on declarations: -! - 8.5.6.2 & 8.5.6.3 constraints on coarrays -! - 8.5.19 constraints on the VOLATILE attribute - -module m - !ERROR: ALLOCATABLE coarray must have a deferred coshape - real, allocatable :: mustBeDeferred[*] ! C827 - !ERROR: Non-ALLOCATABLE coarray must have an explicit coshape - real :: mustBeExplicit[:] ! C828 - type :: hasCoarray - real :: coarray[*] - end type - real :: coarray[*] - type(hasCoarray) :: coarrayComponent - contains - !ERROR: VOLATILE attribute may not apply to an INTENT(IN) argument - subroutine C866(x) - intent(in) :: x - volatile :: x - !ERROR: VOLATILE attribute may apply only to a variable - volatile :: notData - external :: notData - end subroutine - subroutine C867 - !ERROR: VOLATILE attribute may not apply to a coarray accessed by USE or host association - volatile :: coarray - !ERROR: VOLATILE attribute may not apply to a type with a coarray ultimate component accessed by USE or host association - volatile :: coarrayComponent - end subroutine - subroutine C868(coarray,coarrayComponent) - real, volatile :: coarray[*] - type(hasCoarray) :: coarrayComponent - block - !ERROR: VOLATILE attribute may not apply to a coarray accessed by USE or host association - volatile :: coarray - !ERROR: VOLATILE attribute may not apply to a type with a coarray ultimate component accessed by USE or host association - volatile :: coarrayComponent - end block - end subroutine -end module diff --git a/test-lit/Semantics/modfile01.f90 b/test-lit/Semantics/modfile01.f90 deleted file mode 100644 index d3cd5273f853..000000000000 --- a/test-lit/Semantics/modfile01.f90 +++ /dev/null @@ -1,95 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check correct modfile generation for type with private component. -module m - integer :: i - integer, private :: j - type :: t - integer :: i - integer, private :: j - end type - type, private :: u - end type - type(t) :: x -end - -!Expect: m.mod -!module m -!integer(4)::i -!integer(4),private::j -!type::t -!integer(4)::i -!integer(4),private::j -!end type -!type,private::u -!end type -!type(t)::x -!end - -! Check correct modfile generation for type with private module procedure. - -module m2 - private :: s1 -contains - subroutine s1() - end - subroutine s2() - end -end - -!Expect: m2.mod -!module m2 -! private::s1 -!contains -! subroutine s1() -! end -! subroutine s2() -! end -!end - -module m3 - private - public :: f1 -contains - real function f1() - end - real function f2() - end -end - -!Expect: m3.mod -!module m3 -! private::f2 -!contains -! function f1() -! real(4)::f1 -! end -! function f2() -! real(4)::f2 -! end -!end - -! Test optional dummy procedure -module m4 -contains - subroutine s(f) - interface - logical recursive function f() - implicit none - end function - end interface - optional f - end -end - -!Expect: m4.mod -!module m4 -!contains -! subroutine s(f) -! optional::f -! interface -! recursive function f() -! logical(4)::f -! end -! end interface -! end -!end diff --git a/test-lit/Semantics/modfile02.f90 b/test-lit/Semantics/modfile02.f90 deleted file mode 100644 index 9f460004415d..000000000000 --- a/test-lit/Semantics/modfile02.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check modfile generation for private type in public API. - -module m - type, private :: t1 - integer :: i - end type - type, private :: t2 - integer :: i - end type - type(t1) :: x1 - type(t2), private :: x2 -end - -!Expect: m.mod -!module m -!type,private::t1 -!integer(4)::i -!end type -!type,private::t2 -!integer(4)::i -!end type -!type(t1)::x1 -!type(t2),private::x2 -!end diff --git a/test-lit/Semantics/modfile03.f90 b/test-lit/Semantics/modfile03.f90 deleted file mode 100644 index 9beb5308bd38..000000000000 --- a/test-lit/Semantics/modfile03.f90 +++ /dev/null @@ -1,162 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check modfile generation with use-association. - -module m1 - integer :: x1 - integer, private :: x2 -end -!Expect: m1.mod -!module m1 -!integer(4)::x1 -!integer(4),private::x2 -!end - -module m2 - use m1 - integer :: y1 -end -!Expect: m2.mod -!module m2 -!use m1,only:x1 -!integer(4)::y1 -!end - -module m3 - use m2, z1 => x1 -end -!Expect: m3.mod -!module m3 -!use m2,only:y1 -!use m2,only:z1=>x1 -!end - -module m4 - use m1 - use m2 -end -!Expect: m4.mod -!module m4 -!use m1,only:x1 -!use m2,only:y1 -!end - -module m5a - integer, parameter :: k1 = 4 - integer :: l1 = 2 - type t1 - real :: a - end type -contains - pure integer function f1(i) - value :: i - f1 = i - end -end -!Expect: m5a.mod -!module m5a -! integer(4),parameter::k1=4_4 -! integer(4)::l1 -! type::t1 -! real(4)::a -! end type -!contains -! pure function f1(i) -! integer(4),value::i -! integer(4)::f1 -! end -!end - -module m5b - use m5a, only: k2 => k1, l2 => l1, f2 => f1 - character(l2, k2) :: x - interface - subroutine s(x, y) - import f2, l2 - character(l2, k2) :: x - character(f2(l2)) :: y - end subroutine - end interface -end -!Expect: m5b.mod -!module m5b -! use m5a,only:k2=>k1 -! use m5a,only:l2=>l1 -! use m5a,only:f2=>f1 -! character(l2,4)::x -! interface -! subroutine s(x,y) -! import::f2 -! import::l2 -! character(l2,4)::x -! character(f2(l2),1)::y -! end -! end interface -!end - -module m6a - type t1 - end type -end -!Expect: m6a.mod -!module m6a -! type::t1 -! end type -!end - -module m6b - use m6a, only: t2 => t1 -contains - subroutine s(x) - type(t2) :: x - end -end -!Expect: m6b.mod -!module m6b -! use m6a,only:t2=>t1 -!contains -! subroutine s(x) -! type(t2)::x -! end -!end - -module m6c - use m6a, only: t2 => t1 - type, extends(t2) :: t - end type -end -!Expect: m6c.mod -!module m6c -! use m6a,only:t2=>t1 -! type,extends(t2)::t -! end type -!end - -module m6d - use m6a, only: t2 => t1 - type(t2), parameter :: p = t2() -end -!Expect: m6d.mod -!module m6d -! use m6a,only:t2=>t1 -! type(t2),parameter::p=t2() -!end - -module m6e - use m6a, only: t2 => t1 - interface - subroutine s(x) - import t2 - type(t2) :: x - end subroutine - end interface -end -!Expect: m6e.mod -!module m6e -! use m6a,only:t2=>t1 -! interface -! subroutine s(x) -! import::t2 -! type(t2)::x -! end -! end interface -!end diff --git a/test-lit/Semantics/modfile04.f90 b/test-lit/Semantics/modfile04.f90 deleted file mode 100644 index 9dbd3adfeede..000000000000 --- a/test-lit/Semantics/modfile04.f90 +++ /dev/null @@ -1,75 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! modfile with subprograms - -module m1 - type :: t - end type -contains - - pure subroutine s(x, y) bind(c) - logical x - intent(inout) y - intent(in) x - end subroutine - - real function f1() result(x) - x = 1.0 - end function - - function f2(y) - complex y - f2 = 2.0 - end function - -end - -module m2 -contains - type(t) function f3(x) - use m1 - integer, parameter :: a = 2 - type t2(b) - integer, kind :: b = a - integer :: y - end type - type(t2) :: x - end - function f4() result(x) - implicit complex(x) - end -end - -!Expect: m1.mod -!module m1 -!type::t -!end type -!contains -!pure subroutine s(x,y) bind(c) -!logical(4),intent(in)::x -!real(4),intent(inout)::y -!end -!function f1() result(x) -!real(4)::x -!end -!function f2(y) -!complex(4)::y -!real(4)::f2 -!end -!end - -!Expect: m2.mod -!module m2 -!contains -!function f3(x) -! use m1,only:t -! type::t2(b) -! integer(4),kind::b=2_4 -! integer(4)::y -! end type -! type(t2(b=2_4))::x -! type(t)::f3 -!end -!function f4() result(x) -!complex(4)::x -!end -!end diff --git a/test-lit/Semantics/modfile05.f90 b/test-lit/Semantics/modfile05.f90 deleted file mode 100644 index 49e3f47d4a68..000000000000 --- a/test-lit/Semantics/modfile05.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Use-association with VOLATILE or ASYNCHRONOUS - -module m1 - real x - integer y - volatile z -contains -end - -module m2 - use m1 - volatile x - asynchronous y -end - -!Expect: m1.mod -!module m1 -!real(4)::x -!integer(4)::y -!real(4),volatile::z -!end - -!Expect: m2.mod -!module m2 -!use m1,only:x -!use m1,only:y -!use m1,only:z -!volatile::x -!asynchronous::y -!end diff --git a/test-lit/Semantics/modfile06.f90 b/test-lit/Semantics/modfile06.f90 deleted file mode 100644 index 5924b67c7daa..000000000000 --- a/test-lit/Semantics/modfile06.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check modfile generation for external interface -module m - interface - integer function f(x) - end function - subroutine s(y, z) - logical y - complex z - end subroutine - end interface -end - -!Expect: m.mod -!module m -! interface -! function f(x) -! real(4)::x -! integer(4)::f -! end -! end interface -! interface -! subroutine s(y,z) -! logical(4)::y -! complex(4)::z -! end -! end interface -!end diff --git a/test-lit/Semantics/modfile07.f90 b/test-lit/Semantics/modfile07.f90 deleted file mode 100644 index b4a49d9924e3..000000000000 --- a/test-lit/Semantics/modfile07.f90 +++ /dev/null @@ -1,334 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check modfile generation for generic interfaces -module m1 - interface foo - real function s1(x,y) - real, intent(in) :: x - logical, intent(in) :: y - end function - complex function s2(x,y) - complex, intent(in) :: x - logical, intent(in) :: y - end function - end interface - generic :: operator ( + ) => s1, s2 - interface operator ( /= ) - logical function f1(x, y) - real, intent(in) :: x - logical, intent(in) :: y - end function - end interface - interface - logical function f2(x, y) - complex, intent(in) :: x - logical, intent(in) :: y - end function - logical function f3(x, y) - integer, intent(in) :: x - logical, intent(in) :: y - end function - end interface - generic :: operator(.ne.) => f2 - generic :: operator(<>) => f3 - private :: operator( .ne. ) - interface bar - procedure :: s1 - procedure :: s2 - procedure :: s3 - procedure :: s4 - end interface - interface operator( .bar.) - procedure :: s1 - procedure :: s2 - procedure :: s3 - procedure :: s4 - end interface -contains - logical function s3(x,y) - logical, intent(in) :: x,y - end function - integer function s4(x,y) - integer, intent(in) :: x,y - end function -end -!Expect: m1.mod -!module m1 -! interface foo -! procedure::s1 -! procedure::s2 -! end interface -! interface -! function s1(x,y) -! real(4),intent(in)::x -! logical(4),intent(in)::y -! real(4)::s1 -! end -! end interface -! interface -! function s2(x,y) -! complex(4),intent(in)::x -! logical(4),intent(in)::y -! complex(4)::s2 -! end -! end interface -! interface operator(+) -! procedure::s1 -! procedure::s2 -! end interface -! interface operator(/=) -! procedure::f1 -! procedure::f2 -! procedure::f3 -! end interface -! private::operator(/=) -! interface -! function f1(x,y) -! real(4),intent(in)::x -! logical(4),intent(in)::y -! logical(4)::f1 -! end -! end interface -! interface -! function f2(x,y) -! complex(4),intent(in)::x -! logical(4),intent(in)::y -! logical(4)::f2 -! end -! end interface -! interface -! function f3(x,y) -! integer(4),intent(in)::x -! logical(4),intent(in)::y -! logical(4)::f3 -! end -! end interface -! interface bar -! procedure::s1 -! procedure::s2 -! procedure::s3 -! procedure::s4 -! end interface -! interface operator(.bar.) -! procedure::s1 -! procedure::s2 -! procedure::s3 -! procedure::s4 -! end interface -!contains -! function s3(x,y) -! logical(4),intent(in)::x -! logical(4),intent(in)::y -! logical(4)::s3 -! end -! function s4(x,y) -! integer(4),intent(in)::x -! integer(4),intent(in)::y -! integer(4)::s4 -! end -!end - -module m1b - use m1 -end -!Expect: m1b.mod -!module m1b -! use m1,only:foo -! use m1,only:s1 -! use m1,only:s2 -! use m1,only:operator(+) -! use m1,only:f1 -! use m1,only:f2 -! use m1,only:f3 -! use m1,only:bar -! use m1,only:operator(.bar.) -! use m1,only:s3 -! use m1,only:s4 -!end - -module m1c - use m1, only: myfoo => foo - use m1, only: operator(.bar.) - use m1, only: operator(.mybar.) => operator(.bar.) - use m1, only: operator(+) -end -!Expect: m1c.mod -!module m1c -! use m1,only:myfoo=>foo -! use m1,only:operator(.bar.) -! use m1,only:operator(.mybar.)=>operator(.bar.) -! use m1,only:operator(+) -!end - -module m2 - interface foo - procedure foo - end interface -contains - complex function foo() - foo = 1.0 - end -end -!Expect: m2.mod -!module m2 -! interface foo -! procedure::foo -! end interface -!contains -! function foo() -! complex(4)::foo -! end -!end - -module m2b - type :: foo - real :: x - end type - interface foo - end interface - private :: bar - interface bar - end interface -end -!Expect: m2b.mod -!module m2b -! interface foo -! end interface -! type::foo -! real(4)::x -! end type -! interface bar -! end interface -! private::bar -!end - -! Test interface nested inside another interface -module m3 - interface g - subroutine s1(f) - interface - real function f(x) - interface - subroutine x() - end subroutine - end interface - end function - end interface - end subroutine - end interface -end -!Expect: m3.mod -!module m3 -! interface g -! procedure::s1 -! end interface -! interface -! subroutine s1(f) -! interface -! function f(x) -! interface -! subroutine x() -! end -! end interface -! real(4)::f -! end -! end interface -! end -! end interface -!end - -module m4 - interface foo - integer function foo() - end function - integer function f(x) - end function - end interface -end -subroutine s4 - use m4 - i = foo() -end -!Expect: m4.mod -!module m4 -! interface foo -! procedure::foo -! procedure::f -! end interface -! interface -! function foo() -! integer(4)::foo -! end -! end interface -! interface -! function f(x) -! real(4)::x -! integer(4)::f -! end -! end interface -!end - -! Compile contents of m4.mod and verify it gets the same thing again. -module m5 - interface foo - procedure::foo - procedure::f - end interface - interface - function foo() - integer(4)::foo - end - end interface - interface - function f(x) - integer(4)::f - real(4)::x - end - end interface -end -!Expect: m5.mod -!module m5 -! interface foo -! procedure::foo -! procedure::f -! end interface -! interface -! function foo() -! integer(4)::foo -! end -! end interface -! interface -! function f(x) -! real(4)::x -! integer(4)::f -! end -! end interface -!end - -module m6a - interface operator(<) - logical function lt(x, y) - logical, intent(in) :: x, y - end function - end interface -end -!Expect: m6a.mod -!module m6a -! interface operator(<) -! procedure::lt -! end interface -! interface -! function lt(x,y) -! logical(4),intent(in)::x -! logical(4),intent(in)::y -! logical(4)::lt -! end -! end interface -!end - -module m6b - use m6a, only: operator(.lt.) -end -!Expect: m6b.mod -!module m6b -! use m6a,only:operator(.lt.) -!end diff --git a/test-lit/Semantics/modfile08.f90 b/test-lit/Semantics/modfile08.f90 deleted file mode 100644 index 7a2e20195f2d..000000000000 --- a/test-lit/Semantics/modfile08.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check modfile generation for external declarations -module m - real, external :: a - logical b - external c - complex c - external b, d - procedure() :: e - procedure(real) :: f - procedure(s) :: g - type t - procedure(), pointer, nopass :: e - procedure(real), nopass, pointer :: f - procedure(s), private, pointer :: g - end type -contains - subroutine s(x) - class(t) :: x - end -end - -!Expect: m.mod -!module m -! procedure(real(4))::a -! procedure(logical(4))::b -! procedure(complex(4))::c -! procedure()::d -! procedure()::e -! procedure(real(4))::f -! procedure(s)::g -! type::t -! procedure(),nopass,pointer::e -! procedure(real(4)),nopass,pointer::f -! procedure(s),pointer,private::g -! end type -!contains -! subroutine s(x) -! class(t)::x -! end -!end diff --git a/test-lit/Semantics/modfile10.f90 b/test-lit/Semantics/modfile10.f90 deleted file mode 100644 index dc91d8734b19..000000000000 --- a/test-lit/Semantics/modfile10.f90 +++ /dev/null @@ -1,92 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test writing procedure bindings in a derived type. - -module m - interface - subroutine a(i, j) - integer :: i, j - end subroutine - end interface - type, abstract :: t - integer :: i - contains - procedure(a), deferred, nopass :: q - procedure(b), deferred, nopass :: p, r - end type - type t2 - integer :: x - contains - private - final :: c - procedure, non_overridable :: d - end type - type, abstract :: t2a - contains - procedure(a), deferred, public, nopass :: e - end type - type t3 - sequence - integer i - real x - double precision y - double complex z - end type -contains - subroutine b() - end subroutine - subroutine c(x) - type(t2) :: x - end subroutine - subroutine d(x) - class(t2) :: x - end subroutine - subroutine test - type(t2) :: x - call x%d() - end subroutine -end module - -!Expect: m.mod -!module m -! interface -! subroutine a(i,j) -! integer(4)::i -! integer(4)::j -! end -! end interface -! type,abstract::t -! integer(4)::i -! contains -! procedure(a),deferred,nopass::q -! procedure(b),deferred,nopass::p -! procedure(b),deferred,nopass::r -! end type -! type::t2 -! integer(4)::x -! contains -! final::c -! procedure,non_overridable,private::d -! end type -! type,abstract::t2a -! contains -! procedure(a),deferred,nopass::e -! end type -! type::t3 -! sequence -! integer(4)::i -! real(4)::x -! real(8)::y -! complex(8)::z -! end type -!contains -! subroutine b() -! end -! subroutine c(x) -! type(t2)::x -! end -! subroutine d(x) -! class(t2)::x -! end -! subroutine test() -! end -!end diff --git a/test-lit/Semantics/modfile11.f90 b/test-lit/Semantics/modfile11.f90 deleted file mode 100644 index ec4dd2f88099..000000000000 --- a/test-lit/Semantics/modfile11.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - type t1(a, b, c) - integer, kind :: a - integer(8), len :: b, c - integer :: d - end type - type, extends(t1) :: t2(e) - integer, len :: e - end type - type, extends(t2), bind(c) :: t3 - end type -end - -!Expect: m.mod -!module m -! type::t1(a,b,c) -! integer(4),kind::a -! integer(8),len::b -! integer(8),len::c -! integer(4)::d -! end type -! type,extends(t1)::t2(e) -! integer(4),len::e -! end type -! type,bind(c),extends(t2)::t3 -! end type -!end diff --git a/test-lit/Semantics/modfile12.f90 b/test-lit/Semantics/modfile12.f90 deleted file mode 100644 index ca43611984a4..000000000000 --- a/test-lit/Semantics/modfile12.f90 +++ /dev/null @@ -1,66 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - integer(8), parameter :: a = 1, b = 2_8 - parameter(n=3,l=-3,e=1.0/3.0) - real :: x(a:2*(a+b*n)-1) - real, dimension(8) :: y - type t(c, d) - integer, kind :: c = 1 - integer, len :: d = a + b - end type - type(t(a+3,:)), allocatable :: z - class(t(a+4,:)), allocatable :: z2 - class(*), allocatable :: z4 - real*2 :: f - complex*32 :: g - type t2(i, j, h) - integer, len :: h - integer, kind :: j - integer, len :: i - end type -contains - subroutine foo(x) - real :: x(2:) - end - subroutine bar(x) - real :: x(..) - end - subroutine baz(x) - type(*) :: x - end -end - -!Expect: m.mod -!module m -! integer(8),parameter::a=1_8 -! integer(8),parameter::b=2_8 -! integer(4),parameter::n=3_4 -! integer(4),parameter::l=-3_4 -! real(4),parameter::e=3.333333432674407958984375e-1_4 -! real(4)::x(1_8:13_8) -! real(4)::y(1_8:8_8) -! type::t(c,d) -! integer(4),kind::c=1_4 -! integer(4),len::d=3_4 -! end type -! type(t(c=4_4,d=:)),allocatable::z -! class(t(c=5_4,d=:)),allocatable::z2 -! class(*),allocatable::z4 -! real(2)::f -! complex(16)::g -! type::t2(i,j,h) -! integer(4),len::h -! integer(4),kind::j -! integer(4),len::i -! end type -!contains -! subroutine foo(x) -! real(4)::x(2_8:) -! end -! subroutine bar(x) -! real(4)::x(..) -! end -! subroutine baz(x) -! type(*)::x -! end -!end diff --git a/test-lit/Semantics/modfile13.f90 b/test-lit/Semantics/modfile13.f90 deleted file mode 100644 index c4fcfe71751b..000000000000 --- a/test-lit/Semantics/modfile13.f90 +++ /dev/null @@ -1,33 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - character(2) :: z - character(len=3) :: y - character*4 :: x - character :: w - character(len=:), allocatable :: v -contains - subroutine s(n, a, b, c, d) - integer :: n - character(len=n+1,kind=1) :: a - character(n+2,2) :: b - character*(n+3) :: c - character(*) :: d - end -end - -!Expect: m.mod -!module m -! character(2_4,1)::z -! character(3_4,1)::y -! character(4_8,1)::x -! character(1_8,1)::w -! character(:,1),allocatable::v -!contains -! subroutine s(n,a,b,c,d) -! integer(4)::n -! character(n+1_4,1)::a -! character(n+2_4,2)::b -! character(n+3_4,1)::c -! character(*,1)::d -! end -!end diff --git a/test-lit/Semantics/modfile14.f90 b/test-lit/Semantics/modfile14.f90 deleted file mode 100644 index 1c4fa0e92076..000000000000 --- a/test-lit/Semantics/modfile14.f90 +++ /dev/null @@ -1,69 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - type t1 - contains - procedure, nopass :: s2 - procedure, nopass :: s3 - procedure :: r - generic :: foo => s2 - generic :: read(formatted)=> r - end type - type, extends(t1) :: t2 - contains - procedure, nopass :: s4 - generic :: foo => s3 - generic :: foo => s4 - end type -contains - subroutine s2(i) - end - subroutine s3(r) - end - subroutine s4(z) - complex :: z - end - subroutine r(dtv, unit, iotype, v_list, iostat, iomsg) - class(t1), intent(inout) :: dtv - integer, intent(in) :: unit - character (len=*), intent(in) :: iotype - integer, intent(in) :: v_list(:) - integer, intent(out) :: iostat - character (len=*), intent(inout) :: iomsg - end -end - -!Expect: m.mod -!module m -! type::t1 -! contains -! procedure,nopass::s2 -! procedure,nopass::s3 -! procedure::r -! generic::foo=>s2 -! generic::read(formatted)=>r -! end type -! type,extends(t1)::t2 -! contains -! procedure,nopass::s4 -! generic::foo=>s3 -! generic::foo=>s4 -! end type -!contains -! subroutine s2(i) -! integer(4)::i -! end -! subroutine s3(r) -! real(4)::r -! end -! subroutine s4(z) -! complex(4)::z -! end -! subroutine r(dtv,unit,iotype,v_list,iostat,iomsg) -! class(t1),intent(inout)::dtv -! integer(4),intent(in)::unit -! character(*,1),intent(in)::iotype -! integer(4),intent(in)::v_list(:) -! integer(4),intent(out)::iostat -! character(*,1),intent(inout)::iomsg -! end -!end diff --git a/test-lit/Semantics/modfile15.f90 b/test-lit/Semantics/modfile15.f90 deleted file mode 100644 index 4cc8787f5d45..000000000000 --- a/test-lit/Semantics/modfile15.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - type :: t - procedure(a), pointer, pass :: c - procedure(a), pointer, pass(x) :: d - contains - procedure, pass(y) :: a, b - end type -contains - subroutine a(x, y) - class(t) :: x, y - end - subroutine b(y) - class(t) :: y - end -end module - -!Expect: m.mod -!module m -! type::t -! procedure(a),pass,pointer::c -! procedure(a),pass(x),pointer::d -! contains -! procedure,pass(y)::a -! procedure,pass(y)::b -! end type -!contains -! subroutine a(x,y) -! class(t)::x -! class(t)::y -! end -! subroutine b(y) -! class(t)::y -! end -!end diff --git a/test-lit/Semantics/modfile16.f90 b/test-lit/Semantics/modfile16.f90 deleted file mode 100644 index acc17d54a282..000000000000 --- a/test-lit/Semantics/modfile16.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - character(2), parameter :: prefix = 'c_' - integer, bind(c, name='c_a') :: a - procedure(sub), bind(c, name=prefix//'b'), pointer :: b - type, bind(c) :: t - real :: c - end type - real :: d - external :: d - bind(c, name='dd') :: d - real :: e - bind(c, name='ee') :: e - external :: e - bind(c, name='ff') :: f - real :: f - external :: f -contains - subroutine sub() bind(c, name='sub') - end -end - -!Expect: m.mod -!module m -! character(2_4,1),parameter::prefix=1_"c_" -! integer(4),bind(c, name=1_"c_a")::a -! procedure(sub),bind(c, name=1_"c_b"),pointer::b -! type,bind(c)::t -! real(4)::c -! end type -! procedure(real(4)),bind(c, name=1_"dd")::d -! procedure(real(4)),bind(c, name=1_"ee")::e -! procedure(real(4)),bind(c, name=1_"ff")::f -!contains -! subroutine sub() bind(c, name=1_"sub") -! end -!end diff --git a/test-lit/Semantics/modfile17.f90 b/test-lit/Semantics/modfile17.f90 deleted file mode 100644 index 33767a38028c..000000000000 --- a/test-lit/Semantics/modfile17.f90 +++ /dev/null @@ -1,169 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Tests parameterized derived type instantiation with KIND parameters - -module m - type :: capture(k1,k2,k4,k8) - integer(kind=1), kind :: k1 - integer(kind=2), kind :: k2 - integer(kind=4), kind :: k4 - integer(kind=8), kind :: k8 - integer(kind=k1) :: j1 - integer(kind=k2) :: j2 - integer(kind=k4) :: j4 - integer(kind=k8) :: j8 - end type capture - type :: defaulted(n1,n2,n4,n8) - integer(kind=1), kind :: n1 = 1 - integer(kind=2), kind :: n2 = n1 * 2 - integer(kind=4), kind :: n4 = 2 * n2 - integer(kind=8), kind :: n8 = 12 - n4 - type(capture(n1,n2,n4,n8)) :: cap - end type defaulted - type, extends(defaulted) :: extension(k5) - integer(kind=4), kind :: k5 = 4 - integer(kind=k5) :: j5 - end type extension - type(capture(1,1,1,1)) :: x1111 - integer(kind=x1111%j1%kind) :: res01_1 - integer(kind=x1111%j2%kind) :: res02_1 - integer(kind=x1111%j4%kind) :: res03_1 - integer(kind=x1111%j8%kind) :: res04_1 - type(capture(8,8,8,8)) :: x8888 - integer(kind=x8888%j1%kind) :: res05_8 - integer(kind=x8888%j2%kind) :: res06_8 - integer(kind=x8888%j4%kind) :: res07_8 - integer(kind=x8888%j8%kind) :: res08_8 - type(capture(2,k8=1,k4=8,k2=4)) :: x2481 - integer(kind=x2481%j1%kind) :: res09_2 - integer(kind=x2481%j2%kind) :: res10_4 - integer(kind=x2481%j4%kind) :: res11_8 - integer(kind=x2481%j8%kind) :: res12_1 - type(capture(2,1,k4=8,k8=4)) :: x2184 - integer(kind=x2184%j1%kind) :: res13_2 - integer(kind=x2184%j2%kind) :: res14_1 - integer(kind=x2184%j4%kind) :: res15_8 - integer(kind=x2184%j8%kind) :: res16_4 - type(defaulted) :: x1248 - integer(kind=x1248%cap%j1%kind) :: res17_1 - integer(kind=x1248%cap%j2%kind) :: res18_2 - integer(kind=x1248%cap%j4%kind) :: res19_4 - integer(kind=x1248%cap%j8%kind) :: res20_8 - type(defaulted(2)) :: x2484 - integer(kind=x2484%cap%j1%kind) :: res21_2 - integer(kind=x2484%cap%j2%kind) :: res22_4 - integer(kind=x2484%cap%j4%kind) :: res23_8 - integer(kind=x2484%cap%j8%kind) :: res24_4 - type(defaulted(n8=2)) :: x1242 - integer(kind=x1242%cap%j1%kind) :: res25_1 - integer(kind=x1242%cap%j2%kind) :: res26_2 - integer(kind=x1242%cap%j4%kind) :: res27_4 - integer(kind=x1242%cap%j8%kind) :: res28_2 - type(extension(1,1,1,1,1)) :: x11111 - integer(kind=x11111%defaulted%cap%j1%kind) :: res29_1 - integer(kind=x11111%cap%j2%kind) :: res30_1 - integer(kind=x11111%cap%j4%kind) :: res31_1 - integer(kind=x11111%cap%j8%kind) :: res32_1 - integer(kind=x11111%j5%kind) :: res33_1 - type(extension(2,8,4,1,8)) :: x28418 - integer(kind=x28418%defaulted%cap%j1%kind) :: res34_2 - integer(kind=x28418%cap%j2%kind) :: res35_8 - integer(kind=x28418%cap%j4%kind) :: res36_4 - integer(kind=x28418%cap%j8%kind) :: res37_1 - integer(kind=x28418%j5%kind) :: res38_8 - type(extension(8,n8=1,k5=2,n2=4,n4=8)) :: x84812 - integer(kind=x84812%defaulted%cap%j1%kind) :: res39_8 - integer(kind=x84812%cap%j2%kind) :: res40_4 - integer(kind=x84812%cap%j4%kind) :: res41_8 - integer(kind=x84812%cap%j8%kind) :: res42_1 - integer(kind=x84812%j5%kind) :: res43_2 - type(extension(k5=2)) :: x12482 - integer(kind=x12482%defaulted%cap%j1%kind) :: res44_1 - integer(kind=x12482%cap%j2%kind) :: res45_2 - integer(kind=x12482%cap%j4%kind) :: res46_4 - integer(kind=x12482%cap%j8%kind) :: res47_8 - integer(kind=x12482%j5%kind) :: res48_2 -end module - -!Expect: m.mod -!module m -!type::capture(k1,k2,k4,k8) -!integer(1),kind::k1 -!integer(2),kind::k2 -!integer(4),kind::k4 -!integer(8),kind::k8 -!integer(int(k1,kind=8))::j1 -!integer(int(k2,kind=8))::j2 -!integer(int(k4,kind=8))::j4 -!integer(k8)::j8 -!end type -!type::defaulted(n1,n2,n4,n8) -!integer(1),kind::n1=1_1 -!integer(2),kind::n2=int(int(n1,kind=4)*2_4,kind=2) -!integer(4),kind::n4=2_4*int(n2,kind=4) -!integer(8),kind::n8=int(12_4-n4,kind=8) -!type(capture(k1=n1,k2=n2,k4=n4,k8=n8))::cap -!end type -!type,extends(defaulted)::extension(k5) -!integer(4),kind::k5=4_4 -!integer(int(k5,kind=8))::j5 -!end type -!type(capture(k1=1_1,k2=1_2,k4=1_4,k8=1_8))::x1111 -!integer(1)::res01_1 -!integer(1)::res02_1 -!integer(1)::res03_1 -!integer(1)::res04_1 -!type(capture(k1=8_1,k2=8_2,k4=8_4,k8=8_8))::x8888 -!integer(8)::res05_8 -!integer(8)::res06_8 -!integer(8)::res07_8 -!integer(8)::res08_8 -!type(capture(k1=2_1,k2=4_2,k4=8_4,k8=1_8))::x2481 -!integer(2)::res09_2 -!integer(4)::res10_4 -!integer(8)::res11_8 -!integer(1)::res12_1 -!type(capture(k1=2_1,k2=1_2,k4=8_4,k8=4_8))::x2184 -!integer(2)::res13_2 -!integer(1)::res14_1 -!integer(8)::res15_8 -!integer(4)::res16_4 -!type(defaulted(n1=1_1,n2=2_2,n4=4_4,n8=8_8))::x1248 -!integer(1)::res17_1 -!integer(2)::res18_2 -!integer(4)::res19_4 -!integer(8)::res20_8 -!type(defaulted(n1=2_1,n2=4_2,n4=8_4,n8=4_8))::x2484 -!integer(2)::res21_2 -!integer(4)::res22_4 -!integer(8)::res23_8 -!integer(4)::res24_4 -!type(defaulted(n1=1_1,n2=2_2,n4=4_4,n8=2_8))::x1242 -!integer(1)::res25_1 -!integer(2)::res26_2 -!integer(4)::res27_4 -!integer(2)::res28_2 -!type(extension(k5=1_4,n1=1_1,n2=1_2,n4=1_4,n8=1_8))::x11111 -!integer(1)::res29_1 -!integer(1)::res30_1 -!integer(1)::res31_1 -!integer(1)::res32_1 -!integer(1)::res33_1 -!type(extension(k5=8_4,n1=2_1,n2=8_2,n4=4_4,n8=1_8))::x28418 -!integer(2)::res34_2 -!integer(8)::res35_8 -!integer(4)::res36_4 -!integer(1)::res37_1 -!integer(8)::res38_8 -!type(extension(k5=2_4,n1=8_1,n2=4_2,n4=8_4,n8=1_8))::x84812 -!integer(8)::res39_8 -!integer(4)::res40_4 -!integer(8)::res41_8 -!integer(1)::res42_1 -!integer(2)::res43_2 -!type(extension(k5=2_4,n1=1_1,n2=2_2,n4=4_4,n8=8_8))::x12482 -!integer(1)::res44_1 -!integer(2)::res45_2 -!integer(4)::res46_4 -!integer(8)::res47_8 -!integer(2)::res48_2 -!end diff --git a/test-lit/Semantics/modfile18.f90 b/test-lit/Semantics/modfile18.f90 deleted file mode 100644 index 032b0491045b..000000000000 --- a/test-lit/Semantics/modfile18.f90 +++ /dev/null @@ -1,27 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Tests folding of array constructors - -module m - real, parameter :: a0 = 1.0_8 - real, parameter :: a1(2) = [real::2.0, 3.0] - real, parameter :: a2(2) = [4.0, 5.0] - real, parameter :: a3(0) = [real::] - real, parameter :: a4(55) = [real::((1.0*k,k=1,j),j=1,10)] - real, parameter :: a5(*) = [6.0, 7.0, 8.0] - real, parameter :: a6(2) = [9, 10] - real, parameter :: a7(6) = [([(1.0*k,k=1,j)],j=1,3)] - real, parameter :: a8(13) = [real::1,2_1,3_2,4_4,5_8,6_16,7._2,8._3,9._4,10._8,11._16,(12.,12.5),(13._8,13.5)] -end module m - -!Expect: m.mod -!module m -!real(4),parameter::a0=1._4 -!real(4),parameter::a1(1_8:2_8)=[REAL(4)::2._4,3._4] -!real(4),parameter::a2(1_8:2_8)=[REAL(4)::4._4,5._4] -!real(4),parameter::a3(1_8:0_8)=[REAL(4)::] -!real(4),parameter::a4(1_8:55_8)=[REAL(4)::1._4,1._4,2._4,1._4,2._4,3._4,1._4,2._4,3._4,4._4,1._4,2._4,3._4,4._4,5._4,1._4,2._4,3._4,4._4,5._4,6._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1.e1_4] -!real(4),parameter::a5(1_8:*)=[REAL(4)::6._4,7._4,8._4] -!real(4),parameter::a6(1_8:2_8)=[REAL(4)::9._4,1.e1_4] -!real(4),parameter::a7(1_8:6_8)=[REAL(4)::1._4,1._4,2._4,1._4,2._4,3._4] -!real(4),parameter::a8(1_8:13_8)=[REAL(4)::1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1.e1_4,1.1e1_4,1.2e1_4,1.3e1_4] -!end diff --git a/test-lit/Semantics/modfile19.f90 b/test-lit/Semantics/modfile19.f90 deleted file mode 100644 index fcb10b54e9d0..000000000000 --- a/test-lit/Semantics/modfile19.f90 +++ /dev/null @@ -1,20 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - implicit complex(8)(z) - real :: x - namelist /nl1/ x, y - namelist /nl2/ y, x - namelist /nl1/ i, z - complex(8) :: z - real :: y -end - -!Expect: m.mod -!module m -! real(4)::x -! integer(4)::i -! complex(8)::z -! real(4)::y -! namelist/nl1/x,y,i,z -! namelist/nl2/y,x -!end diff --git a/test-lit/Semantics/modfile20.f90 b/test-lit/Semantics/modfile20.f90 deleted file mode 100644 index 90188c177c44..000000000000 --- a/test-lit/Semantics/modfile20.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test modfiles for entities with initialization -module m - integer, parameter :: k8 = 8 - integer(8), parameter :: k4 = k8/2 - integer, parameter :: k1 = 1 - integer(k8), parameter :: i = 2_k8 - real :: r = 2.0_k4 - character(10, kind=k1) :: c = k1_"asdf" - character(10), parameter :: c2 = k1_"qwer" - complex*16, parameter :: z = (1.0_k8, 2.0_k8) - complex*16, parameter :: zn = (-1.0_k8, 2.0_k8) - type t - integer :: a = 123 - type(t), pointer :: b => null() - end type - type(t), parameter :: x = t(456) - type(t), parameter :: y = t(789, null()) -end - -!Expect: m.mod -!module m -! integer(4),parameter::k8=8_4 -! integer(8),parameter::k4=4_8 -! integer(4),parameter::k1=1_4 -! integer(8),parameter::i=2_8 -! real(4)::r -! character(10_4,1)::c -! character(10_4,1),parameter::c2=1_"qwer " -! complex(8),parameter::z=(1._8,2._8) -! complex(8),parameter::zn=(-1._8,2._8) -! type::t -! integer(4)::a=123_4 -! type(t),pointer::b=>NULL() -! end type -! type(t),parameter::x=t(a=456_4,b=NULL()) -! type(t),parameter::y=t(a=789_4,b=NULL()) -! intrinsic::null -!end diff --git a/test-lit/Semantics/modfile21.f90 b/test-lit/Semantics/modfile21.f90 deleted file mode 100644 index 03349a32682d..000000000000 --- a/test-lit/Semantics/modfile21.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m - logical b - bind(C) :: /cb2/ - common //t - common /cb/ x(2:10) /cb2/a,b,c - common /cb/ y,z - common w - common u,v - complex w - dimension b(4,4) - bind(C, name="CB") /cb/ - common /b/ cb -end - -!Expect: m.mod -!module m -! logical(4)::b(1_8:4_8,1_8:4_8) -! real(4)::t -! real(4)::x(2_8:10_8) -! real(4)::a -! real(4)::c -! real(4)::y -! real(4)::z -! real(4)::u -! real(4)::v -! complex(4)::w -! real(4)::cb -! common/cb2/a,b,c -! bind(c)::/cb2/ -! common//t,w,u,v -! common/cb/x,y,z -! bind(c, name=1_"CB")::/cb/ -! common/b/cb -!end diff --git a/test-lit/Semantics/modfile22.f90 b/test-lit/Semantics/modfile22.f90 deleted file mode 100644 index 6279ad78678a..000000000000 --- a/test-lit/Semantics/modfile22.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test character length conversions in constructors - -module m -type :: t(k) - integer, kind :: k = 1 - character(kind=k,len=1) :: a - character(kind=k,len=3) :: b -end type t -type(t), parameter :: p = t(k=1)(a='xx',b='xx') -character(len=2), parameter :: c2(3) = [character(len=2) :: 'x', 'xx', 'xxx'] -end module m - -!Expect: m.mod -!module m -!type::t(k) -!integer(4),kind::k=1_4 -!character(1_4,int(k,kind=8))::a -!character(3_4,int(k,kind=8))::b -!end type -!type(t(k=1_4)),parameter::p=t(k=1_4)(a=1_"x",b=1_"xx ") -!character(2_4,1),parameter::c2(1_8:3_8)=[CHARACTER(KIND=1,LEN=2)::1_"x ",1_"xx",1_"xx"] -!end diff --git a/test-lit/Semantics/modfile23.f90 b/test-lit/Semantics/modfile23.f90 deleted file mode 100644 index 4b5637867e1d..000000000000 --- a/test-lit/Semantics/modfile23.f90 +++ /dev/null @@ -1,204 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test that subprogram interfaces get all of the symbols that they need. - -module m1 - integer(8) :: i - type t1 - sequence - integer :: j - end type - type t2 - end type -end -!Expect: m1.mod -!module m1 -! integer(8)::i -! type::t1 -! sequence -! integer(4)::j -! end type -! type::t2 -! end type -!end - -module m2 - integer(8) :: k -contains - subroutine s(a, j) - use m1 - integer(8) :: j - real :: a(i:j,1:k) ! need i from m1 - end -end -!Expect: m2.mod -!module m2 -! integer(8)::k -!contains -! subroutine s(a,j) -! use m1,only:i -! integer(8)::j -! real(4)::a(i:j,1_8:k) -! end -!end - -module m3 - implicit none -contains - subroutine s(b, n) - type t2 - end type - type t4(l) - integer, len :: l - type(t2) :: x ! need t2 - end type - integer :: n - type(t4(n)) :: b - end -end module -!Expect: m3.mod -!module m3 -!contains -! subroutine s(b,n) -! integer(4)::n -! type::t2 -! end type -! type::t4(l) -! integer(4),len::l -! type(t2)::x -! end type -! type(t4(l=n))::b -! end -!end - -module m4 -contains - subroutine s1(a) - use m1 - common /c/x,n ! x is needed - integer(8) :: n - real :: a(n) - type(t1) :: x - end -end -!Expect: m4.mod -!module m4 -!contains -! subroutine s1(a) -! use m1,only:t1 -! type(t1)::x -! common/c/x,n -! integer(8)::n -! real(4)::a(1_8:n) -! end -!end - -module m5 - type t5 - end type - interface - subroutine s(x1,x5) - use m1 - import :: t5 - type(t1) :: x1 - type(t5) :: x5 - end subroutine - end interface -end -!Expect: m5.mod -!module m5 -! type::t5 -! end type -! interface -! subroutine s(x1,x5) -! use m1,only:t1 -! import::t5 -! type(t1)::x1 -! type(t5)::x5 -! end -! end interface -!end - -module m6 -contains - subroutine s(x) - use m1 - type, extends(t2) :: t6 - end type - type, extends(t6) :: t7 - end type - type(t7) :: x - end -end -!Expect: m6.mod -!module m6 -!contains -! subroutine s(x) -! use m1,only:t2 -! type,extends(t2)::t6 -! end type -! type,extends(t6)::t7 -! end type -! type(t7)::x -! end -!end - -module m7 - type :: t5(l) - integer, len :: l - end type -contains - subroutine s1(x) - use m1 - type(t5(i)) :: x - end subroutine - subroutine s2(x) - use m1 - character(i) :: x - end subroutine -end -!Expect: m7.mod -!module m7 -! type::t5(l) -! integer(4),len::l -! end type -!contains -! subroutine s1(x) -! use m1,only:i -! type(t5(l=int(i,kind=4)))::x -! end -! subroutine s2(x) -! use m1,only:i -! character(i,1)::x -! end -!end - -module m8 - use m1, only: t1, t2 - interface - subroutine s1(x) - import - type(t1) :: x - end subroutine - subroutine s2(x) - import :: t2 - type(t2) :: x - end subroutine - end interface -end -!Expect: m8.mod -!module m8 -! use m1,only:t1 -! use m1,only:t2 -! interface -! subroutine s1(x) -! import::t1 -! type(t1)::x -! end -! end interface -! interface -! subroutine s2(x) -! import::t2 -! type(t2)::x -! end -! end interface -!end diff --git a/test-lit/Semantics/modfile24.f90 b/test-lit/Semantics/modfile24.f90 deleted file mode 100644 index ec446f9e8d3c..000000000000 --- a/test-lit/Semantics/modfile24.f90 +++ /dev/null @@ -1,75 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test declarations with coarray-spec - -! Different ways of declaring the same coarray. -module m1 - real :: a(1:5)[1:10,1:*] - real, dimension(5) :: b[1:10,1:*] - real, codimension[1:10,1:*] :: c(5) - real, codimension[1:10,1:*], dimension(5) :: d - codimension :: e[1:10,1:*] - dimension :: e(5) - real :: e -end -!Expect: m1.mod -!module m1 -! real(4)::a(1_8:5_8)[1_8:10_8,1_8:*] -! real(4)::b(1_8:5_8)[1_8:10_8,1_8:*] -! real(4)::c(1_8:5_8)[1_8:10_8,1_8:*] -! real(4)::d(1_8:5_8)[1_8:10_8,1_8:*] -! real(4)::e(1_8:5_8)[1_8:10_8,1_8:*] -!end - -! coarray-spec in codimension and target statements. -module m2 - codimension :: a[10,*], b[*] - target :: c[10,*], d[*] -end -!Expect: m2.mod -!module m2 -! real(4)::a[1_8:10_8,1_8:*] -! real(4)::b[1_8:*] -! real(4),target::c[1_8:10_8,1_8:*] -! real(4),target::d[1_8:*] -!end - -! coarray-spec in components and with non-constants bounds -module m3 - type t - real :: c[1:10,1:*] - complex, codimension[5,*] :: d - end type - real, allocatable :: e[:,:,:] -contains - subroutine s(a, b, n) - integer(8) :: n - real :: a[1:n,2:*] - real, codimension[1:n,2:*] :: b - end -end -!Expect: m3.mod -!module m3 -! type::t -! real(4)::c[1_8:10_8,1_8:*] -! complex(4)::d[1_8:5_8,1_8:*] -! end type -! real(4),allocatable::e[:,:,:] -!contains -! subroutine s(a,b,n) -! integer(8)::n -! real(4)::a[1_8:n,2_8:*] -! real(4)::b[1_8:n,2_8:*] -! end -!end - -! coarray-spec in both attributes and entity-decl -module m4 - real, codimension[2:*], dimension(2:5) :: a, b(4,4), c[10,*], d(4,4)[10,*] -end -!Expect: m4.mod -!module m4 -! real(4)::a(2_8:5_8)[2_8:*] -! real(4)::b(1_8:4_8,1_8:4_8)[2_8:*] -! real(4)::c(2_8:5_8)[1_8:10_8,1_8:*] -! real(4)::d(1_8:4_8,1_8:4_8)[1_8:10_8,1_8:*] -!end diff --git a/test-lit/Semantics/modfile25.f90 b/test-lit/Semantics/modfile25.f90 deleted file mode 100644 index 210935df2515..000000000000 --- a/test-lit/Semantics/modfile25.f90 +++ /dev/null @@ -1,54 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test compile-time analysis of shapes. - -module m1 - integer(8), parameter :: a0s(*) = shape(3.14159) - real :: a1(5,5,5) - integer(8), parameter :: a1s(*) = shape(a1) - integer(8), parameter :: a1ss(*) = shape(a1s) - integer(8), parameter :: a1sss(*) = shape(a1ss) - integer(8), parameter :: a1rs(*) = [rank(a1),rank(a1s),rank(a1ss),rank(a1sss)] - integer(8), parameter :: a1n(*) = [size(a1),size(a1,1),size(a1,2)] - integer(8), parameter :: a1sn(*) = [size(a1s),size(a1ss),size(a1sss)] - integer(8), parameter :: ac1s(*) = shape([1]) - integer(8), parameter :: ac2s(*) = shape([1,2,3]) - integer(8), parameter :: ac3s(*) = shape([(1,j=1,4)]) - integer(8), parameter :: ac3bs(*) = shape([(1,j=4,1,-1)]) - integer(8), parameter :: ac4s(*) = shape([((j,k,j*k,k=1,3),j=1,4)]) - integer(8), parameter :: ac5s(*) = shape([((0,k=5,1,-2),j=9,2,-3)]) - integer(8), parameter :: rss(*) = shape(reshape([(0,j=1,90)], -[2,3]*(-[5_8,3_8]))) - contains - subroutine subr(x,n1,n2) - real, intent(in) :: x(:,:) - integer, intent(in) :: n1(3), n2(:) - real, allocatable :: a(:,:,:) - a = reshape(x,n1) - a = reshape(x,n2(10:30:9)) ! fails if we can't figure out triplet shape - end subroutine -end module m1 -!Expect: m1.mod -! module m1 -! integer(8),parameter::a0s(1_8:*)=[INTEGER(8)::] -! intrinsic::shape -! real(4)::a1(1_8:5_8,1_8:5_8,1_8:5_8) -! integer(8),parameter::a1s(1_8:*)=[INTEGER(8)::5_8,5_8,5_8] -! integer(8),parameter::a1ss(1_8:*)=[INTEGER(8)::3_8] -! integer(8),parameter::a1sss(1_8:*)=[INTEGER(8)::1_8] -! integer(8),parameter::a1rs(1_8:*)=[INTEGER(8)::3_8,1_8,1_8,1_8] -! integer(8),parameter::a1n(1_8:*)=[INTEGER(8)::125_8,5_8,5_8] -! integer(8),parameter::a1sn(1_8:*)=[INTEGER(8)::3_8,1_8,1_8] -! integer(8),parameter::ac1s(1_8:*)=[INTEGER(8)::1_8] -! integer(8),parameter::ac2s(1_8:*)=[INTEGER(8)::3_8] -! integer(8),parameter::ac3s(1_8:*)=[INTEGER(8)::4_8] -! integer(8),parameter::ac3bs(1_8:*)=[INTEGER(8)::4_8] -! integer(8),parameter::ac4s(1_8:*)=[INTEGER(8)::36_8] -! integer(8),parameter::ac5s(1_8:*)=[INTEGER(8)::9_8] -! integer(8),parameter::rss(1_8:*)=[INTEGER(8)::10_8,9_8] -! intrinsic::reshape -! contains -! subroutine subr(x,n1,n2) -! real(4),intent(in)::x(:,:) -! integer(4),intent(in)::n1(1_8:3_8) -! integer(4),intent(in)::n2(:) -! end -! end diff --git a/test-lit/Semantics/modfile26.f90 b/test-lit/Semantics/modfile26.f90 deleted file mode 100644 index 5064122a3740..000000000000 --- a/test-lit/Semantics/modfile26.f90 +++ /dev/null @@ -1,88 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Intrinsics SELECTED_INT_KIND, SELECTED_REAL_KIND, PRECISION, RANGE, -! RADIX, DIGITS - -module m1 - ! INTEGER(KIND=1) handles 0 <= P < 3 - ! INTEGER(KIND=2) handles 3 <= P < 5 - ! INTEGER(KIND=4) handles 5 <= P < 10 - ! INTEGER(KIND=8) handles 10 <= P < 19 - ! INTEGER(KIND=16) handles 19 <= P < 39 - integer, parameter :: iranges(*) = & - [range(0_1), range(0_2), range(0_4), range(0_8), range(0_16)] - logical, parameter :: ircheck = all([2, 4, 9, 18, 38] == iranges) - integer, parameter :: intpvals(*) = [0, 2, 3, 4, 5, 9, 10, 18, 19, 38, 39] - integer, parameter :: intpkinds(*) = & - [(selected_int_kind(intpvals(j)),j=1,size(intpvals))] - logical, parameter :: ipcheck = & - all([1, 1, 2, 2, 4, 4, 8, 8, 16, 16, -1] == intpkinds) - - ! REAL(KIND=2) handles 0 <= P < 4 (if available) - ! REAL(KIND=3) handles 0 <= P < 3 (if available) - ! REAL(KIND=4) handles 4 <= P < 7 - ! REAL(KIND=8) handles 7 <= P < 16 - ! REAL(KIND=10) handles 16 <= P < 19 (if available; ifort is KIND=16) - ! REAL(KIND=16) handles 19 <= P < 34 (would be 32 with Power double/double) - integer, parameter :: realprecs(*) = & - [precision(0._2), precision(0._3), precision(0._4), precision(0._8), & - precision(0._10), precision(0._16)] - logical, parameter :: rpreccheck = all([3, 2, 6, 15, 18, 33] == realprecs) - integer, parameter :: realpvals(*) = [0, 3, 4, 6, 7, 15, 16, 18, 19, 33, 34] - integer, parameter :: realpkinds(*) = & - [(selected_real_kind(realpvals(j),0),j=1,size(realpvals))] - logical, parameter :: realpcheck = & - all([2, 2, 4, 4, 8, 8, 10, 10, 16, 16, -1] == realpkinds) - ! REAL(KIND=2) handles 0 <= R < 5 (if available) - ! REAL(KIND=3) handles 5 <= R < 38 (if available, same range as KIND=4) - ! REAL(KIND=4) handles 5 <= R < 38 (if no KIND=3) - ! REAL(KIND=8) handles 38 <= R < 308 - ! REAL(KIND=10) handles 308 <= R < 4932 (if available; ifort is KIND=16) - ! REAL(KIND=16) handles 308 <= R < 4932 (except Power double/double) - integer, parameter :: realranges(*) = & - [range(0._2), range(0._3), range(0._4), range(0._8), range(0._10), & - range(0._16)] - logical, parameter :: rrangecheck = & - all([4, 37, 37, 307, 4931, 4931] == realranges) - integer, parameter :: realrvals(*) = & - [0, 4, 5, 37, 38, 307, 308, 4931, 4932] - integer, parameter :: realrkinds(*) = & - [(selected_real_kind(0,realrvals(j)),j=1,size(realrvals))] - logical, parameter :: realrcheck = & - all([2, 2, 3, 3, 8, 8, 10, 10, -2] == realrkinds) - logical, parameter :: radixcheck = & - all([radix(0._2), radix(0._3), radix(0._4), radix(0._8), & - radix(0._10), radix(0._16)] == 2) - integer, parameter :: intdigits(*) = & - [digits(0_1), digits(0_2), digits(0_4), digits(0_8), digits(0_16)] - logical, parameter :: intdigitscheck = & - all([7, 15, 31, 63, 127] == intdigits) - integer, parameter :: realdigits(*) = & - [digits(0._2), digits(0._3), digits(0._4), digits(0._8), digits(0._10), & - digits(0._16)] - logical, parameter :: realdigitscheck = & - all([11, 8, 24, 53, 64, 113] == realdigits) -end module m1 -!Expect: m1.mod -!module m1 -!integer(4),parameter::iranges(1_8:*)=[INTEGER(4)::2_4,4_4,9_4,18_4,38_4] -!logical(4),parameter::ircheck=.true._4 -!intrinsic::all -!integer(4),parameter::intpvals(1_8:*)=[INTEGER(4)::0_4,2_4,3_4,4_4,5_4,9_4,10_4,18_4,19_4,38_4,39_4] -!integer(4),parameter::intpkinds(1_8:*)=[INTEGER(4)::1_4,1_4,2_4,2_4,4_4,4_4,8_4,8_4,16_4,16_4,-1_4] -!logical(4),parameter::ipcheck=.true._4 -!integer(4),parameter::realprecs(1_8:*)=[INTEGER(4)::3_4,2_4,6_4,15_4,18_4,33_4] -!logical(4),parameter::rpreccheck=.true._4 -!integer(4),parameter::realpvals(1_8:*)=[INTEGER(4)::0_4,3_4,4_4,6_4,7_4,15_4,16_4,18_4,19_4,33_4,34_4] -!integer(4),parameter::realpkinds(1_8:*)=[INTEGER(4)::2_4,2_4,4_4,4_4,8_4,8_4,10_4,10_4,16_4,16_4,-1_4] -!logical(4),parameter::realpcheck=.true._4 -!integer(4),parameter::realranges(1_8:*)=[INTEGER(4)::4_4,37_4,37_4,307_4,4931_4,4931_4] -!logical(4),parameter::rrangecheck=.true._4 -!integer(4),parameter::realrvals(1_8:*)=[INTEGER(4)::0_4,4_4,5_4,37_4,38_4,307_4,308_4,4931_4,4932_4] -!integer(4),parameter::realrkinds(1_8:*)=[INTEGER(4)::2_4,2_4,3_4,3_4,8_4,8_4,10_4,10_4,-2_4] -!logical(4),parameter::realrcheck=.true._4 -!logical(4),parameter::radixcheck=.true._4 -!integer(4),parameter::intdigits(1_8:*)=[INTEGER(4)::7_4,15_4,31_4,63_4,127_4] -!logical(4),parameter::intdigitscheck=.true._4 -!integer(4),parameter::realdigits(1_8:*)=[INTEGER(4)::11_4,8_4,24_4,53_4,64_4,113_4] -!logical(4),parameter::realdigitscheck=.true._4 -!end diff --git a/test-lit/Semantics/modfile27.f90 b/test-lit/Semantics/modfile27.f90 deleted file mode 100644 index 2a6e23f6f464..000000000000 --- a/test-lit/Semantics/modfile27.f90 +++ /dev/null @@ -1,45 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test folding of combined array references and structure component -! references. - -module m1 - type :: t1 - integer :: ia1(2) - end type t1 - type(t1), parameter :: t1x1(*) = [t1::t1(ia1=[1,2]),t1(ia1=[3,4])] - logical, parameter :: t1check1 = t1x1(2)%ia1(1) == 3 - logical, parameter :: t1check2 = all(t1x1(1)%ia1 == [1,2]) - logical, parameter :: t1check3 = all(t1x1(:)%ia1(1) == [1,3]) - type :: t2 - type(t1) :: dta1(2) - end type t2 - type(t2), parameter :: t2x1(*) = & - [t2 :: t2(dta1=[t1::t1x1]), & - t2(dta1=[t1::t1(ia1=[5,6]),t1(ia1=[7,8])])] - logical, parameter :: t2check1 = t2x1(1)%dta1(2)%ia1(2) == 4 - logical, parameter :: t2check2 = & - all(t2x1(2)%dta1(2)%ia1(:) == [7,8]) - logical, parameter :: t2check3 = & - all(t2x1(1)%dta1(:)%ia1(2) == [2,4]) - logical, parameter :: t2check4 = & - all(t2x1(:)%dta1(1)%ia1(2) == [2,6]) -end module m1 -!Expect: m1.mod -!module m1 -!type::t1 -!integer(4)::ia1(1_8:2_8) -!end type -!type(t1),parameter::t1x1(1_8:*)=[t1::t1(ia1=[INTEGER(4)::1_4,2_4]),t1(ia1=[INTEGER(4)::3_4,4_4])] -!logical(4),parameter::t1check1=.true._4 -!logical(4),parameter::t1check2=.true._4 -!intrinsic::all -!logical(4),parameter::t1check3=.true._4 -!type::t2 -!type(t1)::dta1(1_8:2_8) -!end type -!type(t2),parameter::t2x1(1_8:*)=[t2::t2(dta1=[t1::t1(ia1=[INTEGER(4)::1_4,2_4]),t1(ia1=[INTEGER(4)::3_4,4_4])]),t2(dta1=[t1::t1(ia1=[INTEGER(4)::5_4,6_4]),t1(ia1=[INTEGER(4)::7_4,8_4])])] -!logical(4),parameter::t2check1=.true._4 -!logical(4),parameter::t2check2=.true._4 -!logical(4),parameter::t2check3=.true._4 -!logical(4),parameter::t2check4=.true._4 -!end diff --git a/test-lit/Semantics/modfile28.f90 b/test-lit/Semantics/modfile28.f90 deleted file mode 100644 index 18a349de5ba1..000000000000 --- a/test-lit/Semantics/modfile28.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t - -! Test UTF-8 support in character literals -! Note: Module files are encoded in UTF-8. - -module m -character(kind=4,len=*), parameter :: c4 = 4_"Hi! 你好!" -! In CHARACTER(1) literals, codepoints > 0xff are serialized into UTF-8; -! each of those bytes then gets encoded into UTF-8 for the module file. -character(kind=1,len=*), parameter :: c1 = 1_"Hi! 你好!" -character(kind=4,len=*), parameter :: c4a(*) = [4_"一", 4_"二", 4_"三", 4_"四", 4_"五"] -integer, parameter :: lc4 = len(c4) -integer, parameter :: lc1 = len(c1) -end module m - -!Expect: m.mod -!module m -!character(*,4),parameter::c4=4_"Hi! \344\275\240\345\245\275!" -!character(*,1),parameter::c1=1_"Hi! \344\275\240\345\245\275!" -!character(*,4),parameter::c4a(1_8:*)=[CHARACTER(KIND=4,LEN=1)::4_"\344\270\200",4_"\344\272\214",4_"\344\270\211",4_"\345\233\233",4_"\344\272\224"] -!integer(4),parameter::lc4=7_4 -!intrinsic::len -!integer(4),parameter::lc1=11_4 -!end diff --git a/test-lit/Semantics/modfile29.f90 b/test-lit/Semantics/modfile29.f90 deleted file mode 100644 index 7afa55120be1..000000000000 --- a/test-lit/Semantics/modfile29.f90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Check that implicitly typed entities get a type in the module file. - -module m - public :: a - private :: b - protected :: i - allocatable :: j -end - -!Expect: m.mod -!module m -! real(4)::a -! real(4),private::b -! integer(4),protected::i -! integer(4),allocatable::j -!end diff --git a/test-lit/Semantics/modfile30.f90 b/test-lit/Semantics/modfile30.f90 deleted file mode 100644 index ef05b9395139..000000000000 --- a/test-lit/Semantics/modfile30.f90 +++ /dev/null @@ -1,88 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Verify miscellaneous bugs - -! The function result must be declared after the dummy arguments -module m1 -contains - function f1(x) result(y) - integer :: x(:) - integer :: y(size(x)) - end - function f2(x) - integer :: x(:) - integer :: f2(size(x)) - end -end - -!Expect: m1.mod -!module m1 -!contains -! function f1(x) result(y) -! integer(4)::x(:) -! integer(4)::y(1_8:int(int(1_8*size(x,dim=1),kind=4),kind=8)) -! end -! function f2(x) -! integer(4)::x(:) -! integer(4)::f2(1_8:int(int(1_8*size(x,dim=1),kind=4),kind=8)) -! end -!end - -! Order of names in PUBLIC statement shouldn't affect .mod file. -module m2 - public :: a - type t - end type - type(t), parameter :: a = t() -end - -!Expect: m2.mod -!module m2 -! type::t -! end type -! type(t),parameter::a=t() -!end - -! Don't write out intrinsics -module m3a - integer, parameter :: i4 = selected_int_kind(9) -end -module m3b - use m3a - integer(i4) :: j -end - -!Expect: m3a.mod -!module m3a -! integer(4),parameter::i4=4_4 -! intrinsic::selected_int_kind -!end - -!Expect: m3b.mod -!module m3b -! use m3a,only:i4 -! use m3a,only:selected_int_kind -! integer(4)::j -!end - -! Test that character literals written with backslash escapes are read correctly. -module m4a - character(1), parameter :: a = achar(1) -end -module m4b - use m4a - character(1), parameter :: b = a -end - -!Expect: m4a.mod -!module m4a -! character(1_4,1),parameter::a=1_"\001" -! intrinsic::achar -!end - -!Expect: m4b.mod -!module m4b -! use m4a,only:a -! use m4a,only:achar -! character(1_4,1),parameter::b=1_"\001" -!end - diff --git a/test-lit/Semantics/modfile31.f90 b/test-lit/Semantics/modfile31.f90 deleted file mode 100644 index a29256fe46a2..000000000000 --- a/test-lit/Semantics/modfile31.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test 7.6 enum values - -module m1 - integer, parameter :: x(1) = [4] - enum, bind(C) - enumerator :: red, green - enumerator blue - enumerator yellow - enumerator :: purple = 2 - enumerator :: brown - end enum - - enum, bind(C) - enumerator :: oak, beech = -rank(x)*x(1), pine, poplar = brown - end enum - -end - -!Expect: m1.mod -!module m1 -!integer(4),parameter::x(1_8:1_8)=[INTEGER(4)::4_4] -!integer(4),parameter::red=0_4 -!integer(4),parameter::green=1_4 -!integer(4),parameter::blue=2_4 -!integer(4),parameter::yellow=3_4 -!integer(4),parameter::purple=2_4 -!integer(4),parameter::brown=3_4 -!integer(4),parameter::oak=0_4 -!integer(4),parameter::beech=-4_4 -!intrinsic::rank -!integer(4),parameter::pine=-3_4 -!integer(4),parameter::poplar=3_4 -!end - diff --git a/test-lit/Semantics/modfile32.f90 b/test-lit/Semantics/modfile32.f90 deleted file mode 100644 index ea5b55a94d05..000000000000 --- a/test-lit/Semantics/modfile32.f90 +++ /dev/null @@ -1,324 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Resolution of generic names in expressions. -! Test by using generic function in a specification expression that needs -! to be written to a .mod file. - -! Resolve based on number of arguments -module m1 - interface f - pure integer(8) function f1(x) - real, intent(in) :: x - end - pure integer(8) function f2(x, y) - real, intent(in) :: x, y - end - pure integer(8) function f3(x, y, z, w) - real, intent(in) :: x, y, z, w - optional :: w - end - end interface -contains - subroutine s1(x, z) - real :: z(f(x)) ! resolves to f1 - end - subroutine s2(x, y, z) - real :: z(f(x, y)) ! resolves to f2 - end - subroutine s3(x, y, z, w) - real :: w(f(x, y, z)) ! resolves to f3 - end - subroutine s4(x, y, z, w, u) - real :: u(f(x, y, z, w)) ! resolves to f3 - end -end -!Expect: m1.mod -!module m1 -! interface f -! procedure :: f1 -! procedure :: f2 -! procedure :: f3 -! end interface -! interface -! pure function f1(x) -! real(4), intent(in) :: x -! integer(8) :: f1 -! end -! end interface -! interface -! pure function f2(x, y) -! real(4), intent(in) :: x -! real(4), intent(in) :: y -! integer(8) :: f2 -! end -! end interface -! interface -! pure function f3(x, y, z, w) -! real(4), intent(in) :: x -! real(4), intent(in) :: y -! real(4), intent(in) :: z -! real(4), intent(in), optional :: w -! integer(8) :: f3 -! end -! end interface -!contains -! subroutine s1(x, z) -! real(4) :: x -! real(4) :: z(1_8:f1(x)) -! end -! subroutine s2(x, y, z) -! real(4) :: x -! real(4) :: y -! real(4) :: z(1_8:f2(x, y)) -! end -! subroutine s3(x, y, z, w) -! real(4) :: x -! real(4) :: y -! real(4) :: z -! real(4) :: w(1_8:f3(x, y, z)) -! end -! subroutine s4(x, y, z, w, u) -! real(4) :: x -! real(4) :: y -! real(4) :: z -! real(4) :: w -! real(4) :: u(1_8:f3(x, y, z, w)) -! end -!end - -! Resolve based on type or kind -module m2 - interface f - pure integer(8) function f_real4(x) - real(4), intent(in) :: x - end - pure integer(8) function f_real8(x) - real(8), intent(in) :: x - end - pure integer(8) function f_integer(x) - integer, intent(in) :: x - end - end interface -contains - subroutine s1(x, y) - real(4) :: x - real :: y(f(x)) ! resolves to f_real4 - end - subroutine s2(x, y) - real(8) :: x - real :: y(f(x)) ! resolves to f_real8 - end - subroutine s3(x, y) - integer :: x - real :: y(f(x)) ! resolves to f_integer - end -end -!Expect: m2.mod -!module m2 -! interface f -! procedure :: f_real4 -! procedure :: f_real8 -! procedure :: f_integer -! end interface -! interface -! pure function f_real4(x) -! real(4), intent(in) :: x -! integer(8) :: f_real4 -! end -! end interface -! interface -! pure function f_real8(x) -! real(8), intent(in) :: x -! integer(8) :: f_real8 -! end -! end interface -! interface -! pure function f_integer(x) -! integer(4), intent(in) :: x -! integer(8) :: f_integer -! end -! end interface -!contains -! subroutine s1(x, y) -! real(4) :: x -! real(4) :: y(1_8:f_real4(x)) -! end -! subroutine s2(x, y) -! real(8) :: x -! real(4) :: y(1_8:f_real8(x)) -! end -! subroutine s3(x, y) -! integer(4) :: x -! real(4) :: y(1_8:f_integer(x)) -! end -!end - -! Resolve based on rank -module m3a - interface f - procedure :: f_elem - procedure :: f_vector - end interface -contains - pure integer(8) elemental function f_elem(x) result(result) - real, intent(in) :: x - result = 1_8 - end - pure integer(8) function f_vector(x) result(result) - real, intent(in) :: x(:) - result = 2_8 - end -end -!Expect: m3a.mod -!module m3a -! interface f -! procedure :: f_elem -! procedure :: f_vector -! end interface -!contains -! elemental pure function f_elem(x) result(result) -! real(4), intent(in) :: x -! integer(8) :: result -! end -! pure function f_vector(x) result(result) -! real(4), intent(in) :: x(:) -! integer(8) :: result -! end -!end - -module m3b -use m3a -contains - subroutine s1(x, y) - real :: x - real :: y(f(x)) ! resolves to f_elem - end - subroutine s2(x, y) - real :: x(10) - real :: y(f(x)) ! resolves to f_vector (preferred over elemental one) - end - subroutine s3(x, y) - real :: x(10, 10) - real :: y(ubound(f(x), 1)) ! resolves to f_elem - end -end -!Expect: m3b.mod -!module m3b -! use m3a, only: f -! use m3a, only: f_elem -! use m3a, only: f_vector -!contains -! subroutine s1(x, y) -! real(4) :: x -! real(4) :: y(1_8:f_elem(x)) -! end -! subroutine s2(x, y) -! real(4) :: x(1_8:10_8) -! real(4) :: y(1_8:f_vector(x)) -! end -! subroutine s3(x, y) -! real(4) :: x(1_8:10_8, 1_8:10_8) -! real(4) :: y(1_8:10_8) -! end -!end - -! Resolve defined unary operator based on type -module m4 - interface operator(.foo.) - pure integer(8) function f_real(x) - real, intent(in) :: x - end - pure integer(8) function f_integer(x) - integer, intent(in) :: x - end - end interface -contains - subroutine s1(x, y) - real :: x - real :: y(.foo. x) ! resolves to f_real - end - subroutine s2(x, y) - integer :: x - real :: y(.foo. x) ! resolves to f_integer - end -end -!Expect: m4.mod -!module m4 -! interface operator(.foo.) -! procedure :: f_real -! procedure :: f_integer -! end interface -! interface -! pure function f_real(x) -! real(4), intent(in) :: x -! integer(8) :: f_real -! end -! end interface -! interface -! pure function f_integer(x) -! integer(4), intent(in) :: x -! integer(8) :: f_integer -! end -! end interface -!contains -! subroutine s1(x, y) -! real(4) :: x -! real(4) :: y(1_8:f_real(x)) -! end -! subroutine s2(x, y) -! integer(4) :: x -! real(4) :: y(1_8:f_integer(x)) -! end -!end - -! Resolve defined binary operator based on type -module m5 - interface operator(.foo.) - pure integer(8) function f1(x, y) - real, intent(in) :: x - real, intent(in) :: y - end - pure integer(8) function f2(x, y) - real, intent(in) :: x - complex, intent(in) :: y - end - end interface -contains - subroutine s1(x, y) - complex :: x - real :: y(1.0 .foo. x) ! resolves to f2 - end - subroutine s2(x, y) - real :: x - real :: y(1.0 .foo. x) ! resolves to f1 - end -end -!Expect: m5.mod -!module m5 -! interface operator(.foo.) -! procedure :: f1 -! procedure :: f2 -! end interface -! interface -! pure function f1(x, y) -! real(4), intent(in) :: x -! real(4), intent(in) :: y -! integer(8) :: f1 -! end -! end interface -! interface -! pure function f2(x, y) -! real(4), intent(in) :: x -! complex(4), intent(in) :: y -! integer(8) :: f2 -! end -! end interface -!contains -! subroutine s1(x, y) -! complex(4) :: x -! real(4) :: y(1_8:f2(1._4, x)) -! end -! subroutine s2(x, y) -! real(4) :: x -! real(4) :: y(1_8:f1(1._4, x)) -! end -!end diff --git a/test-lit/Semantics/modfile33.f90 b/test-lit/Semantics/modfile33.f90 deleted file mode 100644 index d5474c799f77..000000000000 --- a/test-lit/Semantics/modfile33.f90 +++ /dev/null @@ -1,637 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Resolution of user-defined operators in expressions. -! Test by using generic function in a specification expression that needs -! to be written to a .mod file. - -!OPTIONS: -flogical-abbreviations -fxor-operator - -! Numeric operators -module m1 - type :: t - sequence - end type - interface operator(+) - pure integer(8) function add_ll(x, y) - logical, intent(in) :: x, y - end - pure integer(8) function add_li(x, y) - logical, intent(in) :: x - integer, intent(in) :: y - end - pure integer(8) function add_tt(x, y) - import :: t - type(t), intent(in) :: x, y - end - end interface - interface operator(/) - pure integer(8) function div_tz(x, y) - import :: t - type(t), intent(in) :: x - complex, intent(in) :: y - end - pure integer(8) function div_ct(x, y) - import :: t - character(10), intent(in) :: x - type(t), intent(in) :: y - end - end interface -contains - subroutine s1(x, y, z) - logical :: x, y - real :: z(x + y) ! resolves to add_ll - end - subroutine s2(x, y, z) - logical :: x - integer :: y - real :: z(x + y) ! resolves to add_li - end - subroutine s3(x, y, z) - type(t) :: x - complex :: y - real :: z(x / y) ! resolves to div_tz - end - subroutine s4(x, y, z) - character(10) :: x - type(t) :: y - real :: z(x / y) ! resolves to div_ct - end -end - -!Expect: m1.mod -!module m1 -! type :: t -! sequence -! end type -! interface operator(+) -! procedure :: add_ll -! procedure :: add_li -! procedure :: add_tt -! end interface -! interface -! pure function add_ll(x, y) -! logical(4), intent(in) :: x -! logical(4), intent(in) :: y -! integer(8) :: add_ll -! end -! end interface -! interface -! pure function add_li(x, y) -! logical(4), intent(in) :: x -! integer(4), intent(in) :: y -! integer(8) :: add_li -! end -! end interface -! interface -! pure function add_tt(x, y) -! import :: t -! type(t), intent(in) :: x -! type(t), intent(in) :: y -! integer(8) :: add_tt -! end -! end interface -! interface operator(/) -! procedure :: div_tz -! procedure :: div_ct -! end interface -! interface -! pure function div_tz(x, y) -! import :: t -! type(t), intent(in) :: x -! complex(4), intent(in) :: y -! integer(8) :: div_tz -! end -! end interface -! interface -! pure function div_ct(x, y) -! import :: t -! character(10_4, 1), intent(in) :: x -! type(t), intent(in) :: y -! integer(8) :: div_ct -! end -! end interface -!contains -! subroutine s1(x, y, z) -! logical(4) :: x -! logical(4) :: y -! real(4) :: z(1_8:add_ll(x, y)) -! end -! subroutine s2(x, y, z) -! logical(4) :: x -! integer(4) :: y -! real(4) :: z(1_8:add_li(x, y)) -! end -! subroutine s3(x, y, z) -! type(t) :: x -! complex(4) :: y -! real(4) :: z(1_8:div_tz(x, y)) -! end -! subroutine s4(x, y, z) -! character(10_4, 1) :: x -! type(t) :: y -! real(4) :: z(1_8:div_ct(x, y)) -! end -!end - -! Logical operators -module m2 - type :: t - sequence - end type - interface operator(.And.) - pure integer(8) function and_ti(x, y) - import :: t - type(t), intent(in) :: x - integer, intent(in) :: y - end - pure integer(8) function and_li(x, y) - logical, intent(in) :: x - integer, intent(in) :: y - end - end interface - ! Alternative spelling of .AND. - interface operator(.a.) - pure integer(8) function and_tt(x, y) - import :: t - type(t), intent(in) :: x, y - end - end interface - interface operator(.x.) - pure integer(8) function neqv_tt(x, y) - import :: t - type(t), intent(in) :: x, y - end - end interface - interface operator(.neqv.) - pure integer(8) function neqv_rr(x, y) - real, intent(in) :: x, y - end - end interface -contains - subroutine s1(x, y, z) - type(t) :: x - integer :: y - real :: z(x .and. y) ! resolves to and_ti - end - subroutine s2(x, y, z) - logical :: x - integer :: y - real :: z(x .a. y) ! resolves to and_li - end - subroutine s3(x, y, z) - type(t) :: x, y - real :: z(x .and. y) ! resolves to and_tt - end - subroutine s4(x, y, z) - type(t) :: x, y - real :: z(x .neqv. y) ! resolves to neqv_tt - end - subroutine s5(x, y, z) - real :: x, y - real :: z(x .xor. y) ! resolves to neqv_rr - end -end - -!Expect: m2.mod -!module m2 -! type :: t -! sequence -! end type -! interface operator( .and.) -! procedure :: and_ti -! procedure :: and_li -! procedure :: and_tt -! end interface -! interface -! pure function and_ti(x, y) -! import :: t -! type(t), intent(in) :: x -! integer(4), intent(in) :: y -! integer(8) :: and_ti -! end -! end interface -! interface -! pure function and_li(x, y) -! logical(4), intent(in) :: x -! integer(4), intent(in) :: y -! integer(8) :: and_li -! end -! end interface -! interface -! pure function and_tt(x, y) -! import :: t -! type(t), intent(in) :: x -! type(t), intent(in) :: y -! integer(8) :: and_tt -! end -! end interface -! interface operator(.x.) -! procedure :: neqv_tt -! procedure :: neqv_rr -! end interface -! interface -! pure function neqv_tt(x, y) -! import :: t -! type(t), intent(in) :: x -! type(t), intent(in) :: y -! integer(8) :: neqv_tt -! end -! end interface -! interface -! pure function neqv_rr(x, y) -! real(4), intent(in) :: x -! real(4), intent(in) :: y -! integer(8) :: neqv_rr -! end -! end interface -!contains -! subroutine s1(x, y, z) -! type(t) :: x -! integer(4) :: y -! real(4) :: z(1_8:and_ti(x, y)) -! end -! subroutine s2(x, y, z) -! logical(4) :: x -! integer(4) :: y -! real(4) :: z(1_8:and_li(x, y)) -! end -! subroutine s3(x, y, z) -! type(t) :: x -! type(t) :: y -! real(4) :: z(1_8:and_tt(x, y)) -! end -! subroutine s4(x, y, z) -! type(t) :: x -! type(t) :: y -! real(4) :: z(1_8:neqv_tt(x, y)) -! end -! subroutine s5(x, y, z) -! real(4) :: x -! real(4) :: y -! real(4) :: z(1_8:neqv_rr(x, y)) -! end -!end - -! Relational operators -module m3 - type :: t - sequence - end type - interface operator(<>) - pure integer(8) function ne_it(x, y) - import :: t - integer, intent(in) :: x - type(t), intent(in) :: y - end - end interface - interface operator(/=) - pure integer(8) function ne_tt(x, y) - import :: t - type(t), intent(in) :: x, y - end - end interface - interface operator(.ne.) - pure integer(8) function ne_ci(x, y) - character(len=*), intent(in) :: x - integer, intent(in) :: y - end - end interface -contains - subroutine s1(x, y, z) - integer :: x - type(t) :: y - real :: z(x /= y) ! resolves to ne_it - end - subroutine s2(x, y, z) - type(t) :: x - type(t) :: y - real :: z(x .ne. y) ! resolves to ne_tt - end - subroutine s3(x, y, z) - character(len=*) :: x - integer :: y - real :: z(x <> y) ! resolves to ne_ci - end -end - -!Expect: m3.mod -!module m3 -! type :: t -! sequence -! end type -! interface operator(<>) -! procedure :: ne_it -! procedure :: ne_tt -! procedure :: ne_ci -! end interface -! interface -! pure function ne_it(x, y) -! import :: t -! integer(4), intent(in) :: x -! type(t), intent(in) :: y -! integer(8) :: ne_it -! end -! end interface -! interface -! pure function ne_tt(x, y) -! import :: t -! type(t), intent(in) :: x -! type(t), intent(in) :: y -! integer(8) :: ne_tt -! end -! end interface -! interface -! pure function ne_ci(x, y) -! character(*, 1), intent(in) :: x -! integer(4), intent(in) :: y -! integer(8) :: ne_ci -! end -! end interface -!contains -! subroutine s1(x, y, z) -! integer(4) :: x -! type(t) :: y -! real(4) :: z(1_8:ne_it(x, y)) -! end -! subroutine s2(x, y, z) -! type(t) :: x -! type(t) :: y -! real(4) :: z(1_8:ne_tt(x, y)) -! end -! subroutine s3(x, y, z) -! character(*, 1) :: x -! integer(4) :: y -! real(4) :: z(1_8:ne_ci(x, y)) -! end -!end - -! Concatenation -module m4 - type :: t - sequence - end type - interface operator(//) - pure integer(8) function concat_12(x, y) - character(len=*,kind=1), intent(in) :: x - character(len=*,kind=2), intent(in) :: y - end - pure integer(8) function concat_int_real(x, y) - integer, intent(in) :: x - real, intent(in) :: y - end - end interface -contains - subroutine s1(x, y, z) - character(len=*,kind=1) :: x - character(len=*,kind=2) :: y - real :: z(x // y) ! resolves to concat_12 - end - subroutine s2(x, y, z) - integer :: x - real :: y - real :: z(x // y) ! resolves to concat_int_real - end -end -!Expect: m4.mod -!module m4 -! type :: t -! sequence -! end type -! interface operator(//) -! procedure :: concat_12 -! procedure :: concat_int_real -! end interface -! interface -! pure function concat_12(x, y) -! character(*, 1), intent(in) :: x -! character(*, 2), intent(in) :: y -! integer(8) :: concat_12 -! end -! end interface -! interface -! pure function concat_int_real(x, y) -! integer(4), intent(in) :: x -! real(4), intent(in) :: y -! integer(8) :: concat_int_real -! end -! end interface -!contains -! subroutine s1(x, y, z) -! character(*, 1) :: x -! character(*, 2) :: y -! real(4) :: z(1_8:concat_12(x, y)) -! end -! subroutine s2(x, y, z) -! integer(4) :: x -! real(4) :: y -! real(4) :: z(1_8:concat_int_real(x, y)) -! end -!end - -! Unary operators -module m5 - type :: t - end type - interface operator(+) - pure integer(8) function plus_l(x) - logical, intent(in) :: x - end - end interface - interface operator(-) - pure integer(8) function minus_t(x) - import :: t - type(t), intent(in) :: x - end - end interface - interface operator(.not.) - pure integer(8) function not_t(x) - import :: t - type(t), intent(in) :: x - end - pure integer(8) function not_real(x) - real, intent(in) :: x - end - end interface -contains - subroutine s1(x, y) - logical :: x - real :: y(+x) ! resolves_to plus_l - end - subroutine s2(x, y) - type(t) :: x - real :: y(-x) ! resolves_to minus_t - end - subroutine s3(x, y) - type(t) :: x - real :: y(.not. x) ! resolves to not_t - end - subroutine s4(x, y) - real :: y(.not. x) ! resolves to not_real - end -end - -!Expect: m5.mod -!module m5 -! type :: t -! end type -! interface operator(+) -! procedure :: plus_l -! end interface -! interface -! pure function plus_l(x) -! logical(4), intent(in) :: x -! integer(8) :: plus_l -! end -! end interface -! interface operator(-) -! procedure :: minus_t -! end interface -! interface -! pure function minus_t(x) -! import :: t -! type(t), intent(in) :: x -! integer(8) :: minus_t -! end -! end interface -! interface operator( .not.) -! procedure :: not_t -! procedure :: not_real -! end interface -! interface -! pure function not_t(x) -! import :: t -! type(t), intent(in) :: x -! integer(8) :: not_t -! end -! end interface -! interface -! pure function not_real(x) -! real(4), intent(in) :: x -! integer(8) :: not_real -! end -! end interface -!contains -! subroutine s1(x, y) -! logical(4) :: x -! real(4) :: y(1_8:plus_l(x)) -! end -! subroutine s2(x, y) -! type(t) :: x -! real(4) :: y(1_8:minus_t(x)) -! end -! subroutine s3(x, y) -! type(t) :: x -! real(4) :: y(1_8:not_t(x)) -! end -! subroutine s4(x, y) -! real(4) :: x -! real(4) :: y(1_8:not_real(x)) -! end -!end - -! Resolved based on shape -module m6 - interface operator(+) - pure integer(8) function add(x, y) - real, intent(in) :: x(:, :) - real, intent(in) :: y(:, :, :) - end - end interface -contains - subroutine s1(n, x, y, z, a, b) - integer(8) :: n - real :: x - real :: y(4, n) - real :: z(2, 2, 2) - real :: a(size(x+y)) ! intrinsic + - real :: b(y+z) ! resolves to add - end -end - -!Expect: m6.mod -!module m6 -! interface operator(+) -! procedure :: add -! end interface -! interface -! pure function add(x, y) -! real(4), intent(in) :: x(:, :) -! real(4), intent(in) :: y(:, :, :) -! integer(8) :: add -! end -! end interface -!contains -! subroutine s1(n, x, y, z, a, b) -! integer(8) :: n -! real(4) :: x -! real(4) :: y(1_8:4_8, 1_8:n) -! real(4) :: z(1_8:2_8, 1_8:2_8, 1_8:2_8) -! real(4) :: a(1_8:int(int(4_8*(n-1_8+1_8),kind=4),kind=8)) -! real(4) :: b(1_8:add(y, z)) -! end -!end - -! Parameterized derived type -module m7 - type :: t(k) - integer, kind :: k - real(k) :: a - end type - interface operator(+) - pure integer(8) function f1(x, y) - import :: t - type(t(4)), intent(in) :: x, y - end - pure integer(8) function f2(x, y) - import :: t - type(t(8)), intent(in) :: x, y - end - end interface -contains - subroutine s1(x, y, z) - type(t(4)) :: x, y - real :: z(x + y) ! resolves to f1 - end - subroutine s2(x, y, z) - type(t(8)) :: x, y - real :: z(x + y) ! resolves to f2 - end -end - -!Expect: m7.mod -!module m7 -! type :: t(k) -! integer(4), kind :: k -! real(int(k, kind=8)) :: a -! end type -! interface operator(+) -! procedure :: f1 -! procedure :: f2 -! end interface -! interface -! pure function f1(x, y) -! import :: t -! type(t(k=4_4)), intent(in) :: x -! type(t(k=4_4)), intent(in) :: y -! integer(8) :: f1 -! end -! end interface -! interface -! pure function f2(x, y) -! import :: t -! type(t(k=8_4)), intent(in) :: x -! type(t(k=8_4)), intent(in) :: y -! integer(8) :: f2 -! end -! end interface -!contains -! subroutine s1(x, y, z) -! type(t(k=4_4)) :: x -! type(t(k=4_4)) :: y -! real(4) :: z(1_8:f1(x, y)) -! end -! subroutine s2(x, y, z) -! type(t(k=8_4)) :: x -! type(t(k=8_4)) :: y -! real(4) :: z(1_8:f2(x, y)) -! end -!end diff --git a/test-lit/Semantics/modfile34.f90 b/test-lit/Semantics/modfile34.f90 deleted file mode 100644 index 59b0fd1a447f..000000000000 --- a/test-lit/Semantics/modfile34.f90 +++ /dev/null @@ -1,118 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -! Test resolution of type-bound generics. - -module m1 - type :: t - contains - procedure, pass(x) :: add1 => add - procedure, nopass :: add2 => add - procedure :: add_real - generic :: g => add1, add2, add_real - end type -contains - integer(8) pure function add(x, y) - class(t), intent(in) :: x, y - end - integer(8) pure function add_real(x, y) - class(t), intent(in) :: x - real, intent(in) :: y - end - subroutine test1(x, y, z) - type(t) :: x, y - real :: z(x%add1(y)) - end - subroutine test1p(x, y, z) - class(t) :: x, y - real :: z(x%add1(y)) - end - subroutine test2(x, y, z) - type(t) :: x, y - real :: z(x%g(y)) - end - subroutine test2p(x, y, z) - class(t) :: x, y - real :: z(x%g(y)) - end - subroutine test3(x, y, z) - type(t) :: x, y - real :: z(x%g(y, x)) - end - subroutine test3p(x, y, z) - class(t) :: x, y - real :: z(x%g(y, x)) - end - subroutine test4(x, y, z) - type(t) :: x - real :: y - real :: z(x%g(y)) - end - subroutine test4p(x, y, z) - class(t) :: x - real :: y - real :: z(x%g(y)) - end -end - -!Expect: m1.mod -!module m1 -! type :: t -! contains -! procedure, pass(x) :: add1 => add -! procedure, nopass :: add2 => add -! procedure :: add_real -! generic :: g => add1 -! generic :: g => add2 -! generic :: g => add_real -! end type -!contains -! pure function add(x, y) -! class(t), intent(in) :: x -! class(t), intent(in) :: y -! integer(8) :: add -! end -! pure function add_real(x, y) -! class(t), intent(in) :: x -! real(4), intent(in) :: y -! integer(8) :: add_real -! end -! subroutine test1(x, y, z) -! type(t) :: x -! type(t) :: y -! real(4) :: z(1_8:add(x, y)) -! end -! subroutine test1p(x,y,z) -! class(t)::x -! class(t)::y -! real(4)::z(1_8:x%add1(y)) -! end -! subroutine test2(x, y, z) -! type(t) :: x -! type(t) :: y -! real(4)::z(1_8:add(x,y)) -! end -! subroutine test2p(x,y,z) -! class(t)::x -! class(t)::y -! real(4) :: z(1_8:x%add1(y)) -! end -! subroutine test3(x, y, z) -! type(t) :: x -! type(t) :: y -! real(4)::z(1_8:add(y,x)) -! end -! subroutine test3p(x,y,z) -! class(t)::x -! class(t)::y -! real(4) :: z(1_8:x%add2(y, x)) -! end -! subroutine test4(x, y, z) -! type(t) :: x -! real(4) :: y -! real(4)::z(1_8:add_real(x,y)) -! end -! subroutine test4p(x,y,z) -! class(t)::x -! real(4)::y -! real(4) :: z(1_8:x%add_real(y)) -! end -!end diff --git a/test-lit/Semantics/modfile35.f90 b/test-lit/Semantics/modfile35.f90 deleted file mode 100644 index 9ef35747e947..000000000000 --- a/test-lit/Semantics/modfile35.f90 +++ /dev/null @@ -1,251 +0,0 @@ -! RUN: %S/test_modfile.sh %s %f18 %t -module m1 - type :: t1 - contains - procedure, pass(x) :: p1 => f - procedure, non_overridable :: p2 => f - procedure, nopass :: p3 => f - generic :: operator(+) => p1 - generic :: operator(-) => p2 - generic :: operator(<) => p1 - generic :: operator(.and.) => p2 - end type -contains - integer(8) pure function f(x, y) - class(t1), intent(in) :: x - integer, intent(in) :: y - end - ! Operators resolve to type-bound operators in t1 - subroutine test1(x, y, a, b) - class(t1) :: x - integer :: y - real :: a(x + y) - real :: b(x .lt. y) - end - ! Operators resolve to type-bound operators in t1, compile-time resolvable - subroutine test2(x, y, a, b) - class(t1) :: x - integer :: y - real :: a(x - y) - real :: b(x .and. y) - end - ! Operators resolve to type-bound operators in t1, compile-time resolvable - subroutine test3(x, y, a) - type(t1) :: x - integer :: y - real :: a(x + y) - end -end -!Expect: m1.mod -!module m1 -! type :: t1 -! contains -! procedure, pass(x) :: p1 => f -! procedure, non_overridable :: p2 => f -! procedure, nopass :: p3 => f -! generic :: operator(+) => p1 -! generic :: operator(-) => p2 -! generic :: operator(<) => p1 -! generic :: operator(.and.) => p2 -! end type -!contains -! pure function f(x, y) -! class(t1), intent(in) :: x -! integer(4), intent(in) :: y -! integer(8) :: f -! end -! subroutine test1(x, y, a, b) -! class(t1) :: x -! integer(4) :: y -! real(4) :: a(1_8:x%p1(y)) -! real(4) :: b(1_8:x%p1(y)) -! end -! subroutine test2(x, y, a, b) -! class(t1) :: x -! integer(4) :: y -! real(4) :: a(1_8:f(x, y)) -! real(4) :: b(1_8:f(x, y)) -! end -! subroutine test3(x,y,a) -! type(t1) :: x -! integer(4) :: y -! real(4) :: a(1_8:f(x,y)) -! end -!end - -module m2 - type :: t1 - contains - procedure, pass(x) :: p1 => f1 - generic :: operator(+) => p1 - end type - type, extends(t1) :: t2 - contains - procedure, pass(y) :: p2 => f2 - generic :: operator(+) => p2 - end type -contains - integer(8) pure function f1(x, y) - class(t1), intent(in) :: x - integer, intent(in) :: y - end - integer(8) pure function f2(x, y) - class(t1), intent(in) :: x - class(t2), intent(in) :: y - end - subroutine test1(x, y, a) - class(t1) :: x - integer :: y - real :: a(x + y) - end - ! Resolve to operator in parent class - subroutine test2(x, y, a) - class(t2) :: x - integer :: y - real :: a(x + y) - end - ! 2nd arg is passed object - subroutine test3(x, y, a) - class(t1) :: x - class(t2) :: y - real :: a(x + y) - end -end -!Expect: m2.mod -!module m2 -! type :: t1 -! contains -! procedure, pass(x) :: p1 => f1 -! generic :: operator(+) => p1 -! end type -! type, extends(t1) :: t2 -! contains -! procedure, pass(y) :: p2 => f2 -! generic :: operator(+) => p2 -! end type -!contains -! pure function f1(x, y) -! class(t1), intent(in) :: x -! integer(4), intent(in) :: y -! integer(8) :: f1 -! end -! pure function f2(x, y) -! class(t1), intent(in) :: x -! class(t2), intent(in) :: y -! integer(8) :: f2 -! end -! subroutine test1(x, y, a) -! class(t1) :: x -! integer(4) :: y -! real(4) :: a(1_8:x%p1(y)) -! end -! subroutine test2(x, y, a) -! class(t2) :: x -! integer(4) :: y -! real(4) :: a(1_8:x%p1(y)) -! end -! subroutine test3(x, y, a) -! class(t1) :: x -! class(t2) :: y -! real(4) :: a(1_8:y%p2(x)) -! end -!end - -module m3 - type :: t1 - contains - procedure, pass(x) :: p1 => f1 - procedure :: p3 => f3 - generic :: operator(.binary.) => p1 - generic :: operator(.unary.) => p3 - end type - type, extends(t1) :: t2 - contains - procedure, pass(y) :: p2 => f2 - generic :: operator(.binary.) => p2 - end type -contains - integer(8) pure function f1(x, y) - class(t1), intent(in) :: x - integer, intent(in) :: y - end - integer(8) pure function f2(x, y) - class(t1), intent(in) :: x - class(t2), intent(in) :: y - end - integer(8) pure function f3(x) - class(t1), intent(in) :: x - end - subroutine test1(x, y, a) - class(t1) :: x - integer :: y - real :: a(x .binary. y) - end - ! Resolve to operator in parent class - subroutine test2(x, y, a) - class(t2) :: x - integer :: y - real :: a(x .binary. y) - end - ! 2nd arg is passed object - subroutine test3(x, y, a) - class(t1) :: x - class(t2) :: y - real :: a(x .binary. y) - end - subroutine test4(x, y, a) - class(t1) :: x - class(t2) :: y - real :: a(.unary. x + .unary. y) - end -end -!Expect: m3.mod -!module m3 -! type::t1 -! contains -! procedure,pass(x)::p1=>f1 -! procedure::p3=>f3 -! generic::.binary.=>p1 -! generic::.unary.=>p3 -! end type -! type,extends(t1)::t2 -! contains -! procedure,pass(y)::p2=>f2 -! generic::.binary.=>p2 -! end type -!contains -! pure function f1(x,y) -! class(t1),intent(in)::x -! integer(4),intent(in)::y -! integer(8)::f1 -! end -! pure function f2(x,y) -! class(t1),intent(in)::x -! class(t2),intent(in)::y -! integer(8)::f2 -! end -! pure function f3(x) -! class(t1),intent(in)::x -! integer(8)::f3 -! end -! subroutine test1(x,y,a) -! class(t1)::x -! integer(4)::y -! real(4)::a(1_8:x%p1(y)) -! end -! subroutine test2(x,y,a) -! class(t2)::x -! integer(4)::y -! real(4)::a(1_8:x%p1(y)) -! end -! subroutine test3(x,y,a) -! class(t1)::x -! class(t2)::y -! real(4)::a(1_8:y%p2(x)) -! end -! subroutine test4(x,y,a) -! class(t1)::x -! class(t2)::y -! real(4)::a(1_8:x%p3()+y%p3()) -! end -!end diff --git a/test-lit/Semantics/namelist01.f90 b/test-lit/Semantics/namelist01.f90 deleted file mode 100644 index f659c998c7ef..000000000000 --- a/test-lit/Semantics/namelist01.f90 +++ /dev/null @@ -1,50 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test for checking namelist constraints, C8103-C8105 - -module dup - integer dupName - integer uniqueName -end module dup - -subroutine C8103a(x) - use dup, only: uniqueName, dupName - integer :: x - !ERROR: 'dupname' is already declared in this scoping unit - namelist /dupName/ x, x -end subroutine C8103a - -subroutine C8103b(y) - use dup, only: uniqueName - integer :: y - namelist /dupName/ y, y -end subroutine C8103b - -subroutine C8104a(ivar, jvar) - integer :: ivar(10,8) - integer :: jvar(*) - NAMELIST /NLIST/ ivar - !ERROR: A namelist group object 'jvar' must not be assumed-size - NAMELIST /NLIST/ jvar -end subroutine C8104a - -subroutine C8104b(ivar, jvar) - integer, dimension(*) :: jvar - !ERROR: A namelist group object 'jvar' must not be assumed-size - NAMELIST /NLIST/ ivar, jvar -end subroutine C8104b - -subroutine C8104c(jvar) - integer :: jvar(10, 3:*) - !ERROR: A namelist group object 'jvar' must not be assumed-size - NAMELIST /NLIST/ jvar -end subroutine C8104c - -module C8105 - integer, private :: x - public :: NLIST - !ERROR: A PRIVATE namelist group object 'x' must not be in a PUBLIC namelist - NAMELIST /NLIST/ x - !ERROR: A PRIVATE namelist group object 'x' must not be in a PUBLIC namelist - NAMELIST /NLIST2/ x - public :: NLIST2 -end module C8105 diff --git a/test-lit/Semantics/null01.f90 b/test-lit/Semantics/null01.f90 deleted file mode 100644 index 09c6dce22c48..000000000000 --- a/test-lit/Semantics/null01.f90 +++ /dev/null @@ -1,77 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! NULL() intrinsic function error tests - -subroutine test - interface - subroutine s0 - end subroutine - subroutine s1(j) - integer, intent(in) :: j - end subroutine - function f0() - real :: f0 - end function - function f1(x) - real :: f1 - real, intent(inout) :: x - end function - function f2(p) - import s0 - real :: f1 - procedure(s0), pointer, intent(inout) :: p - end function - function f3() - import s1 - procedure(s1), pointer :: f3 - end function - end interface - type :: dt0 - integer, pointer :: ip0 - end type dt0 - type :: dt1 - integer, pointer :: ip1(:) - end type dt1 - type :: dt2 - procedure(s0), pointer, nopass :: pps0 - end type dt2 - type :: dt3 - procedure(s1), pointer, nopass :: pps1 - end type dt3 - integer :: j - type(dt0) :: dt0x - type(dt1) :: dt1x - type(dt2) :: dt2x - type(dt3) :: dt3x - integer, pointer :: ip0, ip1(:), ip2(:,:) - integer, allocatable :: ia0, ia1(:), ia2(:,:) - real, pointer :: rp0, rp1(:) - integer, parameter :: ip0r = rank(null(mold=ip0)) - integer, parameter :: ip1r = rank(null(mold=ip1)) - integer, parameter :: ip2r = rank(null(mold=ip2)) - integer, parameter :: eight = ip0r + ip1r + ip2r + 5 - real(kind=eight) :: r8check - ip0 => null() ! ok - ip1 => null() ! ok - ip2 => null() ! ok - !ERROR: MOLD= argument to NULL() must be a pointer or allocatable - ip0 => null(mold=1) - !ERROR: MOLD= argument to NULL() must be a pointer or allocatable - ip0 => null(mold=j) - dt0x = dt0(null()) - dt0x = dt0(ip0=null()) - dt0x = dt0(ip0=null(ip0)) - dt0x = dt0(ip0=null(mold=ip0)) - !ERROR: TARGET type 'REAL(4)' is not compatible with POINTER type 'INTEGER(4)' - !ERROR: pointer 'ip0' is associated with the result of a reference to function 'null' whose pointer result has an incompatible type or shape - dt0x = dt0(ip0=null(mold=rp0)) - !ERROR: TARGET type 'REAL(4)' is not compatible with POINTER type 'INTEGER(4)' - !ERROR: pointer 'ip1' is associated with the result of a reference to function 'null' whose pointer result has an incompatible type or shape - dt1x = dt1(ip1=null(mold=rp1)) - dt2x = dt2(pps0=null()) - dt2x = dt2(pps0=null(mold=dt2x%pps0)) - !ERROR: Procedure pointer 'pps0' associated with result of reference to function 'null' that is an incompatible procedure pointer - dt2x = dt2(pps0=null(mold=dt3x%pps1)) - !ERROR: Procedure pointer 'pps1' associated with result of reference to function 'null' that is an incompatible procedure pointer - dt3x = dt3(pps1=null(mold=dt2x%pps0)) - dt3x = dt3(pps1=null(mold=dt3x%pps1)) -end subroutine test diff --git a/test-lit/Semantics/nullify01.f90 b/test-lit/Semantics/nullify01.f90 deleted file mode 100644 index 9af635f8f08c..000000000000 --- a/test-lit/Semantics/nullify01.f90 +++ /dev/null @@ -1,42 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test that NULLIFY works - -Module share - Real, Pointer :: rp - Procedure(Real), Pointer :: mprp -End Module share - -Program nullifytest -Use share - -INTEGER, PARAMETER :: maxvalue=1024 - -Type dt - Integer :: l = 3 -End Type -Type t - Type(dt),Pointer :: p -End Type - -Type(t),Allocatable :: x(:) -Type(t),Pointer :: y(:) -Type(t),Pointer :: z - -Integer, Pointer :: pi -Procedure(Real), Pointer :: prp - -Allocate(rp) -Nullify(rp) - -Allocate(x(3)) -Nullify(x(2)%p) - -Nullify(y(2)%p) - -Nullify(pi) -Nullify(prp) -Nullify(mprp) - -Nullify(z%p) - -End Program diff --git a/test-lit/Semantics/nullify02.f90 b/test-lit/Semantics/nullify02.f90 deleted file mode 100644 index 49bcc9ef5d11..000000000000 --- a/test-lit/Semantics/nullify02.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Check for semantic errors in NULLIFY statements - -INTEGER, PARAMETER :: maxvalue=1024 - -Type dt - Integer :: l = 3 -End Type -Type t - Type(dt) :: p -End Type - -Type(t),Allocatable :: x(:) - -Integer :: pi -Procedure(Real) :: prp - -Allocate(x(3)) -!ERROR: component in NULLIFY statement must have the POINTER attribute -Nullify(x(2)%p) - -!ERROR: name in NULLIFY statement must have the POINTER attribute -Nullify(pi) - -!ERROR: name in NULLIFY statement must have the POINTER attribute -Nullify(prp) - -!ERROR: name in NULLIFY statement must be a variable or procedure pointer name -Nullify(maxvalue) - -End Program diff --git a/test-lit/Semantics/omp-atomic.f90 b/test-lit/Semantics/omp-atomic.f90 deleted file mode 100644 index 760d1ee4f619..000000000000 --- a/test-lit/Semantics/omp-atomic.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! OPTIONS: -fopenmp - -! Check OpenMP 2.13.6 atomic Construct - - a = 1.0 - !$omp parallel num_threads(4) - !$omp atomic seq_cst, read - b = a - - !$omp atomic seq_cst write - a = b - !$omp end atomic - - !$omp atomic capture seq_cst - b = a - a = a + 1 - !$omp end atomic - - !$omp atomic - a = a + 1 - !$omp end parallel -end diff --git a/test-lit/Semantics/omp-clause-validity01.f90 b/test-lit/Semantics/omp-clause-validity01.f90 deleted file mode 100644 index 523b2eeb6c10..000000000000 --- a/test-lit/Semantics/omp-clause-validity01.f90 +++ /dev/null @@ -1,470 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! OPTIONS: -fopenmp - -! Check OpenMP clause validity for the following directives: -! -! 2.5 PARALLEL construct -! 2.7.1 Loop construct -! ... - -! TODO: all the internal errors - - integer :: b = 128 - integer :: c = 32 - integer, parameter :: num = 16 - real(8) :: arrayA(256), arrayB(512) - - arrayA = 1.414 - arrayB = 3.14 - N = 1024 - -! 2.5 parallel-clause -> if-clause | -! num-threads-clause | -! default-clause | -! private-clause | -! firstprivate-clause | -! shared-clause | -! copyin-clause | -! reduction-clause | -! proc-bind-clause - - !$omp parallel - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - - !ERROR: SCHEDULE clause is not allowed on the PARALLEL directive - !$omp parallel schedule(static) - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - - !ERROR: COLLAPSE clause is not allowed on the PARALLEL directive - !$omp parallel collapse(2) - do i = 1, N - do j = 1, N - a = 3.14 - enddo - enddo - !$omp end parallel - - a = 1.0 - !$omp parallel firstprivate(a) - do i = 1, N - a = 3.14 - enddo - !ERROR: NUM_THREADS clause is not allowed on the END PARALLEL directive - !$omp end parallel num_threads(4) - - !ERROR: LASTPRIVATE clause is not allowed on the PARALLEL directive - !ERROR: NUM_TASKS clause is not allowed on the PARALLEL directive - !ERROR: INBRANCH clause is not allowed on the PARALLEL directive - !$omp parallel lastprivate(a) NUM_TASKS(4) inbranch - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - - !ERROR: At most one NUM_THREADS clause can appear on the PARALLEL directive - !$omp parallel num_threads(2) num_threads(4) - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - - !ERROR: The parameter of the NUM_THREADS clause must be a positive integer expression - !$omp parallel num_threads(1-4) - do i = 1, N - a = 3.14 - enddo - !ERROR: NOWAIT clause is not allowed on the END PARALLEL directive - !$omp end parallel nowait - - !$omp parallel num_threads(num-10) - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - - !$omp parallel num_threads(b+1) - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - - !$omp parallel - do i = 1, N - enddo - !ERROR: Unmatched END TARGET directive - !$omp end target - -! 2.7.1 do-clause -> private-clause | -! firstprivate-clause | -! lastprivate-clause | -! linear-clause | -! reduction-clause | -! schedule-clause | -! collapse-clause | -! ordered-clause - - !ERROR: When SCHEDULE clause has AUTO specified, it must not have chunk size specified - !ERROR: At most one SCHEDULE clause can appear on the DO directive - !ERROR: When SCHEDULE clause has RUNTIME specified, it must not have chunk size specified - !$omp do schedule(auto, 2) schedule(runtime, 2) - do i = 1, N - a = 3.14 - enddo - - !ERROR: A modifier may not be specified in a LINEAR clause on the DO directive - !ERROR: Internal: no symbol found for 'b' - !$omp do linear(ref(b)) - do i = 1, N - a = 3.14 - enddo - - !ERROR: The NONMONOTONIC modifier can only be specified with SCHEDULE(DYNAMIC) or SCHEDULE(GUIDED) - !ERROR: The NONMONOTONIC modifier cannot be specified if an ORDERED clause is specified - !$omp do schedule(NONMONOTONIC:static) ordered - do i = 1, N - a = 3.14 - enddo - - !$omp do schedule(simd, monotonic:dynamic) - do i = 1, N - a = 3.14 - enddo - - !ERROR: The parameter of the ORDERED clause must be a constant positive integer expression - !ERROR: A loop directive may not have both a LINEAR clause and an ORDERED clause with a parameter - !ERROR: Internal: no symbol found for 'b' - !ERROR: Internal: no symbol found for 'a' - !$omp do ordered(1-1) private(b) linear(b) linear(a) - do i = 1, N - a = 3.14 - enddo - - !ERROR: The parameter of the ORDERED clause must be greater than or equal to the parameter of the COLLAPSE clause - !$omp do collapse(num-14) ordered(1) - do i = 1, N - do j = 1, N - do k = 1, N - a = 3.14 - enddo - enddo - enddo - - !$omp parallel do simd if(parallel:a>1.) - do i = 1, N - enddo - !$omp end parallel do simd - - !ERROR: Unmatched directive name modifier TARGET on the IF clause - !$omp parallel do if(target:a>1.) - do i = 1, N - enddo - !ERROR: Unmatched END SIMD directive - !$omp end simd - -! 2.7.2 sections-clause -> private-clause | -! firstprivate-clause | -! lastprivate-clause | -! reduction-clause - - !$omp parallel - !$omp sections - !$omp section - a = 0.0 - !$omp section - b = 1 - !$omp end sections nowait - !$omp end parallel - - !$omp parallel - !$omp sections - !$omp section - a = 0.0 - !ERROR: Unmatched END PARALLEL SECTIONS directive - !$omp end parallel sections - !$omp end parallel - - !$omp parallel - !$omp sections - a = 0.0 - b = 1 - !$omp section - c = 1 - d = 2 - !ERROR: NUM_THREADS clause is not allowed on the END SECTIONS directive - !$omp end sections num_threads(4) - !$omp end parallel - -! 2.11.2 parallel-sections-clause -> parallel-clause | -! sections-clause - - !$omp parallel sections num_threads(4) private(b) lastprivate(d) - a = 0.0 - !$omp section - b = 1 - c = 2 - !$omp section - d = 3 - !$omp end parallel sections - - !ERROR: At most one NUM_THREADS clause can appear on the PARALLEL SECTIONS directive - !$omp parallel sections num_threads(1) num_threads(4) - a = 0.0 - !ERROR: Unmatched END SECTIONS directive - !$omp end sections - - !$omp parallel sections - !ERROR: NOWAIT clause is not allowed on the END PARALLEL SECTIONS directive - !$omp end parallel sections nowait - -! 2.7.3 single-clause -> private-clause | -! firstprivate-clause -! end-single-clause -> copyprivate-clause | -! nowait-clause - - !$omp parallel - b = 1 - !ERROR: LASTPRIVATE clause is not allowed on the SINGLE directive - !$omp single private(a) lastprivate(c) - a = 3.14 - !ERROR: The COPYPRIVATE clause must not be used with the NOWAIT clause - !ERROR: At most one NOWAIT clause can appear on the END SINGLE directive - !$omp end single copyprivate(a) nowait nowait - c = 2 - !$omp end parallel - -! 2.7.4 workshare - - !$omp parallel - !$omp workshare - a = 1.0 - !$omp end workshare nowait - !ERROR: NUM_THREADS clause is not allowed on the WORKSHARE directive - !$omp workshare num_threads(4) - a = 1.0 - !ERROR: COPYPRIVATE clause is not allowed on the END WORKSHARE directive - !$omp end workshare nowait copyprivate(a) - !$omp end parallel - -! 2.8.1 simd-clause -> safelen-clause | -! simdlen-clause | -! linear-clause | -! aligned-clause | -! private-clause | -! lastprivate-clause | -! reduction-clause | -! collapse-clause - - a = 0.0 - !$omp simd private(b) reduction(+:a) - do i = 1, N - a = a + b + 3.14 - enddo - - !ERROR: At most one SAFELEN clause can appear on the SIMD directive - !$omp simd safelen(1) safelen(2) - do i = 1, N - a = 3.14 - enddo - - !ERROR: The parameter of the SIMDLEN clause must be a constant positive integer expression - !$omp simd simdlen(-1) - do i = 1, N - a = 3.14 - enddo - - !ERROR: The ALIGNMENT parameter of the ALIGNED clause must be a constant positive integer expression - !ERROR: Internal: no symbol found for 'b' - !$omp simd aligned(b:-2) - do i = 1, N - a = 3.14 - enddo - - !$omp parallel - !ERROR: The parameter of the SIMDLEN clause must be less than or equal to the parameter of the SAFELEN clause - !$omp simd safelen(1+1) simdlen(1+2) - do i = 1, N - a = 3.14 - enddo - !$omp end parallel - -! 2.11.1 parallel-do-clause -> parallel-clause | -! do-clause - - !ERROR: At most one PROC_BIND clause can appear on the PARALLEL DO directive - !ERROR: A modifier may not be specified in a LINEAR clause on the PARALLEL DO directive - !ERROR: Internal: no symbol found for 'b' - !$omp parallel do proc_bind(master) proc_bind(close) linear(val(b)) - do i = 1, N - a = 3.14 - enddo - -! 2.8.3 do-simd-clause -> do-clause | -! simd-clause - - !$omp parallel - !ERROR: No ORDERED clause with a parameter can be specified on the DO SIMD directive - !ERROR: NOGROUP clause is not allowed on the DO SIMD directive - !$omp do simd ordered(2) NOGROUP - do i = 1, N - do j = 1, N - a = 3.14 - enddo - enddo - !$omp end parallel - -! 2.11.4 parallel-do-simd-clause -> parallel-clause | -! do-simd-clause - - !$omp parallel do simd collapse(2) safelen(2) & - !$omp & simdlen(1) private(c) firstprivate(a) proc_bind(spread) - do i = 1, N - do j = 1, N - a = 3.14 - enddo - enddo - -! 2.9.2 taskloop -> TASKLOOP [taskloop-clause[ [,] taskloop-clause]...] -! taskloop-clause -> if-clause | -! shared-clause | -! private-clause | -! firstprivate-clause | -! lastprivate-clause | -! default-clause | -! grainsize-clause | -! num-tasks-clause | -! collapse-clause | -! final-clause | -! priority-clause | -! untied-clause | -! mergeable-clause | -! nogroup-clause - - !$omp taskloop - do i = 1, N - a = 3.14 - enddo - - !ERROR: SCHEDULE clause is not allowed on the TASKLOOP directive - !$omp taskloop schedule(static) - do i = 1, N - a = 3.14 - enddo - - !ERROR: GRAINSIZE and NUM_TASKS are mutually exclusive and may not appear on the same TASKLOOP directive - !$omp taskloop num_tasks(3) grainsize(2) - do i = 1,N - a = 3.14 - enddo - - !ERROR: At most one NUM_TASKS clause can appear on the TASKLOOP directive - !$omp taskloop num_tasks(3) num_tasks(2) - do i = 1,N - a = 3.14 - enddo - -! 2.13.1 master - - !$omp parallel - !$omp master - a=3.14 - !$omp end master - !$omp end parallel - - !$omp parallel - !ERROR: NUM_THREADS clause is not allowed on the MASTER directive - !$omp master num_threads(4) - a=3.14 - !$omp end master - !$omp end parallel - -! Standalone Directives (basic) - - !$omp taskyield - !$omp barrier - !$omp taskwait - ! !$omp target enter data map(to:arrayA) map(alloc:arrayB) - ! !$omp target update from(arrayA) to(arrayB) - ! !$omp target exit data map(from:arrayA) map(delete:arrayB) - !$omp ordered depend(source) - !ERROR: Internal: no symbol found for 'i' - !$omp ordered depend(sink:i-1) - !$omp flush (c) - !$omp cancel DO - !$omp cancellation point parallel - -! 2.13.2 critical Construct - - !ERROR: Internal: no symbol found for 'first' - !$omp critical (first) - a = 3.14 - !ERROR: Internal: no symbol found for 'first' - !$omp end critical (first) - -! 2.9.1 task-clause -> if-clause | -! final-clause | -! untied-clause | -! default-clause | -! mergeable-clause | -! private-clause | -! firstprivate-clause | -! shared-clause | -! depend-clause | -! priority-clause - - !$omp task shared(a) default(none) if(task:a > 1.) - a = 1. - !$omp end task - - !ERROR: Unmatched directive name modifier TASKLOOP on the IF clause - !$omp task private(a) if(taskloop:a.eq.1) - a = 1. - !$omp end task - - !ERROR: LASTPRIVATE clause is not allowed on the TASK directive - !ERROR: At most one FINAL clause can appear on the TASK directive - !$omp task lastprivate(b) final(a.GE.1) final(.false.) - b = 1 - !$omp end task - - !ERROR: The parameter of the PRIORITY clause must be a positive integer expression - !$omp task priority(-1) firstprivate(a) mergeable - a = 3.14 - !$omp end task - -! 2.9.3 taskloop-simd-clause -> taskloop-clause | -! simd-clause - - !$omp taskloop simd - do i = 1, N - a = 3.14 - enddo - !$omp end taskloop simd - - !ERROR: REDUCTION clause is not allowed on the TASKLOOP SIMD directive - !$omp taskloop simd reduction(+:a) - do i = 1, N - a = a + 3.14 - enddo - !ERROR: Unmatched END TASKLOOP directive - !$omp end taskloop - - !ERROR: GRAINSIZE and NUM_TASKS are mutually exclusive and may not appear on the same TASKLOOP SIMD directive - !$omp taskloop simd num_tasks(3) grainsize(2) - do i = 1,N - a = 3.14 - enddo - - !ERROR: The parameter of the SIMDLEN clause must be a constant positive integer expression - !ERROR: The ALIGNMENT parameter of the ALIGNED clause must be a constant positive integer expression - !ERROR: Internal: no symbol found for 'a' - !$omp taskloop simd simdlen(-1) aligned(a:-2) - do i = 1, N - a = 3.14 - enddo -end program diff --git a/test-lit/Semantics/omp-declarative-directive.f90 b/test-lit/Semantics/omp-declarative-directive.f90 deleted file mode 100644 index 639ed7d4d895..000000000000 --- a/test-lit/Semantics/omp-declarative-directive.f90 +++ /dev/null @@ -1,75 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! OPTIONS: -fopenmp - -! Check OpenMP declarative directives - -!TODO: all internal errors -! enable declare-reduction example after name resolution - -! 2.8.2 declare-simd - -subroutine declare_simd_1(a, b) - real(8), intent(inout) :: a, b - !ERROR: Internal: no symbol found for 'declare_simd_1' - !ERROR: Internal: no symbol found for 'a' - !$omp declare simd(declare_simd_1) aligned(a) - a = 3.14 + b -end subroutine declare_simd_1 - -module m1 - abstract interface - subroutine sub(x,y) - integer, intent(in)::x - integer, intent(in)::y - end subroutine sub - end interface -end module m1 - -subroutine declare_simd_2 - use m1 - procedure (sub) sub1 - !ERROR: Internal: no symbol found for 'sub1' - !ERROR: NOTINBRANCH and INBRANCH are mutually exclusive and may not appear on the same DECLARE SIMD directive - !$omp declare simd(sub1) inbranch notinbranch - procedure (sub), pointer::p - p=>sub1 - call p(5,10) -end subroutine declare_simd_2 - -subroutine sub1 (x,y) - integer, intent(in)::x, y - print *, x+y -end subroutine sub1 - -! 2.10.6 declare-target -! 2.15.2 threadprivate - -module m2 -contains - subroutine foo - !$omp declare target - !$omp declare target (foo, N, M) - !$omp declare target to(Q, S) link(R) - !ERROR: MAP clause is not allowed on the DECLARE TARGET directive - !$omp declare target map(from:Q) - integer, parameter :: N=10000, M=1024 - integer :: i - real :: Q(N, N), R(N,M), S(M,M) - !$omp threadprivate(i) - end subroutine foo -end module m2 - -! 2.16 declare-reduction - -! subroutine declare_red_1() -! use omp_lib -! integer :: my_var -! !$omp declare reduction (my_add_red : integer : omp_out = omp_out + omp_in) initializer (omp_priv=0) -! my_var = 0 -! !$omp parallel reduction (my_add_red : my_var) num_threads(4) -! my_var = omp_get_thread_num() + 1 -! !$omp end parallel -! print *, "sum of thread numbers is ", my_var -! end subroutine declare_red_1 - -end diff --git a/test-lit/Semantics/omp-device-constructs.f90 b/test-lit/Semantics/omp-device-constructs.f90 deleted file mode 100644 index 7973dc2ef77f..000000000000 --- a/test-lit/Semantics/omp-device-constructs.f90 +++ /dev/null @@ -1,179 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! OPTIONS: -fopenmp -! Check OpenMP clause validity for the following directives: -! 2.10 Device constructs -program main - - real(8) :: arrayA(256), arrayB(256) - integer :: N - - arrayA = 1.414 - arrayB = 3.14 - N = 256 - - !$omp target map(arrayA) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !$omp target device(0) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !ERROR: At most one DEVICE clause can appear on the TARGET directive - !$omp target device(0) device(1) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !ERROR: SCHEDULE clause is not allowed on the TARGET directive - !$omp target schedule(static) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !$omp target defaultmap(tofrom:scalar) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause - !$omp target defaultmap(tofrom) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !ERROR: At most one DEFAULTMAP clause can appear on the TARGET directive - !$omp target defaultmap(tofrom:scalar) defaultmap(tofrom:scalar) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a) - do i = 1, N - a = 3.14 - enddo - !$omp end teams - - !ERROR: At most one NUM_TEAMS clause can appear on the TEAMS directive - !$omp teams num_teams(2) num_teams(3) - do i = 1, N - a = 3.14 - enddo - !$omp end teams - - !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression - !$omp teams num_teams(-1) - do i = 1, N - a = 3.14 - enddo - !$omp end teams - - !ERROR: At most one THREAD_LIMIT clause can appear on the TEAMS directive - !$omp teams thread_limit(2) thread_limit(3) - do i = 1, N - a = 3.14 - enddo - !$omp end teams - - !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression - !$omp teams thread_limit(-1) - do i = 1, N - a = 3.14 - enddo - !$omp end teams - - !ERROR: At most one DEFAULT clause can appear on the TEAMS directive - !$omp teams default(shared) default(private) - do i = 1, N - a = 3.14 - enddo - !$omp end teams - - !$omp target map(tofrom:a) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !ERROR: Only the TO, FROM, TOFROM, or ALLOC map types are permitted for MAP clauses on the TARGET directive - !$omp target map(delete:a) - do i = 1, N - a = 3.14 - enddo - !$omp end target - - !$omp target data device(0) map(to:a) - do i = 1, N - a = 3.14 - enddo - !$omp end target data - - !ERROR: At least one MAP clause must appear on the TARGET DATA directive - !$omp target data device(0) - do i = 1, N - a = 3.14 - enddo - !$omp end target data - - !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive - !$omp target enter data map(to:a) if(.true.) if(.false.) - - !ERROR: Only the TO or ALLOC map types are permitted for MAP clauses on the TARGET ENTER DATA directive - !$omp target enter data map(from:a) - - !$omp target exit data map(delete:a) - - !ERROR: At most one DEVICE clause can appear on the TARGET EXIT DATA directive - !$omp target exit data map(from:a) device(0) device(1) - - !ERROR: Only the FROM, RELEASE, or DELETE map types are permitted for MAP clauses on the TARGET EXIT DATA directive - !$omp target exit data map(to:a) - - !$omp target - !$omp distribute - do i = 1, N - a = 3.14 - enddo - !$omp end distribute - !$omp end target - - !$omp target - !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive - !$omp distribute collapse(2) collapse(3) - do i = 1, N - do j = 1, N - do k = 1, N - a = 3.14 - enddo - enddo - enddo - !$omp end distribute - !$omp end target - - !$omp target - !$omp distribute dist_schedule(static, 2) - do i = 1, N - a = 3.14 - enddo - !$omp end distribute - !$omp end target - - !$omp target - !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive - !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3) - do i = 1, N - a = 3.14 - enddo - !$omp end distribute - !$omp end target - -end program main diff --git a/test-lit/Semantics/omp-loop-association.f90 b/test-lit/Semantics/omp-loop-association.f90 deleted file mode 100644 index 22e9365b2f3f..000000000000 --- a/test-lit/Semantics/omp-loop-association.f90 +++ /dev/null @@ -1,127 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! OPTIONS: -fopenmp - -! Check the association between OpenMPLoopConstruct and DoConstruct - - integer :: b = 128 - integer :: c = 32 - integer, parameter :: num = 16 - N = 1024 - -! Different DO loops - - !$omp parallel - !$omp do - do 10 i=1, N - a = 3.14 -10 print *, a - !$omp end parallel - - !$omp parallel do - DO CONCURRENT (i = 1:N) - a = 3.14 - END DO - - !$omp parallel do simd - outer: DO WHILE (c > 1) - inner: do while (b > 100) - a = 3.14 - b = b - 1 - enddo inner - c = c - 1 - END DO outer - - c = 16 - !ERROR: DO loop after the PARALLEL DO directive must have loop control - !$omp parallel do - do - a = 3.14 - c = c - 1 - if (c < 1) exit - enddo - -! Loop association check - - ! If an end do directive follows a do-construct in which several DO - ! statements share a DO termination statement, then a do directive - ! can only be specified for the outermost of these DO statements. - do 100 i=1, N - !$omp do - do 100 j=1, N - a = 3.14 -100 continue - !ERROR: The ENDDO directive must follow the DO loop associated with the loop construct - !$omp enddo - - !$omp parallel do copyin(a) - do i = 1, N - !$omp parallel do - do j = 1, i - enddo - !$omp end parallel do - a = 3. - enddo - !$omp end parallel do - - !$omp parallel do - do i = 1, N - enddo - !$omp end parallel do - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - - !$omp parallel - a = 3.0 - !$omp do simd - do i = 1, N - enddo - !$omp end do simd - - !$omp parallel do copyin(a) - do i = 1, N - enddo - !$omp end parallel - - a = 0.0 - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - !$omp parallel do private(c) - do i = 1, N - do j = 1, N - !ERROR: A DO loop must follow the PARALLEL DO directive - !$omp parallel do shared(b) - a = 3.14 - enddo - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - enddo - a = 1.414 - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - - do i = 1, N - !$omp parallel do - do j = 2*i*N, (2*i+1)*N - a = 3.14 - enddo - enddo - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - - !ERROR: A DO loop must follow the PARALLEL DO directive - !$omp parallel do private(c) -5 FORMAT (1PE12.4, I10) - do i=1, N - a = 3.14 - enddo - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - - !$omp parallel do simd - do i = 1, N - a = 3.14 - enddo - !$omp end parallel do simd - !ERROR: The END PARALLEL DO SIMD directive must follow the DO loop associated with the loop construct - !$omp end parallel do simd -end diff --git a/test-lit/Semantics/omp-nested01.f90 b/test-lit/Semantics/omp-nested01.f90 deleted file mode 100644 index 0e7220222217..000000000000 --- a/test-lit/Semantics/omp-nested01.f90 +++ /dev/null @@ -1,16 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!XFAIL: * -! OPTIONS: -fopenmp - -! Check OpenMP 2.17 Nesting of Regions - - N = 1024 - !$omp do - do i = 1, N - !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region - !$omp do - do i = 1, N - a = 3.14 - enddo - enddo -end diff --git a/test-lit/Semantics/omp-resolve01.f90 b/test-lit/Semantics/omp-resolve01.f90 deleted file mode 100644 index 528915e88f8d..000000000000 --- a/test-lit/Semantics/omp-resolve01.f90 +++ /dev/null @@ -1,16 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.4 An array section designates a subset of the elements in an array. Although -! Substring shares similar syntax but cannot be treated as valid array section. - - character*8 c, b - character a - - b = "HIFROMPGI" - c = b(2:7) - !ERROR: Substrings are not allowed on OpenMP directives or clauses - !$omp parallel private(c(1:3)) - a = c(1:1) - !$omp end parallel -end diff --git a/test-lit/Semantics/omp-resolve02.f90 b/test-lit/Semantics/omp-resolve02.f90 deleted file mode 100644 index 3d341662b2da..000000000000 --- a/test-lit/Semantics/omp-resolve02.f90 +++ /dev/null @@ -1,19 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -fopenmp - -! Test the effect to name resolution from illegal clause - - !a = 1.0 - b = 2 - !$omp parallel private(a) shared(b) - a = 3. - b = 4 - !ERROR: LASTPRIVATE clause is not allowed on the PARALLEL directive - !ERROR: 'a' appears in more than one data-sharing clause on the same OpenMP directive - !$omp parallel private(a) shared(b) lastprivate(a) - a = 5. - b = 6 - !$omp end parallel - !$omp end parallel - print *,a, b -end diff --git a/test-lit/Semantics/omp-resolve03.f90 b/test-lit/Semantics/omp-resolve03.f90 deleted file mode 100644 index a896ef30c9f4..000000000000 --- a/test-lit/Semantics/omp-resolve03.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.3 Although variables in common blocks can be accessed by use association -! or host association, common block names cannot. As a result, a common block -! name specified in a data-sharing attribute clause must be declared to be a -! common block in the same scoping unit in which the data-sharing attribute -! clause appears. - - common /c/ a, b - integer a(3), b - - A = 1 - B = 2 - block - !ERROR: COMMON block must be declared in the same scoping unit in which the OpenMP directive or clause appears - !$omp parallel shared(/c/) - a(1:2) = 3 - B = 4 - !$omp end parallel - end block - print *, a, b -end diff --git a/test-lit/Semantics/omp-resolve04.f90 b/test-lit/Semantics/omp-resolve04.f90 deleted file mode 100644 index 234013898b87..000000000000 --- a/test-lit/Semantics/omp-resolve04.f90 +++ /dev/null @@ -1,20 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.3 Data-Sharing Attribute Clauses -! A list item that specifies a given variable may not appear in more than -! one clause on the same directive, except that a variable may be specified -! in both firstprivate and lastprivate clauses. - - common /c/ a, b - integer a(3), b - - A = 1 - B = 2 - !ERROR: 'c' appears in more than one data-sharing clause on the same OpenMP directive - !$omp parallel shared(/c/,c) private(/c/) - a(1:2) = 3 - B = 4 - !$omp end parallel - print *, a, b, c -end diff --git a/test-lit/Semantics/omp-resolve05.f90 b/test-lit/Semantics/omp-resolve05.f90 deleted file mode 100644 index ebc50476b499..000000000000 --- a/test-lit/Semantics/omp-resolve05.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.3 Data-Sharing Attribute Clauses -! 2.15.3.1 default Clause - -subroutine default_none() - integer a(3) - - A = 1 - B = 2 - !$omp parallel default(none) private(c) - !ERROR: The DEFAULT(NONE) clause requires that 'a' must be listed in a data-sharing attribute clause - A(1:2) = 3 - !ERROR: The DEFAULT(NONE) clause requires that 'b' must be listed in a data-sharing attribute clause - B = 4 - C = 5 - !$omp end parallel -end subroutine default_none - -program mm - call default_none() - !TODO: private, firstprivate, shared -end diff --git a/test-lit/Semantics/omp-symbol01.f90 b/test-lit/Semantics/omp-symbol01.f90 deleted file mode 100644 index 70782f3adf41..000000000000 --- a/test-lit/Semantics/omp-symbol01.f90 +++ /dev/null @@ -1,69 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! Test clauses that accept list. -! 2.1 Directive Format -! A list consists of a comma-separated collection of one or more list items. -! A list item is a variable, array section or common block name (enclosed in -! slashes). - -!DEF: /md Module -module md - !DEF: /md/myty PUBLIC DerivedType - type :: myty - !DEF: /md/myty/a ObjectEntity REAL(4) - real :: a - !DEF: /md/myty/b ObjectEntity INTEGER(4) - integer :: b - end type myty -end module md -!DEF: /mm MainProgram -program mm - !REF: /md - use :: md - !DEF: /mm/c CommonBlockDetails - !DEF: /mm/x ObjectEntity REAL(4) - !DEF: /mm/y ObjectEntity REAL(4) - common /c/x, y - !REF: /mm/x - !REF: /mm/y - real x, y - !DEF: /mm/myty Use - !DEF: /mm/t ObjectEntity TYPE(myty) - type(myty) :: t - !DEF: /mm/b ObjectEntity INTEGER(4) - integer b(10) - !REF: /mm/t - !REF: /md/myty/a - t%a = 3.14 - !REF: /mm/t - !REF: /md/myty/b - t%b = 1 - !REF: /mm/b - b = 2 - !DEF: /mm/a (Implicit) ObjectEntity REAL(4) - a = 1.0 - !DEF: /mm/c (Implicit) ObjectEntity REAL(4) - c = 2.0 -!$omp parallel do private(a,t,/c/) shared(c) - !DEF: /mm/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,10 - !DEF: /mm/Block1/a (OmpPrivate) HostAssoc REAL(4) - !REF: /mm/b - !REF: /mm/Block1/i - a = a+b(i) - !DEF: /mm/Block1/t (OmpPrivate) HostAssoc TYPE(myty) - !REF: /md/myty/a - !REF: /mm/Block1/i - t%a = i - !DEF: /mm/Block1/y (OmpPrivate) HostAssoc REAL(4) - y = 0. - !DEF: /mm/Block1/x (OmpPrivate) HostAssoc REAL(4) - !REF: /mm/Block1/a - !REF: /mm/Block1/i - !REF: /mm/Block1/y - x = a+i+y - !REF: /mm/c - c = 3.0 - end do -end program diff --git a/test-lit/Semantics/omp-symbol02.f90 b/test-lit/Semantics/omp-symbol02.f90 deleted file mode 100644 index eddb6865e88c..000000000000 --- a/test-lit/Semantics/omp-symbol02.f90 +++ /dev/null @@ -1,26 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! 1.4.1 Structure of the OpenMP Memory Model - -! Test implicit declaration in the OpenMP directive enclosing scope -! through clause; also test to avoid creating multiple symbols for -! the same variable - - !DEF: /MainProgram1/b (Implicit) ObjectEntity REAL(4) - b = 2 - !DEF: /MainProgram1/c (Implicit) ObjectEntity REAL(4) - c = 0 - !$omp parallel private(a,b) shared(c,d) - !DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(4) - a = 3. - !DEF: /MainProgram1/Block1/b (OmpPrivate) HostAssoc REAL(4) - b = 4 - !REF: /MainProgram1/c - c = 5 - !DEF: /MainProgram1/d (Implicit) ObjectEntity REAL(4) - d = 6 - !$omp end parallel - !DEF: /MainProgram1/a (Implicit) ObjectEntity REAL(4) - print *, a -end program diff --git a/test-lit/Semantics/omp-symbol03.f90 b/test-lit/Semantics/omp-symbol03.f90 deleted file mode 100644 index 54072a1e1049..000000000000 --- a/test-lit/Semantics/omp-symbol03.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! 1.4.1 Structure of the OpenMP Memory Model -! In the inner OpenMP region, SHARED `a` refers to the `a` in the outer OpenMP -! region; PRIVATE `b` refers to the new `b` in the same OpenMP region - - !DEF: /MainProgram1/b (Implicit) ObjectEntity REAL(4) - b = 2 - !$omp parallel private(a) shared(b) - !DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(4) - a = 3. - !REF: /MainProgram1/b - b = 4 - !$omp parallel private(b) shared(a) - !REF: /MainProgram1/Block1/a - a = 5. - !DEF: /MainProgram1/Block1/Block1/b (OmpPrivate) HostAssoc REAL(4) - b = 6 - !$omp end parallel - !$omp end parallel - !DEF: /MainProgram1/a (Implicit) ObjectEntity REAL(4) - !REF: /MainProgram1/b - print *, a, b -end program diff --git a/test-lit/Semantics/omp-symbol04.f90 b/test-lit/Semantics/omp-symbol04.f90 deleted file mode 100644 index 052fa859cd32..000000000000 --- a/test-lit/Semantics/omp-symbol04.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.3 Data-Sharing Attribute Clauses -! Both PARALLEL and DO (worksharing) directives need to create new scope, -! so PRIVATE `a` will have new symbol in each region - - !DEF: /MainProgram1/a ObjectEntity REAL(8) - real*8 a - !REF: /MainProgram1/a - a = 3.14 - !$omp parallel private(a) - !DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(8) - a = 2. - !$omp do private(a) - !DEF: /MainProgram1/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,10 - !DEF: /MainProgram1/Block1/Block1/a (OmpPrivate) HostAssoc REAL(8) - a = 1. - end do - !$omp end parallel - !REF: /MainProgram1/a - print *, a -end program diff --git a/test-lit/Semantics/omp-symbol05.f90 b/test-lit/Semantics/omp-symbol05.f90 deleted file mode 100644 index 1a4b42e1ce32..000000000000 --- a/test-lit/Semantics/omp-symbol05.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.2 threadprivate Directive -! The threadprivate directive specifies that variables are replicated, -! with each thread having its own copy. When threadprivate variables are -! referenced in the OpenMP region, we know they are already private to -! their threads, so no new symbol needs to be created. - -!DEF: /mm Module -module mm - !$omp threadprivate (i) -contains - !DEF: /mm/foo PUBLIC (Subroutine) Subprogram - subroutine foo - !DEF: /mm/foo/a ObjectEntity INTEGER(4) - integer :: a = 3 - !$omp parallel - !REF: /mm/foo/a - a = 1 - !DEF: /mm/i PUBLIC (Implicit, OmpThreadprivate) ObjectEntity INTEGER(4) - !REF: /mm/foo/a - i = a - !$omp end parallel - !REF: /mm/foo/a - print *, a - block - !DEF: /mm/foo/Block2/i ObjectEntity REAL(4) - real i - !REF: /mm/foo/Block2/i - i = 3.14 - end block - end subroutine foo -end module mm -!DEF: /tt MainProgram -program tt - !REF: /mm - use :: mm - !DEF: /tt/foo (Subroutine) Use - call foo -end program tt diff --git a/test-lit/Semantics/omp-symbol06.f90 b/test-lit/Semantics/omp-symbol06.f90 deleted file mode 100644 index b8ac0fc06115..000000000000 --- a/test-lit/Semantics/omp-symbol06.f90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.3 Data-Sharing Attribute Clauses -! A list item that specifies a given variable may not appear in more than -! one clause on the same directive, except that a variable may be specified -! in both firstprivate and lastprivate clauses. - - !DEF: /MainProgram1/a (Implicit) ObjectEntity REAL(4) - a = 1. - !$omp parallel do firstprivate(a) lastprivate(a) - !DEF: /MainProgram1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,10 - !DEF: /MainProgram1/Block1/a (OmpFirstPrivate, OmpLastPrivate) HostAssoc REAL(4) - a = 2. - end do -end program diff --git a/test-lit/Semantics/omp-symbol07.f90 b/test-lit/Semantics/omp-symbol07.f90 deleted file mode 100644 index c6cf500b41da..000000000000 --- a/test-lit/Semantics/omp-symbol07.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! Generic tests -! 1. subroutine or function calls should not be fixed for DSA or DMA - -!DEF: /foo (Function) Subprogram REAL(4) -!DEF: /foo/rnum ObjectEntity REAL(4) -function foo(rnum) - !REF: /foo/rnum - real rnum - !REF: /foo/rnum - rnum = rnum+1. -end function foo -!DEF: /function_call_in_region EXTERNAL (Subroutine) Subprogram -subroutine function_call_in_region - implicit none - !DEF: /function_call_in_region/foo (Function) ProcEntity REAL(4) - real foo - !DEF: /function_call_in_region/a ObjectEntity REAL(4) - real :: a = 0. - !DEF: /function_call_in_region/b ObjectEntity REAL(4) - real :: b = 5. - !$omp parallel default(none) private(a) shared(b) - !DEF: /function_call_in_region/Block1/a (OmpPrivate) HostAssoc REAL(4) - !REF: /function_call_in_region/foo - !REF: /function_call_in_region/b - a = foo(b) - !$omp end parallel - !REF: /function_call_in_region/a - !REF: /function_call_in_region/b - print *, a, b -end subroutine function_call_in_region -!DEF: /mm MainProgram -program mm - !REF: /function_call_in_region - call function_call_in_region -end program mm diff --git a/test-lit/Semantics/omp-symbol08.f90 b/test-lit/Semantics/omp-symbol08.f90 deleted file mode 100644 index 3a11933ac023..000000000000 --- a/test-lit/Semantics/omp-symbol08.f90 +++ /dev/null @@ -1,252 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!OPTIONS: -fopenmp - -! 2.15.1.1 Predetermined rules for associated do-loops index variable -! a) The loop iteration variable(s) in the associated do-loop(s) of a do, -! parallel do, taskloop, or distribute construct is (are) private. -! b) The loop iteration variable in the associated do-loop of a simd construct -! with just one associated do-loop is linear with a linear-step that is the -! increment of the associated do-loop. -! c) The loop iteration variables in the associated do-loops of a simd -! construct with multiple associated do-loops are lastprivate. -! d) A loop iteration variable for a sequential loop in a parallel or task -! generating construct is private in the innermost such construct that -! encloses the loop. -! - TBD - -! All the tests assume that the do-loops association for collapse/ordered -! clause has been performed (the number of nested do-loops >= n). - -! Rule a) -! TODO: nested constructs (k should be private too) -!DEF: /test_do (Subroutine) Subprogram -subroutine test_do - implicit none - !DEF: /test_do/a ObjectEntity REAL(4) - real a(20,20,20) - !DEF: /test_do/i ObjectEntity INTEGER(4) - !DEF: /test_do/j ObjectEntity INTEGER(4) - !DEF: /test_do/k ObjectEntity INTEGER(4) - integer i, j, k -!$omp parallel - !REF: /test_do/i - i = 99 -!$omp do collapse(2) - !DEF: /test_do/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,5 - !DEF: /test_do/Block1/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do j=6,10 - !REF: /test_do/a - a(1,1,1) = 0. - !DEF: /test_do/Block1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do k=11,15 - !REF: /test_do/a - !REF: /test_do/Block1/k - !REF: /test_do/Block1/Block1/j - !REF: /test_do/Block1/Block1/i - a(k,j,i) = 1. - end do - end do - end do -!$omp end parallel -end subroutine test_do - -! Rule a) -!DEF: /test_pardo (Subroutine) Subprogram -subroutine test_pardo - implicit none - !DEF: /test_pardo/a ObjectEntity REAL(4) - real a(20,20,20) - !DEF: /test_pardo/i ObjectEntity INTEGER(4) - !DEF: /test_pardo/j ObjectEntity INTEGER(4) - !DEF: /test_pardo/k ObjectEntity INTEGER(4) - integer i, j, k -!$omp parallel do collapse(2) private(k) ordered(2) - !DEF: /test_pardo/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,5 - !DEF: /test_pardo/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do j=6,10 - !REF: /test_pardo/a - a(1,1,1) = 0. - !DEF: /test_pardo/Block1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do k=11,15 - !REF: /test_pardo/a - !REF: /test_pardo/Block1/k - !REF: /test_pardo/Block1/j - !REF: /test_pardo/Block1/i - a(k,j,i) = 1. - end do - end do - end do -end subroutine test_pardo - -! Rule a) -!DEF: /test_taskloop (Subroutine) Subprogram -subroutine test_taskloop - implicit none - !DEF: /test_taskloop/a ObjectEntity REAL(4) - real a(5,5) - !DEF: /test_taskloop/i ObjectEntity INTEGER(4) - !DEF: /test_taskloop/j ObjectEntity INTEGER(4) - integer i, j -!$omp taskloop private(j) - !DEF: /test_taskloop/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,5 - !DEF: /test_taskloop/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - !REF: /test_taskloop/Block1/i - do j=1,i - !REF: /test_taskloop/a - !REF: /test_taskloop/Block1/j - !REF: /test_taskloop/Block1/i - a(j,i) = 3.14 - end do - end do -!$omp end taskloop -end subroutine test_taskloop - -! Rule a); OpenMP 4.5 Examples teams.2.f90 -! TODO: reduction; data-mapping attributes -!DEF: /dotprod (Subroutine) Subprogram -!DEF: /dotprod/b ObjectEntity REAL(4) -!DEF: /dotprod/c ObjectEntity REAL(4) -!DEF: /dotprod/n ObjectEntity INTEGER(4) -!DEF: /dotprod/block_size ObjectEntity INTEGER(4) -!DEF: /dotprod/num_teams ObjectEntity INTEGER(4) -!DEF: /dotprod/block_threads ObjectEntity INTEGER(4) -subroutine dotprod (b, c, n, block_size, num_teams, block_threads) - implicit none - !REF: /dotprod/n - integer n - !REF: /dotprod/b - !REF: /dotprod/n - !REF: /dotprod/c - !DEF: /dotprod/sum ObjectEntity REAL(4) - real b(n), c(n), sum - !REF: /dotprod/block_size - !REF: /dotprod/num_teams - !REF: /dotprod/block_threads - !DEF: /dotprod/i ObjectEntity INTEGER(4) - !DEF: /dotprod/i0 ObjectEntity INTEGER(4) - integer block_size, num_teams, block_threads, i, i0 - !REF: /dotprod/sum - sum = 0.0e0 -!$omp target map(to:b,c) map(tofrom:sum) -!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+:sum) -!$omp distribute - !DEF: /dotprod/Block1/Block1/Block1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - !REF: /dotprod/n - !REF: /dotprod/block_size - do i0=1,n,block_size -!$omp parallel do reduction(+:sum) - !DEF: /dotprod/Block1/Block1/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - !REF: /dotprod/Block1/Block1/Block1/i0 - !DEF: /dotprod/min INTRINSIC (Function) ProcEntity - !REF: /dotprod/block_size - !REF: /dotprod/n - do i=i0,min(i0+block_size, n) - !REF: /dotprod/sum - !REF: /dotprod/b - !REF: /dotprod/Block1/Block1/Block1/Block1/i - !REF: /dotprod/c - sum = sum+b(i)*c(i) - end do - end do -!$omp end teams -!$omp end target - !REF: /dotprod/sum - print *, sum -end subroutine dotprod - -! Rule b) -! TODO: nested constructs (j, k should be private too) -!DEF: /test_simd (Subroutine) Subprogram -subroutine test_simd - implicit none - !DEF: /test_simd/a ObjectEntity REAL(4) - real a(20,20,20) - !DEF: /test_simd/i ObjectEntity INTEGER(4) - !DEF: /test_simd/j ObjectEntity INTEGER(4) - !DEF: /test_simd/k ObjectEntity INTEGER(4) - integer i, j, k -!$omp parallel do simd - !DEF: /test_simd/Block1/i (OmpLinear, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,5 - !DEF: /test_simd/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do j=6,10 - !DEF: /test_simd/Block1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do k=11,15 - !REF: /test_simd/a - !REF: /test_simd/Block1/k - !REF: /test_simd/Block1/j - !REF: /test_simd/Block1/i - a(k,j,i) = 3.14 - end do - end do - end do -end subroutine test_simd - -! Rule c) -!DEF: /test_simd_multi (Subroutine) Subprogram -subroutine test_simd_multi - implicit none - !DEF: /test_simd_multi/a ObjectEntity REAL(4) - real a(20,20,20) - !DEF: /test_simd_multi/i ObjectEntity INTEGER(4) - !DEF: /test_simd_multi/j ObjectEntity INTEGER(4) - !DEF: /test_simd_multi/k ObjectEntity INTEGER(4) - integer i, j, k -!$omp parallel do simd collapse(3) - !DEF: /test_simd_multi/Block1/i (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,5 - !DEF: /test_simd_multi/Block1/j (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do j=6,10 - !DEF: /test_simd_multi/Block1/k (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do k=11,15 - !REF: /test_simd_multi/a - !REF: /test_simd_multi/Block1/k - !REF: /test_simd_multi/Block1/j - !REF: /test_simd_multi/Block1/i - a(k,j,i) = 3.14 - end do - end do - end do -end subroutine test_simd_multi - -! Rule d) -!DEF: /test_seq_loop (Subroutine) Subprogram -subroutine test_seq_loop - implicit none - !DEF: /test_seq_loop/i ObjectEntity INTEGER(4) - !DEF: /test_seq_loop/j ObjectEntity INTEGER(4) - integer i, j - !REF: /test_seq_loop/i - i = -1 - !REF: /test_seq_loop/j - j = -1 - !$omp parallel - !REF: /test_seq_loop/i - !REF: /test_seq_loop/j - print *, i, j - !$omp parallel - !REF: /test_seq_loop/i - !DEF: /test_seq_loop/Block1/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - print *, i, j - !$omp do - !DEF: /test_seq_loop/Block1/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) - do i=1,10 - !REF: /test_seq_loop/Block1/Block1/j - do j=1,10 - end do - end do - !REF: /test_seq_loop/i - !REF: /test_seq_loop/Block1/Block1/j - print *, i, j - !$omp end parallel - !REF: /test_seq_loop/i - !REF: /test_seq_loop/j - print *, i, j - !$omp end parallel - !REF: /test_seq_loop/i - !REF: /test_seq_loop/j - print *, i, j -end subroutine test_seq_loop diff --git a/test-lit/Semantics/procinterface01.f90 b/test-lit/Semantics/procinterface01.f90 deleted file mode 100644 index b66206e24134..000000000000 --- a/test-lit/Semantics/procinterface01.f90 +++ /dev/null @@ -1,184 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Tests for "proc-interface" semantics. -! These cases are all valid. - -!DEF: /module1 Module -module module1 - abstract interface - !DEF: /module1/abstract1 PUBLIC (Function) Subprogram REAL(4) - !DEF: /module1/abstract1/x INTENT(IN) ObjectEntity REAL(4) - real function abstract1(x) - !REF: /module1/abstract1/x - real, intent(in) :: x - end function abstract1 - end interface - - interface - !DEF: /module1/explicit1 EXTERNAL, PUBLIC (Function) Subprogram REAL(4) - !DEF: /module1/explicit1/x INTENT(IN) ObjectEntity REAL(4) - real function explicit1(x) - !REF: /module1/explicit1/x - real, intent(in) :: x - end function explicit1 - !DEF: /module1/logical EXTERNAL, PUBLIC (Function) Subprogram INTEGER(4) - !DEF: /module1/logical/x INTENT(IN) ObjectEntity REAL(4) - integer function logical(x) - !REF: /module1/logical/x - real, intent(in) :: x - end function logical - !DEF: /module1/tan EXTERNAL, PUBLIC (Function) Subprogram CHARACTER(1_4,1) - !DEF: /module1/tan/x INTENT(IN) ObjectEntity REAL(4) - character(len=1) function tan(x) - !REF: /module1/tan/x - real, intent(in) :: x - end function tan - end interface - - !DEF: /module1/derived1 PUBLIC DerivedType - type :: derived1 - !REF: /module1/abstract1 - !DEF: /module1/derived1/p1 NOPASS, POINTER (Function) ProcEntity REAL(4) - !DEF: /module1/nested1 PUBLIC (Function) Subprogram REAL(4) - procedure(abstract1), pointer, nopass :: p1 => nested1 - !REF: /module1/explicit1 - !DEF: /module1/derived1/p2 NOPASS, POINTER (Function) ProcEntity REAL(4) - !REF: /module1/nested1 - procedure(explicit1), pointer, nopass :: p2 => nested1 - !DEF: /module1/derived1/p3 NOPASS, POINTER (Function) ProcEntity LOGICAL(4) - !DEF: /module1/nested2 PUBLIC (Function) Subprogram LOGICAL(4) - procedure(logical), pointer, nopass :: p3 => nested2 - !DEF: /module1/derived1/p4 NOPASS, POINTER (Function) ProcEntity LOGICAL(4) - !DEF: /module1/nested3 PUBLIC (Function) Subprogram LOGICAL(4) - procedure(logical(kind=4)), pointer, nopass :: p4 => nested3 - !DEF: /module1/derived1/p5 NOPASS, POINTER (Function) ProcEntity COMPLEX(4) - !DEF: /module1/nested4 PUBLIC (Function) Subprogram COMPLEX(4) - procedure(complex), pointer, nopass :: p5 => nested4 - !DEF: /module1/sin ELEMENTAL, INTRINSIC, PUBLIC ProcEntity - !DEF: /module1/derived1/p6 NOPASS, POINTER ProcEntity - !REF: /module1/nested1 - procedure(sin), pointer, nopass :: p6 => nested1 - !REF: /module1/sin - !DEF: /module1/derived1/p7 NOPASS, POINTER ProcEntity - !DEF: /module1/cos ELEMENTAL, INTRINSIC, PUBLIC ProcEntity - procedure(sin), pointer, nopass :: p7 => cos - !REF: /module1/tan - !DEF: /module1/derived1/p8 NOPASS, POINTER (Function) ProcEntity CHARACTER(1_4,1) - !DEF: /module1/nested5 PUBLIC (Function) Subprogram CHARACTER(1_8,1) - procedure(tan), pointer, nopass :: p8 => nested5 - end type derived1 - -contains - - !REF: /module1/nested1 - !DEF: /module1/nested1/x INTENT(IN) ObjectEntity REAL(4) - real function nested1(x) - !REF: /module1/nested1/x - real, intent(in) :: x - !DEF: /module1/nested1/nested1 ObjectEntity REAL(4) - !REF: /module1/nested1/x - nested1 = x+1. - end function nested1 - - !REF: /module1/nested2 - !DEF: /module1/nested2/x INTENT(IN) ObjectEntity REAL(4) - logical function nested2(x) - !REF: /module1/nested2/x - real, intent(in) :: x - !DEF: /module1/nested2/nested2 ObjectEntity LOGICAL(4) - !REF: /module1/nested2/x - nested2 = x/=0 - end function nested2 - - !REF: /module1/nested3 - !DEF: /module1/nested3/x INTENT(IN) ObjectEntity REAL(4) - logical function nested3(x) - !REF: /module1/nested3/x - real, intent(in) :: x - !DEF: /module1/nested3/nested3 ObjectEntity LOGICAL(4) - !REF: /module1/nested3/x - nested3 = x>0 - end function nested3 - - !REF: /module1/nested4 - !DEF: /module1/nested4/x INTENT(IN) ObjectEntity REAL(4) - complex function nested4(x) - !REF: /module1/nested4/x - real, intent(in) :: x - !DEF: /module1/nested4/nested4 ObjectEntity COMPLEX(4) - !DEF: /module1/nested4/cmplx INTRINSIC (Function) ProcEntity - !REF: /module1/nested4/x - nested4 = cmplx(x+4., 6.) - end function nested4 - - !REF: /module1/nested5 - !DEF: /module1/nested5/x INTENT(IN) ObjectEntity REAL(4) - character function nested5(x) - !REF: /module1/nested5/x - real, intent(in) :: x - !DEF: /module1/nested5/nested5 ObjectEntity CHARACTER(1_8,1) - nested5 = "a" - end function nested5 -end module module1 - -!DEF: /explicit1 ELEMENTAL (Function) Subprogram REAL(4) -!DEF: /explicit1/x INTENT(IN) ObjectEntity REAL(4) -real elemental function explicit1(x) - !REF: /explicit1/x - real, intent(in) :: x - !DEF: /explicit1/explicit1 ObjectEntity REAL(4) - !REF: /explicit1/x - explicit1 = -x -end function explicit1 - -!DEF: /logical (Function) Subprogram INTEGER(4) -!DEF: /logical/x INTENT(IN) ObjectEntity REAL(4) -integer function logical(x) - !REF: /logical/x - real, intent(in) :: x - !DEF: /logical/logical ObjectEntity INTEGER(4) - !REF: /logical/x - logical = x+3. -end function logical - -!DEF: /tan (Function) Subprogram REAL(4) -!DEF: /tan/x INTENT(IN) ObjectEntity REAL(4) -real function tan(x) - !REF: /tan/x - real, intent(in) :: x - !DEF: /tan/tan ObjectEntity REAL(4) - !REF: /tan/x - tan = x+5. -end function tan - -!DEF: /main MainProgram -program main - !REF: /module1 - use :: module1 - !DEF: /main/derived1 Use - !DEF: /main/instance ObjectEntity TYPE(derived1) - type(derived1) :: instance - !REF: /main/instance - !REF: /module1/derived1/p1 - if (instance%p1(1.)/=2.) print *, "p1 failed" - !REF: /main/instance - !REF: /module1/derived1/p2 - if (instance%p2(1.)/=2.) print *, "p2 failed" - !REF: /main/instance - !REF: /module1/derived1/p3 - if (.not.instance%p3(1.)) print *, "p3 failed" - !REF: /main/instance - !REF: /module1/derived1/p4 - if (.not.instance%p4(1.)) print *, "p4 failed" - !REF: /main/instance - !REF: /module1/derived1/p5 - if (instance%p5(1.)/=(5.,6.)) print *, "p5 failed" - !REF: /main/instance - !REF: /module1/derived1/p6 - if (instance%p6(1.)/=2.) print *, "p6 failed" - !REF: /main/instance - !REF: /module1/derived1/p7 - if (instance%p7(0.)/=1.) print *, "p7 failed" - !REF: /main/instance - !REF: /module1/derived1/p8 - if (instance%p8(1.)/="a") print *, "p8 failed" -end program main diff --git a/test-lit/Semantics/resolve01.f90 b/test-lit/Semantics/resolve01.f90 deleted file mode 100644 index eee8d662517f..000000000000 --- a/test-lit/Semantics/resolve01.f90 +++ /dev/null @@ -1,10 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -integer :: x -!ERROR: The type of 'x' has already been declared -real :: x -integer(8) :: i -parameter(i=1,j=2,k=3) -integer :: j -!ERROR: The type of 'k' has already been implicitly declared -real :: k -end diff --git a/test-lit/Semantics/resolve02.f90 b/test-lit/Semantics/resolve02.f90 deleted file mode 100644 index 0d8e83b0ed29..000000000000 --- a/test-lit/Semantics/resolve02.f90 +++ /dev/null @@ -1,16 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s - !ERROR: Declaration of 'x' conflicts with its use as internal procedure - real :: x -contains - subroutine x - end -end - -module m - !ERROR: Declaration of 'x' conflicts with its use as module procedure - real :: x -contains - subroutine x - end -end diff --git a/test-lit/Semantics/resolve03.f90 b/test-lit/Semantics/resolve03.f90 deleted file mode 100644 index 773aaab3d453..000000000000 --- a/test-lit/Semantics/resolve03.f90 +++ /dev/null @@ -1,6 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -implicit none -integer :: x -!ERROR: No explicit type declared for 'y' -y = x -end diff --git a/test-lit/Semantics/resolve04.f90 b/test-lit/Semantics/resolve04.f90 deleted file mode 100644 index 5132b9f780f6..000000000000 --- a/test-lit/Semantics/resolve04.f90 +++ /dev/null @@ -1,58 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!ERROR: No explicit type declared for 'f' -function f() - implicit none -end - -!ERROR: No explicit type declared for 'y' -subroutine s(x, y) - implicit none - integer :: x -end - -subroutine s2 - implicit none - block - !ERROR: No explicit type declared for 'i' - i = 1 - end block -contains - subroutine s3 - !ERROR: No explicit type declared for 'j' - j = 2 - end subroutine -end subroutine - -module m1 - implicit none -contains - subroutine s1 - implicit real (a-h) - a1 = 1. - h1 = 1. - !ERROR: No explicit type declared for 'i1' - i1 = 1 - !ERROR: No explicit type declared for 'z1' - z1 = 2. - contains - subroutine ss1 - implicit integer(f-j) ! overlap with host scope import is OK - a2 = 1. - h2 = 1 - i2 = 1 - !ERROR: No explicit type declared for 'z2' - z2 = 2. - contains - !ERROR: An internal subprogram may not contain an internal subprogram - subroutine sss1 - implicit none - !ERROR: No explicit type declared for 'a3' - a3 = 1. - end subroutine - end subroutine - end subroutine - subroutine s2 - !ERROR: No explicit type declared for 'b1' - b1 = 1. - end subroutine -end module diff --git a/test-lit/Semantics/resolve05.f90 b/test-lit/Semantics/resolve05.f90 deleted file mode 100644 index d1960e1808b1..000000000000 --- a/test-lit/Semantics/resolve05.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -program p - integer :: p ! this is ok -end -module m - integer :: m ! this is ok -end -submodule(m) sm - integer :: sm ! this is ok -end -module m2 - type :: t - end type - interface - subroutine s - !ERROR: Module 'm2' cannot USE itself - use m2, only: t - end subroutine - end interface -end module -subroutine s - !ERROR: 's' is already declared in this scoping unit - integer :: s -end -function f() result(res) - integer :: res - !ERROR: 'f' is already declared in this scoping unit - !ERROR: The type of 'f' has already been declared - real :: f - res = 1 -end diff --git a/test-lit/Semantics/resolve06.f90 b/test-lit/Semantics/resolve06.f90 deleted file mode 100644 index 276feb3b4ee4..000000000000 --- a/test-lit/Semantics/resolve06.f90 +++ /dev/null @@ -1,7 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -implicit none -allocatable :: x -integer :: x -!ERROR: No explicit type declared for 'y' -allocatable :: y -end diff --git a/test-lit/Semantics/resolve07.f90 b/test-lit/Semantics/resolve07.f90 deleted file mode 100644 index f2e46f42a9d1..000000000000 --- a/test-lit/Semantics/resolve07.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - integer :: x(2) - !ERROR: The dimensions of 'x' have already been declared - allocatable :: x(:) - real :: y[1:*] - !ERROR: The codimensions of 'y' have already been declared - allocatable :: y[:] -end - -subroutine s2 - target :: x(1) - !ERROR: The dimensions of 'x' have already been declared - integer :: x(2) - target :: y[1:*] - !ERROR: The codimensions of 'y' have already been declared - integer :: y[2:*] -end - -subroutine s3 - dimension :: x(4), x2(8) - !ERROR: The dimensions of 'x' have already been declared - allocatable :: x(:) - codimension :: y[*], y2[1:2,2:*] - !ERROR: The codimensions of 'y' have already been declared - allocatable :: y[:] -end - -subroutine s4 - integer, dimension(10) :: x(2,2), y -end diff --git a/test-lit/Semantics/resolve08.f90 b/test-lit/Semantics/resolve08.f90 deleted file mode 100644 index 7252c79ef033..000000000000 --- a/test-lit/Semantics/resolve08.f90 +++ /dev/null @@ -1,7 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -integer :: g(10) -f(i) = i + 1 ! statement function -g(i) = i + 2 ! mis-parsed array assignment -!ERROR: 'h' has not been declared as an array -h(i) = i + 3 -end diff --git a/test-lit/Semantics/resolve09.f90 b/test-lit/Semantics/resolve09.f90 deleted file mode 100644 index 5104a371a639..000000000000 --- a/test-lit/Semantics/resolve09.f90 +++ /dev/null @@ -1,114 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -integer :: y -procedure() :: a -procedure(real) :: b -call a ! OK - can be function or subroutine -!ERROR: Cannot call subroutine 'a' like a function -c = a() -!ERROR: Cannot call function 'b' like a subroutine -call b -!ERROR: Cannot call function 'y' like a subroutine -call y -call x -!ERROR: Cannot call subroutine 'x' like a function -z = x() -end - -subroutine s - !ERROR: Cannot call function 'f' like a subroutine - call f - !ERROR: Cannot call subroutine 's' like a function - i = s() -contains - function f() - end -end - -subroutine s2 - ! subroutine vs. function is determined by use - external :: a, b - call a() - !ERROR: Cannot call subroutine 'a' like a function - x = a() - x = b() - !ERROR: Cannot call function 'b' like a subroutine - call b() -end - -subroutine s3 - ! subroutine vs. function is determined by use, even in internal subprograms - external :: a - procedure() :: b -contains - subroutine s3a() - x = a() - call b() - end - subroutine s3b() - !ERROR: Cannot call function 'a' like a subroutine - call a() - !ERROR: Cannot call subroutine 'b' like a function - x = b() - end -end - -module m - ! subroutine vs. function is determined at end of specification part - external :: a - procedure() :: b -contains - subroutine s() - call a() - !ERROR: Cannot call subroutine 'b' like a function - x = b() - end -end - -! Call to entity in global scope, even with IMPORT, NONE -subroutine s4 - block - import, none - integer :: i - !ERROR: Use of 'm' as a procedure conflicts with its declaration - i = m() - !ERROR: Use of 'm' as a procedure conflicts with its declaration - call m() - end block -end - -! Call to entity in global scope, even with IMPORT, NONE -subroutine s5 - block - import, none - integer :: i - i = foo() - !ERROR: Cannot call function 'foo' like a subroutine - call foo() - end block -end - -subroutine s6 - call a6() -end -!ERROR: 'a6' was previously called as a subroutine -function a6() - a6 = 0.0 -end - -subroutine s7 - x = a7() -end -!ERROR: 'a7' was previously called as a function -subroutine a7() -end - -!OK: use of a8 and b8 is consistent -subroutine s8 - call a8() - x = b8() -end -subroutine a8() -end -function b8() - b8 = 0.0 -end diff --git a/test-lit/Semantics/resolve10.f90 b/test-lit/Semantics/resolve10.f90 deleted file mode 100644 index 9990935899fa..000000000000 --- a/test-lit/Semantics/resolve10.f90 +++ /dev/null @@ -1,43 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - public - type t - integer, private :: i - end type - !ERROR: The default accessibility of this module has already been declared - private !C869 -end - -subroutine s1 - !ERROR: PUBLIC statement may only appear in the specification part of a module - public !C869 -end - -subroutine s2 - !ERROR: PRIVATE attribute may only appear in the specification part of a module - integer, private :: i !C817 -end - -subroutine s3 - type t - !ERROR: PUBLIC attribute may only appear in the specification part of a module - integer, public :: i !C817 - end type -end - -module m4 - interface - module subroutine s() - end subroutine - end interface -end -submodule(m4) sm4 - !ERROR: PUBLIC statement may only appear in the specification part of a module - public !C869 - !ERROR: PUBLIC attribute may only appear in the specification part of a module - real, public :: x !C817 - type :: t - !ERROR: PRIVATE attribute may only appear in the specification part of a module - real, private :: y !C817 - end type -end diff --git a/test-lit/Semantics/resolve11.f90 b/test-lit/Semantics/resolve11.f90 deleted file mode 100644 index d94c0f8c87d1..000000000000 --- a/test-lit/Semantics/resolve11.f90 +++ /dev/null @@ -1,51 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - public i - integer, private :: j - !ERROR: The accessibility of 'i' has already been specified as PUBLIC - private i - !The accessibility of 'j' has already been specified as PRIVATE - private j -end - -module m2 - interface operator(.foo.) - module procedure ifoo - end interface - public :: operator(.foo.) - !ERROR: The accessibility of operator '.foo.' has already been specified as PUBLIC - private :: operator(.foo.) - interface operator(+) - module procedure ifoo - end interface - public :: operator(+) - !ERROR: The accessibility of 'operator(+)' has already been specified as PUBLIC - private :: operator(+) , ifoo -contains - integer function ifoo(x, y) - logical, intent(in) :: x, y - end -end module - -module m3 - type t - end type - private :: operator(.lt.) - interface operator(<) - logical function lt(x, y) - import t - type(t), intent(in) :: x, y - end function - end interface - !ERROR: The accessibility of 'operator(<)' has already been specified as PRIVATE - public :: operator(<) - interface operator(.gt.) - logical function gt(x, y) - import t - type(t), intent(in) :: x, y - end function - end interface - public :: operator(>) - !ERROR: The accessibility of 'operator(.gt.)' has already been specified as PUBLIC - private :: operator(.gt.) -end diff --git a/test-lit/Semantics/resolve12.f90 b/test-lit/Semantics/resolve12.f90 deleted file mode 100644 index 03bad9f5616f..000000000000 --- a/test-lit/Semantics/resolve12.f90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 -end - -subroutine sub -end - -use m1 -!ERROR: Error reading module file for module 'm2' -use m2 -!ERROR: 'sub' is not a module -use sub -end diff --git a/test-lit/Semantics/resolve13.f90 b/test-lit/Semantics/resolve13.f90 deleted file mode 100644 index 6fc03b1e8be0..000000000000 --- a/test-lit/Semantics/resolve13.f90 +++ /dev/null @@ -1,50 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 - integer :: x - integer, private :: y - interface operator(.foo.) - module procedure ifoo - end interface - interface operator(-) - module procedure ifoo - end interface - interface operator(.priv.) - module procedure ifoo - end interface - interface operator(*) - module procedure ifoo - end interface - private :: operator(.priv.), operator(*) -contains - integer function ifoo(x, y) - logical, intent(in) :: x, y - end -end - -use m1, local_x => x -!ERROR: 'y' is PRIVATE in 'm1' -use m1, local_y => y -!ERROR: 'z' not found in module 'm1' -use m1, local_z => z -use m1, operator(.localfoo.) => operator(.foo.) -!ERROR: Operator '.bar.' not found in module 'm1' -use m1, operator(.localbar.) => operator(.bar.) - -!ERROR: 'y' is PRIVATE in 'm1' -use m1, only: y -!ERROR: Operator '.priv.' is PRIVATE in 'm1' -use m1, only: operator(.priv.) -!ERROR: 'operator(*)' is PRIVATE in 'm1' -use m1, only: operator(*) -!ERROR: 'z' not found in module 'm1' -use m1, only: z -!ERROR: 'z' not found in module 'm1' -use m1, only: my_x => z -use m1, only: operator(.foo.) -!ERROR: Operator '.bar.' not found in module 'm1' -use m1, only: operator(.bar.) -use m1, only: operator(-) , ifoo -!ERROR: 'operator(+)' not found in module 'm1' -use m1, only: operator(+) - -end diff --git a/test-lit/Semantics/resolve14.f90 b/test-lit/Semantics/resolve14.f90 deleted file mode 100644 index 326fe8e94894..000000000000 --- a/test-lit/Semantics/resolve14.f90 +++ /dev/null @@ -1,22 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 - integer :: x - integer :: y - integer :: z -end -module m2 - real :: y - real :: z - real :: w -end - -use m1, xx => x, y => z -use m2 -volatile w -!ERROR: Cannot change CONTIGUOUS attribute on use-associated 'w' -contiguous w -!ERROR: 'z' is use-associated from module 'm2' and cannot be re-declared -integer z -!ERROR: Reference to 'y' is ambiguous -y = 1 -end diff --git a/test-lit/Semantics/resolve15.f90 b/test-lit/Semantics/resolve15.f90 deleted file mode 100644 index 1cca8ce3dd7b..000000000000 --- a/test-lit/Semantics/resolve15.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - real :: var - interface i - !ERROR: 'var' is not a subprogram - procedure :: sub, var - !ERROR: Procedure 'bad' not found - procedure :: bad - end interface - interface operator(.foo.) - !ERROR: 'var' is not a subprogram - procedure :: sub, var - !ERROR: Procedure 'bad' not found - procedure :: bad - end interface -contains - subroutine sub - end -end - -subroutine s - interface i - !ERROR: 'sub' is not a module procedure - module procedure :: sub - end interface - interface assignment(=) - !ERROR: 'sub' is not a module procedure - module procedure :: sub - end interface -contains - subroutine sub(x, y) - real, intent(out) :: x - logical, intent(in) :: y - end -end diff --git a/test-lit/Semantics/resolve16.f90 b/test-lit/Semantics/resolve16.f90 deleted file mode 100644 index 8ce084a26fe9..000000000000 --- a/test-lit/Semantics/resolve16.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - interface - subroutine sub0 - end - !ERROR: A PROCEDURE statement is only allowed in a generic interface block - procedure :: sub1, sub2 - end interface -contains - subroutine sub1 - end - subroutine sub2 - end -end diff --git a/test-lit/Semantics/resolve17.f90 b/test-lit/Semantics/resolve17.f90 deleted file mode 100644 index f9c9451dcfe2..000000000000 --- a/test-lit/Semantics/resolve17.f90 +++ /dev/null @@ -1,207 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - integer :: foo - !Note: PGI, Intel, and GNU allow this; NAG and Sun do not - !ERROR: 'foo' is already declared in this scoping unit - interface foo - end interface -end module - -module m2 - interface s - end interface -contains - !ERROR: 's' may not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic - subroutine s - end subroutine -end module - -module m3 - ! This is okay: s is generic and specific - interface s - procedure s2 - end interface - interface s - procedure s - end interface -contains - subroutine s() - end subroutine - subroutine s2(x) - end subroutine -end module - -module m4a - interface g - procedure s_real - end interface -contains - subroutine s_real(x) - end -end -module m4b - interface g - procedure s_int - end interface -contains - subroutine s_int(i) - end -end -! Generic g should merge the two use-associated ones -subroutine s4 - use m4a - use m4b - call g(123) - call g(1.2) -end - -module m5a - interface g - procedure s_real - end interface -contains - subroutine s_real(x) - end -end -module m5b - interface gg - procedure s_int - end interface -contains - subroutine s_int(i) - end -end -! Generic g should merge the two use-associated ones -subroutine s5 - use m5a - use m5b, g => gg - call g(123) - call g(1.2) -end - -module m6a - interface gg - procedure sa - end interface -contains - subroutine sa(x) - end -end -module m6b - interface gg - procedure sb - end interface -contains - subroutine sb(y) - end -end -subroutine s6 - !ERROR: Generic 'g' may not have specific procedures 'sa' and 'sb' as their interfaces are not distinguishable - use m6a, g => gg - use m6b, g => gg -end - -module m7a - interface g - procedure s1 - end interface -contains - subroutine s1(x) - end -end -module m7b - interface g - procedure s2 - end interface -contains - subroutine s2(x, y) - end -end -module m7c - interface g - procedure s3 - end interface -contains - subroutine s3(x, y, z) - end -end -! Merge the three use-associated generics -subroutine s7 - use m7a - use m7b - use m7c - call g(1.0) - call g(1.0, 2.0) - call g(1.0, 2.0, 3.0) -end - -module m8a - interface g - procedure s1 - end interface -contains - subroutine s1(x) - end -end -module m8b - interface g - procedure s2 - end interface -contains - subroutine s2(x, y) - end -end -module m8c - integer :: g -end -! If merged generic conflicts with another USE, it is an error (if it is referenced) -subroutine s8 - use m8a - use m8b - use m8c - !ERROR: Reference to 'g' is ambiguous - g = 1 -end - -module m9a - interface g - module procedure s1 - module procedure g - end interface -contains - subroutine g() - end - subroutine s1(x) - integer :: x - end -end module -module m9b - use m9a - interface g - module procedure s2 - end interface -contains - subroutine s2(x) - real :: x - end -end module -module m9c - interface g - module procedure g - end interface -contains - subroutine g(x) - real :: x - end -end module -! Merge use-associated generics that have the same symbol (s1) -subroutine s9 - use m9a - use m9b -end -! Merge use-associate generics each with specific of same name -subroutine s9c - use m9a - !ERROR: Generic interface 'g' has ambiguous specific procedures from modules 'm9a' and 'm9c' - use m9c -end diff --git a/test-lit/Semantics/resolve18.f90 b/test-lit/Semantics/resolve18.f90 deleted file mode 100644 index dff395f4bc9b..000000000000 --- a/test-lit/Semantics/resolve18.f90 +++ /dev/null @@ -1,87 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 - implicit none -contains - subroutine foo(x) - real :: x - end subroutine -end module - -!Note: PGI, Intel, GNU, and NAG allow this; Sun does not -module m2 - use m1 - implicit none - !ERROR: 'foo' may not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic - interface foo - module procedure s - end interface -contains - subroutine s(i) - integer :: i - end subroutine -end module - -subroutine foo - !ERROR: Cannot use-associate 'foo'; it is already declared in this scope - use m1 -end - -subroutine bar - !ERROR: Cannot use-associate 'bar'; it is already declared in this scope - use m1, bar => foo -end - -!OK to use-associate a type with the same name as a generic -module m3a - type :: foo - end type -end -module m3b - use m3a - interface foo - end interface -end - -! Can't have derived type and function with same name -module m4a - type :: foo - end type -contains - !ERROR: 'foo' is already declared in this scoping unit - function foo(x) - end -end -! Even if there is also a generic interface of that name -module m4b - type :: foo - end type - !ERROR: 'foo' is already declared in this scoping unit - interface foo - procedure :: foo - end interface foo -contains - function foo(x) - end -end - -! Use associating a name that is a generic and a derived type -module m5a - interface g - end interface - type g - end type -end module -module m5b - use m5a - interface g - procedure f - end interface - type(g) :: x -contains - function f(i) - end function -end module -subroutine s5 - use m5b - type(g) :: y -end diff --git a/test-lit/Semantics/resolve19.f90 b/test-lit/Semantics/resolve19.f90 deleted file mode 100644 index f28f2b45abdf..000000000000 --- a/test-lit/Semantics/resolve19.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - interface a - subroutine s(x) - real :: x - end subroutine - !ERROR: 's' is already declared in this scoping unit - subroutine s(x) - integer :: x - end subroutine - end interface -end module - -module m2 - interface s - subroutine s(x) - real :: x - end subroutine - !ERROR: 's' is already declared in this scoping unit - subroutine s(x) - integer :: x - end subroutine - end interface -end module diff --git a/test-lit/Semantics/resolve20.f90 b/test-lit/Semantics/resolve20.f90 deleted file mode 100644 index 38dbd2367fe4..000000000000 --- a/test-lit/Semantics/resolve20.f90 +++ /dev/null @@ -1,67 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - abstract interface - subroutine foo - end subroutine - end interface - - procedure() :: a - procedure(integer) :: b - procedure(foo) :: c - procedure(bar) :: d - !ERROR: 'missing' must be an abstract interface or a procedure with an explicit interface - procedure(missing) :: e - !ERROR: 'b' must be an abstract interface or a procedure with an explicit interface - procedure(b) :: f - procedure(c) :: g - external :: h - !ERROR: 'h' must be an abstract interface or a procedure with an explicit interface - procedure(h) :: i - procedure(forward) :: j - !ERROR: 'bad1' must be an abstract interface or a procedure with an explicit interface - procedure(bad1) :: k1 - !ERROR: 'bad2' must be an abstract interface or a procedure with an explicit interface - procedure(bad2) :: k2 - !ERROR: 'bad3' must be an abstract interface or a procedure with an explicit interface - procedure(bad3) :: k3 - - abstract interface - subroutine forward - end subroutine - end interface - - real :: bad1(1) - real :: bad2 - type :: bad3 - end type - - type :: m ! the name of a module can be used as a local identifier - end type m - - external :: a, b, c, d - !ERROR: EXTERNAL attribute not allowed on 'm' - external :: m - !ERROR: EXTERNAL attribute not allowed on 'foo' - external :: foo - !ERROR: EXTERNAL attribute not allowed on 'bar' - external :: bar - - !ERROR: PARAMETER attribute not allowed on 'm' - parameter(m=2) - !ERROR: PARAMETER attribute not allowed on 'foo' - parameter(foo=2) - !ERROR: PARAMETER attribute not allowed on 'bar' - parameter(bar=2) - - type, abstract :: t1 - integer :: i - contains - !ERROR: 'proc' must be an abstract interface or a procedure with an explicit interface - !ERROR: Procedure component 'p1' has invalid interface 'proc' - procedure(proc), deferred :: p1 - end type t1 - -contains - subroutine bar - end subroutine -end module diff --git a/test-lit/Semantics/resolve21.f90 b/test-lit/Semantics/resolve21.f90 deleted file mode 100644 index 764537a565f5..000000000000 --- a/test-lit/Semantics/resolve21.f90 +++ /dev/null @@ -1,44 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - type :: t - integer :: i - integer :: s1 - integer :: t - end type - !ERROR: 't' is already declared in this scoping unit - integer :: t - integer :: i, j - type(t) :: x - !ERROR: Derived type 't2' not found - type(t2) :: y - external :: v - type(t) :: v, w - external :: w - !ERROR: 'z' is not an object of derived type; it is implicitly typed - i = z%i - !ERROR: 's1' is an invalid base for a component reference - i = s1%i - !ERROR: 'j' is not an object of derived type - i = j%i - !ERROR: Component 'j' not found in derived type 't' - i = x%j - !ERROR: 'v' is an invalid base for a component reference - i = v%i - !ERROR: 'w' is an invalid base for a component reference - i = w%i - i = x%i !OK -end subroutine - -subroutine s2 - type :: t1 - integer :: i - end type - type :: t2 - type(t1) :: x - end type - type(t2) :: y - integer :: i - !ERROR: Component 'j' not found in derived type 't1' - k = y%x%j - k = y%x%i !OK -end subroutine diff --git a/test-lit/Semantics/resolve22.f90 b/test-lit/Semantics/resolve22.f90 deleted file mode 100644 index 3549ec76e777..000000000000 --- a/test-lit/Semantics/resolve22.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - !OK: interface followed by type with same name - interface t - end interface - type t - end type - type(t) :: x - x = t() -end subroutine - -subroutine s2 - !OK: type followed by interface with same name - type t - end type - interface t - end interface - type(t) :: x - x = t() -end subroutine - -subroutine s3 - type t - end type - interface t - end interface - !ERROR: 't' is already declared in this scoping unit - type t - end type - type(t) :: x - x = t() -end subroutine diff --git a/test-lit/Semantics/resolve23.f90 b/test-lit/Semantics/resolve23.f90 deleted file mode 100644 index 41644843bf1f..000000000000 --- a/test-lit/Semantics/resolve23.f90 +++ /dev/null @@ -1,13 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - type :: t - real :: y - end type -end module - -use m -implicit type(t)(x) -z = x%y !OK: x is type(t) -!ERROR: 'w' is not an object of derived type; it is implicitly typed -z = w%y -end diff --git a/test-lit/Semantics/resolve24.f90 b/test-lit/Semantics/resolve24.f90 deleted file mode 100644 index c2ce595d9054..000000000000 --- a/test-lit/Semantics/resolve24.f90 +++ /dev/null @@ -1,64 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine test1 - !ERROR: Generic interface 'foo' has both a function and a subroutine - interface foo - subroutine s1(x) - end subroutine - subroutine s2(x, y) - end subroutine - function f() - end function - end interface -end subroutine - -subroutine test2 - !ERROR: Generic interface 'foo' has both a function and a subroutine - interface foo - function f1(x) - end function - subroutine s() - end subroutine - function f2(x, y) - end function - end interface -end subroutine - -module test3 - !ERROR: Generic interface 'foo' has both a function and a subroutine - interface foo - module procedure s - module procedure f - end interface -contains - subroutine s(x) - end subroutine - function f() - end function -end module - -subroutine test4 - type foo - end type - !ERROR: Generic interface 'foo' may only contain functions due to derived type with same name - interface foo - subroutine s() - end subroutine - end interface -end subroutine - -subroutine test5 - interface foo - function f1() - end function - end interface - interface bar - subroutine s1() - end subroutine - subroutine s2(x) - end subroutine - end interface - !ERROR: Cannot call function 'foo' like a subroutine - call foo() - !ERROR: Cannot call subroutine 'bar' like a function - x = bar() -end subroutine diff --git a/test-lit/Semantics/resolve25.f90 b/test-lit/Semantics/resolve25.f90 deleted file mode 100644 index 4d3ec8c81495..000000000000 --- a/test-lit/Semantics/resolve25.f90 +++ /dev/null @@ -1,60 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - interface foo - subroutine s1(x) - real x - end - !ERROR: 's2' is not a module procedure - module procedure s2 - !ERROR: Procedure 's3' not found - procedure s3 - !ERROR: Procedure 's1' is already specified in generic 'foo' - procedure s1 - end interface - interface - subroutine s4(x,y) - real x,y - end subroutine - subroutine s2(x,y) - complex x,y - end subroutine - end interface - generic :: bar => s4 - generic :: bar => s2 - !ERROR: Procedure 's4' is already specified in generic 'bar' - generic :: bar => s4 - - generic :: operator(.foo.)=> s4 - generic :: operator(.foo.)=> s2 - !ERROR: Procedure 's4' is already specified in generic operator '.foo.' - generic :: operator(.foo.)=> s4 -end module - -module m2 - interface - integer function f(x, y) - logical, intent(in) :: x, y - end function - end interface - generic :: operator(+)=> f - !ERROR: Procedure 'f' is already specified in generic 'operator(+)' - generic :: operator(+)=> f -end - -module m3 - interface operator(.ge.) - procedure f - end interface - interface operator(>=) - !ERROR: Procedure 'f' is already specified in generic 'operator(.ge.)' - procedure f - end interface - generic :: operator(>) => f - !ERROR: Procedure 'f' is already specified in generic 'operator(>)' - generic :: operator(.gt.) => f -contains - logical function f(x, y) result(result) - logical, intent(in) :: x, y - result = .true. - end -end diff --git a/test-lit/Semantics/resolve26.f90 b/test-lit/Semantics/resolve26.f90 deleted file mode 100644 index f39366faaef0..000000000000 --- a/test-lit/Semantics/resolve26.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 - interface - module subroutine s() - end subroutine - end interface -end - -module m2 - interface - module subroutine s() - end subroutine - end interface -end - -submodule(m1) s1 -end - -!ERROR: Error reading module file for submodule 's1' of module 'm2' -submodule(m2:s1) s2 -end - -!ERROR: Error reading module file for module 'm3' -submodule(m3:s1) s3 -end diff --git a/test-lit/Semantics/resolve27.f90 b/test-lit/Semantics/resolve27.f90 deleted file mode 100644 index b10105ed9e7d..000000000000 --- a/test-lit/Semantics/resolve27.f90 +++ /dev/null @@ -1,22 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - interface - module subroutine s() - end subroutine - end interface -end - -submodule(m) s1 -end - -submodule(m) s2 -end - -submodule(m:s1) s3 - integer x -end - -!ERROR: Module 'm' already has a submodule named 's3' -submodule(m:s2) s3 - integer y -end diff --git a/test-lit/Semantics/resolve28.f90 b/test-lit/Semantics/resolve28.f90 deleted file mode 100644 index 0fd81807c97f..000000000000 --- a/test-lit/Semantics/resolve28.f90 +++ /dev/null @@ -1,56 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s - type t - end type - interface - subroutine s1 - import, none - !ERROR: IMPORT,NONE must be the only IMPORT statement in a scope - import, all - end subroutine - subroutine s2 - import :: t - !ERROR: IMPORT,NONE must be the only IMPORT statement in a scope - import, none - end subroutine - subroutine s3 - import, all - !ERROR: IMPORT,ALL must be the only IMPORT statement in a scope - import :: t - end subroutine - subroutine s4 - import :: t - !ERROR: IMPORT,ALL must be the only IMPORT statement in a scope - import, all - end subroutine - end interface -end - -module m - !ERROR: IMPORT is not allowed in a module scoping unit - import, none -end - -submodule(m) sub1 - import, all !OK -end - -submodule(m) sub2 - !ERROR: IMPORT,NONE is not allowed in a submodule scoping unit - import, none -end - -function f - !ERROR: IMPORT is not allowed in an external subprogram scoping unit - import, all -end - -subroutine sub2() - block - import, all !OK - end block -end - -!ERROR: IMPORT is not allowed in a main program scoping unit -import -end diff --git a/test-lit/Semantics/resolve29.f90 b/test-lit/Semantics/resolve29.f90 deleted file mode 100644 index d328eba594e7..000000000000 --- a/test-lit/Semantics/resolve29.f90 +++ /dev/null @@ -1,44 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - type t1 - end type - type t3 - end type - interface - subroutine s1(x) - !ERROR: 't1' from host is not accessible - import :: t1 - type(t1) :: x - integer :: t1 - end subroutine - subroutine s2() - !ERROR: 't2' not found in host scope - import :: t2 - end subroutine - subroutine s3(x, y) - !ERROR: Derived type 't1' not found - type(t1) :: x, y - end subroutine - subroutine s4(x, y) - !ERROR: 't3' from host is not accessible - import, all - type(t1) :: x - type(t3) :: y - integer :: t3 - end subroutine - end interface -contains - subroutine s5() - end - subroutine s6() - import, only: s5 - implicit none(external) - call s5() - end - subroutine s7() - import, only: t1 - implicit none(external) - !ERROR: 's5' is an external procedure without the EXTERNAL attribute in a scope with IMPLICIT NONE(EXTERNAL) - call s5() - end -end module diff --git a/test-lit/Semantics/resolve30.f90 b/test-lit/Semantics/resolve30.f90 deleted file mode 100644 index 98777124b134..000000000000 --- a/test-lit/Semantics/resolve30.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - integer x - block - import, none - !ERROR: 'x' from host scoping unit is not accessible due to IMPORT - x = 1 - end block -end - -subroutine s2 - block - import, none - !ERROR: 'y' from host scoping unit is not accessible due to IMPORT - y = 1 - end block -end - -subroutine s3 - implicit none - integer :: i, j - block - import, none - !ERROR: No explicit type declared for 'i' - real :: a(16) = [(i, i=1, 16)] - !ERROR: No explicit type declared for 'j' - data(a(j), j=1, 16) / 16 * 0.0 / - end block -end - -subroutine s4 - real :: i, j - !ERROR: Must have INTEGER type, but is REAL(4) - real :: a(16) = [(i, i=1, 16)] - data( - !ERROR: Must have INTEGER type, but is REAL(4) - a(j), & - !ERROR: Must have INTEGER type, but is REAL(4) - j=1, 16 & - ) / 16 * 0.0 / -end diff --git a/test-lit/Semantics/resolve31.f90 b/test-lit/Semantics/resolve31.f90 deleted file mode 100644 index 3c61cd0bb9dc..000000000000 --- a/test-lit/Semantics/resolve31.f90 +++ /dev/null @@ -1,68 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - integer :: t0 - !ERROR: 't0' is not a derived type - type(t0) :: x - type :: t1 - end type - type, extends(t1) :: t2 - end type - !ERROR: Derived type 't3' not found - type, extends(t3) :: t4 - end type - !ERROR: 't0' is not a derived type - type, extends(t0) :: t5 - end type -end subroutine - -module m1 - type t0 - end type -end -module m2 - type t - end type -end -module m3 - type t0 - end type -end -subroutine s2 - use m1 - use m2, t0 => t - use m3 - !ERROR: Reference to 't0' is ambiguous - type, extends(t0) :: t1 - end type -end subroutine - -module m4 - type :: t1 - private - sequence - private ! not a fatal error - end type - type :: t1a - end type - !ERROR: A sequence type may not have the EXTENDS attribute - type, extends(t1a) :: t2 - sequence - integer i - end type - type :: t3 - sequence - integer i - !ERROR: A sequence type may not have a CONTAINS statement - contains - end type -contains - subroutine s3 - type :: t1 - !ERROR: PRIVATE is only allowed in a derived type that is in a module - private - contains - !ERROR: PRIVATE is only allowed in a derived type that is in a module - private - end type - end -end diff --git a/test-lit/Semantics/resolve32.f90 b/test-lit/Semantics/resolve32.f90 deleted file mode 100644 index 317a0ad9ed12..000000000000 --- a/test-lit/Semantics/resolve32.f90 +++ /dev/null @@ -1,75 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m2 - public s2, s4 - private s3 -contains - subroutine s2 - end - subroutine s3 - end - subroutine s4 - end -end module - -module m - use m2 - external bar - interface - subroutine foo - end subroutine - end interface - integer :: i - type t1 - integer :: c - contains - !ERROR: The binding of 'a' ('missing') must be either an accessible module procedure or an external procedure with an explicit interface - procedure, nopass :: a => missing - procedure, nopass :: b => s, s2 - !ERROR: Type parameter, component, or procedure binding 'c' already defined in this type - procedure, nopass :: c - !ERROR: DEFERRED is only allowed when an interface-name is provided - procedure, nopass, deferred :: d => s - !Note: s3 not found because it's not accessible -- should we issue a message - !to that effect? - !ERROR: 's3' must be either an accessible module procedure or an external procedure with an explicit interface - procedure, nopass :: s3 - procedure, nopass :: foo - !ERROR: 'bar' must be either an accessible module procedure or an external procedure with an explicit interface - procedure, nopass :: bar - !ERROR: 'i' must be either an accessible module procedure or an external procedure with an explicit interface - procedure, nopass :: i - !ERROR: Type parameter, component, or procedure binding 'b' already defined in this type - procedure, nopass :: b => s4 - !ERROR: DEFERRED is required when an interface-name is provided - procedure(foo), nopass :: g - end type - type, abstract :: t1a ! DEFERRED valid only in ABSTRACT derived type - contains - procedure(foo), nopass, deferred :: e - procedure(s), nopass, deferred :: f - !ERROR: Type parameter, component, or procedure binding 'f' already defined in this type - procedure(foo), nopass, deferred :: f - !ERROR: 'bar' must be an abstract interface or a procedure with an explicit interface - procedure(bar), nopass, deferred :: h - end type - type t2 - integer :: i - contains - procedure, nopass :: b => s - final :: f - !ERROR: Type parameter, component, or procedure binding 'i' already defined in this type - final :: i - end type - type t3 - contains - private - procedure, nopass :: b => s - procedure, nopass, public :: f - end type -contains - subroutine s - end - subroutine f(x) - type(t2) :: x - end -end module diff --git a/test-lit/Semantics/resolve33.f90 b/test-lit/Semantics/resolve33.f90 deleted file mode 100644 index 4a37c5fb57aa..000000000000 --- a/test-lit/Semantics/resolve33.f90 +++ /dev/null @@ -1,31 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Derived type parameters - -module m - !ERROR: Duplicate type parameter name: 'a' - type t1(a, b, a) - integer, kind :: a - integer(8), len :: b - end type - !ERROR: No definition found for type parameter 'b' - type t2(a, b, c) - integer, kind :: a - integer, len :: c - end type - !ERROR: No definition found for type parameter 'b' - type t3(a, b) - integer, kind :: a - integer :: b - end type - type t4(a) - integer, kind :: a - !ERROR: 'd' is not a type parameter of this derived type - integer(8), len :: d - end type - type t5(a, b) - integer, len :: a - integer, len :: b - !ERROR: Type parameter, component, or procedure binding 'a' already defined in this type - integer, len :: a - end type -end module diff --git a/test-lit/Semantics/resolve34.f90 b/test-lit/Semantics/resolve34.f90 deleted file mode 100644 index 3405dfea3498..000000000000 --- a/test-lit/Semantics/resolve34.f90 +++ /dev/null @@ -1,134 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Extended derived types - -module m1 - type :: t1 - integer :: x - !ERROR: Component 'x' is already declared in this derived type - real :: x - end type -end - -module m2 - type :: t1 - integer :: i - end type - type, extends(t1) :: t2 - !ERROR: Component 'i' is already declared in a parent of this derived type - integer :: i - end type -end - -module m3 - type :: t1 - end type - type, extends(t1) :: t2 - integer :: i - !ERROR: 't1' is a parent type of this type and so cannot be a component - real :: t1 - end type - type, extends(t2) :: t3 - !ERROR: 't1' is a parent type of this type and so cannot be a component - real :: t1 - end type -end - -module m4 - type :: t1 - integer :: t1 - end type - !ERROR: Type cannot be extended as it has a component named 't1' - type, extends(t1) :: t2 - end type -end - -module m5 - type :: t1 - integer :: t2 - end type - type, extends(t1) :: t2 - end type - !ERROR: Type cannot be extended as it has a component named 't2' - type, extends(t2) :: t3 - end type -end - -module m6 - ! t1 can be extended if it is known as anything but t3 - type :: t1 - integer :: t3 - end type - type, extends(t1) :: t2 - end type -end -subroutine s6 - use :: m6, only: t3 => t1 - !ERROR: Type cannot be extended as it has a component named 't3' - type, extends(t3) :: t4 - end type -end -subroutine r6 - use :: m6, only: t5 => t1 - type, extends(t5) :: t6 - end type -end - -module m7 - type, private :: t1 - integer :: i1 - end type - type, extends(t1) :: t2 - integer :: i2 - integer, private :: i3 - end type -end -subroutine s7 - use m7 - type(t2) :: x - integer :: j - j = x%i2 - !ERROR: PRIVATE component 'i3' is only accessible within module 'm7' - j = x%i3 - !ERROR: PRIVATE component 't1' is only accessible within module 'm7' - j = x%t1%i1 -end - -! 7.5.4.8(2) -module m8 - type :: t - integer :: i1 - integer, private :: i2 - end type -contains - subroutine s0 - type(t) :: x - x = t(i1=2, i2=5) !OK - end -end -subroutine s8 - use m8 - type(t) :: x - !ERROR: PRIVATE component 'i2' is only accessible within module 'm8' - x = t(2, 5) - !ERROR: PRIVATE component 'i2' is only accessible within module 'm8' - x = t(i1=2, i2=5) -end - -! 7.5.4.8(2) -module m9 - interface - module subroutine s() - end subroutine - end interface - type :: t - integer :: i1 - integer, private :: i2 - end type -end -submodule(m9) sm8 -contains - module subroutine s - type(t) :: x - x = t(i1=2, i2=5) !OK - end -end diff --git a/test-lit/Semantics/resolve35.f90 b/test-lit/Semantics/resolve35.f90 deleted file mode 100644 index 7f6a8ea9492b..000000000000 --- a/test-lit/Semantics/resolve35.f90 +++ /dev/null @@ -1,134 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Construct names - -subroutine s1 - real :: foo - !ERROR: 'foo' is already declared in this scoping unit - foo: block - end block foo -end - -subroutine s2(x) - logical :: x - foo: if (x) then - end if foo - !ERROR: 'foo' is already declared in this scoping unit - foo: do i = 1, 10 - end do foo -end - -subroutine s3 - real :: a(10,10), b(10,10) - type y; end type - integer(8) :: x - !ERROR: Index name 'y' conflicts with existing identifier - forall(x=1:10, y=1:10) - a(x, y) = b(x, y) - end forall - !ERROR: Index name 'y' conflicts with existing identifier - forall(x=1:10, y=1:10) a(x, y) = b(x, y) -end - -subroutine s4 - real :: a(10), b(10) - complex :: x - integer :: i(2) - !ERROR: Must have INTEGER type, but is COMPLEX(4) - forall(x=1:10) - !ERROR: Must have INTEGER type, but is COMPLEX(4) - !ERROR: Must have INTEGER type, but is COMPLEX(4) - a(x) = b(x) - end forall - !ERROR: Must have INTEGER type, but is REAL(4) - forall(y=1:10) - !ERROR: Must have INTEGER type, but is REAL(4) - !ERROR: Must have INTEGER type, but is REAL(4) - a(y) = b(y) - end forall - !ERROR: Index variable 'i' is not scalar - forall(i=1:10) - a(i) = b(i) - end forall -end - -subroutine s6 - integer, parameter :: n = 4 - real, dimension(n) :: x - data(x(i), i=1, n) / n * 0.0 / - !ERROR: Index name 't' conflicts with existing identifier - forall(t=1:n) x(t) = 0.0 -contains - subroutine t - end -end - -subroutine s6b - integer, parameter :: k = 4 - integer :: l = 4 - forall(integer(k) :: i = 1:10) - end forall - ! C713 A scalar-int-constant-name shall be a named constant of type integer. - !ERROR: Must be a constant value - forall(integer(l) :: i = 1:10) - end forall -end - -subroutine s7 - !ERROR: 'i' is already declared in this scoping unit - do concurrent(integer::i=1:5) local(j, i) & - !ERROR: 'j' is already declared in this scoping unit - local_init(k, j) & - shared(a) - a = j + 1 - end do -end - -subroutine s8 - implicit none - !ERROR: No explicit type declared for 'i' - do concurrent(i=1:5) & - !ERROR: No explicit type declared for 'j' - local(j) & - !ERROR: No explicit type declared for 'k' - local_init(k) - end do -end - -subroutine s9 - integer :: j - !ERROR: 'i' is already declared in this scoping unit - do concurrent(integer::i=1:5) shared(i) & - shared(j) & - !ERROR: 'j' is already declared in this scoping unit - shared(j) - end do -end - -subroutine s10 - external bad1 - real, parameter :: bad2 = 1.0 - x = cos(0.) - do concurrent(i=1:2) & - !ERROR: 'bad1' may not appear in a locality-spec because it is not definable - local(bad1) & - !ERROR: 'bad2' may not appear in a locality-spec because it is not definable - local(bad2) & - !ERROR: 'bad3' may not appear in a locality-spec because it is not definable - local(bad3) & - !ERROR: 'cos' may not appear in a locality-spec because it is not definable - local(cos) - end do - do concurrent(i=1:2) & - !ERROR: The name 'bad1' must be a variable to appear in a locality-spec - shared(bad1) & - !ERROR: The name 'bad2' must be a variable to appear in a locality-spec - shared(bad2) & - !ERROR: The name 'bad3' must be a variable to appear in a locality-spec - shared(bad3) & - !ERROR: The name 'cos' must be a variable to appear in a locality-spec - shared(cos) - end do -contains - subroutine bad3 - end -end diff --git a/test-lit/Semantics/resolve36.f90 b/test-lit/Semantics/resolve36.f90 deleted file mode 100644 index 438ad1aeca92..000000000000 --- a/test-lit/Semantics/resolve36.f90 +++ /dev/null @@ -1,88 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 - interface - module subroutine sub1(arg1) - integer, intent(inout) :: arg1 - end subroutine - module integer function fun1() - end function - end interface - type t - end type - integer i -end module - -submodule(m1) s1 -contains - !ERROR: 'missing1' was not declared a separate module procedure - module procedure missing1 - end - !ERROR: 'missing2' was not declared a separate module procedure - module subroutine missing2 - end - !ERROR: 't' was not declared a separate module procedure - module procedure t - end - !ERROR: 'i' was not declared a separate module procedure - module subroutine i - end -end submodule - -module m2 - interface - module subroutine sub1(arg1) - integer, intent(inout) :: arg1 - end subroutine - module integer function fun1() - end function - end interface - type t - end type - !ERROR: Declaration of 'i' conflicts with its use as module procedure - integer i -contains - !ERROR: 'missing1' was not declared a separate module procedure - module procedure missing1 - end - !ERROR: 'missing2' was not declared a separate module procedure - module subroutine missing2 - end - !ERROR: 't' is already declared in this scoping unit - !ERROR: 't' was not declared a separate module procedure - module procedure t - end - !ERROR: 'i' was not declared a separate module procedure - module subroutine i - end -end module - -! Separate module procedure defined in same module as declared -module m3 - interface - module subroutine sub - end subroutine - end interface -contains - module procedure sub - end procedure -end module - -! Separate module procedure defined in a submodule -module m4 - interface - module subroutine a - end subroutine - module subroutine b - end subroutine - end interface -end module -submodule(m4) s4a -contains - module procedure a - end procedure -end submodule -submodule(m4:s4a) s4b -contains - module procedure b - end procedure -end diff --git a/test-lit/Semantics/resolve37.f90 b/test-lit/Semantics/resolve37.f90 deleted file mode 100644 index a07ebbc6625b..000000000000 --- a/test-lit/Semantics/resolve37.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C701 The type-param-value for a kind type parameter shall be a constant -! expression. This constraint looks like a mistake in the standard. -integer, parameter :: k = 8 -real, parameter :: l = 8.0 -integer :: n = 2 -!ERROR: Must be a constant value -parameter(m=n) -integer(k) :: x -! C713 A scalar-int-constant-name shall be a named constant of type integer. -!ERROR: Must have INTEGER type, but is REAL(4) -integer(l) :: y -!ERROR: Must be a constant value -integer(n) :: z -type t(k) - integer, kind :: k -end type -!ERROR: Type parameter 'k' lacks a value and has no default -type(t( & -!ERROR: Must have INTEGER type, but is LOGICAL(4) - .true.)) :: w -!ERROR: Must have INTEGER type, but is REAL(4) -real :: u(l*2) -!ERROR: Must have INTEGER type, but is REAL(4) -character(len=l) :: v -!ERROR: Initialization expression for PARAMETER 'o' (o) cannot be computed as a constant value -real, parameter :: o = o -!ERROR: Must be a constant value -integer, parameter :: p = 0/0 -!ERROR: Must be a constant value -integer, parameter :: q = 1+2*(1/0) -!ERROR: Must be a constant value -integer(kind=2/0) r -integer, parameter :: sok(*)=[1,2]/[1,2] -!ERROR: Must be a constant value -integer, parameter :: snok(*)=[1,2]/[1,0] -end diff --git a/test-lit/Semantics/resolve38.f90 b/test-lit/Semantics/resolve38.f90 deleted file mode 100644 index 53e8db813380..000000000000 --- a/test-lit/Semantics/resolve38.f90 +++ /dev/null @@ -1,128 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C772 -module m1 - type t1 - contains - procedure, nopass :: s1 - !ERROR: Binding name 's2' not found in this derived type - generic :: g1 => s2 - end type - type t2 - integer :: s1 - contains - !ERROR: 's1' is not the name of a specific binding of this type - generic :: g2 => s1 - end type -contains - subroutine s1 - end -end - -module m2 - type :: t3 - contains - private - procedure, nopass :: s3 - generic, public :: g3 => s3 - generic :: h3 => s3 - end type -contains - subroutine s3(i) - end -end - -! C771 -module m3 - use m2 - type, extends(t3) :: t4 - contains - procedure, nopass :: s4 - procedure, nopass :: s5 - !ERROR: 'g3' does not have the same accessibility as its previous declaration - generic, private :: g3 => s4 - !ERROR: 'h3' does not have the same accessibility as its previous declaration - generic, public :: h3 => s4 - generic :: i3 => s4 - !ERROR: 'i3' does not have the same accessibility as its previous declaration - generic, private :: i3 => s5 - end type - type :: t5 - contains - private - procedure, nopass :: s3 - procedure, nopass :: s4 - procedure, nopass :: s5 - generic :: g5 => s3, s4 - !ERROR: 'g5' does not have the same accessibility as its previous declaration - generic, public :: g5 => s5 - end type -contains - subroutine s4(r) - end - subroutine s5(z) - complex :: z - end -end - -! Test forward reference in type-bound generic to binding is allowed -module m4 - type :: t1 - contains - generic :: g => s1 - generic :: g => s2 - procedure, nopass :: s1 - procedure, nopass :: s2 - end type - type :: t2 - contains - generic :: g => p1 - generic :: g => p2 - procedure, nopass :: p1 => s1 - procedure, nopass :: p2 => s2 - end type -contains - subroutine s1() - end - subroutine s2(x) - end -end - -! C773 - duplicate binding names -module m5 - type :: t1 - contains - generic :: g => s1 - generic :: g => s2 - procedure, nopass :: s1 - procedure, nopass :: s2 - !ERROR: Binding name 's1' was already specified for generic 'g' - generic :: g => s1 - end type -contains - subroutine s1() - end - subroutine s2(x) - end -end - -module m6 - type t - contains - procedure :: f1 - procedure :: f2 - generic :: operator(.eq.) => f1 - !ERROR: Binding name 'f1' was already specified for generic 'operator(.eq.)' - generic :: operator(==) => f2, f1 - end type -contains - logical function f1(x, y) result(result) - class(t), intent(in) :: x - real, intent(in) :: y - result = .true. - end - logical function f2(x, y) result(result) - class(t), intent(in) :: x - integer, intent(in) :: y - result = .true. - end -end diff --git a/test-lit/Semantics/resolve39.f90 b/test-lit/Semantics/resolve39.f90 deleted file mode 100644 index d0052f16f863..000000000000 --- a/test-lit/Semantics/resolve39.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - implicit none - real(8) :: x = 2.0 - !ERROR: The associate name 'a' is already used in this associate statement - associate(a => x, b => x+1, a => x+2) - x = b - end associate - !ERROR: No explicit type declared for 'b' - x = b -end - -subroutine s2 - !ERROR: Associate name 'a' must have a type - associate (a => z'1') - end associate -end - -subroutine s3 -! Test that associated entities are not preventing to fix -! mis-parsed function references into array references - real :: a(10) - associate (b => a(2:10:2)) - ! Check no complains about "Use of 'b' as a procedure" - print *, b(1) ! OK - end associate - associate (c => a(2:10:2)) - ! Check the function reference has been fixed to an array reference - !ERROR: Reference to array 'c' with empty subscript list - print *, c() - end associate -end diff --git a/test-lit/Semantics/resolve40.f90 b/test-lit/Semantics/resolve40.f90 deleted file mode 100644 index 95c2c9e8034c..000000000000 --- a/test-lit/Semantics/resolve40.f90 +++ /dev/null @@ -1,91 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - namelist /nl/x - block - !ERROR: NAMELIST statement is not allowed in a BLOCK construct - namelist /nl/y - end block -end - -subroutine s2 - open(12, file='nl.out') - !ERROR: Namelist group 'nl' not found - write(12, nml=nl) -end - -subroutine s3 - real :: x - open(12, file='nl.out') - !ERROR: 'x' is not the name of a namelist group - write(12, nml=x) -end - -module m4 - real :: x - namelist /nl/x -end -subroutine s4a - use m4 - namelist /nl2/x - open(12, file='nl.out') - write(12, nml=nl) - write(12, nml=nl2) -end -subroutine s4b - use m4 - real :: y - !ERROR: 'nl' is already declared in this scoping unit - namelist /nl/y -end - -subroutine s5 - namelist /nl/x - !ERROR: The type of 'x' has already been implicitly declared - integer x -end - -subroutine s6 - !ERROR: 's6' is not a variable - namelist /nl/ s6 - !ERROR: 'f' is not a variable - namelist /nl/ f -contains - integer function f() - f = 1 - end -end - -subroutine s7 - real x - namelist /nl/ x - !ERROR: EXTERNAL attribute not allowed on 'x' - external x -end - -subroutine s8 - data x/1.0/ - !ERROR: The type of 'x' has already been implicitly declared - integer x -end - -subroutine s9 - real :: x(4) - !ERROR: 'i' is already declared in this scoping unit - data ((x(i,i),i=1,2),i=1,2)/4*0.0/ -end - -module m10 - integer :: x - public :: nl - namelist /nl/ x -end - -subroutine s11 - integer :: nl2 - !ERROR: 'nl2' is already declared in this scoping unit - namelist /nl2/x - namelist /nl3/x - !ERROR: 'nl3' is already declared in this scoping unit - integer :: nl3 - nl2 = 1 -end diff --git a/test-lit/Semantics/resolve41.f90 b/test-lit/Semantics/resolve41.f90 deleted file mode 100644 index e2bf877016ed..000000000000 --- a/test-lit/Semantics/resolve41.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m - implicit none - real, parameter :: a = 8.0 - !ERROR: Must have INTEGER type, but is REAL(4) - integer :: aa = 2_a - integer :: b = 8 - ! C713 A scalar-int-constant-name shall be a named constant of type integer. - !ERROR: Must be a constant value - integer :: bb = 2_b - !TODO: should get error -- not scalar - !integer, parameter :: c(10) = 8 - !integer :: cc = 2_c - integer, parameter :: d = 47 - !ERROR: INTEGER(KIND=47) is not a supported type - integer :: dd = 2_d - !ERROR: Parameter 'e' not found - integer :: ee = 2_e - !ERROR: Missing initialization for parameter 'f' - integer, parameter :: f - integer :: ff = 2_f - !ERROR: REAL(KIND=23) is not a supported type - real(d/2) :: g - !ERROR: REAL*47 is not a supported type - real*47 :: h - !ERROR: COMPLEX*47 is not a supported type - complex*47 :: i -end diff --git a/test-lit/Semantics/resolve42.f90 b/test-lit/Semantics/resolve42.f90 deleted file mode 100644 index 5b6ac9f88b2b..000000000000 --- a/test-lit/Semantics/resolve42.f90 +++ /dev/null @@ -1,114 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1 - !ERROR: Array 'z' without ALLOCATABLE or POINTER attribute must have explicit shape - common x, y(4), z(:) -end - -subroutine s2 - common /c1/ x, y, z - !ERROR: 'y' is already in a COMMON block - common y -end - -subroutine s3 - procedure(real) :: x - !ERROR: 'x' is already declared as a procedure - common x - common y - !ERROR: 'y' is already declared as an object - procedure(real) :: y -end - -subroutine s5 - integer x(2) - !ERROR: The dimensions of 'x' have already been declared - common x(4), y(4) - !ERROR: The dimensions of 'y' have already been declared - real y(2) -end - -function f6(x) result(r) - !ERROR: Dummy argument 'x' may not appear in a COMMON block - !ERROR: ALLOCATABLE object 'y' may not appear in a COMMON block - common x,y,z - allocatable y - !ERROR: Function result 'r' may not appear in a COMMON block - common r -end - -module m7 - !ERROR: Variable 'w' with BIND attribute may not appear in a COMMON block - !ERROR: Variable 'z' with BIND attribute may not appear in a COMMON block - common w,z - integer, bind(c) :: z - integer, bind(c,name="w") :: w -end - -module m8 - type t - end type - class(*), pointer :: x - !ERROR: Unlimited polymorphic pointer 'x' may not appear in a COMMON block - !ERROR: Unlimited polymorphic pointer 'y' may not appear in a COMMON block - common x, y - class(*), pointer :: y -end - -module m9 - integer x -end -subroutine s9 - use m9 - !ERROR: 'x' is use-associated from module 'm9' and cannot be re-declared - common x -end - -module m10 - type t - end type - type(t) :: x - !ERROR: Derived type 'x' in COMMON block must have the BIND or SEQUENCE attribute - common x -end - -module m11 - type t1 - sequence - integer, allocatable :: a - end type - type t2 - sequence - type(t1) :: b - integer:: c - end type - type(t2) :: x2 - !ERROR: Derived type variable 'x2' may not appear in a COMMON block due to ALLOCATABLE component - common x2 -end - -module m12 - type t1 - sequence - integer :: a = 123 - end type - type t2 - sequence - type(t1) :: b - integer:: c - end type - type(t2) :: x2 - !ERROR: Derived type variable 'x2' may not appear in a COMMON block due to component with default initialization - common x2 -end - -subroutine s13 - block - !ERROR: COMMON statement is not allowed in a BLOCK construct - common x - end block -end - -subroutine s14 - !ERROR: 'c' appears as a COMMON block in a BIND statement but not in a COMMON statement - bind(c) :: /c/ -end diff --git a/test-lit/Semantics/resolve43.f90 b/test-lit/Semantics/resolve43.f90 deleted file mode 100644 index 385dfedc34bd..000000000000 --- a/test-lit/Semantics/resolve43.f90 +++ /dev/null @@ -1,46 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Error tests for structure constructors. -! Errors caught by expression resolution are tested elsewhere; these are the -! errors meant to be caught by name resolution, as well as acceptable use -! cases. -! Type parameters are used to make the parses unambiguous. - -module module1 - type :: type1(j) - integer, kind :: j - integer :: n = 1 - end type type1 - type, extends(type1) :: type2(k) - integer, kind :: k - integer :: m - end type type2 - type :: privaten(j) - integer, kind :: j - integer, private :: n - end type privaten - contains - subroutine type1arg(x) - type(type1(0)), intent(in) :: x - end subroutine type1arg - subroutine type2arg(x) - type(type2(0,0)), intent(in) :: x - end subroutine type2arg - subroutine errors - call type1arg(type1(0)()) - call type1arg(type1(0)(1)) - call type1arg(type1(0)(n=1)) - !ERROR: Keyword 'bad=' does not name a component of derived type 'type1' - call type1arg(type1(0)(bad=1)) - call type2arg(type2(0,0)(n=1,m=2)) - call type2arg(type2(0,0)(m=2)) - call type2arg(type2(0,0)(type1=type1(0)(n=1),m=2)) - call type2arg(type2(0,0)(type1=type1(0)(),m=2)) - end subroutine errors -end module module1 - -module module2 - !ERROR: No definition found for type parameter 'k' - type :: type1(k) - end type - type(type1):: x -end module diff --git a/test-lit/Semantics/resolve44.f90 b/test-lit/Semantics/resolve44.f90 deleted file mode 100644 index dd082adc89df..000000000000 --- a/test-lit/Semantics/resolve44.f90 +++ /dev/null @@ -1,45 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Error tests for recursive use of derived types. - -program main - type :: recursive1 - !ERROR: Recursive use of the derived type requires POINTER or ALLOCATABLE - type(recursive1) :: bad1 - type(recursive1), pointer :: ok1 - type(recursive1), allocatable :: ok2 - !ERROR: Recursive use of the derived type requires POINTER or ALLOCATABLE - !ERROR: CLASS entity 'bad2' must be a dummy argument or have ALLOCATABLE or POINTER attribute - class(recursive1) :: bad2 - class(recursive1), pointer :: ok3 - class(recursive1), allocatable :: ok4 - end type recursive1 - type :: recursive2(kind,len) - integer, kind :: kind - integer, len :: len - !ERROR: Recursive use of the derived type requires POINTER or ALLOCATABLE - type(recursive2(kind,len)) :: bad1 - type(recursive2(kind,len)), pointer :: ok1 - type(recursive2(kind,len)), allocatable :: ok2 - !ERROR: Recursive use of the derived type requires POINTER or ALLOCATABLE - !ERROR: CLASS entity 'bad2' must be a dummy argument or have ALLOCATABLE or POINTER attribute - class(recursive2(kind,len)) :: bad2 - class(recursive2(kind,len)), pointer :: ok3 - class(recursive2(kind,len)), allocatable :: ok4 - end type recursive2 - type :: recursive3(kind,len) - integer, kind :: kind = 1 - integer, len :: len = 2 - !ERROR: Recursive use of the derived type requires POINTER or ALLOCATABLE - type(recursive3) :: bad1 - type(recursive3), pointer :: ok1 - type(recursive3), allocatable :: ok2 - !ERROR: Recursive use of the derived type requires POINTER or ALLOCATABLE - !ERROR: CLASS entity 'bad2' must be a dummy argument or have ALLOCATABLE or POINTER attribute - class(recursive3) :: bad2 - class(recursive3), pointer :: ok3 - class(recursive3), allocatable :: ok4 - end type recursive3 - !ERROR: Derived type 'recursive4' cannot extend itself - type, extends(recursive4) :: recursive4 - end type recursive4 -end program main diff --git a/test-lit/Semantics/resolve45.f90 b/test-lit/Semantics/resolve45.f90 deleted file mode 100644 index e28dc33c4e72..000000000000 --- a/test-lit/Semantics/resolve45.f90 +++ /dev/null @@ -1,63 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -function f1(x, y) - integer x - !ERROR: SAVE attribute may not be applied to dummy argument 'x' - !ERROR: SAVE attribute may not be applied to dummy argument 'y' - save x,y - integer y - !ERROR: SAVE attribute may not be applied to function result 'f1' - save f1 -end - -function f2(x, y) - !ERROR: SAVE attribute may not be applied to function result 'f2' - real, save :: f2 - !ERROR: SAVE attribute may not be applied to dummy argument 'x' - complex, save :: x - allocatable :: y - !ERROR: SAVE attribute may not be applied to dummy argument 'y' - integer, save :: y -end - -subroutine s3(x) - !ERROR: SAVE attribute may not be applied to dummy argument 'x' - procedure(integer), pointer, save :: x - !ERROR: Procedure 'y' with SAVE attribute must also have POINTER attribute - procedure(integer), save :: y -end - -subroutine s4 - !ERROR: Explicit SAVE of 'z' is redundant due to global SAVE statement - save z - save - procedure(integer), pointer :: x - !ERROR: Explicit SAVE of 'x' is redundant due to global SAVE statement - save :: x - !ERROR: Explicit SAVE of 'y' is redundant due to global SAVE statement - integer, save :: y -end - -subroutine s5 - implicit none - integer x - block - !ERROR: No explicit type declared for 'x' - save x - end block -end - -subroutine s6 - save x - save y - !ERROR: SAVE attribute was already specified on 'y' - integer, save :: y - integer, save :: z - !ERROR: SAVE attribute was already specified on 'x' - !ERROR: SAVE attribute was already specified on 'z' - save x,z -end - -subroutine s7 - !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement - save /x/ -end diff --git a/test-lit/Semantics/resolve46.f90 b/test-lit/Semantics/resolve46.f90 deleted file mode 100644 index 181ccfb5c280..000000000000 --- a/test-lit/Semantics/resolve46.f90 +++ /dev/null @@ -1,22 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C1030 - pointers to intrinsic procedures -program main - intrinsic :: cos ! a specific & generic intrinsic name - intrinsic :: alog10 ! a specific intrinsic name, not generic - intrinsic :: null ! a weird special case - intrinsic :: bessel_j0 ! generic intrinsic, not specific - intrinsic :: amin0 - !ERROR: 'haltandcatchfire' is not a known intrinsic procedure - intrinsic :: haltandcatchfire - procedure(sin), pointer :: p - p => alog ! valid use of an unrestricted specific intrinsic - p => alog10 ! ditto, but already declared intrinsic - p => cos ! ditto, but also generic - p => tan ! a generic & an unrestricted specific, not already declared - !ERROR: Procedure pointer 'p' associated with incompatible procedure designator 'amin0' - p => amin0 - !ERROR: Procedure pointer 'p' associated with incompatible procedure designator 'amin1' - p => amin1 - !ERROR: 'bessel_j0' is not a specific intrinsic procedure - p => bessel_j0 -end program main diff --git a/test-lit/Semantics/resolve47.f90 b/test-lit/Semantics/resolve47.f90 deleted file mode 100644 index 04dab5616855..000000000000 --- a/test-lit/Semantics/resolve47.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -module m1 - !ERROR: Logical constant '.true.' may not be used as a defined operator - interface operator(.TRUE.) - end interface - !ERROR: Logical constant '.false.' may not be used as a defined operator - generic :: operator(.false.) => bar -end - -module m2 - interface operator(+) - module procedure foo - end interface - interface operator(.foo.) - module procedure foo - end interface - interface operator(.ge.) - module procedure bar - end interface -contains - integer function foo(x, y) - logical, intent(in) :: x, y - foo = 0 - end - logical function bar(x, y) - complex, intent(in) :: x, y - bar = .false. - end -end - -!ERROR: Intrinsic operator '.le.' may not be used as a defined operator -use m2, only: operator(.le.) => operator(.ge.) -!ERROR: Intrinsic operator '.not.' may not be used as a defined operator -use m2, only: operator(.not.) => operator(.foo.) -!ERROR: Logical constant '.true.' may not be used as a defined operator -use m2, only: operator(.true.) => operator(.foo.) -end diff --git a/test-lit/Semantics/resolve48.f90 b/test-lit/Semantics/resolve48.f90 deleted file mode 100644 index 887505d16442..000000000000 --- a/test-lit/Semantics/resolve48.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test correct use-association of a derived type. -module m1 - implicit none - type :: t - end type -end module -module m2 - use m1, only: t -end module -module m3 - use m2 - type(t) :: o -end - -! Test access-stmt with generic interface and type of same name. -module m4 - private - public :: t1, t2 - type :: t2 - end type - interface t1 - module procedure init1 - end interface - interface t2 - module procedure init2 - end interface - type :: t1 - end type -contains - type(t1) function init1() - end function - type(t2) function init2() - end function -end module diff --git a/test-lit/Semantics/resolve49.f90 b/test-lit/Semantics/resolve49.f90 deleted file mode 100644 index 97d2cbdb1267..000000000000 --- a/test-lit/Semantics/resolve49.f90 +++ /dev/null @@ -1,45 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test section subscript -program p1 - real :: a(10,10) - real :: b(5,5) - real :: c - integer :: n - n = 2 - b = a(1:10:n,1:n+3) -end - -! Test substring -program p2 - character :: a(10) - character :: b(5) - integer :: n - n = 3 - b = a(n:7) - b = a(n+3:) - b = a(:n+2) - a(n:7) = b - a(n+3:) = b - a(:n+2) = b -end - -! Test pointer assignment with bounds -program p3 - integer, pointer :: a(:,:) - integer, target :: b(2,2) - integer :: n - n = 2 - a(n:,n:) => b - a(1:n,1:n) => b -end - -! Test pointer assignment to array element -program p4 - type :: t - real, pointer :: a - end type - type(t) :: x(10) - integer :: i - real, target :: y - x(i)%a => y -end program diff --git a/test-lit/Semantics/resolve50.f90 b/test-lit/Semantics/resolve50.f90 deleted file mode 100644 index 34d6f1c1d5d5..000000000000 --- a/test-lit/Semantics/resolve50.f90 +++ /dev/null @@ -1,30 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test coarray association in CHANGE TEAM statement - -subroutine s1 - use iso_fortran_env - type(team_type) :: t - complex :: x[*] - real :: y[*] - real :: z - ! OK - change team(t, x[*] => y) - end team - ! C1116 - !ERROR: Selector in coarray association must name a coarray - change team(t, x[*] => 1) - end team - !ERROR: Selector in coarray association must name a coarray - change team(t, x[*] => z) - end team -end - -subroutine s2 - use iso_fortran_env - type(team_type) :: t - real :: y[10,*], y2[*], x[*] - ! C1113 - !ERROR: The codimensions of 'x' have already been declared - change team(t, x[10,*] => y, x[*] => y2) - end team -end diff --git a/test-lit/Semantics/resolve51.f90 b/test-lit/Semantics/resolve51.f90 deleted file mode 100644 index de763ef49911..000000000000 --- a/test-lit/Semantics/resolve51.f90 +++ /dev/null @@ -1,18 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test SELECT TYPE errors: C1157 - -subroutine s1() - type :: t - end type - procedure(f) :: ff - !ERROR: Selector is not a named variable: 'associate-name =>' is required - select type(ff()) - class is(t) - class default - end select -contains - function f() - class(t), pointer :: f - f => null() - end function -end subroutine diff --git a/test-lit/Semantics/resolve52.f90 b/test-lit/Semantics/resolve52.f90 deleted file mode 100644 index 846b412f05ca..000000000000 --- a/test-lit/Semantics/resolve52.f90 +++ /dev/null @@ -1,133 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Tests for C760: -! The passed-object dummy argument shall be a scalar, nonpointer, nonallocatable -! dummy data object with the same declared type as the type being defined; -! all of its length type parameters shall be assumed; it shall be polymorphic -! (7.3.2.3) if and only if the type being defined is extensible (7.5.7). -! It shall not have the VALUE attribute. - -module m1 - type :: t - procedure(real), pointer, nopass :: a - !ERROR: Procedure component 'b' must have NOPASS attribute or explicit interface - procedure(real), pointer :: b - end type -end - -module m2 - type :: t - !ERROR: Procedure component 'a' with no dummy arguments must have NOPASS attribute - procedure(s1), pointer :: a - !ERROR: Procedure component 'b' with no dummy arguments must have NOPASS attribute - procedure(s1), pointer, pass :: b - contains - !ERROR: Procedure binding 'p1' with no dummy arguments must have NOPASS attribute - procedure :: p1 => s1 - !ERROR: Procedure binding 'p2' with no dummy arguments must have NOPASS attribute - procedure, pass :: p2 => s1 - end type -contains - subroutine s1() - end -end - -module m3 - type :: t - !ERROR: 'y' is not a dummy argument of procedure interface 's' - procedure(s), pointer, pass(y) :: a - contains - !ERROR: 'z' is not a dummy argument of procedure interface 's' - procedure, pass(z) :: p => s - end type -contains - subroutine s(x) - class(t) :: x - end -end - -module m4 - type :: t - !ERROR: Passed-object dummy argument 'x' of procedure 'a' may not have the POINTER attribute - procedure(s1), pointer :: a - !ERROR: Passed-object dummy argument 'x' of procedure 'b' may not have the ALLOCATABLE attribute - procedure(s2), pointer, pass(x) :: b - !ERROR: Passed-object dummy argument 'f' of procedure 'c' must be a data object - procedure(s3), pointer, pass :: c - !ERROR: Passed-object dummy argument 'x' of procedure 'd' must be scalar - procedure(s4), pointer, pass :: d - end type -contains - subroutine s1(x) - class(t), pointer :: x - end - subroutine s2(w, x) - real :: x - !ERROR: The type of 'x' has already been declared - class(t), allocatable :: x - end - subroutine s3(f) - interface - real function f() - end function - end interface - end - subroutine s4(x) - class(t) :: x(10) - end -end - -module m5 - type :: t1 - sequence - !ERROR: Passed-object dummy argument 'x' of procedure 'a' must be of type 't1' but is 'REAL(4)' - procedure(s), pointer :: a - end type - type :: t2 - contains - !ERROR: Passed-object dummy argument 'y' of procedure 's' must be of type 't2' but is 'TYPE(t1)' - procedure, pass(y) :: s - end type -contains - subroutine s(x, y) - real :: x - type(t1) :: y - end -end - -module m6 - type :: t(k, l) - integer, kind :: k - integer, len :: l - !ERROR: Passed-object dummy argument 'x' of procedure 'a' has non-assumed length parameter 'l' - procedure(s1), pointer :: a - end type -contains - subroutine s1(x) - class(t(1, 2)) :: x - end -end - -module m7 - type :: t - sequence ! t is not extensible - !ERROR: Passed-object dummy argument 'x' of procedure 'a' may not be polymorphic because 't' is not extensible - procedure(s), pointer :: a - end type -contains - subroutine s(x) - !ERROR: Non-extensible derived type 't' may not be used with CLASS keyword - class(t) :: x - end -end - -module m8 - type :: t - contains - !ERROR: Passed-object dummy argument 'x' of procedure 's' must be polymorphic because 't' is extensible - procedure :: s - end type -contains - subroutine s(x) - type(t) :: x ! x is not polymorphic - end -end diff --git a/test-lit/Semantics/resolve53.f90 b/test-lit/Semantics/resolve53.f90 deleted file mode 100644 index 1aee5e79bcc9..000000000000 --- a/test-lit/Semantics/resolve53.f90 +++ /dev/null @@ -1,459 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! 15.4.3.4.5 Restrictions on generic declarations -! Specific procedures of generic interfaces must be distinguishable. - -module m1 - !ERROR: Generic 'g' may not have specific procedures 's2' and 's4' as their interfaces are not distinguishable - interface g - procedure s1 - procedure s2 - procedure s3 - procedure s4 - end interface -contains - subroutine s1(x) - integer(8) x - end - subroutine s2(x) - integer x - end - subroutine s3 - end - subroutine s4(x) - integer x - end -end - -module m2 - !ERROR: Generic 'g' may not have specific procedures 's1' and 's2' as their interfaces are not distinguishable - interface g - subroutine s1(x) - end subroutine - subroutine s2(x) - real x - end subroutine - end interface -end - -module m3 - !ERROR: Generic 'g' may not have specific procedures 'f1' and 'f2' as their interfaces are not distinguishable - interface g - integer function f1() - end function - real function f2() - end function - end interface -end - -module m4 - type :: t1 - end type - type, extends(t1) :: t2 - end type - interface g - subroutine s1(x) - import :: t1 - type(t1) :: x - end - subroutine s2(x) - import :: t2 - type(t2) :: x - end - end interface -end - -! These are all different ranks so they are distinguishable -module m5 - interface g - subroutine s1(x) - real x - end subroutine - subroutine s2(x) - real x(:) - end subroutine - subroutine s3(x) - real x(:,:) - end subroutine - end interface -end - -module m6 - use m5 - !ERROR: Generic 'g' may not have specific procedures 's1' and 's4' as their interfaces are not distinguishable - interface g - subroutine s4(x) - end subroutine - end interface -end - -module m7 - use m5 - !ERROR: Generic 'g' may not have specific procedures 's1' and 's5' as their interfaces are not distinguishable - !ERROR: Generic 'g' may not have specific procedures 's2' and 's5' as their interfaces are not distinguishable - !ERROR: Generic 'g' may not have specific procedures 's3' and 's5' as their interfaces are not distinguishable - interface g - subroutine s5(x) - real x(..) - end subroutine - end interface -end - - -! Two procedures that differ only by attributes are not distinguishable -module m8 - !ERROR: Generic 'g' may not have specific procedures 's1' and 's2' as their interfaces are not distinguishable - interface g - pure subroutine s1(x) - real, intent(in) :: x - end subroutine - subroutine s2(x) - real, intent(in) :: x - end subroutine - end interface -end - -module m9 - !ERROR: Generic 'g' may not have specific procedures 's1' and 's2' as their interfaces are not distinguishable - interface g - subroutine s1(x) - real :: x(10) - end subroutine - subroutine s2(x) - real :: x(100) - end subroutine - end interface -end - -module m10 - !ERROR: Generic 'g' may not have specific procedures 's1' and 's2' as their interfaces are not distinguishable - interface g - subroutine s1(x) - real :: x(10) - end subroutine - subroutine s2(x) - real :: x(..) - end subroutine - end interface -end - -program m11 - interface g1 - subroutine s1(x) - real, pointer, intent(out) :: x - end subroutine - subroutine s2(x) - real, allocatable :: x - end subroutine - end interface - !ERROR: Generic 'g2' may not have specific procedures 's3' and 's4' as their interfaces are not distinguishable - interface g2 - subroutine s3(x) - real, pointer, intent(in) :: x - end subroutine - subroutine s4(x) - real, allocatable :: x - end subroutine - end interface -end - -module m12 - !ERROR: Generic 'g1' may not have specific procedures 's1' and 's2' as their interfaces are not distinguishable - generic :: g1 => s1, s2 ! rank-1 and assumed-rank - !ERROR: Generic 'g2' may not have specific procedures 's2' and 's3' as their interfaces are not distinguishable - generic :: g2 => s2, s3 ! scalar and assumed-rank - !ERROR: Generic 'g3' may not have specific procedures 's1' and 's4' as their interfaces are not distinguishable - generic :: g3 => s1, s4 ! different shape, same rank -contains - subroutine s1(x) - real :: x(10) - end - subroutine s2(x) - real :: x(..) - end - subroutine s3(x) - real :: x - end - subroutine s4(x) - real :: x(100) - end -end - -! Procedures that are distinguishable by return type of a dummy argument -module m13 - interface g1 - procedure s1 - procedure s2 - end interface - interface g2 - procedure s1 - procedure s3 - end interface -contains - subroutine s1(x) - procedure(real), pointer :: x - end - subroutine s2(x) - procedure(integer), pointer :: x - end - subroutine s3(x) - interface - function x() - procedure(real), pointer :: x - end function - end interface - end -end - -! Check user-defined operators -module m14 - interface operator(*) - module procedure f1 - module procedure f2 - end interface - !ERROR: Generic 'operator(+)' may not have specific procedures 'f1' and 'f3' as their interfaces are not distinguishable - interface operator(+) - module procedure f1 - module procedure f3 - end interface - interface operator(.foo.) - module procedure f1 - module procedure f2 - end interface - !ERROR: Generic operator '.bar.' may not have specific procedures 'f1' and 'f3' as their interfaces are not distinguishable - interface operator(.bar.) - module procedure f1 - module procedure f3 - end interface -contains - real function f1(x, y) - real, intent(in) :: x - logical, intent(in) :: y - end - integer function f2(x, y) - integer, intent(in) :: x - logical, intent(in) :: y - end - real function f3(x, y) - real, value :: x - logical, value :: y - end -end module - -! Types distinguished by kind (but not length) parameters -module m15 - type :: t1(k1, l1) - integer, kind :: k1 = 1 - integer, len :: l1 = 101 - end type - - type, extends(t1) :: t2(k2a, l2, k2b) - integer, kind :: k2a = 2 - integer, kind :: k2b = 3 - integer, len :: l2 = 102 - end type - - type, extends(t2) :: t3(l3, k3) - integer, kind :: k3 = 4 - integer, len :: l3 = 103 - end type - - interface g1 - procedure s1 - procedure s2 - end interface - !ERROR: Generic 'g2' may not have specific procedures 's1' and 's3' as their interfaces are not distinguishable - interface g2 - procedure s1 - procedure s3 - end interface - !ERROR: Generic 'g3' may not have specific procedures 's4' and 's5' as their interfaces are not distinguishable - interface g3 - procedure s4 - procedure s5 - end interface - interface g4 - procedure s5 - procedure s6 - procedure s9 - end interface - interface g5 - procedure s4 - procedure s7 - procedure s9 - end interface - interface g6 - procedure s5 - procedure s8 - procedure s9 - end interface - !ERROR: Generic 'g7' may not have specific procedures 's6' and 's7' as their interfaces are not distinguishable - interface g7 - procedure s6 - procedure s7 - end interface - !ERROR: Generic 'g8' may not have specific procedures 's6' and 's8' as their interfaces are not distinguishable - interface g8 - procedure s6 - procedure s8 - end interface - !ERROR: Generic 'g9' may not have specific procedures 's7' and 's8' as their interfaces are not distinguishable - interface g9 - procedure s7 - procedure s8 - end interface - -contains - subroutine s1(x) - type(t1(1, 4)) :: x - end - subroutine s2(x) - type(t1(2, 4)) :: x - end - subroutine s3(x) - type(t1(l1=5)) :: x - end - subroutine s4(x) - type(t3(1, 101, 2, 102, 3, 103, 4)) :: x - end subroutine - subroutine s5(x) - type(t3) :: x - end subroutine - subroutine s6(x) - type(t3(1, 99, k2b=2, k2a=3, l2=*, l3=97, k3=4)) :: x - end subroutine - subroutine s7(x) - type(t3(k1=1, l1=99, k2a=3, k2b=2, k3=4)) :: x - end subroutine - subroutine s8(x) - type(t3(1, :, 3, :, 2, :, 4)), allocatable :: x - end subroutine - subroutine s9(x) - type(t3(k1=2)) :: x - end subroutine -end - - -! Check that specifics for type-bound generics can be distinguished -module m16 - type :: t - contains - procedure, nopass :: s1 - procedure, nopass :: s2 - procedure, nopass :: s3 - generic :: g1 => s1, s2 - !ERROR: Generic 'g2' may not have specific procedures 's1' and 's3' as their interfaces are not distinguishable - generic :: g2 => s1, s3 - end type -contains - subroutine s1(x) - real :: x - end - subroutine s2(x) - integer :: x - end - subroutine s3(x) - real :: x - end -end - -! Check polymorphic types -module m17 - type :: t - end type - type, extends(t) :: t1 - end type - type, extends(t) :: t2 - end type - type, extends(t2) :: t2a - end type - interface g1 - procedure s1 - procedure s2 - end interface - !ERROR: Generic 'g2' may not have specific procedures 's3' and 's4' as their interfaces are not distinguishable - interface g2 - procedure s3 - procedure s4 - end interface - interface g3 - procedure s1 - procedure s4 - end interface - !ERROR: Generic 'g4' may not have specific procedures 's2' and 's3' as their interfaces are not distinguishable - interface g4 - procedure s2 - procedure s3 - end interface - !ERROR: Generic 'g5' may not have specific procedures 's2' and 's5' as their interfaces are not distinguishable - interface g5 - procedure s2 - procedure s5 - end interface - !ERROR: Generic 'g6' may not have specific procedures 's2' and 's6' as their interfaces are not distinguishable - interface g6 - procedure s2 - procedure s6 - end interface -contains - subroutine s1(x) - type(t) :: x - end - subroutine s2(x) - type(t2a) :: x - end - subroutine s3(x) - class(t) :: x - end - subroutine s4(x) - class(t2) :: x - end - subroutine s5(x) - class(*) :: x - end - subroutine s6(x) - type(*) :: x - end -end - -! Test C1514 rule 3 -- distinguishable passed-object dummy arguments -module m18 - type :: t(k) - integer, kind :: k - contains - procedure, pass(x) :: p1 => s - procedure, pass :: p2 => s - procedure :: p3 => s - procedure, pass(y) :: p4 => s - generic :: g1 => p1, p4 - generic :: g2 => p2, p4 - generic :: g3 => p3, p4 - end type -contains - subroutine s(x, y) - class(t(1)) :: x - class(t(2)) :: y - end -end - -! C1511 - rules for operators -module m19 - interface operator(.foo.) - module procedure f1 - module procedure f2 - end interface - !ERROR: Generic operator '.bar.' may not have specific procedures 'f2' and 'f3' as their interfaces are not distinguishable - interface operator(.bar.) - module procedure f2 - module procedure f3 - end interface -contains - integer function f1(i) - integer :: i - end - integer function f2(i, j) - integer :: i, j - end - integer function f3(i, j) - integer :: i, j - end -end diff --git a/test-lit/Semantics/resolve54.f90 b/test-lit/Semantics/resolve54.f90 deleted file mode 100644 index f9f895fa7f05..000000000000 --- a/test-lit/Semantics/resolve54.f90 +++ /dev/null @@ -1,186 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Tests based on examples in C.10.6 - -! C.10.6(10) -module m1 - interface GOOD1 - function F1A(X) - real :: F1A, X - end function - function F1B(X) - integer :: F1B, X - end function - end interface -end - -! C.10.6(13) -module m2 - interface GOOD2 - function F2A(X) - real :: F2A, X - end function - function F2B(X, Y) - complex :: F2B - real :: X, Y - end function - end interface -end - -! C.10.6(15) -module m3 - interface GOOD3 - subroutine S3A(W, X, Y, Z) - real :: W, Y - integer :: X, Z - end subroutine - subroutine S3B(X, W, Z, Y) - real :: W, Z - integer :: X, Y - end subroutine - end interface -end -module m3b - interface GOOD3 - subroutine S3B(X, W, Z, Y) - real :: W, Z - integer :: X, Y - end subroutine - subroutine S3A(W, X, Y, Z) - real :: W, Y - integer :: X, Z - end subroutine - end interface -end - -! C.10.6(17) -! BAD4(1.0,2,Y=3.0,Z=4) could apply to either procedure -module m4 - !ERROR: Generic 'bad4' may not have specific procedures 's4a' and 's4b' as their interfaces are not distinguishable - interface BAD4 - subroutine S4A(W, X, Y, Z) - real :: W, Y - integer :: X, Z - end subroutine - subroutine S4B(X, W, Z, Y) - real :: X, Y - integer :: W, Z - end subroutine - end interface -end -module m4b - !ERROR: Generic 'bad4' may not have specific procedures 's4b' and 's4a' as their interfaces are not distinguishable - interface BAD4 - subroutine S4B(X, W, Z, Y) - real :: X, Y - integer :: W, Z - end subroutine - subroutine S4A(W, X, Y, Z) - real :: W, Y - integer :: X, Z - end subroutine - end interface -end - -! C.10.6(19) -module m5 - interface GOOD5 - subroutine S5A(X) - real :: X - end subroutine - subroutine S5B(Y, X) - real :: Y, X - end subroutine - end interface -end - -module FRUITS - type :: FRUIT - end type - type, extends(FRUIT) :: APPLE - end type - type, extends(FRUIT) :: PEAR - end type - type, extends(PEAR) :: BOSC - end type -end - -! C.10.6(21) -! type(PEAR) :: A_PEAR -! type(BOSC) :: A_BOSC -! BAD6(A_PEAR,A_BOSC) ! could be s6a or s6b -module m6 - !ERROR: Generic 'bad6' may not have specific procedures 's6a' and 's6b' as their interfaces are not distinguishable - interface BAD6 - subroutine S6A(X, Y) - use FRUITS - class(PEAR) :: X, Y - end subroutine - subroutine S6B(X, Y) - use FRUITS - class(FRUIT) :: X - class(BOSC) :: Y - end subroutine - end interface -end -module m6b - !ERROR: Generic 'bad6' may not have specific procedures 's6b' and 's6a' as their interfaces are not distinguishable - interface BAD6 - subroutine S6B(X, Y) - use FRUITS - class(FRUIT) :: X - class(BOSC) :: Y - end subroutine - subroutine S6A(X, Y) - use FRUITS - class(PEAR) :: X, Y - end subroutine - end interface -end - -! C.10.6(22) -module m7 - interface GOOD7 - subroutine S7A(X, Y, Z) - use FRUITS - class(PEAR) :: X, Y, Z - end subroutine - subroutine S7B(X, Z, W) - use FRUITS - class(FRUIT) :: X - class(BOSC) :: Z - class(APPLE), optional :: W - end subroutine - end interface -end -module m7b - interface GOOD7 - subroutine S7B(X, Z, W) - use FRUITS - class(FRUIT) :: X - class(BOSC) :: Z - class(APPLE), optional :: W - end subroutine - subroutine S7A(X, Y, Z) - use FRUITS - class(PEAR) :: X, Y, Z - end subroutine - end interface -end - -! C.10.6(25) -! Invalid generic (according to the rules), despite the fact that it is unambiguous -module m8 - !ERROR: Generic 'bad8' may not have specific procedures 's8a' and 's8b' as their interfaces are not distinguishable - interface BAD8 - subroutine S8A(X, Y, Z) - real, optional :: X - integer :: Y - real :: Z - end subroutine - subroutine S8B(X, Z, Y) - integer, optional :: X - integer :: Z - real :: Y - end subroutine - end interface -end diff --git a/test-lit/Semantics/resolve55.f90 b/test-lit/Semantics/resolve55.f90 deleted file mode 100644 index 98006bc0a07b..000000000000 --- a/test-lit/Semantics/resolve55.f90 +++ /dev/null @@ -1,94 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Tests for C1128: -! A variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not -! have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of -! finalizable type; shall not be a nonpointer polymorphic dummy argument; and -! shall not be a coarray or an assumed-size array. - -subroutine s1() -! Cannot have ALLOCATABLE variable in a locality spec - integer, allocatable :: k -!ERROR: ALLOCATABLE variable 'k' not allowed in a locality-spec - do concurrent(i=1:5) local(k) - end do -end subroutine s1 - -subroutine s2(arg) -! Cannot have a dummy OPTIONAL in a locality spec - integer, optional :: arg -!ERROR: OPTIONAL argument 'arg' not allowed in a locality-spec - do concurrent(i=1:5) local(arg) - end do -end subroutine s2 - -subroutine s3(arg) -! This is OK - real :: arg - do concurrent(i=1:5) local(arg) - end do -end subroutine s3 - -subroutine s4(arg) -! Cannot have a dummy INTENT(IN) in a locality spec - real, intent(in) :: arg -!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec - do concurrent(i=1:5) local(arg) - end do -end subroutine s4 - -subroutine s5() -! Cannot have a variable of a finalizable type in a locality spec - type t1 - integer :: i - contains - final :: f - end type t1 - - type(t1) :: var - -!ERROR: Finalizable variable 'var' not allowed in a locality-spec - do concurrent(i=1:5) local(var) - end do - -contains - subroutine f(x) - type(t1) :: x - end subroutine f -end subroutine s5 - -subroutine s6 -! Cannot have a nonpointer polymorphic dummy argument in a locality spec - type :: t - integer :: field - end type t -contains - subroutine s(x, y) - class(t), pointer :: x - class(t) :: y - -! This is allowed - do concurrent(i=1:5) local(x) - end do - -! This is not allowed -!ERROR: Nonpointer polymorphic argument 'y' not allowed in a locality-spec - do concurrent(i=1:5) local(y) - end do - end subroutine s -end subroutine s6 - -subroutine s7() -! Cannot have a coarray - integer, codimension[*] :: coarray_var -!ERROR: Coarray 'coarray_var' not allowed in a locality-spec - do concurrent(i=1:5) local(coarray_var) - end do -end subroutine s7 - -subroutine s8(arg) -! Cannot have an assumed size array - integer, dimension(*) :: arg -!ERROR: Assumed size array 'arg' not allowed in a locality-spec - do concurrent(i=1:5) local(arg) - end do -end subroutine s8 diff --git a/test-lit/Semantics/resolve56.f90 b/test-lit/Semantics/resolve56.f90 deleted file mode 100644 index 1efa535bd434..000000000000 --- a/test-lit/Semantics/resolve56.f90 +++ /dev/null @@ -1,67 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test that associations constructs can be correctly combined. The intrinsic -! functions are not what is tested here, they are only use to reveal the types -! of local variables. - - implicit none - real res - complex zres - integer ires - class(*), allocatable :: a, b - select type(a) - type is (integer) - select type(b) - type is (integer) - ires = selected_int_kind(b) - ires = selected_int_kind(a) - end select - type is (real) - res = acos(a) - !ERROR: Actual argument for 'x=' has bad type 'CLASS(*)' - res = acos(b) - end select - - select type(c => a) - type is (real) - res = acos(c) - class default - !ERROR: Actual argument for 'x=' has bad type 'CLASS(*)' - res = acos(c) - end select - select type(a) - type is (integer) - !ERROR: Actual argument for 'x=' has bad type 'INTEGER(4)' - res = acos(a) - end select - - select type(b) - type is (integer) - associate(y=>1.0, x=>1, z=>(1.0,2.3)) - ires = selected_int_kind(x) - select type(a) - type is (real) - res = acos(a) - res = acos(y) - !ERROR: Actual argument for 'x=' has bad type 'INTEGER(4)' - res = acos(b) - type is (integer) - ires = selected_int_kind(b) - zres = acos(z) - !ERROR: Actual argument for 'x=' has bad type 'INTEGER(4)' - res = acos(a) - end select - end associate - ires = selected_int_kind(b) - !ERROR: No explicit type declared for 'c' - ires = selected_int_kind(c) - !ERROR: Actual argument for 'x=' has bad type 'CLASS(*)' - res = acos(a) - class default - !ERROR: Actual argument for 'r=' has bad type 'CLASS(*)' - ires = selected_int_kind(b) - end select - !ERROR: Actual argument for 'r=' has bad type 'CLASS(*)' - ires = selected_int_kind(a) - !ERROR: Actual argument for 'x=' has bad type 'CLASS(*)' - res = acos(b) -end diff --git a/test-lit/Semantics/resolve57.f90 b/test-lit/Semantics/resolve57.f90 deleted file mode 100644 index 265decd3bcde..000000000000 --- a/test-lit/Semantics/resolve57.f90 +++ /dev/null @@ -1,122 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Tests for the last sentence of C1128: -!A variable-name that is not permitted to appear in a variable definition -!context shall not appear in a LOCAL or LOCAL_INIT locality-spec. - -subroutine s1(arg) - real, intent(in) :: arg - - ! This is not OK because "arg" is "intent(in)" -!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec - do concurrent (i=1:5) local(arg) - end do -end subroutine s1 - -subroutine s2(arg) - real, value, intent(in) :: arg - - ! This is not OK even though "arg" has the "value" attribute. C1128 - ! explicitly excludes dummy arguments of INTENT(IN) -!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec - do concurrent (i=1:5) local(arg) - end do -end subroutine s2 - -module m3 - real, protected :: prot - real var - - contains - subroutine sub() - ! C857 This is OK because of the "protected" attribute only applies to - ! accesses outside the module - do concurrent (i=1:5) local(prot) - end do - end subroutine sub -endmodule m3 - -subroutine s4() - use m3 - - ! C857 This is not OK because of the "protected" attribute -!ERROR: 'prot' may not appear in a locality-spec because it is not definable - do concurrent (i=1:5) local(prot) - end do - - ! C857 This is OK because of there's no "protected" attribute - do concurrent (i=1:5) local(var) - end do -end subroutine s4 - -subroutine s5() - real :: a, b, c, d, e - - associate (a => b + c, d => e) - b = 3.0 - ! C1101 This is OK because 'd' is associated with a variable - do concurrent (i=1:5) local(d) - end do - - ! C1101 This is not OK because 'a' is not associated with a variable -!ERROR: 'a' may not appear in a locality-spec because it is not definable - do concurrent (i=1:5) local(a) - end do - end associate -end subroutine s5 - -subroutine s6() - type point - real :: x, y - end type point - - type, extends(point) :: color_point - integer :: color - end type color_point - - type(point), target :: c, d - class(point), pointer :: p_or_c - - p_or_c => c - select type ( a => p_or_c ) - type is ( point ) - ! C1158 This is OK because 'a' is associated with a variable - do concurrent (i=1:5) local(a) - end do - end select - - select type ( a => func() ) - type is ( point ) - ! C1158 This is not OK because 'a' is not associated with a variable -!ERROR: 'a' may not appear in a locality-spec because it is not definable - do concurrent (i=1:5) local(a) - end do - end select - - contains - function func() - class(point), pointer :: func - func => c - end function func -end subroutine s6 - -module m4 - real, protected :: prot - real var -endmodule m4 - -pure subroutine s7() - use m4 - - ! C1594 This is not OK because we're in a PURE subroutine -!ERROR: 'var' may not appear in a locality-spec because it is not definable - do concurrent (i=1:5) local(var) - end do -end subroutine s7 - -subroutine s8() - integer, parameter :: iconst = 343 - -!ERROR: 'iconst' may not appear in a locality-spec because it is not definable - do concurrent (i=1:5) local(iconst) - end do -end subroutine s8 diff --git a/test-lit/Semantics/resolve58.f90 b/test-lit/Semantics/resolve58.f90 deleted file mode 100644 index db11e6779335..000000000000 --- a/test-lit/Semantics/resolve58.f90 +++ /dev/null @@ -1,58 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1(x, y) - !ERROR: Array pointer 'x' must have deferred shape or assumed rank - real, pointer :: x(1:) ! C832 - !ERROR: Allocatable array 'y' must have deferred shape or assumed rank - real, dimension(1:,1:), allocatable :: y ! C832 -end - -subroutine s2(a, b, c) - real :: a(:,1:) - real :: b(10,*) - real :: c(..) - !ERROR: Array pointer 'd' must have deferred shape or assumed rank - real, pointer :: d(:,1:) ! C832 - !ERROR: Allocatable array 'e' must have deferred shape or assumed rank - real, allocatable :: e(10,*) ! C832 - !ERROR: Assumed-rank array 'f' must be a dummy argument - real, pointer :: f(..) ! C837 - !ERROR: Assumed-shape array 'g' must be a dummy argument - real :: g(:,1:) - !ERROR: Assumed-size array 'h' must be a dummy argument - real :: h(10,*) ! C833 - !ERROR: Assumed-rank array 'i' must be a dummy argument - real :: i(..) ! C837 -end - -subroutine s3(a, b) - real :: a(*) - !ERROR: Dummy array argument 'b' may not have implied shape - real :: b(*,*) ! C836 - !ERROR: Implied-shape array 'c' must be a named constant - real :: c(*) ! C836 - !ERROR: Named constant 'd' array must have explicit or implied shape - integer, parameter :: d(:) = [1, 2, 3] -end - -subroutine s4() - type :: t - integer, allocatable :: a(:) - !ERROR: Component array 'b' without ALLOCATABLE or POINTER attribute must have explicit shape - integer :: b(:) ! C749 - real, dimension(1:10) :: c - !ERROR: Array pointer component 'd' must have deferred shape - real, pointer, dimension(1:10) :: d ! C745 - end type -end - -function f() - !ERROR: Array 'f' without ALLOCATABLE or POINTER attribute must have explicit shape - real, dimension(:) :: f ! C832 -end - -subroutine s5() - !ERROR: Allocatable array 'a' must have deferred shape or assumed rank - integer :: a(10), b(:) - allocatable :: a - allocatable :: b -end subroutine diff --git a/test-lit/Semantics/resolve59.f90 b/test-lit/Semantics/resolve59.f90 deleted file mode 100644 index 0e6965a5d165..000000000000 --- a/test-lit/Semantics/resolve59.f90 +++ /dev/null @@ -1,138 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Testing 15.6.2.2 point 4 (What function-name refers to depending on the -! presence of RESULT). - - -module m_no_result -! Without RESULT, it refers to the result object (no recursive -! calls possible) -contains - ! testing with data object results - function f1() - real :: x, f1 - !ERROR: 'f1' is not a function - x = acos(f1()) - f1 = x - x = acos(f1) !OK - end function - function f2(i) - integer i - real :: x, f2 - !ERROR: 'f2' is not an array - x = acos(f2(i+1)) - f2 = x - x = acos(f2) !OK - end function - function f3(i) - integer i - real :: x, f3(1) - ! OK reference to array result f1 - x = acos(f3(i+1)) - f3 = x - x = sum(acos(f3)) !OK - end function - - ! testing with function pointer results - function rf() - real :: rf - end function - function f4() - procedure(rf), pointer :: f4 - f4 => rf - ! OK call to f4 pointer (rf) - x = acos(f4()) - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f4) - end function - function f5(x) - real :: x - interface - real function rfunc(x) - real, intent(in) :: x - end function - end interface - procedure(rfunc), pointer :: f5 - f5 => rfunc - ! OK call to f5 pointer - x = acos(f5(x+1)) - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f5) - end function - ! Sanity test: f18 handles C1560 violation by ignoring RESULT - function f6() result(f6) !OKI (warning) - end function - function f7() result(f7) !OKI (warning) - real :: x, f7 - !ERROR: 'f7' is not a function - x = acos(f7()) - f7 = x - x = acos(f7) !OK - end function -end module - -module m_with_result -! With RESULT, it refers to the function (recursive calls possible) -contains - - ! testing with data object results - function f1() result(r) - real :: r - r = acos(f1()) !OK, recursive call - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f1) - end function - function f2(i) result(r) - integer i - real :: r - r = acos(f2(i+1)) ! OK, recursive call - !ERROR: Typeless item not allowed for 'x=' argument - r = acos(f2) - end function - function f3(i) result(r) - integer i - real :: r(1) - r = acos(f3(i+1)) !OK recursive call - !ERROR: Typeless item not allowed for 'x=' argument - r = sum(acos(f3)) - end function - - ! testing with function pointer results - function rf() - real :: rf - end function - function f4() result(r) - real :: x - procedure(rf), pointer :: r - r => rf - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f4()) ! recursive call - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f4) - x = acos(r()) ! OK - end function - function f5(x) result(r) - real :: x - procedure(acos), pointer :: r - r => acos - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f5(x+1)) ! recursive call - !ERROR: Typeless item not allowed for 'x=' argument - x = acos(f5) - x = acos(r(x+1)) ! OK - end function - - ! testing that calling the result is also caught - function f6() result(r) - real :: x, r - !ERROR: 'r' is not a function - x = r() - end function -end module - -subroutine array_rank_test() - real :: x(10, 10), y - !ERROR: Reference to rank-2 object 'x' has 1 subscripts - y = x(1) - !ERROR: Reference to rank-2 object 'x' has 3 subscripts - y = x(1, 2, 3) -end diff --git a/test-lit/Semantics/resolve60.f90 b/test-lit/Semantics/resolve60.f90 deleted file mode 100644 index 3232bc0fb87a..000000000000 --- a/test-lit/Semantics/resolve60.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Testing 7.6 enum - - ! OK - enum, bind(C) - enumerator :: red, green - enumerator blue, pink - enumerator yellow - enumerator :: purple = 2 - end enum - - integer(yellow) anint4 - - enum, bind(C) - enumerator :: square, cicrle - !ERROR: 'square' is already declared in this scoping unit - enumerator square - end enum - - dimension :: apple(4) - real :: peach - - enum, bind(C) - !ERROR: 'apple' is already declared in this scoping unit - enumerator :: apple - enumerator :: pear - !ERROR: 'peach' is already declared in this scoping unit - enumerator :: peach - !ERROR: 'red' is already declared in this scoping unit - enumerator :: red - end enum - - enum, bind(C) - !ERROR: Enumerator value could not be computed from the given expression - !ERROR: Must be a constant value - enumerator :: wrong = 0/0 - end enum - -end diff --git a/test-lit/Semantics/resolve61.f90 b/test-lit/Semantics/resolve61.f90 deleted file mode 100644 index eb5ba13a07a3..000000000000 --- a/test-lit/Semantics/resolve61.f90 +++ /dev/null @@ -1,115 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -program p1 - integer(8) :: a, b, c, d - pointer(a, b) - !ERROR: 'b' cannot be a Cray pointer as it is already a Cray pointee - pointer(b, c) - !ERROR: 'a' cannot be a Cray pointee as it is already a Cray pointer - pointer(d, a) -end - -program p2 - pointer(a, c) - !ERROR: 'c' was already declared as a Cray pointee - pointer(b, c) -end - -program p3 - real a - !ERROR: Cray pointer 'a' must have type INTEGER(8) - pointer(a, b) -end - -program p4 - implicit none - real b - !ERROR: No explicit type declared for 'd' - pointer(a, b), (c, d) -end - -program p5 - integer(8) a(10) - !ERROR: Cray pointer 'a' must be a scalar - pointer(a, b) -end - -program p6 - real b(8) - !ERROR: Array spec was already declared for 'b' - pointer(a, b(4)) -end - -program p7 - !ERROR: Cray pointee 'b' must have must have explicit shape or assumed size - pointer(a, b(:)) -contains - subroutine s(x, y) - real :: x(*) ! assumed size - !ERROR: Cray pointee 'y' must have must have explicit shape or assumed size - real :: y(:) ! assumed shape - pointer(w, y) - end -end - -program p8 - integer(8), parameter :: k = 2 - type t - end type - !ERROR: 't' is not a variable - pointer(t, a) - !ERROR: 's' is not a variable - pointer(s, b) - !ERROR: 'k' is not a variable - pointer(k, c) -contains - subroutine s - end -end - -program p9 - integer(8), parameter :: k = 2 - type t - end type - !ERROR: 't' is not a variable - pointer(a, t) - !ERROR: 's' is not a variable - pointer(b, s) - !ERROR: 'k' is not a variable - pointer(c, k) -contains - subroutine s - end -end - -module m10 - integer(8) :: a - real :: b -end -program p10 - use m10 - !ERROR: 'b' cannot be a Cray pointee as it is use-associated - pointer(a, c),(d, b) -end - -program p11 - pointer(a, b) - !ERROR: PARAMETER attribute not allowed on 'a' - parameter(a=2) - !ERROR: PARAMETER attribute not allowed on 'b' - parameter(b=3) -end - -program p12 - type t1 - sequence - real c1 - end type - type t2 - integer c2 - end type - type(t1) :: x1 - type(t2) :: x2 - pointer(a, x1) - !ERROR: Type of Cray pointee 'x2' is a non-sequence derived type - pointer(b, x2) -end diff --git a/test-lit/Semantics/resolve62.f90 b/test-lit/Semantics/resolve62.f90 deleted file mode 100644 index 5de3a45e900f..000000000000 --- a/test-lit/Semantics/resolve62.f90 +++ /dev/null @@ -1,79 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Resolve generic based on number of arguments -subroutine s1 - interface f - real function f1(x) - optional :: x - end - real function f2(x, y) - end - end interface - z = f(1.0) - z = f(1.0, 2.0) - !ERROR: No specific procedure of generic 'f' matches the actual arguments - z = f(1.0, 2.0, 3.0) -end - -! Elemental and non-element function both match: non-elemental one should be used -subroutine s2 - interface f - logical elemental function f1(x) - intent(in) :: x - end - real function f2(x) - real :: x(10) - end - end interface - real :: x, y(10), z - logical :: a - a = f(1.0) - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and REAL(4) - a = f(y) -end - -! Resolve named operator -subroutine s3 - interface operator(.foo.) - pure integer(8) function f_real(x, y) - real, intent(in) :: x, y - end - pure integer(8) function f_integer(x, y) - integer, intent(in) :: x, y - end - end interface - logical :: a, b, c - x = y .foo. z ! OK: f_real - i = j .foo. k ! OK: f_integer - !ERROR: No intrinsic or user-defined .FOO. matches operand types LOGICAL(4) and LOGICAL(4) - a = b .foo. c -end - -! Generic resolves successfully but error analyzing call -module m4 - real, protected :: x - real :: y - interface s - pure subroutine s1(x) - real, intent(out) :: x - end - subroutine s2(x, y) - real :: x, y - end - end interface -end -subroutine s4a - use m4 - real :: z - !OK - call s(z) -end -subroutine s4b - use m4 - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call s(x) -end -pure subroutine s4c - use m4 - !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable - call s(y) -end diff --git a/test-lit/Semantics/resolve63.f90 b/test-lit/Semantics/resolve63.f90 deleted file mode 100644 index 07ae767d676b..000000000000 --- a/test-lit/Semantics/resolve63.f90 +++ /dev/null @@ -1,237 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Invalid operand types when user-defined operator is available -module m1 - type :: t - end type - interface operator(==) - logical function eq_tt(x, y) - import :: t - type(t), intent(in) :: x, y - end - end interface - interface operator(+) - logical function add_tr(x, y) - import :: t - type(t), intent(in) :: x - real, intent(in) :: y - end - logical function plus_t(x) - import :: t - type(t), intent(in) :: x - end - logical function add_12(x, y) - real, intent(in) :: x(:), y(:,:) - end - end interface - interface operator(.and.) - logical function and_tr(x, y) - import :: t - type(t), intent(in) :: x - real, intent(in) :: y - end - end interface - interface operator(//) - logical function concat_tt(x, y) - import :: t - type(t), intent(in) :: x, y - end - end interface - interface operator(.not.) - logical function not_r(x) - real, intent(in) :: x - end - end interface - type(t) :: x, y - real :: r - logical :: l -contains - subroutine test_relational() - l = x == y !OK - l = x .eq. y !OK - !ERROR: No intrinsic or user-defined OPERATOR(==) matches operand types TYPE(t) and REAL(4) - l = x == r - end - subroutine test_numeric() - l = x + r !OK - !ERROR: No intrinsic or user-defined OPERATOR(+) matches operand types REAL(4) and TYPE(t) - l = r + x - end - subroutine test_logical() - l = x .and. r !OK - !ERROR: No intrinsic or user-defined OPERATOR(.AND.) matches operand types REAL(4) and TYPE(t) - l = r .and. x - end - subroutine test_unary() - l = +x !OK - !ERROR: No intrinsic or user-defined OPERATOR(+) matches operand type LOGICAL(4) - l = +l - l = .not. r !OK - !ERROR: No intrinsic or user-defined OPERATOR(.NOT.) matches operand type TYPE(t) - l = .not. x - end - subroutine test_concat() - l = x // y !OK - !ERROR: No intrinsic or user-defined OPERATOR(//) matches operand types TYPE(t) and REAL(4) - l = x // r - end - subroutine test_conformability(x, y) - real :: x(10), y(10,10) - l = x + y !OK - !ERROR: No intrinsic or user-defined OPERATOR(+) matches rank 2 array of REAL(4) and rank 1 array of REAL(4) - l = y + x - end -end - -! Invalid operand types when user-defined operator is not available -module m2 - type :: t - end type - type(t) :: x, y - real :: r - logical :: l -contains - subroutine test_relational() - !ERROR: Operands of .EQ. must have comparable types; have TYPE(t) and REAL(4) - l = x == r - end - subroutine test_numeric() - !ERROR: Operands of + must be numeric; have REAL(4) and TYPE(t) - l = r + x - end - subroutine test_logical() - !ERROR: Operands of .AND. must be LOGICAL; have REAL(4) and TYPE(t) - l = r .and. x - end - subroutine test_unary() - !ERROR: Operand of unary + must be numeric; have LOGICAL(4) - l = +l - !ERROR: Operand of .NOT. must be LOGICAL; have TYPE(t) - l = .not. x - end - subroutine test_concat(a, b) - character(4,kind=1) :: a - character(4,kind=2) :: b - character(4) :: c - !ERROR: Operands of // must be CHARACTER with the same kind; have CHARACTER(KIND=1) and CHARACTER(KIND=2) - c = a // b - !ERROR: Operands of // must be CHARACTER with the same kind; have TYPE(t) and REAL(4) - l = x // r - end - subroutine test_conformability(x, y) - real :: x(10), y(10,10) - !ERROR: Operands of + are not conformable; have rank 2 and rank 1 - l = y + x - end -end - -! Invalid untyped operands: user-defined operator doesn't affect errors -module m3 - interface operator(+) - logical function add(x, y) - logical, intent(in) :: x - integer, value :: y - end - end interface -contains - subroutine s1(x, y) - logical :: x - integer :: y - logical :: l - complex :: z - y = y + z'1' !OK - !ERROR: Operands of + must be numeric; have untyped and COMPLEX(4) - z = z'1' + z - y = +z'1' !OK - !ERROR: Operand of unary - must be numeric; have untyped - y = -z'1' - !ERROR: Operands of + must be numeric; have LOGICAL(4) and untyped - y = x + z'1' - !ERROR: Operands of .NE. must have comparable types; have LOGICAL(4) and untyped - l = x /= null() - end -end - -! Test alternate operators. They aren't enabled by default so should be -! treated as defined operators, not intrinsic ones. -module m4 -contains - subroutine s1(x, y, z) - logical :: x - real :: y, z - !ERROR: No operator .A. defined for REAL(4) and REAL(4) - x = y .a. z - !ERROR: No operator .O. defined for REAL(4) and REAL(4) - x = y .o. z - !ERROR: No operator .N. defined for REAL(4) - x = .n. y - !ERROR: No operator .XOR. defined for REAL(4) and REAL(4) - x = y .xor. z - !ERROR: No operator .X. defined for REAL(4) - x = .x. y - end -end - -! Like m4 in resolve63 but compiled with different options. -! .A. is a defined operator. -module m5 - interface operator(.A.) - logical function f1(x, y) - integer, intent(in) :: x, y - end - end interface - interface operator(.and.) - logical function f2(x, y) - real, intent(in) :: x, y - end - end interface -contains - subroutine s1(x, y, z) - logical :: x - complex :: y, z - !ERROR: No intrinsic or user-defined OPERATOR(.AND.) matches operand types COMPLEX(4) and COMPLEX(4) - x = y .and. z - !ERROR: No intrinsic or user-defined .A. matches operand types COMPLEX(4) and COMPLEX(4) - x = y .a. z - end -end - -! Type-bound operators -module m6 - type :: t1 - contains - procedure, pass(x) :: p1 => f1 - generic :: operator(+) => p1 - end type - type, extends(t1) :: t2 - contains - procedure, pass(y) :: p2 => f2 - generic :: operator(+) => p2 - end type - type :: t3 - contains - procedure, nopass :: p1 => f1 - !ERROR: OPERATOR(+) procedure 'p1' may not have NOPASS attribute - generic :: operator(+) => p1 - end type -contains - integer function f1(x, y) - class(t1), intent(in) :: x - integer, intent(in) :: y - end - integer function f2(x, y) - class(t1), intent(in) :: x - class(t2), intent(in) :: y - end - subroutine test(x, y, z) - class(t1) :: x - class(t2) :: y - integer :: i - i = x + y - i = x + i - i = y + i - !ERROR: No intrinsic or user-defined OPERATOR(+) matches operand types TYPE(t2) and TYPE(t1) - i = y + x - !ERROR: No intrinsic or user-defined OPERATOR(+) matches operand types INTEGER(4) and TYPE(t1) - i = i + x - end -end diff --git a/test-lit/Semantics/resolve64.f90 b/test-lit/Semantics/resolve64.f90 deleted file mode 100644 index 3be2ae14fd5d..000000000000 --- a/test-lit/Semantics/resolve64.f90 +++ /dev/null @@ -1,46 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!OPTIONS: -flogical-abbreviations -fxor-operator - -! Like m4 in resolve63 but compiled with different options. -! Alternate operators are enabled so treat these as intrinsic. -module m4 -contains - subroutine s1(x, y, z) - logical :: x - real :: y, z - !ERROR: Operands of .AND. must be LOGICAL; have REAL(4) and REAL(4) - x = y .a. z - !ERROR: Operands of .OR. must be LOGICAL; have REAL(4) and REAL(4) - x = y .o. z - !ERROR: Operand of .NOT. must be LOGICAL; have REAL(4) - x = .n. y - !ERROR: Operands of .NEQV. must be LOGICAL; have REAL(4) and REAL(4) - x = y .xor. z - !ERROR: Operands of .NEQV. must be LOGICAL; have REAL(4) and REAL(4) - x = y .x. y - end -end - -! Like m4 in resolve63 but compiled with different options. -! Alternate operators are enabled so treat .A. as .AND. -module m5 - interface operator(.A.) - logical function f1(x, y) - integer, intent(in) :: x, y - end - end interface - interface operator(.and.) - logical function f2(x, y) - real, intent(in) :: x, y - end - end interface -contains - subroutine s1(x, y, z) - logical :: x - complex :: y, z - !ERROR: No intrinsic or user-defined OPERATOR(.A.) matches operand types COMPLEX(4) and COMPLEX(4) - x = y .and. z - !ERROR: No intrinsic or user-defined OPERATOR(.A.) matches operand types COMPLEX(4) and COMPLEX(4) - x = y .a. z - end -end diff --git a/test-lit/Semantics/resolve65.f90 b/test-lit/Semantics/resolve65.f90 deleted file mode 100644 index 9e1278b66dd5..000000000000 --- a/test-lit/Semantics/resolve65.f90 +++ /dev/null @@ -1,113 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test restrictions on what subprograms can be used for defined assignment. - -module m1 - implicit none - type :: t - contains - !ERROR: Defined assignment procedure 'binding' must be a subroutine - generic :: assignment(=) => binding - procedure :: binding => assign_t1 - procedure :: assign_t - procedure :: assign_t2 - procedure :: assign_t3 - !ERROR: Defined assignment subroutine 'assign_t2' must have two dummy arguments - !ERROR: In defined assignment subroutine 'assign_t3', second dummy argument 'y' must have INTENT(IN) or VALUE attribute - !ERROR: In defined assignment subroutine 'assign_t4', first dummy argument 'x' must have INTENT(OUT) or INTENT(INOUT) - generic :: assignment(=) => assign_t, assign_t2, assign_t3, assign_t4 - procedure :: assign_t4 - end type - type :: t2 - contains - procedure, nopass :: assign_t - !ERROR: Defined assignment procedure 'assign_t' may not have NOPASS attribute - generic :: assignment(=) => assign_t - end type -contains - subroutine assign_t(x, y) - class(t), intent(out) :: x - type(t), intent(in) :: y - end - logical function assign_t1(x, y) - class(t), intent(out) :: x - type(t), intent(in) :: y - end - subroutine assign_t2(x) - class(t), intent(out) :: x - end - subroutine assign_t3(x, y) - class(t), intent(out) :: x - real :: y - end - subroutine assign_t4(x, y) - class(t) :: x - integer, intent(in) :: y - end -end - -module m2 - type :: t - end type - interface assignment(=) - !ERROR: In defined assignment subroutine 's1', dummy argument 'y' may not be OPTIONAL - subroutine s1(x, y) - import t - type(t), intent(out) :: x - real, optional, intent(in) :: y - end - !ERROR: In defined assignment subroutine 's2', dummy argument 'y' must be a data object - subroutine s2(x, y) - import t - type(t), intent(out) :: x - intent(in) :: y - interface - subroutine y() - end - end interface - end - end interface -end - -! Detect defined assignment that conflicts with intrinsic assignment -module m5 - type :: t - end type - interface assignment(=) - ! OK - lhs is derived type - subroutine assign_tt(x, y) - import t - type(t), intent(out) :: x - type(t), intent(in) :: y - end - !OK - incompatible types - subroutine assign_il(x, y) - integer, intent(out) :: x - logical, intent(in) :: y - end - !OK - different ranks - subroutine assign_23(x, y) - integer, intent(out) :: x(:,:) - integer, intent(in) :: y(:,:,:) - end - !OK - scalar = array - subroutine assign_01(x, y) - integer, intent(out) :: x - integer, intent(in) :: y(:) - end - !ERROR: Defined assignment subroutine 'assign_10' conflicts with intrinsic assignment - subroutine assign_10(x, y) - integer, intent(out) :: x(:) - integer, intent(in) :: y - end - !ERROR: Defined assignment subroutine 'assign_ir' conflicts with intrinsic assignment - subroutine assign_ir(x, y) - integer, intent(out) :: x - real, intent(in) :: y - end - !ERROR: Defined assignment subroutine 'assign_ii' conflicts with intrinsic assignment - subroutine assign_ii(x, y) - integer(2), intent(out) :: x - integer(1), intent(in) :: y - end - end interface -end diff --git a/test-lit/Semantics/resolve66.f90 b/test-lit/Semantics/resolve66.f90 deleted file mode 100644 index d54fd2bfe66c..000000000000 --- a/test-lit/Semantics/resolve66.f90 +++ /dev/null @@ -1,106 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test that user-defined assignment is used in the right places - -module m1 - type t1 - end type - type t2 - end type - interface assignment(=) - subroutine assign_il(x, y) - integer, intent(out) :: x - logical, intent(in) :: y - end - subroutine assign_li(x, y) - logical, intent(out) :: x - integer, intent(in) :: y - end - subroutine assign_tt(x, y) - import t1 - type(t1), intent(out) :: x - type(t1), intent(in) :: y - end - subroutine assign_tz(x, y) - import t1 - type(t1), intent(out) :: x - complex, intent(in) :: y - end - subroutine assign_01(x, y) - real, intent(out) :: x - real, intent(in) :: y(:) - end - end interface -contains - ! These are all intrinsic assignments - pure subroutine test1() - type(t2) :: a, b, b5(5) - logical :: l - integer :: i, i5(5) - a = b - b5 = a - l = .true. - i = z'1234' - i5 = 1.0 - end - - ! These have invalid type combinations - subroutine test2() - type(t1) :: a - type(t2) :: b - logical :: l, l5(5) - complex :: z, z5(5), z55(5,5) - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t1) and TYPE(t2) - a = b - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types REAL(4) and LOGICAL(4) - r = l - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and REAL(4) - l = r - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t1) and REAL(4) - a = r - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t2) and COMPLEX(4) - b = z - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar COMPLEX(4) and rank 1 array of COMPLEX(4) - z = z5 - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches rank 1 array of LOGICAL(4) and scalar COMPLEX(4) - l5 = z - !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches rank 1 array of COMPLEX(4) and rank 2 array of COMPLEX(4) - z5 = z55 - end - - ! These should all be defined assignments. Because the subroutines - ! implementing them are not pure, they should all produce errors - pure subroutine test3() - type(t1) :: a, b - integer :: i - logical :: l - complex :: z - real :: r, r5(5) - !ERROR: Procedure 'assign_tt' referenced in pure subprogram 'test3' must be pure too - a = b - !ERROR: Procedure 'assign_il' referenced in pure subprogram 'test3' must be pure too - i = l - !ERROR: Procedure 'assign_li' referenced in pure subprogram 'test3' must be pure too - l = i - !ERROR: Procedure 'assign_il' referenced in pure subprogram 'test3' must be pure too - i = .true. - !ERROR: Procedure 'assign_tz' referenced in pure subprogram 'test3' must be pure too - a = z - !ERROR: Procedure 'assign_01' referenced in pure subprogram 'test3' must be pure too - r = r5 - end - - ! Like test3 but not in a pure subroutine so no errors. - subroutine test4() - type(t1) :: a, b - integer :: i - logical :: l - complex :: z - real :: r, r5(5) - a = b - i = l - l = i - i = .true. - a = z - r = r5 - end -end diff --git a/test-lit/Semantics/resolve67.f90 b/test-lit/Semantics/resolve67.f90 deleted file mode 100644 index 7a8537a0a65e..000000000000 --- a/test-lit/Semantics/resolve67.f90 +++ /dev/null @@ -1,104 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test restrictions on what subprograms can be used for defined operators. -! See: 15.4.3.4.2 - -module m1 - interface operator(+) - !ERROR: OPERATOR(+) procedure 'add1' must be a function - subroutine add1(x, y, z) - real, intent(out) :: x - real, intent(in) :: y, z - end - end interface -end - -module m2 - interface operator(-) - real function sub1(x) - logical, intent(in) :: x - end - real function sub2(x, y) - logical, intent(in) :: x, y - end - !ERROR: OPERATOR(-) function 'sub3' must have one or two dummy arguments - real function sub3(x, y, z) - real, intent(in) :: x, y, z - end - end interface - interface operator(.not.) - !ERROR: OPERATOR(.NOT.) function 'not1' must have one dummy argument - real function not1(x, y) - real, intent(in) :: x, y - end - end interface -end - -module m3 - interface operator(/) - !ERROR: OPERATOR(/) function 'divide' may not have assumed-length CHARACTER(*) result - character(*) function divide(x, y) - character(*), intent(in) :: x, y - end - end interface - interface operator(<) - !ERROR: In OPERATOR(<) function 'lt1', dummy argument 'x' must have INTENT(IN) or VALUE attribute - !ERROR: In OPERATOR(<) function 'lt1', dummy argument 'y' may not be OPTIONAL - logical function lt1(x, y) - logical :: x - real, value, optional :: y - end - !ERROR: In OPERATOR(<) function 'lt2', dummy argument 'y' must be a data object - logical function lt2(x, y) - logical, intent(in) :: x - intent(in) :: y - interface - subroutine y() - end - end interface - end - end interface -end - -module m4 - interface operator(+) - !ERROR: OPERATOR(+) function 'add' conflicts with intrinsic operator - complex function add(x, y) - real, intent(in) :: x - integer, value :: y - end - !ERROR: OPERATOR(+) function 'plus' conflicts with intrinsic operator - real function plus(x) - complex, intent(in) :: x - end - end interface - interface operator(.not.) - real function not1(x) - real, value :: x - end - !ERROR: OPERATOR(.NOT.) function 'not2' conflicts with intrinsic operator - logical(8) function not2(x) - logical(8), value :: x - end - end interface - interface operator(.and.) - !ERROR: OPERATOR(.AND.) function 'and' conflicts with intrinsic operator - real function and(x, y) - logical(1), value :: x - logical(8), value :: y - end - end interface - interface operator(//) - real function concat1(x, y) - real, value :: x, y - end - real function concat2(x, y) - character(kind=1, len=4), intent(in) :: x - character(kind=4, len=4), intent(in) :: y - end - !ERROR: OPERATOR(//) function 'concat3' conflicts with intrinsic operator - real function concat3(x, y) - character(kind=4, len=4), intent(in) :: x - character(kind=4, len=4), intent(in) :: y - end - end interface -end diff --git a/test-lit/Semantics/resolve68.f90 b/test-lit/Semantics/resolve68.f90 deleted file mode 100644 index 6accdafd5263..000000000000 --- a/test-lit/Semantics/resolve68.f90 +++ /dev/null @@ -1,34 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Test resolution of type-bound generics. - -module m1 - type :: t - contains - procedure, pass(x) :: add1 => add - procedure, nopass :: add2 => add - procedure :: add_real - generic :: g => add1, add2, add_real - end type -contains - integer function add(x, y) - class(t), intent(in) :: x, y - end - integer function add_real(x, y) - class(t), intent(in) :: x - real, intent(in) :: y - end - subroutine test1(x, y, z) - type(t) :: x - integer :: y - integer :: z - !ERROR: No specific procedure of generic 'g' matches the actual arguments - z = x%g(y) - end - subroutine test2(x, y, z) - type(t) :: x - real :: y - integer :: z - !ERROR: No specific procedure of generic 'g' matches the actual arguments - z = x%g(x, y) - end -end diff --git a/test-lit/Semantics/resolve69.f90 b/test-lit/Semantics/resolve69.f90 deleted file mode 100644 index 3bbc37e3f7aa..000000000000 --- a/test-lit/Semantics/resolve69.f90 +++ /dev/null @@ -1,55 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -subroutine s1() - ! C701 (R701) The type-param-value for a kind type parameter shall be a - ! constant expression. - ! - ! C702 (R701) A colon shall not be used as a type-param-value except in the - ! declaration of an entity that has the POINTER or ALLOCATABLE attribute. - ! - ! C704 (R703) In a declaration-type-spec, every type-param-value that is - ! not a colon or an asterisk shall be a specification expression. - ! Section 10.1.11 defines specification expressions - ! - integer, parameter :: constVal = 1 - integer :: nonConstVal = 1 -!ERROR: Invalid specification expression: reference to local entity 'nonconstval' - character(nonConstVal) :: colonString1 - character(len=20, kind=constVal + 1) :: constKindString - character(len=:, kind=constVal + 1), pointer :: constKindString1 -!ERROR: The type parameter LEN cannot be deferred without the POINTER or ALLOCATABLE attribute - character(len=:, kind=constVal + 1) :: constKindString2 -!ERROR: Must be a constant value - character(len=20, kind=nonConstVal) :: nonConstKindString -!ERROR: The type parameter LEN cannot be deferred without the POINTER or ALLOCATABLE attribute - character(len=:) :: deferredString -!ERROR: The type parameter LEN cannot be deferred without the POINTER or ALLOCATABLE attribute - character(:) :: colonString2 - !OK because of the allocatable attribute - character(:), allocatable :: colonString3 - -!ERROR: Must have INTEGER type, but is REAL(4) - character(3.5) :: badParamValue - - type derived(typeKind, typeLen) - integer, kind :: typeKind - integer, len :: typeLen - end type derived - - type (derived(constVal, 3)) :: constDerivedKind -!ERROR: Value of kind type parameter 'typekind' (nonconstval) is not a scalar INTEGER constant -!ERROR: Invalid specification expression: reference to local entity 'nonconstval' - type (derived(nonConstVal, 3)) :: nonConstDerivedKind - - !OK because all type-params are constants - type (derived(3, constVal)) :: constDerivedLen - -!ERROR: Invalid specification expression: reference to local entity 'nonconstval' - type (derived(3, nonConstVal)) :: nonConstDerivedLen -!ERROR: The value of type parameter 'typelen' cannot be deferred without the POINTER or ALLOCATABLE attribute - type (derived(3, :)) :: colonDerivedLen -!ERROR: The value of type parameter 'typekind' cannot be deferred without the POINTER or ALLOCATABLE attribute -!ERROR: The value of type parameter 'typelen' cannot be deferred without the POINTER or ALLOCATABLE attribute - type (derived( :, :)) :: colonDerivedLen1 - type (derived( :, :)), pointer :: colonDerivedLen2 - type (derived(4, :)), pointer :: colonDerivedLen3 -end subroutine s1 diff --git a/test-lit/Semantics/resolve70.f90 b/test-lit/Semantics/resolve70.f90 deleted file mode 100644 index 31f33c345b63..000000000000 --- a/test-lit/Semantics/resolve70.f90 +++ /dev/null @@ -1,59 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C703 (R702) The derived-type-spec shall not specify an abstract type (7.5.7). -! This constraint refers to the derived-type-spec in a type-spec. A type-spec -! can appear in an ALLOCATE statement, an ac-spec for an array constructor, and -! in the type specifier of a TYPE GUARD statement -! -! C706 TYPE(derived-type-spec) shall not specify an abstract type (7.5.7). -! This is for a declaration-type-spec -! -! C796 (R756) The derived-type-spec shall not specify an abstract type (7.5.7). -! -! C705 (R703) In a declaration-type-spec that uses the CLASS keyword, -! derived-type-spec shall specify an extensible type (7.5.7). -subroutine s() - type, abstract :: abstractType - end type abstractType - - type, extends(abstractType) :: concreteType - end type concreteType - - ! declaration-type-spec - !ERROR: ABSTRACT derived type may not be used here - type (abstractType), allocatable :: abstractVar - - ! ac-spec for an array constructor - !ERROR: ABSTRACT derived type may not be used here - !ERROR: ABSTRACT derived type may not be used here - type (abstractType), parameter :: abstractArray(*) = (/ abstractType :: /) - - class(*), allocatable :: selector - - ! Structure constructor - !ERROR: ABSTRACT derived type may not be used here - !ERROR: ABSTRACT derived type 'abstracttype' may not be used in a structure constructor - type (abstractType) :: abstractVar1 = abstractType() - - ! Allocate statement - !ERROR: ABSTRACT derived type may not be used here - allocate(abstractType :: abstractVar) - - select type(selector) - ! Type specifier for a type guard statement - !ERROR: ABSTRACT derived type may not be used here - type is (abstractType) - end select -end subroutine s - -subroutine s1() - type :: extensible - end type - type, bind(c) :: inextensible - end type - - ! This one's OK - class(extensible), allocatable :: y - - !ERROR: Non-extensible derived type 'inextensible' may not be used with CLASS keyword - class(inextensible), allocatable :: x -end subroutine s1 diff --git a/test-lit/Semantics/resolve71.f90 b/test-lit/Semantics/resolve71.f90 deleted file mode 100644 index 8c1c56fd9b0e..000000000000 --- a/test-lit/Semantics/resolve71.f90 +++ /dev/null @@ -1,24 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C708 An entity declared with the CLASS keyword shall be a dummy argument -! or have the ALLOCATABLE or POINTER attribute. -subroutine s() - type :: parentType - end type - - class(parentType), pointer :: pvar - class(parentType), allocatable :: avar - class(*), allocatable :: starAllocatableVar - class(*), pointer :: starPointerVar - !ERROR: CLASS entity 'barevar' must be a dummy argument or have ALLOCATABLE or POINTER attribute - class(parentType) :: bareVar - !ERROR: CLASS entity 'starvar' must be a dummy argument or have ALLOCATABLE or POINTER attribute - class(*) :: starVar - - contains - subroutine inner(arg1, arg2, arg3, arg4, arg5) - class (parenttype) :: arg1, arg3 - type(parentType) :: arg2 - class (parenttype), pointer :: arg4 - class (parenttype), allocatable :: arg5 - end subroutine inner -end subroutine s diff --git a/test-lit/Semantics/resolve72.f90 b/test-lit/Semantics/resolve72.f90 deleted file mode 100644 index 9963e27223a8..000000000000 --- a/test-lit/Semantics/resolve72.f90 +++ /dev/null @@ -1,26 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C709 An assumed-type entity shall be a dummy data object that does not have -! the ALLOCATABLE, CODIMENSION, INTENT (OUT), POINTER, or VALUE attribute and -! is not an explicit-shape array. -subroutine s() - !ERROR: Assumed-type entity 'starvar' must be a dummy argument - type(*) :: starVar - - contains - subroutine inner1(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) - type(*) :: arg1 ! OK - type(*), dimension(*) :: arg2 ! OK - !ERROR: Assumed-type argument 'arg3' cannot have the ALLOCATABLE attribute - type(*), allocatable :: arg3 - !ERROR: Assumed-type argument 'arg4' cannot be a coarray - type(*), codimension[*] :: arg4 - !ERROR: Assumed-type argument 'arg5' cannot be INTENT(OUT) - type(*), intent(out) :: arg5 - !ERROR: Assumed-type argument 'arg6' cannot have the POINTER attribute - type(*), pointer :: arg6 - !ERROR: Assumed-type argument 'arg7' cannot have the VALUE attribute - type(*), value :: arg7 - !ERROR: Assumed-type argument 'arg8' must be assumed shape or assumed size array - type(*), dimension(3) :: arg8 - end subroutine inner1 -end subroutine s diff --git a/test-lit/Semantics/resolve73.f90 b/test-lit/Semantics/resolve73.f90 deleted file mode 100644 index 35f8429aeacf..000000000000 --- a/test-lit/Semantics/resolve73.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C721 A type-param-value of * shall be used only -! * to declare a dummy argument, -! * to declare a named constant, -! * in the type-spec of an ALLOCATE statement wherein each allocate-object is -! a dummy argument of type CHARACTER with an assumed character length, -! * in the type-spec or derived-type-spec of a type guard statement (11.1.11), -! or -! * in an external function, to declare the character length parameter of the function result. -subroutine s(arg) - character(len=*), pointer :: arg - character*(*), parameter :: cvar1 = "abc" - character*4, cvar2 - character(len=4_4) :: cvar3 - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - character(len=*) :: cvar4 - - type derived(param) - integer, len :: param - class(*), allocatable :: x - end type - type(derived(34)) :: a - interface - function fun() - character(len=4) :: fun - end function fun - end interface - - select type (ax => a%x) - type is (integer) - print *, "hello" - type is (character(len=*)) - print *, "hello" - class is (derived(param=*)) - print *, "hello" - class default - print *, "hello" - end select - - allocate (character(len=*) :: arg) -end subroutine s diff --git a/test-lit/Semantics/resolve74.f90 b/test-lit/Semantics/resolve74.f90 deleted file mode 100644 index 60927b198769..000000000000 --- a/test-lit/Semantics/resolve74.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C722 A function name shall not be declared with an asterisk type-param-value -! unless it is of type CHARACTER and is the name of a dummy function or the -! name of the result of an external function. -subroutine s() - - type derived(param) - integer, len :: param - end type - type(derived(34)) :: a - - procedure(character(len=*)) :: externCharFunc - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - procedure(type(derived(param =*))) :: externDerivedFunc - - interface - subroutine subr(dummyFunc) - character(len=*) :: dummyFunc - end subroutine subr - end interface - - contains - function works() - type(derived(param=4)) :: works - end function works - - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - function fails1() - character(len=*) :: fails1 - end function fails1 - - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - function fails2() - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - type(derived(param=*)) :: fails2 - end function fails2 - -end subroutine s diff --git a/test-lit/Semantics/resolve75.f90 b/test-lit/Semantics/resolve75.f90 deleted file mode 100644 index 708ce8ffaeec..000000000000 --- a/test-lit/Semantics/resolve75.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! C726 The length specified for a character statement function or for a -! statement function dummy argument of type character shall be a constant -! expression. -subroutine s() - implicit character(len=3) (c) - implicit character(len=*) (d) - stmtFunc1 (x) = x * 32 - cStmtFunc2 (x) = "abc" - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - cStmtFunc3 (dummy) = "abc" - !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result - dStmtFunc3 (x) = "abc" -end subroutine s diff --git a/test-lit/Semantics/separate-module-procs.f90 b/test-lit/Semantics/separate-module-procs.f90 deleted file mode 100644 index 33dfcd557fde..000000000000 --- a/test-lit/Semantics/separate-module-procs.f90 +++ /dev/null @@ -1,116 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -!===--- separate-module-procs.f90 - Test separate module procedure ---------=== -! -! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -! See https://llvm.org/LICENSE.txt for license information. -! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -! -!===------------------------------------------------------------------------=== - -! case 1: ma_create_new_fun' was not declared a separate module procedure -module m1 - integer :: i - interface ma - module function ma_create_fun( ) result(this) - integer this - end function - end interface -end module - -submodule (m1) ma_submodule - integer :: j - contains - module function ma_create_fun() result(this) - integer this - i = 1 - j = 2 - end function - - !ERROR: 'ma_create_new_fun' was not declared a separate module procedure - module function ma_create_new_fun() result(this) - integer :: this - i = 2 - j = 1 - print *, "Hello" - end function -end submodule - -! case 2: 'mb_create_new_sub' was not declared a separate module procedure -module m2 - integer :: i - interface mb - module subroutine mb_create_sub - end subroutine mb_create_sub - end interface -end module - -submodule (m2) mb_submodule - integer :: j - contains - module subroutine mb_create_sub - integer this - i = 1 - j = 2 - end subroutine mb_create_sub - - !ERROR: 'mb_create_new_sub' was not declared a separate module procedure - module SUBROUTINE mb_create_new_sub() - integer :: this - i = 2 - j = 1 - end SUBROUTINE mb_create_new_sub -end submodule - -! case 3: separate module procedure without module prefix -module m3 - interface mc - function mc_create( ) result(this) - integer :: this - end function - end interface -end module - -submodule (m3) mc_submodule - contains - !ERROR: 'mc_create' was not declared a separate module procedure - module function mc_create() result(this) - integer :: this - end function -end submodule - -! case 4: Submodule having separate module procedure rather than a module -module m4 - interface - real module function func1() ! module procedure interface body for func1 - end function - end interface -end module - -submodule (m4) m4sub - interface - module function func2(b) ! module procedure interface body for func2 - integer :: b - integer :: func2 - end function - - real module function func3() ! module procedure interface body for func3 - end function - end interface - contains - real module function func1() ! implementation of func1 declared in m4 - func1 = 20 - end function -end submodule - -submodule (m4:m4sub) m4sub2 - contains - module function func2(b) ! implementation of func2 declared in m4sub - integer :: b - integer :: func2 - func2 = b - end function - - real module function func3() ! implementation of func3 declared in m4sub - func3 = 20 - end function -end submodule diff --git a/test-lit/Semantics/stop01.f90 b/test-lit/Semantics/stop01.f90 deleted file mode 100644 index 2ae8d65a84bb..000000000000 --- a/test-lit/Semantics/stop01.f90 +++ /dev/null @@ -1,61 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -program main - implicit none - integer :: i = -1 - integer, pointer :: p_i - integer(kind = 1) :: invalid = 0 - integer, dimension(1:100) :: iarray - integer, dimension(:), pointer :: p_iarray - integer, allocatable, dimension(:) :: aiarray - logical :: l = .false. - logical, dimension(1:100) :: larray - logical, allocatable, dimension(:) :: alarray - character(len = 128) :: chr1 - character(kind = 4, len = 128) :: chr2 - - if (i .eq. 0) stop "Stop." - if (i .eq. 0) stop "Stop."(1:4) - if (i .eq. 0) stop chr1 -!ERROR: CHARACTER stop code must be of default kind - if (i .eq. 0) stop chr2 - if (i .eq. 0) stop 1 - if (i .eq. 0) stop 1 + 2 - if (i .eq. 0) stop i - if (i .eq. 0) stop p_i - if (i .eq. 0) stop p_iarray(1) - if (i .eq. 0) stop iarray(1) - if (i .eq. 0) stop aiarray(1) - if (i .eq. 0) stop 1 + i -!ERROR: INTEGER stop code must be of default kind - if (i .eq. 0) stop invalid -!ERROR: Stop code must be of INTEGER or CHARACTER type - if (i .eq. 0) stop 12.34 - if (i .eq. 0) stop 1, quiet = .true. - if (i .eq. 0) stop 2, quiet = .false. - if (i .eq. 0) stop 3, quiet = l - if (i .eq. 0) stop 3, quiet = .not. l - if (i .eq. 0) stop 3, quiet = larray(1) - if (i .eq. 0) stop , quiet = .false. - if (i .eq. 0) error stop "Error." - if (i .eq. 0) error stop chr1 -!ERROR: CHARACTER stop code must be of default kind - if (i .eq. 0) error stop chr2 - if (i .eq. 0) error stop 1 - if (i .eq. 0) error stop i - if (i .eq. 0) error stop p_i - if (i .eq. 0) error stop p_iarray(1) - if (i .eq. 0) error stop iarray(1) - if (i .eq. 0) error stop aiarray(1) - if (i .eq. 0) error stop 1 + i -!ERROR: INTEGER stop code must be of default kind - if (i .eq. 0) error stop invalid -!ERROR: Stop code must be of INTEGER or CHARACTER type - if (i .eq. 0) error stop 12.34 - if (i .eq. 0) error stop 1, quiet = .true. - if (i .eq. 0) error stop 2, quiet = .false. - if (i .eq. 0) error stop 3, quiet = l - if (i .eq. 0) error stop 3, quiet = .not. l - if (i .eq. 0) error stop 3, quiet = larray(1) - if (i .eq. 0) error stop , quiet = .false. - stop -end program diff --git a/test-lit/Semantics/structconst01.f90 b/test-lit/Semantics/structconst01.f90 deleted file mode 100644 index 68f0261cd85d..000000000000 --- a/test-lit/Semantics/structconst01.f90 +++ /dev/null @@ -1,70 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Error tests for structure constructors. -! Errors caught by name resolution are tested elsewhere; these are the -! errors meant to be caught by expression semantic analysis, as well as -! acceptable use cases. -! Type parameters are used here to make the parses unambiguous. -! C796 (R756) The derived-type-spec shall not specify an abstract type (7.5.7). -! This refers to a derived-type-spec used in a structure constructor - -module module1 - type :: type1(j) - integer, kind :: j - integer :: n = 1 - end type type1 - type, extends(type1) :: type2(k) - integer, kind :: k - integer :: m - end type type2 - type, abstract :: abstract(j) - integer, kind :: j - integer :: n - end type abstract - type :: privaten(j) - integer, kind :: j - integer, private :: n - end type privaten - contains - subroutine type1arg(x) - type(type1(0)), intent(in) :: x - end subroutine type1arg - subroutine type2arg(x) - type(type2(0,0)), intent(in) :: x - end subroutine type2arg - subroutine abstractarg(x) - class(abstract(0)), intent(in) :: x - end subroutine abstractarg - subroutine errors - call type1arg(type1(0)()) - call type1arg(type1(0)(1)) - call type1arg(type1(0)(n=1)) - !ERROR: Type parameter 'j' may not appear as a component of a structure constructor - call type1arg(type1(0)(j=1)) - !ERROR: Component 'n' conflicts with another component earlier in this structure constructor - call type1arg(type1(0)(1,n=2)) - !ERROR: Value in structure constructor lacks a component name - call type1arg(type1(0)(n=1,2)) - !ERROR: Component 'n' conflicts with another component earlier in this structure constructor - call type1arg(type1(0)(n=1,n=2)) - !ERROR: Unexpected value in structure constructor - call type1arg(type1(0)(1,2)) - call type2arg(type2(0,0)(n=1,m=2)) - call type2arg(type2(0,0)(m=2)) - !ERROR: Structure constructor lacks a value for component 'm' - call type2arg(type2(0,0)()) - call type2arg(type2(0,0)(type1=type1(0)(n=1),m=2)) - call type2arg(type2(0,0)(type1=type1(0)(),m=2)) - !ERROR: Component 'type1' conflicts with another component earlier in this structure constructor - call type2arg(type2(0,0)(n=1,type1=type1(0)(n=2),m=3)) - !ERROR: Component 'n' conflicts with another component earlier in this structure constructor - call type2arg(type2(0,0)(type1=type1(0)(n=1),n=2,m=3)) - !ERROR: Component 'n' conflicts with another component earlier in this structure constructor - call type2arg(type2(0,0)(type1=type1(0)(1),n=2,m=3)) - !ERROR: Type parameter 'j' may not appear as a component of a structure constructor - call type2arg(type2(0,0)(j=1, & - !ERROR: Type parameter 'k' may not appear as a component of a structure constructor - k=2,m=3)) - !ERROR: ABSTRACT derived type 'abstract' may not be used in a structure constructor - call abstractarg(abstract(0)(n=1)) - end subroutine errors -end module module1 diff --git a/test-lit/Semantics/structconst02.f90 b/test-lit/Semantics/structconst02.f90 deleted file mode 100644 index 22428651fa1c..000000000000 --- a/test-lit/Semantics/structconst02.f90 +++ /dev/null @@ -1,42 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Error tests for structure constructors: per-component type -! (in)compatibility. - -module module1 - interface - real function realfunc(x) - real, value :: x - end function realfunc - end interface - type :: scalar(ik,rk,zk,ck,lk,len) - integer, kind :: ik = 4, rk = 4, zk = 4, ck = 1, lk = 1 - integer, len :: len = 1 - integer(kind=ik) :: ix = 0 - real(kind=rk) :: rx = 0. - complex(kind=zk) :: zx = (0.,0.) - character(kind=ck,len=len) :: cx = ' ' - logical(kind=lk) :: lx = .false. - real(kind=rk), pointer :: rp => NULL() - procedure(realfunc), pointer, nopass :: rfp1 => NULL() - procedure(real), pointer, nopass :: rfp2 => NULL() - end type scalar - contains - subroutine scalararg(x) - type(scalar), intent(in) :: x - end subroutine scalararg - subroutine errors - call scalararg(scalar(4)(ix=1,rx=2.,zx=(3.,4.),cx='a',lx=.true.)) - call scalararg(scalar(4)(1,2.,(3.,4.),'a',.true.)) -! call scalararg(scalar(4)(ix=5.,rx=6,zx=(7._8,8._2),cx=4_'b',lx=.true._4)) -! call scalararg(scalar(4)(5.,6,(7._8,8._2),4_'b',.true._4)) - call scalararg(scalar(4)(ix=5.,rx=6,zx=(7._8,8._2),cx=4_'b',lx=.true.)) - call scalararg(scalar(4)(5.,6,(7._8,8._2),4_'b',.true.)) - !ERROR: Value in structure constructor of type CHARACTER(1) is incompatible with component 'ix' of type INTEGER(4) - call scalararg(scalar(4)(ix='a')) - !ERROR: Value in structure constructor of type LOGICAL(4) is incompatible with component 'ix' of type INTEGER(4) - call scalararg(scalar(4)(ix=.false.)) - !ERROR: Value in structure constructor of type INTEGER(4) is incompatible with component 'ix' of type INTEGER(4) - call scalararg(scalar(4)(ix=[1])) - !TODO more! - end subroutine errors -end module module1 diff --git a/test-lit/Semantics/structconst03.f90 b/test-lit/Semantics/structconst03.f90 deleted file mode 100644 index 776b4d082309..000000000000 --- a/test-lit/Semantics/structconst03.f90 +++ /dev/null @@ -1,153 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Error tests for structure constructors: C1594 violations -! from assigning globally-visible data to POINTER components. -! test/Semantics/structconst04.f90 is this same test without type -! parameters. - -module usefrom - real, target :: usedfrom1 -end module usefrom - -module module1 - use usefrom - implicit none - type :: has_pointer1 - real, pointer :: ptop - type(has_pointer1), allocatable :: link1 ! don't loop during analysis - end type has_pointer1 - type :: has_pointer2 - type(has_pointer1) :: pnested - type(has_pointer2), allocatable :: link2 - end type has_pointer2 - type, extends(has_pointer2) :: has_pointer3 - type(has_pointer3), allocatable :: link3 - end type has_pointer3 - type :: t1(k) - integer, kind :: k - real, pointer :: pt1 - type(t1(k)), allocatable :: link - end type t1 - type :: t2(k) - integer, kind :: k - type(has_pointer1) :: hp1 - type(t2(k)), allocatable :: link - end type t2 - type :: t3(k) - integer, kind :: k - type(has_pointer2) :: hp2 - type(t3(k)), allocatable :: link - end type t3 - type :: t4(k) - integer, kind :: k - type(has_pointer3) :: hp3 - type(t4(k)), allocatable :: link - end type t4 - real, target :: modulevar1 - type(has_pointer1) :: modulevar2 - type(has_pointer2) :: modulevar3 - type(has_pointer3) :: modulevar4 - - contains - - pure subroutine ps1(dummy1, dummy2, dummy3, dummy4) - real, target :: local1 - type(t1(0)) :: x1 - type(t2(0)) :: x2 - type(t3(0)) :: x3 - type(t4(0)) :: x4 - real, intent(in), target :: dummy1 - real, intent(inout), target :: dummy2 - real, pointer :: dummy3 - real, intent(inout), target :: dummy4[*] - real, target :: commonvar1 - common /cblock/ commonvar1 - x1 = t1(0)(local1) - !ERROR: Externally visible object 'usedfrom1' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(0)(usedfrom1) - !ERROR: Externally visible object 'modulevar1' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(0)(modulevar1) - !ERROR: Externally visible object 'cblock' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(0)(commonvar1) - !ERROR: Externally visible object 'dummy1' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(0)(dummy1) - x1 = t1(0)(dummy2) - !ERROR: Externally visible object 'dummy3' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(0)(dummy3) -! TODO when semantics handles coindexing: -! TODO !ERROR: Externally visible object may not be associated with a pointer in a pure procedure -! TODO x1 = t1(0)(dummy4[0]) - x1 = t1(0)(dummy4) - !ERROR: Externally visible object 'modulevar2' may not be associated with pointer component 'ptop' in a pure procedure - x2 = t2(0)(modulevar2) - !ERROR: Externally visible object 'modulevar3' may not be associated with pointer component 'ptop' in a pure procedure - x3 = t3(0)(modulevar3) - !ERROR: Externally visible object 'modulevar4' may not be associated with pointer component 'ptop' in a pure procedure - x4 = t4(0)(modulevar4) - contains - pure subroutine subr(dummy1a, dummy2a, dummy3a, dummy4a) - real, target :: local1a - type(t1(0)) :: x1a - type(t2(0)) :: x2a - type(t3(0)) :: x3a - type(t4(0)) :: x4a - real, intent(in), target :: dummy1a - real, intent(inout), target :: dummy2a - real, pointer :: dummy3a - real, intent(inout), target :: dummy4a[*] - x1a = t1(0)(local1a) - !ERROR: Externally visible object 'usedfrom1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(usedfrom1) - !ERROR: Externally visible object 'modulevar1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(modulevar1) - !ERROR: Externally visible object 'commonvar1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(commonvar1) - !ERROR: Externally visible object 'dummy1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(dummy1) - !ERROR: Externally visible object 'dummy1a' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(dummy1a) - x1a = t1(0)(dummy2a) - !ERROR: Externally visible object 'dummy3' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(dummy3) - !ERROR: Externally visible object 'dummy3a' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(0)(dummy3a) -! TODO when semantics handles coindexing: -! TODO !ERROR: Externally visible object may not be associated with a pointer in a pure procedure -! TODO x1a = t1(0)(dummy4a[0]) - x1a = t1(0)(dummy4a) - !ERROR: Externally visible object 'modulevar2' may not be associated with pointer component 'ptop' in a pure procedure - x2a = t2(0)(modulevar2) - !ERROR: Externally visible object 'modulevar3' may not be associated with pointer component 'ptop' in a pure procedure - x3a = t3(0)(modulevar3) - !ERROR: Externally visible object 'modulevar4' may not be associated with pointer component 'ptop' in a pure procedure - x4a = t4(0)(modulevar4) - end subroutine subr - end subroutine - - impure real function ipf1(dummy1, dummy2, dummy3, dummy4) - real, target :: local1 - type(t1(0)) :: x1 - type(t2(0)) :: x2 - type(t3(0)) :: x3 - type(t4(0)) :: x4 - real, intent(in), target :: dummy1 - real, intent(inout), target :: dummy2 - real, pointer :: dummy3 - real, intent(inout), target :: dummy4[*] - real, target :: commonvar1 - common /cblock/ commonvar1 - ipf1 = 0. - x1 = t1(0)(local1) - x1 = t1(0)(usedfrom1) - x1 = t1(0)(modulevar1) - x1 = t1(0)(commonvar1) - x1 = t1(0)(dummy1) - x1 = t1(0)(dummy2) - x1 = t1(0)(dummy3) -! TODO when semantics handles coindexing: -! TODO x1 = t1(0)(dummy4[0]) - x1 = t1(0)(dummy4) - x2 = t2(0)(modulevar2) - x3 = t3(0)(modulevar3) - x4 = t4(0)(modulevar4) - end function ipf1 -end module module1 diff --git a/test-lit/Semantics/structconst04.f90 b/test-lit/Semantics/structconst04.f90 deleted file mode 100644 index 07a9d69df868..000000000000 --- a/test-lit/Semantics/structconst04.f90 +++ /dev/null @@ -1,148 +0,0 @@ -! RUN: %S/test_errors.sh %s %flang %t -! Error tests for structure constructors: C1594 violations -! from assigning globally-visible data to POINTER components. -! This test is structconst03.f90 with the type parameters removed. - -module usefrom - real, target :: usedfrom1 -end module usefrom - -module module1 - use usefrom - implicit none - type :: has_pointer1 - real, pointer :: ptop - type(has_pointer1), allocatable :: link1 ! don't loop during analysis - end type has_pointer1 - type :: has_pointer2 - type(has_pointer1) :: pnested - type(has_pointer2), allocatable :: link2 - end type has_pointer2 - type, extends(has_pointer2) :: has_pointer3 - type(has_pointer3), allocatable :: link3 - end type has_pointer3 - type :: t1 - real, pointer :: pt1 - type(t1), allocatable :: link - end type t1 - type :: t2 - type(has_pointer1) :: hp1 - type(t2), allocatable :: link - end type t2 - type :: t3 - type(has_pointer2) :: hp2 - type(t3), allocatable :: link - end type t3 - type :: t4 - type(has_pointer3) :: hp3 - type(t4), allocatable :: link - end type t4 - real, target :: modulevar1 - type(has_pointer1) :: modulevar2 - type(has_pointer2) :: modulevar3 - type(has_pointer3) :: modulevar4 - - contains - - pure subroutine ps1(dummy1, dummy2, dummy3, dummy4) - real, target :: local1 - type(t1) :: x1 - type(t2) :: x2 - type(t3) :: x3 - type(t4) :: x4 - real, intent(in), target :: dummy1 - real, intent(inout), target :: dummy2 - real, pointer :: dummy3 - real, intent(inout), target :: dummy4[*] - real, target :: commonvar1 - common /cblock/ commonvar1 - x1 = t1(local1) - !ERROR: Externally visible object 'usedfrom1' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(usedfrom1) - !ERROR: Externally visible object 'modulevar1' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(modulevar1) - !ERROR: Externally visible object 'cblock' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(commonvar1) - !ERROR: Externally visible object 'dummy1' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(dummy1) - x1 = t1(dummy2) - !ERROR: Externally visible object 'dummy3' may not be associated with pointer component 'pt1' in a pure procedure - x1 = t1(dummy3) -! TODO when semantics handles coindexing: -! TODO !ERROR: Externally visible object may not be associated with a pointer in a pure procedure -! TODO x1 = t1(dummy4[0]) - x1 = t1(dummy4) - !ERROR: Externally visible object 'modulevar2' may not be associated with pointer component 'ptop' in a pure procedure - x2 = t2(modulevar2) - !ERROR: Externally visible object 'modulevar3' may not be associated with pointer component 'ptop' in a pure procedure - x3 = t3(modulevar3) - !ERROR: Externally visible object 'modulevar4' may not be associated with pointer component 'ptop' in a pure procedure - x4 = t4(modulevar4) - contains - pure subroutine subr(dummy1a, dummy2a, dummy3a, dummy4a) - real, target :: local1a - type(t1) :: x1a - type(t2) :: x2a - type(t3) :: x3a - type(t4) :: x4a - real, intent(in), target :: dummy1a - real, intent(inout), target :: dummy2a - real, pointer :: dummy3a - real, intent(inout), target :: dummy4a[*] - x1a = t1(local1a) - !ERROR: Externally visible object 'usedfrom1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(usedfrom1) - !ERROR: Externally visible object 'modulevar1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(modulevar1) - !ERROR: Externally visible object 'commonvar1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(commonvar1) - !ERROR: Externally visible object 'dummy1' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(dummy1) - !ERROR: Externally visible object 'dummy1a' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(dummy1a) - x1a = t1(dummy2a) - !ERROR: Externally visible object 'dummy3' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(dummy3) - !ERROR: Externally visible object 'dummy3a' may not be associated with pointer component 'pt1' in a pure procedure - x1a = t1(dummy3a) -! TODO when semantics handles coindexing: -! TODO !ERROR: Externally visible object may not be associated with a pointer in a pure procedure -! TODO x1a = t1(dummy4a[0]) - x1a = t1(dummy4a) - !ERROR: Externally visible object 'modulevar2' may not be associated with pointer component 'ptop' in a pure procedure - x2a = t2(modulevar2) - !ERROR: Externally visible object 'modulevar3' may not be associated with pointer component 'ptop' in a pure procedure - x3a = t3(modulevar3) - !ERROR: Externally visible object 'modulevar4' may not be associated with pointer component 'ptop' in a pure procedure - x4a = t4(modulevar4) - end subroutine subr - end subroutine - - impure real function ipf1(dummy1, dummy2, dummy3, dummy4) - real, target :: local1 - type(t1) :: x1 - type(t2) :: x2 - type(t3) :: x3 - type(t4) :: x4 - real, intent(in), target :: dummy1 - real, intent(inout), target :: dummy2 - real, pointer :: dummy3 - real, intent(inout), target :: dummy4[*] - real, target :: commonvar1 - common /cblock/ commonvar1 - ipf1 = 0. - x1 = t1(local1) - x1 = t1(usedfrom1) - x1 = t1(modulevar1) - x1 = t1(commonvar1) - x1 = t1(dummy1) - x1 = t1(dummy2) - x1 = t1(dummy3) -! TODO when semantics handles coindexing: -! TODO x1 = t1(dummy4[0]) - x1 = t1(dummy4) - x2 = t2(modulevar2) - x3 = t3(modulevar3) - x4 = t4(modulevar4) - end function ipf1 -end module module1 diff --git a/test-lit/Semantics/symbol01.f90 b/test-lit/Semantics/symbol01.f90 deleted file mode 100644 index 9d8cacd3d6b8..000000000000 --- a/test-lit/Semantics/symbol01.f90 +++ /dev/null @@ -1,30 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Test that intent-stmt and subprogram prefix and suffix are resolved. - -!DEF: /m Module -module m - !DEF: /m/f PRIVATE, PURE, RECURSIVE (Function) Subprogram REAL(4) - private :: f -contains - !DEF: /m/s BIND(C), PUBLIC, PURE (Subroutine) Subprogram - !DEF: /m/s/x INTENT(IN) (Implicit) ObjectEntity REAL(4) - !DEF: /m/s/y INTENT(INOUT) (Implicit) ObjectEntity REAL(4) - pure subroutine s (x, y) bind(c) - !REF: /m/s/x - intent(in) :: x - !REF: /m/s/y - intent(inout) :: y - contains - !DEF: /m/s/ss PURE (Subroutine) Subprogram - pure subroutine ss - end subroutine - end subroutine - !REF: /m/f - !DEF: /m/f/x ALLOCATABLE ObjectEntity REAL(4) - recursive pure function f() result(x) - !REF: /m/f/x - real, allocatable :: x - !REF: /m/f/x - x = 1.0 - end function -end module diff --git a/test-lit/Semantics/symbol02.f90 b/test-lit/Semantics/symbol02.f90 deleted file mode 100644 index 8f53c50580ed..000000000000 --- a/test-lit/Semantics/symbol02.f90 +++ /dev/null @@ -1,53 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Test host association in module subroutine and internal subroutine. - -!DEF: /m Module -module m - !DEF: /m/t PUBLIC DerivedType - type :: t - end type - !REF: /m/t - !DEF: /m/x PUBLIC ObjectEntity TYPE(t) - type(t) :: x - interface - !DEF: /m/s3 MODULE, PUBLIC (Subroutine) Subprogram - !DEF: /m/s3/y ObjectEntity TYPE(t) - module subroutine s3(y) - !REF: /m/t - !REF: /m/s3/y - type(t) :: y - end subroutine - end interface -contains - !DEF: /m/s PUBLIC (Subroutine) Subprogram - subroutine s - !REF: /m/t - !DEF: /m/s/y ObjectEntity TYPE(t) - type(t) :: y - !REF: /m/s/y - !REF: /m/x - y = x - !DEF: /m/s/s (Subroutine) HostAssoc - call s - contains - !DEF: /m/s/s2 (Subroutine) Subprogram - subroutine s2 - !REF: /m/x - !REF: /m/s/y - !REF: /m/t - !REF: /m/s/s - import, only: x, y, t, s - !REF: /m/t - !DEF: /m/s/s2/z ObjectEntity TYPE(t) - type(t) :: z - !REF: /m/s/s2/z - !REF: /m/x - z = x - !REF: /m/s/s2/z - !REF: /m/s/y - z = y - !REF: /m/s/s - call s - end subroutine - end subroutine -end module diff --git a/test-lit/Semantics/symbol03.f90 b/test-lit/Semantics/symbol03.f90 deleted file mode 100644 index 41a7cc26e694..000000000000 --- a/test-lit/Semantics/symbol03.f90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Test host association in internal subroutine of main program. - -!DEF: /main MainProgram -program main - !DEF: /main/x ObjectEntity INTEGER(4) - integer x - !DEF: /main/s (Subroutine) Subprogram - call s -contains - !REF: /main/s - subroutine s - !DEF: /main/s/y (Implicit) ObjectEntity REAL(4) - !REF: /main/x - y = x - end subroutine -end program diff --git a/test-lit/Semantics/symbol05.f90 b/test-lit/Semantics/symbol05.f90 deleted file mode 100644 index 678b8f19f55d..000000000000 --- a/test-lit/Semantics/symbol05.f90 +++ /dev/null @@ -1,117 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Explicit and implicit entities in blocks - -!DEF: /s1 (Subroutine) Subprogram -subroutine s1 - !DEF: /s1/x ObjectEntity INTEGER(4) - integer x - block - !DEF: /s1/Block1/y ObjectEntity INTEGER(4) - integer y - !REF: /s1/x - x = 1 - !REF: /s1/Block1/y - y = 2.0 - end block - block - !DEF: /s1/Block2/y ObjectEntity REAL(4) - real y - !REF: /s1/Block2/y - y = 3.0 - end block -end subroutine - -!DEF: /s2 (Subroutine) Subprogram -subroutine s2 - implicit integer(w-x) - block - !DEF: /s2/x (Implicit) ObjectEntity INTEGER(4) - x = 1 - !DEF: /s2/y (Implicit) ObjectEntity REAL(4) - y = 2 - end block -contains - !DEF: /s2/s (Subroutine) Subprogram - subroutine s - !REF: /s2/x - x = 1 - !DEF: /s2/s/w (Implicit) ObjectEntity INTEGER(4) - w = 1 - end subroutine -end subroutine - -!DEF: /s3 (Subroutine) Subprogram -subroutine s3 - !DEF: /s3/j ObjectEntity INTEGER(8) - integer(kind=8) j - block - !DEF: /s3/Block1/t DerivedType - type :: t - !DEF: /s3/Block1/t/x ObjectEntity REAL(4) - !DEF: /s3/Block1/t/ImpliedDos1/i (Implicit) ObjectEntity INTEGER(4) - real :: x(10) = [(i, i=1,10)] - !DEF: /s3/Block1/t/y ObjectEntity REAL(4) - !DEF: /s3/Block1/t/ImpliedDos2/j ObjectEntity INTEGER(8) - real :: y(10) = [(j, j=1,10)] - end type - end block -end subroutine - -!DEF: /s4 (Subroutine) Subprogram -subroutine s4 - implicit integer(x) - interface - !DEF: /s4/s EXTERNAL (Subroutine) Subprogram - !DEF: /s4/s/x (Implicit) ObjectEntity REAL(4) - !DEF: /s4/s/y (Implicit) ObjectEntity INTEGER(4) - subroutine s (x, y) - implicit integer(y) - end subroutine - end interface -end subroutine - -!DEF: /s5 (Subroutine) Subprogram -subroutine s5 - block - !DEF: /s5/Block1/x (Implicit) ObjectEntity REAL(4) - dimension :: x(2) - block - !DEF: /s5/Block1/Block1/x (Implicit) ObjectEntity REAL(4) - dimension :: x(3) - end block - end block - !DEF: /s5/x (Implicit) ObjectEntity REAL(4) - x = 1.0 -end subroutine - -!DEF: /s6 (Subroutine) Subprogram -subroutine s6 - !DEF: /s6/i ObjectEntity INTEGER(4) - !DEF: /s6/j ObjectEntity INTEGER(4) - !DEF: /s6/k ObjectEntity INTEGER(4) - integer i, j, k - block - !DEF: /s6/Block1/i ASYNCHRONOUS, VOLATILE HostAssoc INTEGER(4) - volatile :: i - !DEF: /s6/Block1/j ASYNCHRONOUS HostAssoc INTEGER(4) - asynchronous :: j - !REF: /s6/Block1/i - asynchronous :: i - !DEF: /s6/Block1/k TARGET (Implicit) ObjectEntity INTEGER(4) - target :: k - end block -end subroutine - -!DEF: /m7 Module -module m7 - !DEF: /m7/i PUBLIC ObjectEntity INTEGER(4) - !DEF: /m7/j PUBLIC ObjectEntity INTEGER(4) - integer i, j -end module -!DEF: /s7 (Subroutine) Subprogram -subroutine s7 - !REF: /m7 - use :: m7 - !DEF: /s7/j VOLATILE Use INTEGER(4) - volatile :: j -end subroutine diff --git a/test-lit/Semantics/symbol06.f90 b/test-lit/Semantics/symbol06.f90 deleted file mode 100644 index b3b3e17b10da..000000000000 --- a/test-lit/Semantics/symbol06.f90 +++ /dev/null @@ -1,90 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!DEF: /main MainProgram -program main - !DEF: /main/t1 DerivedType - type :: t1 - !DEF: /main/t1/a1 ObjectEntity INTEGER(4) - integer :: a1 - end type - !REF: /main/t1 - !DEF: /main/t2 DerivedType - type, extends(t1) :: t2 - !DEF: /main/t2/a2 ObjectEntity INTEGER(4) - integer :: a2 - end type - !REF: /main/t2 - !DEF: /main/t3 DerivedType - type, extends(t2) :: t3 - !DEF: /main/t3/a3 ObjectEntity INTEGER(4) - integer :: a3 - end type - !REF: /main/t3 - !DEF: /main/x3 ObjectEntity TYPE(t3) - type(t3) :: x3 - !DEF: /main/i ObjectEntity INTEGER(4) - integer i - !REF: /main/i - !REF: /main/x3 - !REF: /main/t2/a2 - i = x3%a2 - !REF: /main/i - !REF: /main/x3 - !REF: /main/t1/a1 - i = x3%a1 - !REF: /main/i - !REF: /main/x3 - !DEF: /main/t3/t2 (ParentComp) ObjectEntity TYPE(t2) - !REF: /main/t2/a2 - i = x3%t2%a2 - !REF: /main/i - !REF: /main/x3 - !REF: /main/t3/t2 - !REF: /main/t1/a1 - i = x3%t2%a1 - !REF: /main/i - !REF: /main/x3 - !DEF: /main/t2/t1 (ParentComp) ObjectEntity TYPE(t1) - !REF: /main/t1/a1 - i = x3%t1%a1 - !REF: /main/i - !REF: /main/x3 - !REF: /main/t3/t2 - !REF: /main/t2/t1 - !REF: /main/t1/a1 - i = x3%t2%t1%a1 -end program - -!DEF: /m1 Module -module m1 - !DEF: /m1/t1 PUBLIC DerivedType - type :: t1 - !DEF: /m1/t1/t1 ObjectEntity INTEGER(4) - integer :: t1 - end type -end module - -!DEF: /s1 (Subroutine) Subprogram -subroutine s1 - !REF: /m1 - !DEF: /s1/t2 Use - !REF: /m1/t1 - use :: m1, only: t2 => t1 - !REF: /s1/t2 - !DEF: /s1/t3 DerivedType - type, extends(t2) :: t3 - end type - !REF: /s1/t3 - !DEF: /s1/x ObjectEntity TYPE(t3) - type(t3) :: x - !DEF: /s1/i ObjectEntity INTEGER(4) - integer i - !REF: /s1/i - !REF: /s1/x - !REF: /m1/t1/t1 - i = x%t1 - !REF: /s1/i - !REF: /s1/x - !DEF: /s1/t3/t2 (ParentComp) ObjectEntity TYPE(t2) - !REF: /m1/t1/t1 - i = x%t2%t1 -end subroutine diff --git a/test-lit/Semantics/symbol07.f90 b/test-lit/Semantics/symbol07.f90 deleted file mode 100644 index b387ec6c673b..000000000000 --- a/test-lit/Semantics/symbol07.f90 +++ /dev/null @@ -1,40 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!DEF: /main MainProgram -program main - implicit complex(z) - !DEF: /main/t DerivedType - type :: t - !DEF: /main/t/re ObjectEntity REAL(4) - real :: re - !DEF: /main/t/im ObjectEntity REAL(4) - real :: im - end type - !DEF: /main/z1 ObjectEntity COMPLEX(4) - complex z1 - !REF: /main/t - !DEF: /main/w ObjectEntity TYPE(t) - type(t) :: w - !DEF: /main/x ObjectEntity REAL(4) - !DEF: /main/y ObjectEntity REAL(4) - real x, y - !REF: /main/x - !REF: /main/z1 - x = z1%re - !REF: /main/y - !REF: /main/z1 - y = z1%im - !DEF: /main/z2 (Implicit) ObjectEntity COMPLEX(4) - !REF: /main/x - z2%re = x - !REF: /main/z2 - !REF: /main/y - z2%im = y - !REF: /main/x - !REF: /main/w - !REF: /main/t/re - x = w%re - !REF: /main/y - !REF: /main/w - !REF: /main/t/im - y = w%im -end program diff --git a/test-lit/Semantics/symbol08.f90 b/test-lit/Semantics/symbol08.f90 deleted file mode 100644 index 801f7f449b20..000000000000 --- a/test-lit/Semantics/symbol08.f90 +++ /dev/null @@ -1,15 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!DEF: /main MainProgram -program main - !DEF: /main/x POINTER ObjectEntity REAL(4) - pointer :: x - !REF: /main/x - real x - !DEF: /main/y EXTERNAL, POINTER (Function) ProcEntity REAL(4) - pointer :: y - !REF: /main/y - procedure (real) :: y - !DEF: /main/z (Implicit) ObjectEntity REAL(4) - !REF: /main/y - z = y() -end program diff --git a/test-lit/Semantics/symbol09.f90 b/test-lit/Semantics/symbol09.f90 deleted file mode 100644 index 77d4a3416df3..000000000000 --- a/test-lit/Semantics/symbol09.f90 +++ /dev/null @@ -1,142 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!DEF: /s1 (Subroutine) Subprogram -subroutine s1 - !DEF: /s1/a ObjectEntity REAL(4) - !DEF: /s1/b ObjectEntity REAL(4) - real a(10), b(10) - !DEF: /s1/i ObjectEntity INTEGER(8) - integer(kind=8) i - !DEF: /s1/Forall1/i ObjectEntity INTEGER(8) - forall(i=1:10) - !REF: /s1/a - !REF: /s1/Forall1/i - !REF: /s1/b - a(i) = b(i) - end forall - !DEF: /s1/Forall2/i ObjectEntity INTEGER(8) - !REF: /s1/a - !REF: /s1/b - forall(i=1:10)a(i) = b(i) -end subroutine - -!DEF: /s2 (Subroutine) Subprogram -subroutine s2 - !DEF: /s2/a ObjectEntity REAL(4) - real a(10) - !DEF: /s2/i ObjectEntity INTEGER(4) - integer i - !DEF: /s2/Block1/i ObjectEntity INTEGER(4) - do concurrent(i=1:10) - !REF: /s2/a - !REF: /s2/Block1/i - a(i) = i - end do - !REF: /s2/i - do i=1,10 - !REF: /s2/a - !REF: /s2/i - a(i) = i - end do -end subroutine - -!DEF: /s3 (Subroutine) Subprogram -subroutine s3 - !DEF: /s3/n PARAMETER ObjectEntity INTEGER(4) - integer, parameter :: n = 4 - !DEF: /s3/n2 PARAMETER ObjectEntity INTEGER(4) - !REF: /s3/n - integer, parameter :: n2 = n*n - !REF: /s3/n - !DEF: /s3/x ObjectEntity REAL(4) - real, dimension(n,n) :: x - !REF: /s3/x - !DEF: /s3/ImpliedDos1/k (Implicit) ObjectEntity INTEGER(4) - !DEF: /s3/ImpliedDos1/j ObjectEntity INTEGER(8) - !REF: /s3/n - !REF: /s3/n2 - data ((x(k,j),integer(kind=8)::j=1,n),k=1,n)/n2*3.0/ -end subroutine - -!DEF: /s4 (Subroutine) Subprogram -subroutine s4 - !DEF: /s4/t DerivedType - !DEF: /s4/t/k TypeParam INTEGER(4) - type :: t(k) - !REF: /s4/t/k - integer, kind :: k - !DEF: /s4/t/a ObjectEntity INTEGER(4) - integer :: a - end type t - !REF: /s4/t - !DEF: /s4/x (InDataStmt) ObjectEntity TYPE(t(k=1_4)) - type(t(1)) :: x - !REF: /s4/x - !REF: /s4/t - data x/t(1)(2)/ - !REF: /s4/x - !REF: /s4/t - x = t(1)(2) -end subroutine - -!DEF: /s5 (Subroutine) Subprogram -subroutine s5 - !DEF: /s5/t DerivedType - !DEF: /s5/t/l TypeParam INTEGER(4) - type :: t(l) - !REF: /s5/t/l - integer, len :: l - end type t - !REF: /s5/t - !DEF: /s5/x ALLOCATABLE ObjectEntity TYPE(t(l=:)) - type(t(:)), allocatable :: x - !DEF: /s5/y ALLOCATABLE ObjectEntity REAL(4) - real, allocatable :: y - !REF: /s5/t - !REF: /s5/x - allocate(t(1)::x) - !REF: /s5/y - allocate(real::y) -end subroutine - -!DEF: /s6 (Subroutine) Subprogram -subroutine s6 - !DEF: /s6/j ObjectEntity INTEGER(8) - integer(kind=8) j - !DEF: /s6/a ObjectEntity INTEGER(4) - integer :: a(5) = 1 - !DEF: /s6/Block1/i ObjectEntity INTEGER(4) - !DEF: /s6/Block1/j (LocalityLocal) HostAssoc INTEGER(8) - !DEF: /s6/Block1/k (LocalityLocalInit) HostAssoc INTEGER(4) - !DEF: /s6/Block1/a (LocalityShared) HostAssoc INTEGER(4) - do concurrent(integer::i=1:5)local(j)local_init(k)shared(a) - !REF: /s6/Block1/a - !REF: /s6/Block1/i - !REF: /s6/Block1/j - a(i) = j+1 - end do -end subroutine - -!DEF: /s7 (Subroutine) Subprogram -subroutine s7 - !DEF: /s7/one PARAMETER ObjectEntity REAL(4) - real, parameter :: one = 1.0 - !DEF: /s7/z ObjectEntity COMPLEX(4) - !REF: /s7/one - complex :: z = (one, -one) -end subroutine - -!DEF: /s8 (Subroutine) Subprogram -subroutine s8 - !DEF: /s8/one PARAMETER ObjectEntity REAL(4) - real, parameter :: one = 1.0 - !DEF: /s8/y ObjectEntity REAL(4) - !DEF: /s8/z ObjectEntity REAL(4) - real y(10), z(10) - !REF: /s8/y - !DEF: /s8/ImpliedDos1/i (Implicit) ObjectEntity INTEGER(4) - !REF: /s8/z - !DEF: /s8/ImpliedDos2/i (Implicit) ObjectEntity INTEGER(4) - !DEF: /s8/x (Implicit, InDataStmt) ObjectEntity REAL(4) - !REF: /s8/one - data (y(i),i=1,10),(z(i),i=1,10),x/21*one/ -end subroutine diff --git a/test-lit/Semantics/symbol10.f90 b/test-lit/Semantics/symbol10.f90 deleted file mode 100644 index e487764fa5a2..000000000000 --- a/test-lit/Semantics/symbol10.f90 +++ /dev/null @@ -1,40 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!DEF: /m1 Module -module m1 -contains - !DEF: /m1/foo_complex PUBLIC (Subroutine) Subprogram - !DEF: /m1/foo_complex/z ObjectEntity COMPLEX(4) - subroutine foo_complex (z) - !REF: /m1/foo_complex/z - complex z - end subroutine -end module -!DEF: /m2 Module -module m2 - !REF: /m1 - use :: m1 - !DEF: /m2/foo PUBLIC (Subroutine) Generic - interface foo - !DEF: /m2/foo_int PUBLIC (Subroutine) Subprogram - module procedure :: foo_int - !DEF: /m2/foo_real EXTERNAL, PUBLIC (Subroutine) Subprogram - procedure :: foo_real - !DEF: /m2/foo_complex PUBLIC (Subroutine) Use - procedure :: foo_complex - end interface - interface - !REF: /m2/foo_real - !DEF: /m2/foo_real/r ObjectEntity REAL(4) - subroutine foo_real (r) - !REF: /m2/foo_real/r - real r - end subroutine - end interface -contains - !REF: /m2/foo_int - !DEF: /m2/foo_int/i ObjectEntity INTEGER(4) - subroutine foo_int (i) - !REF: /m2/foo_int/i - integer i - end subroutine -end module diff --git a/test-lit/Semantics/symbol11.f90 b/test-lit/Semantics/symbol11.f90 deleted file mode 100644 index e759310c8dcb..000000000000 --- a/test-lit/Semantics/symbol11.f90 +++ /dev/null @@ -1,134 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -!DEF: /s1 (Subroutine) Subprogram -subroutine s1 - implicit none - !DEF: /s1/x ObjectEntity REAL(8) - real(kind=8) :: x = 2.0 - !DEF: /s1/a ObjectEntity INTEGER(4) - integer a - !DEF: /s1/t DerivedType - type :: t - end type - !REF: /s1/t - !DEF: /s1/z ALLOCATABLE ObjectEntity CLASS(t) - class(t), allocatable :: z - !DEF: /s1/Block1/a AssocEntity REAL(8) - !REF: /s1/x - !DEF: /s1/Block1/b AssocEntity REAL(8) - !DEF: /s1/Block1/c AssocEntity CLASS(t) - !REF: /s1/z - associate (a => x, b => x+1, c => z) - !REF: /s1/x - !REF: /s1/Block1/a - x = a - end associate -end subroutine - -!DEF: /s2 (Subroutine) Subprogram -subroutine s2 - !DEF: /s2/x ObjectEntity CHARACTER(4_4,1) - !DEF: /s2/y ObjectEntity CHARACTER(4_4,1) - character(len=4) x, y - !DEF: /s2/Block1/z AssocEntity CHARACTER(4_8,1) - !REF: /s2/x - associate (z => x) - !REF: /s2/Block1/z - print *, "z:", z - end associate - !TODO: need correct length for z - !DEF: /s2/Block2/z AssocEntity CHARACTER(8_8,1) - !REF: /s2/x - !REF: /s2/y - associate (z => x//y) - !REF: /s2/Block2/z - print *, "z:", z - end associate -end subroutine - -!DEF: /s3 (Subroutine) Subprogram -subroutine s3 - !DEF: /s3/t1 DerivedType - type :: t1 - !DEF: /s3/t1/a1 ObjectEntity INTEGER(4) - integer :: a1 - end type - !REF: /s3/t1 - !DEF: /s3/t2 DerivedType - type, extends(t1) :: t2 - !DEF: /s3/t2/a2 ObjectEntity INTEGER(4) - integer :: a2 - end type - !DEF: /s3/i ObjectEntity INTEGER(4) - integer i - !REF: /s3/t1 - !DEF: /s3/x POINTER ObjectEntity CLASS(t1) - class(t1), pointer :: x - !REF: /s3/x - select type (y => x) - !REF: /s3/t2 - class is (t2) - !REF: /s3/i - !DEF: /s3/Block1/y TARGET AssocEntity TYPE(t2) - !REF: /s3/t2/a2 - i = y%a2 - type is (integer(kind=8)) - !REF: /s3/i - !DEF: /s3/Block2/y TARGET AssocEntity INTEGER(8) - i = y - class default - !DEF: /s3/Block3/y TARGET AssocEntity CLASS(t1) - print *, y - end select -end subroutine - -!DEF: /s4 (Subroutine) Subprogram -subroutine s4 - !DEF: /s4/t1 DerivedType - type :: t1 - !DEF: /s4/t1/a ObjectEntity REAL(4) - real :: a - end type - !DEF: /s4/t2 DerivedType - type :: t2 - !REF: /s4/t1 - !DEF: /s4/t2/b ObjectEntity TYPE(t1) - type(t1) :: b - end type - !REF: /s4/t2 - !DEF: /s4/x ObjectEntity TYPE(t2) - type(t2) :: x - !DEF: /s4/Block1/y AssocEntity TYPE(t1) - !REF: /s4/x - !REF: /s4/t2/b - associate(y => x%b) - !REF: /s4/Block1/y - !REF: /s4/t1/a - y%a = 0.0 - end associate -end subroutine - -!DEF: /s5 (Subroutine) Subprogram -subroutine s5 - !DEF: /s5/t DerivedType - type :: t - !DEF: /s5/t/a ObjectEntity REAL(4) - real :: a - end type - !DEF: /s5/b ObjectEntity REAL(4) - real b - !DEF: /s5/Block1/x AssocEntity TYPE(t) - !DEF: /s5/f (Function) Subprogram TYPE(t) - associate(x => f()) - !REF: /s5/b - !REF: /s5/Block1/x - !REF: /s5/t/a - b = x%a - end associate -contains - !REF: /s5/f - function f() - !REF: /s5/t - !DEF: /s5/f/f ObjectEntity TYPE(t) - type(t) :: f - end function -end subroutine diff --git a/test-lit/Semantics/symbol12.f90 b/test-lit/Semantics/symbol12.f90 deleted file mode 100644 index 22350f6c25e2..000000000000 --- a/test-lit/Semantics/symbol12.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Verify that SAVE attribute is propagated by EQUIVALENCE - -!DEF: /s1 (Subroutine) Subprogram -subroutine s1 - !DEF: /s1/a SAVE ObjectEntity REAL(4) - !DEF: /s1/b SAVE ObjectEntity REAL(4) - !DEF: /s1/c SAVE ObjectEntity REAL(4) - !DEF: /s1/d SAVE ObjectEntity REAL(4) - real a, b, c, d - !REF: /s1/d - save :: d - !REF: /s1/a - !REF: /s1/b - equivalence(a, b) - !REF: /s1/b - !REF: /s1/c - equivalence(b, c) - !REF: /s1/c - !REF: /s1/d - equivalence(c, d) - !DEF: /s1/e ObjectEntity INTEGER(4) - !DEF: /s1/f ObjectEntity INTEGER(4) - equivalence(e, f) - !REF: /s1/e - !REF: /s1/f - integer e, f -end subroutine diff --git a/test-lit/Semantics/symbol13.f90 b/test-lit/Semantics/symbol13.f90 deleted file mode 100644 index 640066ed76ea..000000000000 --- a/test-lit/Semantics/symbol13.f90 +++ /dev/null @@ -1,23 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Old-style "*length" specifiers (R723) - -!DEF: /f1 (Function) Subprogram CHARACTER(1_8,1) -!DEF: /f1/x1 INTENT(IN) ObjectEntity CHARACTER(2_4,1) -!DEF: /f1/x2 INTENT(IN) ObjectEntity CHARACTER(3_4,1) -character*1 function f1(x1, x2) - !DEF: /f1/n PARAMETER ObjectEntity INTEGER(4) - integer, parameter :: n = 2 - !REF: /f1/n - !REF: /f1/x1 - !REF: /f1/x2 - !DEF: /f1/len INTRINSIC (Function) ProcEntity - character*(n), intent(in) :: x1, x2*(len(x1)+1) - !DEF: /f1/t DerivedType - type :: t - !REF: /f1/len - !REF: /f1/x2 - !DEF: /f1/t/c1 ObjectEntity CHARACTER(4_4,1) - !DEF: /f1/t/c2 ObjectEntity CHARACTER(6_8,1) - character*(len(x2)+1) :: c1, c2*6 - end type t -end function f1 diff --git a/test-lit/Semantics/symbol14.f90 b/test-lit/Semantics/symbol14.f90 deleted file mode 100644 index d523e8d6f480..000000000000 --- a/test-lit/Semantics/symbol14.f90 +++ /dev/null @@ -1,27 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! "Bare" uses of type parameters and components - - !DEF: /MainProgram1/t1 DerivedType - !DEF: /MainProgram1/t1/k TypeParam INTEGER(4) - type :: t1(k) - !REF: /MainProgram1/t1/k - integer, kind :: k=666 - !DEF: /MainProgram1/t1/a ObjectEntity REAL(4) - !REF: /MainProgram1/t1/k - real :: a(k) - end type t1 - !REF: /MainProgram1/t1 - !DEF: /MainProgram1/t2 DerivedType - type, extends(t1) :: t2 - !DEF: /MainProgram1/t2/b ObjectEntity REAL(4) - !REF: /MainProgram1/t1/k - real :: b(k) - !DEF: /MainProgram1/t2/c ObjectEntity REAL(4) - !DEF: /MainProgram1/size INTRINSIC (Function) ProcEntity - !REF: /MainProgram1/t1/a - real :: c(size(a)) - !REF: /MainProgram1/t1 - !DEF: /MainProgram1/t2/x ObjectEntity TYPE(t1(k=666_4)) - type(t1) :: x - end type t2 -end program diff --git a/test-lit/Semantics/symbol15.f90 b/test-lit/Semantics/symbol15.f90 deleted file mode 100644 index 00298cfa1d84..000000000000 --- a/test-lit/Semantics/symbol15.f90 +++ /dev/null @@ -1,254 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Forward references in pointer initializers and TBP bindings. - -!DEF: /m Module -module m - implicit none - abstract interface - !DEF: /m/iface PUBLIC (Subroutine) Subprogram - subroutine iface - end subroutine - end interface - !DEF: /m/op1 POINTER, PUBLIC ObjectEntity REAL(4) - real, pointer :: op1 - !DEF: /m/op2 POINTER, PUBLIC ObjectEntity REAL(4) - real, pointer :: op2 => null() - !DEF: /m/op3 POINTER, PUBLIC ObjectEntity REAL(4) - !DEF: /m/x PUBLIC, TARGET ObjectEntity REAL(4) - real, pointer :: op3 => x - !DEF: /m/op4 POINTER, PUBLIC ObjectEntity REAL(4) - !DEF: /m/y PUBLIC, TARGET ObjectEntity REAL(4) - real, pointer :: op4 => y(1) - !REF: /m/iface - !DEF: /m/pp1 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - procedure(iface), pointer :: pp1 - !REF: /m/iface - !DEF: /m/pp2 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - procedure(iface), pointer :: pp2 => null() - !REF: /m/iface - !DEF: /m/pp3 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - !DEF: /m/ext1 EXTERNAL, PUBLIC (Subroutine) ProcEntity - procedure(iface), pointer :: pp3 => ext1 - !REF: /m/iface - !DEF: /m/pp4 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - !DEF: /m/ext2 EXTERNAL, PUBLIC (Subroutine) Subprogram - procedure(iface), pointer :: pp4 => ext2 - !REF: /m/iface - !DEF: /m/pp5 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - !DEF: /m/ext3 EXTERNAL, PUBLIC (Subroutine) ProcEntity - procedure(iface), pointer :: pp5 => ext3 - !REF: /m/iface - !DEF: /m/pp6 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - !DEF: /m/modproc1 PUBLIC (Subroutine) Subprogram - procedure(iface), pointer :: pp6 => modproc1 - !DEF: /m/t1 PUBLIC DerivedType - type :: t1 - !DEF: /m/t1/opc1 POINTER ObjectEntity REAL(4) - real, pointer :: opc1 - !DEF: /m/t1/opc2 POINTER ObjectEntity REAL(4) - real, pointer :: opc2 => null() - !DEF: /m/t1/opc3 POINTER ObjectEntity REAL(4) - !REF: /m/x - real, pointer :: opc3 => x - !DEF: /m/t1/opc4 POINTER ObjectEntity REAL(4) - !REF: /m/y - real, pointer :: opc4 => y(1) - !REF: /m/iface - !DEF: /m/t1/ppc1 NOPASS, POINTER (Subroutine) ProcEntity - procedure(iface), nopass, pointer :: ppc1 - !REF: /m/iface - !DEF: /m/t1/ppc2 NOPASS, POINTER (Subroutine) ProcEntity - procedure(iface), nopass, pointer :: ppc2 => null() - !REF: /m/iface - !DEF: /m/t1/ppc3 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext1 - procedure(iface), nopass, pointer :: ppc3 => ext1 - !REF: /m/iface - !DEF: /m/t1/ppc4 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext2 - procedure(iface), nopass, pointer :: ppc4 => ext2 - !REF: /m/iface - !DEF: /m/t1/ppc5 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext3 - procedure(iface), nopass, pointer :: ppc5 => ext3 - !REF: /m/iface - !DEF: /m/t1/ppc6 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/modproc1 - procedure(iface), nopass, pointer :: ppc6 => modproc1 - contains - !DEF: /m/t1/b2 NOPASS ProcBinding - !REF: /m/ext2 - procedure, nopass :: b2 => ext2 - !DEF: /m/t1/b3 NOPASS ProcBinding - !REF: /m/ext3 - procedure, nopass :: b3 => ext3 - !DEF: /m/t1/b4 NOPASS ProcBinding - !REF: /m/modproc1 - procedure, nopass :: b4 => modproc1 - end type - !DEF: /m/pdt1 PUBLIC DerivedType - !DEF: /m/pdt1/k TypeParam INTEGER(4) - type :: pdt1(k) - !REF: /m/pdt1/k - integer, kind :: k - !DEF: /m/pdt1/opc1 POINTER ObjectEntity REAL(4) - real, pointer :: opc1 - !DEF: /m/pdt1/opc2 POINTER ObjectEntity REAL(4) - real, pointer :: opc2 => null() - !DEF: /m/pdt1/opc3 POINTER ObjectEntity REAL(4) - !REF: /m/x - real, pointer :: opc3 => x - !DEF: /m/pdt1/opc4 POINTER ObjectEntity REAL(4) - !REF: /m/y - !REF: /m/pdt1/k - real, pointer :: opc4 => y(k) - !REF: /m/iface - !DEF: /m/pdt1/ppc1 NOPASS, POINTER (Subroutine) ProcEntity - procedure(iface), nopass, pointer :: ppc1 - !REF: /m/iface - !DEF: /m/pdt1/ppc2 NOPASS, POINTER (Subroutine) ProcEntity - procedure(iface), nopass, pointer :: ppc2 => null() - !REF: /m/iface - !DEF: /m/pdt1/ppc3 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext1 - procedure(iface), nopass, pointer :: ppc3 => ext1 - !REF: /m/iface - !DEF: /m/pdt1/ppc4 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext2 - procedure(iface), nopass, pointer :: ppc4 => ext2 - !REF: /m/iface - !DEF: /m/pdt1/ppc5 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext3 - procedure(iface), nopass, pointer :: ppc5 => ext3 - !REF: /m/iface - !DEF: /m/pdt1/ppc6 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/modproc1 - procedure(iface), nopass, pointer :: ppc6 => modproc1 - contains - !DEF: /m/pdt1/b2 NOPASS ProcBinding - !REF: /m/ext2 - procedure, nopass :: b2 => ext2 - !DEF: /m/pdt1/b3 NOPASS ProcBinding - !REF: /m/ext3 - procedure, nopass :: b3 => ext3 - !DEF: /m/pdt1/b4 NOPASS ProcBinding - !REF: /m/modproc1 - procedure, nopass :: b4 => modproc1 - end type - !REF: /m/t1 - !DEF: /m/t1x PUBLIC ObjectEntity TYPE(t1) - type(t1) :: t1x - !REF: /m/pdt1 - !DEF: /m/pdt1x PUBLIC ObjectEntity TYPE(pdt1(k=1_4)) - type(pdt1(1)) :: pdt1x - !REF: /m/x - !REF: /m/y - real, target :: x, y(2) - !REF: /m/ext1 - external :: ext1 - !REF: /m/iface - !REF: /m/ext3 - procedure(iface) :: ext3 - interface - !REF: /m/ext2 - subroutine ext2 - end subroutine - end interface - !DEF: /m/op10 POINTER, PUBLIC ObjectEntity REAL(4) - !REF: /m/x - real, pointer :: op10 => x - !DEF: /m/op11 POINTER, PUBLIC ObjectEntity REAL(4) - !REF: /m/y - real, pointer :: op11 => y(1) - !REF: /m/iface - !DEF: /m/pp10 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - !REF: /m/ext1 - procedure(iface), pointer :: pp10 => ext1 - !REF: /m/iface - !DEF: /m/pp11 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity - !REF: /m/ext2 - procedure(iface), pointer :: pp11 => ext2 - !DEF: /m/t2 PUBLIC DerivedType - type :: t2 - !DEF: /m/t2/opc10 POINTER ObjectEntity REAL(4) - !REF: /m/x - real, pointer :: opc10 => x - !DEF: /m/t2/opc11 POINTER ObjectEntity REAL(4) - !REF: /m/y - real, pointer :: opc11 => y(1) - !REF: /m/iface - !DEF: /m/t2/ppc10 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext1 - procedure(iface), nopass, pointer :: ppc10 => ext1 - !REF: /m/iface - !DEF: /m/t2/ppc11 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext2 - procedure(iface), nopass, pointer :: ppc11 => ext2 - contains - !DEF: /m/t2/b10 NOPASS ProcBinding - !REF: /m/ext2 - procedure, nopass :: b10 => ext2 - !DEF: /m/t2/b11 NOPASS ProcBinding - !REF: /m/ext3 - procedure, nopass :: b11 => ext3 - end type - !DEF: /m/pdt2 PUBLIC DerivedType - !DEF: /m/pdt2/k TypeParam INTEGER(4) - type :: pdt2(k) - !REF: /m/pdt2/k - integer, kind :: k - !DEF: /m/pdt2/opc10 POINTER ObjectEntity REAL(4) - !REF: /m/x - real, pointer :: opc10 => x - !DEF: /m/pdt2/opc11 POINTER ObjectEntity REAL(4) - !REF: /m/y - !REF: /m/pdt2/k - real, pointer :: opc11 => y(k) - !REF: /m/iface - !DEF: /m/pdt2/ppc10 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext1 - procedure(iface), nopass, pointer :: ppc10 => ext1 - !REF: /m/iface - !DEF: /m/pdt2/ppc11 NOPASS, POINTER (Subroutine) ProcEntity - !REF: /m/ext2 - procedure(iface), nopass, pointer :: ppc11 => ext2 - contains - !DEF: /m/pdt2/b10 NOPASS ProcBinding - !REF: /m/ext2 - procedure, nopass :: b10 => ext2 - !DEF: /m/pdt2/b11 NOPASS ProcBinding - !REF: /m/ext3 - procedure, nopass :: b11 => ext3 - end type - !REF: /m/t2 - !DEF: /m/t2x PUBLIC ObjectEntity TYPE(t2) - type(t2) :: t2x - !REF: /m/pdt2 - !DEF: /m/pdt2x PUBLIC ObjectEntity TYPE(pdt2(k=1_4)) - type(pdt2(1)) :: pdt2x -contains - !REF: /m/modproc1 - subroutine modproc1 - end subroutine -end module -!DEF: /ext1 (Subroutine) Subprogram -subroutine ext1 -end subroutine -!DEF: /ext2 (Subroutine) Subprogram -subroutine ext2 -end subroutine -!DEF: /ext3 (Subroutine) Subprogram -subroutine ext3 -end subroutine -!DEF: /main MainProgram -program main - !REF: /m - use :: m - !DEF: /main/pdt1 Use - !DEF: /main/pdt1y ObjectEntity TYPE(pdt1(k=2_4)) - type(pdt1(2)) :: pdt1y - !DEF: /main/pdt2 Use - !DEF: /main/pdt2y ObjectEntity TYPE(pdt2(k=2_4)) - type(pdt2(2)) :: pdt2y - print *, "compiled" -end program diff --git a/test-lit/Semantics/symbol16.f90 b/test-lit/Semantics/symbol16.f90 deleted file mode 100644 index 0650222e0833..000000000000 --- a/test-lit/Semantics/symbol16.f90 +++ /dev/null @@ -1,17 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Statement functions - -!DEF: /p1 MainProgram -program p1 - !DEF: /p1/f (Function) Subprogram INTEGER(4) - !DEF: /p1/i ObjectEntity INTEGER(4) - !DEF: /p1/j ObjectEntity INTEGER(4) - integer f, i, j - !REF: /p1/f - !REF: /p1/i - !DEF: /p1/f/i ObjectEntity INTEGER(4) - f(i) = i + 1 - !REF: /p1/j - !REF: /p1/f - j = f(2) -end program diff --git a/test-lit/Semantics/symbol17.f90 b/test-lit/Semantics/symbol17.f90 deleted file mode 100644 index a99c8245f6d7..000000000000 --- a/test-lit/Semantics/symbol17.f90 +++ /dev/null @@ -1,140 +0,0 @@ -! RUN: %S/test_symbols.sh %s %flang %t -! Forward references to derived types (non-error cases) - -!DEF: /main MainProgram -program main - !DEF: /main/t1 DerivedType - type :: t1 - !DEF: /main/t2 DerivedType - !DEF: /main/t1/t1a ALLOCATABLE ObjectEntity TYPE(t2) - type(t2), allocatable :: t1a - !REF: /main/t2 - !DEF: /main/t1/t1p POINTER ObjectEntity TYPE(t2) - type(t2), pointer :: t1p - end type - !REF: /main/t2 - type :: t2 - !REF: /main/t2 - !DEF: /main/t2/t2a ALLOCATABLE ObjectEntity TYPE(t2) - type(t2), allocatable :: t2a - !REF: /main/t2 - !DEF: /main/t2/t2p POINTER ObjectEntity TYPE(t2) - type(t2), pointer :: t2p - end type - !REF: /main/t1 - !DEF: /main/t1x TARGET ObjectEntity TYPE(t1) - type(t1), target :: t1x - !REF: /main/t1x - !REF: /main/t1/t1a - allocate(t1x%t1a) - !REF: /main/t1x - !REF: /main/t1/t1p - !REF: /main/t1/t1a - t1x%t1p => t1x%t1a - !REF: /main/t1x - !REF: /main/t1/t1a - !REF: /main/t2/t2a - allocate(t1x%t1a%t2a) - !REF: /main/t1x - !REF: /main/t1/t1a - !REF: /main/t2/t2p - !REF: /main/t2/t2a - t1x%t1a%t2p => t1x%t1a%t2a -end program -!DEF: /f1/fwd DerivedType -!DEF: /f1 (Function) Subprogram TYPE(fwd) -!DEF: /f1/n (Implicit) ObjectEntity INTEGER(4) -type(fwd) function f1(n) - !REF: /f1/fwd - type :: fwd - !DEF: /f1/fwd/n ObjectEntity INTEGER(4) - integer :: n - end type - !DEF: /f1/f1 ObjectEntity TYPE(fwd) - !REF: /f1/fwd/n - !REF: /f1/n - f1%n = n -end function -!DEF: /s1 (Subroutine) Subprogram -!DEF: /s1/q1 (Implicit) ObjectEntity TYPE(fwd) -subroutine s1 (q1) - !DEF: /s1/fwd DerivedType - implicit type(fwd)(q) - !REF: /s1/fwd - type :: fwd - !DEF: /s1/fwd/n ObjectEntity INTEGER(4) - integer :: n - end type - !REF: /s1/q1 - !REF: /s1/fwd/n - q1%n = 1 -end subroutine -!DEF: /f2/fwdpdt DerivedType -!DEF: /f2/kind INTRINSIC (Function) ProcEntity -!DEF: /f2 (Function) Subprogram TYPE(fwdpdt(k=4_4)) -!DEF: /f2/n (Implicit) ObjectEntity INTEGER(4) -type(fwdpdt(kind(0))) function f2(n) - !REF: /f2/fwdpdt - !DEF: /f2/fwdpdt/k TypeParam INTEGER(4) - type :: fwdpdt(k) - !REF: /f2/fwdpdt/k - integer, kind :: k - !REF: /f2/fwdpdt/k - !DEF: /f2/fwdpdt/n ObjectEntity INTEGER(int(k,kind=8)) - integer(kind=k) :: n - end type - !DEF: /f2/f2 ObjectEntity TYPE(fwdpdt(k=4_4)) - !DEF: /f2/DerivedType2/n ObjectEntity INTEGER(4) - !REF: /f2/n - f2%n = n -end function -!DEF: /s2 (Subroutine) Subprogram -!DEF: /s2/q1 (Implicit) ObjectEntity TYPE(fwdpdt(k=4_4)) -subroutine s2 (q1) - !DEF: /s2/fwdpdt DerivedType - !DEF: /s2/kind INTRINSIC (Function) ProcEntity - implicit type(fwdpdt(kind(0)))(q) - !REF: /s2/fwdpdt - !DEF: /s2/fwdpdt/k TypeParam INTEGER(4) - type :: fwdpdt(k) - !REF: /s2/fwdpdt/k - integer, kind :: k - !REF: /s2/fwdpdt/k - !DEF: /s2/fwdpdt/n ObjectEntity INTEGER(int(k,kind=8)) - integer(kind=k) :: n - end type - !REF: /s2/q1 - !DEF: /s2/DerivedType2/n ObjectEntity INTEGER(4) - q1%n = 1 -end subroutine -!DEF: /m1 Module -module m1 - !DEF: /m1/forward PRIVATE DerivedType - private :: forward - !DEF: /m1/base PUBLIC DerivedType - type :: base - !REF: /m1/forward - !DEF: /m1/base/p POINTER ObjectEntity CLASS(forward) - class(forward), pointer :: p - end type - !REF: /m1/base - !REF: /m1/forward - type, extends(base) :: forward - !DEF: /m1/forward/n ObjectEntity INTEGER(4) - integer :: n - end type - contains - !DEF: /m1/test PUBLIC (Subroutine) Subprogram - subroutine test - !REF: /m1/forward - !DEF: /m1/test/object TARGET ObjectEntity TYPE(forward) - type(forward), target :: object - !REF: /m1/test/object - !REF: /m1/base/p - object%p => object - !REF: /m1/test/object - !REF: /m1/base/p - !REF: /m1/forward/n - object%p%n = 666 - end subroutine -end module diff --git a/test-lit/CMakeLists.txt b/test/CMakeLists.txt similarity index 100% rename from test-lit/CMakeLists.txt rename to test/CMakeLists.txt diff --git a/test-lit/Driver/version_test.f90 b/test/Driver/version_test.f90 similarity index 100% rename from test-lit/Driver/version_test.f90 rename to test/Driver/version_test.f90 diff --git a/test/Evaluate/folding01.f90 b/test/Evaluate/folding01.f90 index 81f59c59a277..8a75a819ff81 100644 --- a/test/Evaluate/folding01.f90 +++ b/test/Evaluate/folding01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test intrinsic operation folding diff --git a/test/Evaluate/folding02.f90 b/test/Evaluate/folding02.f90 index 47c7f6373e4f..b69ff87b5c20 100644 --- a/test/Evaluate/folding02.f90 +++ b/test/Evaluate/folding02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Check intrinsic function folding with host runtime library module m diff --git a/test/Evaluate/folding03.f90 b/test/Evaluate/folding03.f90 index 56a6adffb824..c5e26faf8327 100644 --- a/test/Evaluate/folding03.f90 +++ b/test/Evaluate/folding03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test operation folding edge case (both expected value and messages) ! These tests make assumptions regarding real(4) and integer(4) extrema. diff --git a/test/Evaluate/folding04.f90 b/test/Evaluate/folding04.f90 index 3ced207a742c..a0e207b375b7 100644 --- a/test/Evaluate/folding04.f90 +++ b/test/Evaluate/folding04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test intrinsic function folding edge case (both expected value and messages) ! These tests make assumptions regarding real(4) extrema. diff --git a/test/Evaluate/folding05.f90 b/test/Evaluate/folding05.f90 index 5e5e5c576976..79635e392d77 100644 Binary files a/test/Evaluate/folding05.f90 and b/test/Evaluate/folding05.f90 differ diff --git a/test/Evaluate/folding06.f90 b/test/Evaluate/folding06.f90 index c591989488c3..42dc70d5165e 100644 --- a/test/Evaluate/folding06.f90 +++ b/test/Evaluate/folding06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test transformational intrinsic function folding module m diff --git a/test/Evaluate/folding07.f90 b/test/Evaluate/folding07.f90 index b7e13eb027a3..9c9c0a40ed61 100644 --- a/test/Evaluate/folding07.f90 +++ b/test/Evaluate/folding07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test numeric model inquiry intrinsics module m diff --git a/test/Evaluate/folding08.f90 b/test/Evaluate/folding08.f90 index a5546b9cf2c4..67f435a99f31 100644 --- a/test/Evaluate/folding08.f90 +++ b/test/Evaluate/folding08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test folding of LBOUND and UBOUND module m diff --git a/test/Evaluate/folding09.f90 b/test/Evaluate/folding09.f90 index af89aecf951a..a7510604acca 100644 --- a/test/Evaluate/folding09.f90 +++ b/test/Evaluate/folding09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_folding.sh %s %flang %t ! Test folding of IS_CONTIGUOUS on simply contiguous items (9.5.4) ! When IS_CONTIGUOUS() is constant, it's .TRUE. diff --git a/test-lit/Evaluate/test_folding.sh b/test/Evaluate/test_folding.sh similarity index 100% rename from test-lit/Evaluate/test_folding.sh rename to test/Evaluate/test_folding.sh diff --git a/test-lit/Lower/pre-fir-tree01.f90 b/test/Lower/pre-fir-tree01.f90 similarity index 100% rename from test-lit/Lower/pre-fir-tree01.f90 rename to test/Lower/pre-fir-tree01.f90 diff --git a/test-lit/Lower/pre-fir-tree02.f90 b/test/Lower/pre-fir-tree02.f90 similarity index 100% rename from test-lit/Lower/pre-fir-tree02.f90 rename to test/Lower/pre-fir-tree02.f90 diff --git a/test-lit/Lower/pre-fir-tree03.f90 b/test/Lower/pre-fir-tree03.f90 similarity index 100% rename from test-lit/Lower/pre-fir-tree03.f90 rename to test/Lower/pre-fir-tree03.f90 diff --git a/test-lit/Lower/pre-fir-tree04.f90 b/test/Lower/pre-fir-tree04.f90 similarity index 100% rename from test-lit/Lower/pre-fir-tree04.f90 rename to test/Lower/pre-fir-tree04.f90 diff --git a/test/Preprocessing/pp001.F b/test/Preprocessing/pp001.F index ba131b4a24c6..3cbdcb5a6e3e 100644 --- a/test/Preprocessing/pp001.F +++ b/test/Preprocessing/pp001.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * keyword macros integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp002.F b/test/Preprocessing/pp002.F index f46baf73e289..1c3fea8341d2 100644 --- a/test/Preprocessing/pp002.F +++ b/test/Preprocessing/pp002.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #undef integer, parameter :: KWM = 777 #define KWM 666 diff --git a/test/Preprocessing/pp003.F b/test/Preprocessing/pp003.F index 0470f1909a69..aa996a230cea 100644 --- a/test/Preprocessing/pp003.F +++ b/test/Preprocessing/pp003.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * function-like macros integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp004.F b/test/Preprocessing/pp004.F index 800a96fbedba..9ac946701872 100644 --- a/test/Preprocessing/pp004.F +++ b/test/Preprocessing/pp004.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWMs case-sensitive integer, parameter :: KWM = 777 #define KWM 666 diff --git a/test/Preprocessing/pp005.F b/test/Preprocessing/pp005.F index 05fab7a92f1b..91a6e6bd8ced 100644 --- a/test/Preprocessing/pp005.F +++ b/test/Preprocessing/pp005.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM split across continuation, implicit padding integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp006.F b/test/Preprocessing/pp006.F index 55b87df8d430..79057fe5110e 100644 --- a/test/Preprocessing/pp006.F +++ b/test/Preprocessing/pp006.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * ditto, but with intervening *comment line integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp007.F b/test/Preprocessing/pp007.F index 8be4396a2492..56b27b3c6c9f 100644 --- a/test/Preprocessing/pp007.F +++ b/test/Preprocessing/pp007.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM split across continuation, clipped after column 72 integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp008.F b/test/Preprocessing/pp008.F index 38c5b6657a87..0edfc38419b0 100644 --- a/test/Preprocessing/pp008.F +++ b/test/Preprocessing/pp008.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM with spaces in name at invocation NOT replaced integer, parameter :: KWM = 777 #define KWM 666 diff --git a/test/Preprocessing/pp009.F b/test/Preprocessing/pp009.F index a53623ff0369..ec563ea2828e 100644 --- a/test/Preprocessing/pp009.F +++ b/test/Preprocessing/pp009.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call split across continuation, implicit padding integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp010.F b/test/Preprocessing/pp010.F index 0769c98274dd..84f6017eb821 100644 --- a/test/Preprocessing/pp010.F +++ b/test/Preprocessing/pp010.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * ditto, but with intervening *comment line integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp011.F b/test/Preprocessing/pp011.F index 4ec376649422..c3e344ccc12b 100644 --- a/test/Preprocessing/pp011.F +++ b/test/Preprocessing/pp011.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call name split across continuation, clipped integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp012.F b/test/Preprocessing/pp012.F index 703fabf7d8db..d4e1f71aab6f 100644 --- a/test/Preprocessing/pp012.F +++ b/test/Preprocessing/pp012.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call name split across continuation integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp013.F b/test/Preprocessing/pp013.F index 6fb8ca75b5c8..af4dec10b2f2 100644 --- a/test/Preprocessing/pp013.F +++ b/test/Preprocessing/pp013.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call split between name and ( integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp014.F b/test/Preprocessing/pp014.F index 397a31d1a8aa..0ba1e62da0ad 100644 --- a/test/Preprocessing/pp014.F +++ b/test/Preprocessing/pp014.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call split between name and (, with intervening *comment integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp015.F b/test/Preprocessing/pp015.F index 4c399a835567..aecad2657be8 100644 --- a/test/Preprocessing/pp015.F +++ b/test/Preprocessing/pp015.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call split between name and (, clipped integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp016.F b/test/Preprocessing/pp016.F index 210ad0b3fddb..e7960ac57002 100644 --- a/test/Preprocessing/pp016.F +++ b/test/Preprocessing/pp016.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call split between name and ( and in argument integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp017.F b/test/Preprocessing/pp017.F index e658fbd922cf..9708a7b5ead4 100644 --- a/test/Preprocessing/pp017.F +++ b/test/Preprocessing/pp017.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KLM rescan integer, parameter :: KWM = 666, KWM2 = 667 #define KWM2 777 diff --git a/test/Preprocessing/pp018.F b/test/Preprocessing/pp018.F index 877c6545e1c8..9a6fbb925cc2 100644 --- a/test/Preprocessing/pp018.F +++ b/test/Preprocessing/pp018.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KLM rescan with #undef (so rescan is after expansion) integer, parameter :: KWM2 = 777, KWM = 667 #define KWM2 666 diff --git a/test/Preprocessing/pp019.F b/test/Preprocessing/pp019.F index a2c9a0284857..278d9fa30320 100644 --- a/test/Preprocessing/pp019.F +++ b/test/Preprocessing/pp019.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM rescan integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp020.F b/test/Preprocessing/pp020.F index f0d26357c5d2..f1c3f4dbd0cc 100644 --- a/test/Preprocessing/pp020.F +++ b/test/Preprocessing/pp020.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM expansion of argument integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp021.F b/test/Preprocessing/pp021.F index 45073ab6f1e6..a4693a92a1d4 100644 --- a/test/Preprocessing/pp021.F +++ b/test/Preprocessing/pp021.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM NOT expanded in 'literal' #define KWM 666 character(len=3) :: ch diff --git a/test/Preprocessing/pp022.F b/test/Preprocessing/pp022.F index e9a1e8ba4b91..07f2b1c43220 100644 --- a/test/Preprocessing/pp022.F +++ b/test/Preprocessing/pp022.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM NOT expanded in "literal" #define KWM 666 character(len=3) :: ch diff --git a/test/Preprocessing/pp023.F b/test/Preprocessing/pp023.F index fb63d63f4fc1..51794e397c93 100644 --- a/test/Preprocessing/pp023.F +++ b/test/Preprocessing/pp023.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM NOT expanded in 9HHOLLERITH literal #define KWM 666 #define HKWM 667 diff --git a/test/Preprocessing/pp024.F b/test/Preprocessing/pp024.F index 9072f6e50cc8..aa810c3a1c91 100644 --- a/test/Preprocessing/pp024.F +++ b/test/Preprocessing/pp024.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM NOT expanded in Hollerith in FORMAT #define KWM 666 #define HKWM 667 diff --git a/test/Preprocessing/pp025.F b/test/Preprocessing/pp025.F index 42ad011842ff..bd6976d350e8 100644 --- a/test/Preprocessing/pp025.F +++ b/test/Preprocessing/pp025.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * KWM expansion is before token pasting due to fixed-form space removal integer, parameter :: IKWM2Z = 777 #define KWM KWM2 diff --git a/test/Preprocessing/pp026.F b/test/Preprocessing/pp026.F index e0ea032c383f..edbb30fab2ea 100644 --- a/test/Preprocessing/pp026.F +++ b/test/Preprocessing/pp026.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * ## token pasting works in FLM integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp027.F b/test/Preprocessing/pp027.F index e2663800c1ce..f21236b8c762 100644 --- a/test/Preprocessing/pp027.F +++ b/test/Preprocessing/pp027.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #DEFINE works in fixed form integer, parameter :: KWM = 666 #DEFINE KWM 777 diff --git a/test/Preprocessing/pp028.F b/test/Preprocessing/pp028.F index 2906d389b57d..3e23d9b92041 100644 --- a/test/Preprocessing/pp028.F +++ b/test/Preprocessing/pp028.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * fixed-form clipping done before KWM expansion on source line integer, parameter :: KW = 777 #define KWM 666 diff --git a/test/Preprocessing/pp029.F b/test/Preprocessing/pp029.F index 4374ef84489b..a3ead5d9e507 100644 --- a/test/Preprocessing/pp029.F +++ b/test/Preprocessing/pp029.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * \ newline allowed in #define integer, parameter :: KWM = 666 #define KWM 77\ diff --git a/test/Preprocessing/pp030.F b/test/Preprocessing/pp030.F index 3022e0ddf3df..da356e83f56f 100644 --- a/test/Preprocessing/pp030.F +++ b/test/Preprocessing/pp030.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * /* C comment */ erased from #define integer, parameter :: KWM = 666 #define KWM 777 /* C comment */ diff --git a/test/Preprocessing/pp031.F b/test/Preprocessing/pp031.F index 0f59921bcb82..6e287662df91 100644 --- a/test/Preprocessing/pp031.F +++ b/test/Preprocessing/pp031.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * // C++ comment NOT erased from #define integer, parameter :: KWM = 666 #define KWM 777 // C comment diff --git a/test/Preprocessing/pp032.F b/test/Preprocessing/pp032.F index 9d9f14238d86..b8772d9798ba 100644 --- a/test/Preprocessing/pp032.F +++ b/test/Preprocessing/pp032.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * /* C comment */ \ newline erased from #define integer, parameter :: KWM = 666 #define KWM 77/* C comment */\ diff --git a/test/Preprocessing/pp033.F b/test/Preprocessing/pp033.F index 34cf1996cc74..27228aa270f0 100644 --- a/test/Preprocessing/pp033.F +++ b/test/Preprocessing/pp033.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * /* C comment \ newline */ erased from #define integer, parameter :: KWM = 666 #define KWM 77/* C comment \ diff --git a/test/Preprocessing/pp034.F b/test/Preprocessing/pp034.F index a9ed984b3b6e..7f77e1857d6f 100644 --- a/test/Preprocessing/pp034.F +++ b/test/Preprocessing/pp034.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * \ newline allowed in name on KWM definition integer, parameter :: KWMC = 666 #define KWM\ diff --git a/test/Preprocessing/pp035.F b/test/Preprocessing/pp035.F index 0135c9c4551a..c1acd3288533 100644 --- a/test/Preprocessing/pp035.F +++ b/test/Preprocessing/pp035.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #if 2 .LT. 3 works integer, parameter :: KWM = 666 #if 2 .LT. 3 diff --git a/test/Preprocessing/pp036.F b/test/Preprocessing/pp036.F index ac922ae42ceb..9327c9af5e10 100644 --- a/test/Preprocessing/pp036.F +++ b/test/Preprocessing/pp036.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #define FALSE TRUE ... .FALSE. -> .TRUE. #define FALSE TRUE if (.FALSE.) then diff --git a/test/Preprocessing/pp037.F b/test/Preprocessing/pp037.F index 6c3edb09eb6f..10272a0d6c58 100644 --- a/test/Preprocessing/pp037.F +++ b/test/Preprocessing/pp037.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * fixed-form clipping NOT applied to #define integer, parameter :: KWM = 666 * 1 2 3 4 5 6 7 diff --git a/test/Preprocessing/pp038.F b/test/Preprocessing/pp038.F index 3c83dda7d03b..6ec8157bacb2 100644 --- a/test/Preprocessing/pp038.F +++ b/test/Preprocessing/pp038.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call with closing ')' on next line (not a continuation) integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp039.F b/test/Preprocessing/pp039.F index 52e6dd78603a..b26cd7df47b8 100644 --- a/test/Preprocessing/pp039.F +++ b/test/Preprocessing/pp039.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * FLM call with '(' on next line (not a continuation) integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp040.F b/test/Preprocessing/pp040.F index 59e901ac3c6b..f68f7d7895de 100644 --- a/test/Preprocessing/pp040.F +++ b/test/Preprocessing/pp040.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #define KWM c, then KWM works as comment line initiator #define KWM c KWM print *, 'pp040.F FAIL HARD!'; stop diff --git a/test/Preprocessing/pp041.F b/test/Preprocessing/pp041.F index 33c5ced3924d..73a2462f6fff 100644 --- a/test/Preprocessing/pp041.F +++ b/test/Preprocessing/pp041.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * use KWM expansion as continuation indicators #define KWM 0 #define KWM2 1 diff --git a/test/Preprocessing/pp042.F b/test/Preprocessing/pp042.F index 439e1affbca2..9e3f97ac4990 100644 --- a/test/Preprocessing/pp042.F +++ b/test/Preprocessing/pp042.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #define c 1, then use c as label in fixed-form #define c 1 c print *, 'pp042.F pass'; goto 2 diff --git a/test/Preprocessing/pp043.F b/test/Preprocessing/pp043.F index be0069cf8557..9b5912815a14 100644 --- a/test/Preprocessing/pp043.F +++ b/test/Preprocessing/pp043.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #define with # in column 6 is a continuation line in fixed-form integer, parameter :: defineKWM666 = 555 integer, parameter :: KWM = diff --git a/test/Preprocessing/pp044.F b/test/Preprocessing/pp044.F index 72ce6cc41159..dc409587e0f3 100644 --- a/test/Preprocessing/pp044.F +++ b/test/Preprocessing/pp044.F @@ -1,3 +1,4 @@ +! RUN: %flang -E %s * #define directive amid continuations integer, parameter :: KWM = 222, KWM111 = 333, KWM222 = 555 integer, parameter :: KWMKWM = 333 diff --git a/test/Preprocessing/pp101.F90 b/test/Preprocessing/pp101.F90 index 694201a8f33e..0c7def81978d 100644 --- a/test/Preprocessing/pp101.F90 +++ b/test/Preprocessing/pp101.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! keyword macros integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp102.F90 b/test/Preprocessing/pp102.F90 index 22e4613b3b18..cbf6865e06a2 100644 --- a/test/Preprocessing/pp102.F90 +++ b/test/Preprocessing/pp102.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! #undef integer, parameter :: KWM = 777 #define KWM 666 diff --git a/test/Preprocessing/pp103.F90 b/test/Preprocessing/pp103.F90 index 9df4c9dbdf7b..4bb4a7942f84 100644 --- a/test/Preprocessing/pp103.F90 +++ b/test/Preprocessing/pp103.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! function-like macros integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp104.F90 b/test/Preprocessing/pp104.F90 index b15f0db7c5b9..edc9b41a5776 100644 --- a/test/Preprocessing/pp104.F90 +++ b/test/Preprocessing/pp104.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWMs case-sensitive integer, parameter :: KWM = 777 #define KWM 666 diff --git a/test/Preprocessing/pp105.F90 b/test/Preprocessing/pp105.F90 index cd475db01c39..2a178652673a 100644 --- a/test/Preprocessing/pp105.F90 +++ b/test/Preprocessing/pp105.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM call name split across continuation, with leading & integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp106.F90 b/test/Preprocessing/pp106.F90 index e169ff70b2ce..74f6e2fc94b2 100644 --- a/test/Preprocessing/pp106.F90 +++ b/test/Preprocessing/pp106.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! ditto, with & ! comment integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp107.F90 b/test/Preprocessing/pp107.F90 index bf6d427c0400..ac7c15480ce9 100644 --- a/test/Preprocessing/pp107.F90 +++ b/test/Preprocessing/pp107.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM call name split across continuation, no leading &, with & ! comment integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp108.F90 b/test/Preprocessing/pp108.F90 index 7ce6ccbdedc1..78d65b2aa2ef 100644 --- a/test/Preprocessing/pp108.F90 +++ b/test/Preprocessing/pp108.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! ditto, but without & ! comment integer, parameter :: KWM = 666 #define KWM 777 diff --git a/test/Preprocessing/pp109.F90 b/test/Preprocessing/pp109.F90 index a80579d18b3e..8f78fccce539 100644 --- a/test/Preprocessing/pp109.F90 +++ b/test/Preprocessing/pp109.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM call name split with leading & integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp110.F90 b/test/Preprocessing/pp110.F90 index f5bf3b1867f4..c822c399c92d 100644 --- a/test/Preprocessing/pp110.F90 +++ b/test/Preprocessing/pp110.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! ditto, with & ! comment integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp111.F90 b/test/Preprocessing/pp111.F90 index 668fcdc5f8d3..3e6f7ab72117 100644 --- a/test/Preprocessing/pp111.F90 +++ b/test/Preprocessing/pp111.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM call name split across continuation, no leading &, with & ! comment integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp112.F90 b/test/Preprocessing/pp112.F90 index 0a3c7f8906dc..99a88655f584 100644 --- a/test/Preprocessing/pp112.F90 +++ b/test/Preprocessing/pp112.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! ditto, but without & ! comment integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp113.F90 b/test/Preprocessing/pp113.F90 index 4c928033638f..2f0ec74c2195 100644 --- a/test/Preprocessing/pp113.F90 +++ b/test/Preprocessing/pp113.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM call split across continuation between name and (, leading & integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp114.F90 b/test/Preprocessing/pp114.F90 index f6c0e0263a2f..9f314b2b8418 100644 --- a/test/Preprocessing/pp114.F90 +++ b/test/Preprocessing/pp114.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! ditto, with & ! comment, leading & integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp115.F90 b/test/Preprocessing/pp115.F90 index 4a38aca53311..0a2be4a950b1 100644 --- a/test/Preprocessing/pp115.F90 +++ b/test/Preprocessing/pp115.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! ditto, with & ! comment, no leading & integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp116.F90 b/test/Preprocessing/pp116.F90 index 8708f79347cc..eb46b804415d 100644 --- a/test/Preprocessing/pp116.F90 +++ b/test/Preprocessing/pp116.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM call split between name and (, no leading & integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp117.F90 b/test/Preprocessing/pp117.F90 index 8b8687f03743..10b0353353de 100644 --- a/test/Preprocessing/pp117.F90 +++ b/test/Preprocessing/pp117.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM rescan integer, parameter :: KWM = 666, KWM2 = 667 #define KWM2 777 diff --git a/test/Preprocessing/pp118.F90 b/test/Preprocessing/pp118.F90 index 014d99791f1a..8c86c16efe13 100644 --- a/test/Preprocessing/pp118.F90 +++ b/test/Preprocessing/pp118.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM rescan with #undef, proving rescan after expansion integer, parameter :: KWM2 = 777, KWM = 667 #define KWM2 666 diff --git a/test/Preprocessing/pp119.F90 b/test/Preprocessing/pp119.F90 index 37470de411a4..1a2775966d19 100644 --- a/test/Preprocessing/pp119.F90 +++ b/test/Preprocessing/pp119.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM rescan integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp120.F90 b/test/Preprocessing/pp120.F90 index f7e0ae103490..dccc5c624cc2 100644 --- a/test/Preprocessing/pp120.F90 +++ b/test/Preprocessing/pp120.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM expansion of argument integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp121.F90 b/test/Preprocessing/pp121.F90 index bd855fe2f6ab..ca6df63feb54 100644 --- a/test/Preprocessing/pp121.F90 +++ b/test/Preprocessing/pp121.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM NOT expanded in 'literal' #define KWM 666 character(len=3) :: ch diff --git a/test/Preprocessing/pp122.F90 b/test/Preprocessing/pp122.F90 index dbad83a61c6a..004340072fa2 100644 --- a/test/Preprocessing/pp122.F90 +++ b/test/Preprocessing/pp122.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM NOT expanded in "literal" #define KWM 666 character(len=3) :: ch diff --git a/test/Preprocessing/pp123.F90 b/test/Preprocessing/pp123.F90 index 6e6c45244b8a..b40fa356a4fb 100644 --- a/test/Preprocessing/pp123.F90 +++ b/test/Preprocessing/pp123.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM NOT expanded in Hollerith literal #define KWM 666 #define HKWM 667 diff --git a/test/Preprocessing/pp124.F90 b/test/Preprocessing/pp124.F90 index 2cf4d56dba23..8b74ef37c130 100644 --- a/test/Preprocessing/pp124.F90 +++ b/test/Preprocessing/pp124.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! KWM NOT expanded in Hollerith in FORMAT #define KWM 666 #define HKWM 667 diff --git a/test/Preprocessing/pp125.F90 b/test/Preprocessing/pp125.F90 index 5f3875d8e88e..0671697f1fe1 100644 --- a/test/Preprocessing/pp125.F90 +++ b/test/Preprocessing/pp125.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! #DEFINE works in free form integer, parameter :: KWM = 666 #DEFINE KWM 777 diff --git a/test/Preprocessing/pp126.F90 b/test/Preprocessing/pp126.F90 index c2684c51413b..a2180bcc5e4b 100644 --- a/test/Preprocessing/pp126.F90 +++ b/test/Preprocessing/pp126.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! \ newline works in #define integer, parameter :: KWM = 666 #define KWM 77\ diff --git a/test/Preprocessing/pp127.F90 b/test/Preprocessing/pp127.F90 index 19f83b6afbc9..842d2bf6954b 100644 --- a/test/Preprocessing/pp127.F90 +++ b/test/Preprocessing/pp127.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM call with closing ')' on next line (not a continuation) integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp128.F90 b/test/Preprocessing/pp128.F90 index 84b338bc7cc9..dc2516e14078 100644 --- a/test/Preprocessing/pp128.F90 +++ b/test/Preprocessing/pp128.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! FLM call with '(' on next line (not a continuation) integer function IFLM(x) integer :: x diff --git a/test/Preprocessing/pp129.F90 b/test/Preprocessing/pp129.F90 index a8eea8699683..b0fe285e4011 100644 --- a/test/Preprocessing/pp129.F90 +++ b/test/Preprocessing/pp129.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! #define KWM !, then KWM works as comment line initiator #define KWM ! KWM print *, 'pp129.F90 FAIL HARD!'; stop diff --git a/test/Preprocessing/pp130.F90 b/test/Preprocessing/pp130.F90 index c3d8079210c6..3c1baab63b7f 100644 --- a/test/Preprocessing/pp130.F90 +++ b/test/Preprocessing/pp130.F90 @@ -1,3 +1,4 @@ +! RUN: %flang -E %s ! #define KWM &, use for continuation w/o pasting (ifort and nag seem to continue #define) #define KWM & diff --git a/test-lit/Semantics/Inputs/getdefinition03-b.f90 b/test/Semantics/Inputs/getdefinition03-b.f90 similarity index 100% rename from test-lit/Semantics/Inputs/getdefinition03-b.f90 rename to test/Semantics/Inputs/getdefinition03-b.f90 diff --git a/test-lit/Semantics/Inputs/getsymbols02-a.f90 b/test/Semantics/Inputs/getsymbols02-a.f90 similarity index 100% rename from test-lit/Semantics/Inputs/getsymbols02-a.f90 rename to test/Semantics/Inputs/getsymbols02-a.f90 diff --git a/test-lit/Semantics/Inputs/getsymbols02-b.f90 b/test/Semantics/Inputs/getsymbols02-b.f90 similarity index 100% rename from test-lit/Semantics/Inputs/getsymbols02-b.f90 rename to test/Semantics/Inputs/getsymbols02-b.f90 diff --git a/test-lit/Semantics/Inputs/getsymbols02-c.f90 b/test/Semantics/Inputs/getsymbols02-c.f90 similarity index 100% rename from test-lit/Semantics/Inputs/getsymbols02-c.f90 rename to test/Semantics/Inputs/getsymbols02-c.f90 diff --git a/test-lit/Semantics/Inputs/getsymbols03-b.f90 b/test/Semantics/Inputs/getsymbols03-b.f90 similarity index 100% rename from test-lit/Semantics/Inputs/getsymbols03-b.f90 rename to test/Semantics/Inputs/getsymbols03-b.f90 diff --git a/test-lit/Semantics/Inputs/mod-file-changed.f90 b/test/Semantics/Inputs/mod-file-changed.f90 similarity index 100% rename from test-lit/Semantics/Inputs/mod-file-changed.f90 rename to test/Semantics/Inputs/mod-file-changed.f90 diff --git a/test-lit/Semantics/Inputs/mod-file-unchanged.f90 b/test/Semantics/Inputs/mod-file-unchanged.f90 similarity index 100% rename from test-lit/Semantics/Inputs/mod-file-unchanged.f90 rename to test/Semantics/Inputs/mod-file-unchanged.f90 diff --git a/test-lit/Semantics/Inputs/modfile09-a.f90 b/test/Semantics/Inputs/modfile09-a.f90 similarity index 100% rename from test-lit/Semantics/Inputs/modfile09-a.f90 rename to test/Semantics/Inputs/modfile09-a.f90 diff --git a/test-lit/Semantics/Inputs/modfile09-b.f90 b/test/Semantics/Inputs/modfile09-b.f90 similarity index 100% rename from test-lit/Semantics/Inputs/modfile09-b.f90 rename to test/Semantics/Inputs/modfile09-b.f90 diff --git a/test-lit/Semantics/Inputs/modfile09-c.f90 b/test/Semantics/Inputs/modfile09-c.f90 similarity index 100% rename from test-lit/Semantics/Inputs/modfile09-c.f90 rename to test/Semantics/Inputs/modfile09-c.f90 diff --git a/test-lit/Semantics/Inputs/modfile09-d.f90 b/test/Semantics/Inputs/modfile09-d.f90 similarity index 100% rename from test-lit/Semantics/Inputs/modfile09-d.f90 rename to test/Semantics/Inputs/modfile09-d.f90 diff --git a/test/Semantics/allocate01.f90 b/test/Semantics/allocate01.f90 index 6944e2b30090..0948230a3ea2 100644 --- a/test/Semantics/allocate01.f90 +++ b/test/Semantics/allocate01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements ! Creating a symbol that allocate should accept diff --git a/test/Semantics/allocate02.f90 b/test/Semantics/allocate02.f90 index 7f1693849b5f..13a68e811a55 100644 --- a/test/Semantics/allocate02.f90 +++ b/test/Semantics/allocate02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/test/Semantics/allocate03.f90 b/test/Semantics/allocate03.f90 index f86b44ceca2e..63598f0786df 100644 --- a/test/Semantics/allocate03.f90 +++ b/test/Semantics/allocate03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C933_a(b1, ca3, ca4, cp3, cp3mold, cp4, cp7, cp8, bsrc) diff --git a/test/Semantics/allocate04.f90 b/test/Semantics/allocate04.f90 index 3b7ce25bf00e..40e7562938df 100644 --- a/test/Semantics/allocate04.f90 +++ b/test/Semantics/allocate04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/test/Semantics/allocate05.f90 b/test/Semantics/allocate05.f90 index 5d3f2b58160f..84814b674735 100644 --- a/test/Semantics/allocate05.f90 +++ b/test/Semantics/allocate05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/test/Semantics/allocate06.f90 b/test/Semantics/allocate06.f90 index 606f9cec32fe..1de258ccfb46 100644 --- a/test/Semantics/allocate06.f90 +++ b/test/Semantics/allocate06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/test/Semantics/allocate07.f90 b/test/Semantics/allocate07.f90 index 3641ae62a3c6..14077a24013e 100644 --- a/test/Semantics/allocate07.f90 +++ b/test/Semantics/allocate07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C936(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred) diff --git a/test/Semantics/allocate08.f90 b/test/Semantics/allocate08.f90 index 732ce270a78b..3e235fcc9cdc 100644 --- a/test/Semantics/allocate08.f90 +++ b/test/Semantics/allocate08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C945_a(srca, srcb, srcc, src_complex, src_logical, & diff --git a/test/Semantics/allocate09.f90 b/test/Semantics/allocate09.f90 index e47cd8134b49..61046fb13ce2 100644 --- a/test/Semantics/allocate09.f90 +++ b/test/Semantics/allocate09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C946(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred) diff --git a/test/Semantics/allocate10.f90 b/test/Semantics/allocate10.f90 index b3e5d77da315..c15dc57b4472 100644 --- a/test/Semantics/allocate10.f90 +++ b/test/Semantics/allocate10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements !TODO: mixing expr and source-expr? diff --git a/test/Semantics/allocate11.f90 b/test/Semantics/allocate11.f90 index 45128ac8d69d..b883edc4980a 100644 --- a/test/Semantics/allocate11.f90 +++ b/test/Semantics/allocate11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements ! TODO: Function Pointer in allocate and derived types! diff --git a/test/Semantics/allocate12.f90 b/test/Semantics/allocate12.f90 index 8e46b6ddf3d0..41de8edc83ed 100644 --- a/test/Semantics/allocate12.f90 +++ b/test/Semantics/allocate12.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C941_C942b_C950(xsrc, x1, a2, b2, cx1, ca2, cb1, cb2, c1) diff --git a/test/Semantics/allocate13.f90 b/test/Semantics/allocate13.f90 index 5e01c3853748..b7010f5b0c89 100644 --- a/test/Semantics/allocate13.f90 +++ b/test/Semantics/allocate13.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements module not_iso_fortran_env diff --git a/test/Semantics/altreturn01.f90 b/test/Semantics/altreturn01.f90 index b227d15b4ba1..0449ff774c36 100644 --- a/test/Semantics/altreturn01.f90 +++ b/test/Semantics/altreturn01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check calls with alt returns CALL TEST (N, *100, *200 ) diff --git a/test/Semantics/altreturn02.f90 b/test/Semantics/altreturn02.f90 index ab59a3246588..74ff96933a83 100644 --- a/test/Semantics/altreturn02.f90 +++ b/test/Semantics/altreturn02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check subroutine with alt return SUBROUTINE TEST (N, *, *) diff --git a/test/Semantics/altreturn03.f90 b/test/Semantics/altreturn03.f90 index 15410e716752..73a63860efc7 100644 --- a/test/Semantics/altreturn03.f90 +++ b/test/Semantics/altreturn03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for various alt return error conditions SUBROUTINE TEST (N, *, *) diff --git a/test/Semantics/altreturn04.f90 b/test/Semantics/altreturn04.f90 index 5e930c781c2b..e3714fb92223 100644 --- a/test/Semantics/altreturn04.f90 +++ b/test/Semantics/altreturn04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Functions cannot use alt return REAL FUNCTION altreturn01(X) diff --git a/test/Semantics/altreturn05.f90 b/test/Semantics/altreturn05.f90 index 6669942d00cc..cbd222cba9e7 100644 --- a/test/Semantics/altreturn05.f90 +++ b/test/Semantics/altreturn05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test extension: RETURN from main program return !ok diff --git a/test/Semantics/assign01.f90 b/test/Semantics/assign01.f90 index b125da87ad22..bd41a5b5cc9f 100644 --- a/test/Semantics/assign01.f90 +++ b/test/Semantics/assign01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! 10.2.3.1(2) All masks and LHS of assignments in a WHERE must conform subroutine s1 diff --git a/test/Semantics/assign02.f90 b/test/Semantics/assign02.f90 index 5b3fa4f6da2b..e97be64d6aab 100644 --- a/test/Semantics/assign02.f90 +++ b/test/Semantics/assign02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Pointer assignment constraints 10.2.2.2 module m1 diff --git a/test/Semantics/assign03.f90 b/test/Semantics/assign03.f90 index 6127de22de4f..5b9fe269addc 100644 --- a/test/Semantics/assign03.f90 +++ b/test/Semantics/assign03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Pointer assignment constraints 10.2.2.2 (see also assign02.f90) module m diff --git a/test/Semantics/bad-forward-type.f90 b/test/Semantics/bad-forward-type.f90 index a8f7a4c64af6..62ad9d4b2b4c 100644 --- a/test/Semantics/bad-forward-type.f90 +++ b/test/Semantics/bad-forward-type.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Forward references to derived types (error cases) !ERROR: The derived type 'undef' was forward-referenced but not defined diff --git a/test/Semantics/bindings01.f90 b/test/Semantics/bindings01.f90 index 72cab0832388..54aaacd2e9f8 100644 --- a/test/Semantics/bindings01.f90 +++ b/test/Semantics/bindings01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Confirm enforcement of constraints and restrictions in 7.5.7.3 ! and C779-C785. diff --git a/test/Semantics/block-data01.f90 b/test/Semantics/block-data01.f90 index 5abd0999c010..164709118f6f 100644 --- a/test/Semantics/block-data01.f90 +++ b/test/Semantics/block-data01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test BLOCK DATA subprogram (14.3) block data foo !ERROR: IMPORT is not allowed in a BLOCK DATA subprogram diff --git a/test/Semantics/blockconstruct01.f90 b/test/Semantics/blockconstruct01.f90 index 727e6ab05eeb..7f7eec5b56c3 100644 --- a/test/Semantics/blockconstruct01.f90 +++ b/test/Semantics/blockconstruct01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1107 -- COMMON, EQUIVALENCE, INTENT, NAMELIST, OPTIONAL, VALUE or ! STATEMENT FUNCTIONS not allow in specification part diff --git a/test/Semantics/blockconstruct02.f90 b/test/Semantics/blockconstruct02.f90 index eb7203052fcf..2a1a95f312bf 100644 --- a/test/Semantics/blockconstruct02.f90 +++ b/test/Semantics/blockconstruct02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1108 -- Save statement in a BLOCK construct shall not conatin a ! saved-entity-list that does not specify a common-block-name diff --git a/test/Semantics/blockconstruct03.f90 b/test/Semantics/blockconstruct03.f90 index cb016bb8080f..df5aff7699ea 100644 --- a/test/Semantics/blockconstruct03.f90 +++ b/test/Semantics/blockconstruct03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Tests implemented for this standard: ! Block Construct ! C1109 diff --git a/test/Semantics/c_f_pointer.f90 b/test/Semantics/c_f_pointer.f90 index 2f48574717b4..1064461c509d 100644 --- a/test/Semantics/c_f_pointer.f90 +++ b/test/Semantics/c_f_pointer.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Enforce 18.2.3.3 program test diff --git a/test/Semantics/call01.f90 b/test/Semantics/call01.f90 index d38fc904cfeb..88274dd42844 100644 --- a/test/Semantics/call01.f90 +++ b/test/Semantics/call01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Confirm enforcement of constraints and restrictions in 15.6.2.1 non_recursive function f01(n) result(res) diff --git a/test/Semantics/call02.f90 b/test/Semantics/call02.f90 index f60eabfd8e1e..2d23274da1b0 100644 --- a/test/Semantics/call02.f90 +++ b/test/Semantics/call02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! 15.5.1 procedure reference constraints and restrictions subroutine s01(elem, subr) diff --git a/test/Semantics/call03.f90 b/test/Semantics/call03.f90 index c994b9fa8519..098106aed45e 100644 --- a/test/Semantics/call03.f90 +++ b/test/Semantics/call03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.5.2.4 constraints and restrictions for non-POINTER non-ALLOCATABLE ! dummy arguments. diff --git a/test/Semantics/call04.f90 b/test/Semantics/call04.f90 index a3e727a770c8..3064fee5decc 100644 --- a/test/Semantics/call04.f90 +++ b/test/Semantics/call04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 8.5.10 & 8.5.18 constraints on dummy argument declarations module m diff --git a/test/Semantics/call05.f90 b/test/Semantics/call05.f90 index 368ec59b33b8..80f1874ff2d5 100644 --- a/test/Semantics/call05.f90 +++ b/test/Semantics/call05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.5.2.5 constraints and restrictions for POINTER & ALLOCATABLE ! arguments when both sides of the call have the same attributes. diff --git a/test/Semantics/call06.f90 b/test/Semantics/call06.f90 index d9c8a0beee72..eb4bd3755f87 100644 --- a/test/Semantics/call06.f90 +++ b/test/Semantics/call06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.5.2.6 constraints and restrictions for ALLOCATABLE ! dummy arguments. diff --git a/test/Semantics/call07.f90 b/test/Semantics/call07.f90 index bd44e43b552c..f596e3600288 100644 --- a/test/Semantics/call07.f90 +++ b/test/Semantics/call07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments. module m diff --git a/test/Semantics/call08.f90 b/test/Semantics/call08.f90 index 7fe42e7bd7ef..88ec7e3b4cca 100644 --- a/test/Semantics/call08.f90 +++ b/test/Semantics/call08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.5.2.8 coarray dummy arguments module m diff --git a/test/Semantics/call09.f90 b/test/Semantics/call09.f90 index 06c304af4101..e27c78e4281f 100644 --- a/test/Semantics/call09.f90 +++ b/test/Semantics/call09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.5.2.9(2,3,5) dummy procedure requirements module m diff --git a/test/Semantics/call10.f90 b/test/Semantics/call10.f90 index 00db9cd7319c..52983c9f18a0 100644 --- a/test/Semantics/call10.f90 +++ b/test/Semantics/call10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.7 (C1583-C1590, C1592-C1599) constraints and restrictions ! for pure procedures. ! (C1591 is tested in call11.f90; C1594 in call12.f90.) diff --git a/test/Semantics/call11.f90 b/test/Semantics/call11.f90 index 254566fa38b8..b53b40334e93 100644 --- a/test/Semantics/call11.f90 +++ b/test/Semantics/call11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.7 C1591 & others: contexts requiring pure subprograms module m diff --git a/test/Semantics/call12.f90 b/test/Semantics/call12.f90 index ebcaab6fb903..3ce0812560ac 100644 --- a/test/Semantics/call12.f90 +++ b/test/Semantics/call12.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.7 C1594 - prohibited assignments in pure subprograms module used diff --git a/test/Semantics/call13.f90 b/test/Semantics/call13.f90 index 798de8fbf2d9..952a7d0c8b1d 100644 --- a/test/Semantics/call13.f90 +++ b/test/Semantics/call13.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 15.4.2.2 constraints and restrictions for calls to implicit ! interfaces diff --git a/test/Semantics/call14.f90 b/test/Semantics/call14.f90 index d6e94be51996..e25620b2694b 100644 --- a/test/Semantics/call14.f90 +++ b/test/Semantics/call14.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test 8.5.18 constraints on the VALUE attribute module m diff --git a/test/Semantics/call15.f90 b/test/Semantics/call15.f90 index 204a0e6c6237..04ee9e88c153 100644 --- a/test/Semantics/call15.f90 +++ b/test/Semantics/call15.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C711 An assumed-type actual argument that corresponds to an assumed-rank ! dummy argument shall be assumed-shape or assumed-rank. subroutine s(arg1, arg2, arg3) diff --git a/test/Semantics/canondo01.f90 b/test/Semantics/canondo01.f90 index 46c82cba9c1d..51060f8a5f1d 100644 --- a/test/Semantics/canondo01.f90 +++ b/test/Semantics/canondo01.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: end do SUBROUTINE sub00(a,b,n,m) diff --git a/test/Semantics/canondo02.f90 b/test/Semantics/canondo02.f90 index 0389df4d52c8..62dbd4b0a024 100644 --- a/test/Semantics/canondo02.f90 +++ b/test/Semantics/canondo02.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: end do SUBROUTINE sub00(a,b,n,m) diff --git a/test/Semantics/canondo03.f90 b/test/Semantics/canondo03.f90 index f72b1ffd0180..4be30775221e 100644 --- a/test/Semantics/canondo03.f90 +++ b/test/Semantics/canondo03.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: 10 continue ! CHECK: end do diff --git a/test/Semantics/canondo04.f90 b/test/Semantics/canondo04.f90 index 763d62674084..452d77d0559e 100644 --- a/test/Semantics/canondo04.f90 +++ b/test/Semantics/canondo04.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK-NOT: do [1-9] ! Figure out how to also execute this test. diff --git a/test/Semantics/canondo05.f90 b/test/Semantics/canondo05.f90 index f676eff82219..4550e9849fc4 100644 --- a/test/Semantics/canondo05.f90 +++ b/test/Semantics/canondo05.f90 @@ -1,5 +1,6 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s -! XXXRUN: ${F18} -fopenmp -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! XXXEXEC: ${F18} -fopenmp -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK-NOT: do *[1-9] program P diff --git a/test/Semantics/canondo06.f90 b/test/Semantics/canondo06.f90 index 1e7235b9dc47..0aea3daed4f9 100644 --- a/test/Semantics/canondo06.f90 +++ b/test/Semantics/canondo06.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -fopenmp -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -fopenmp -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK-NOT: do *[1-9] ! CHECK: omp simd diff --git a/test/Semantics/canondo07.f90 b/test/Semantics/canondo07.f90 index 59a524275efb..f5a0feef93d0 100644 --- a/test/Semantics/canondo07.f90 +++ b/test/Semantics/canondo07.f90 @@ -1,7 +1,8 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1131 -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: A DO loop should terminate with an END DO or CONTINUE program endDo diff --git a/test/Semantics/canondo08.f90 b/test/Semantics/canondo08.f90 index 7e5c158692b1..c5bfb56f1288 100644 --- a/test/Semantics/canondo08.f90 +++ b/test/Semantics/canondo08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 @@ -5,7 +6,7 @@ ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo09.f90 b/test/Semantics/canondo09.f90 index 98c422124c21..99956a03fe3d 100644 --- a/test/Semantics/canondo09.f90 +++ b/test/Semantics/canondo09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 @@ -5,7 +6,7 @@ ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo10.f90 b/test/Semantics/canondo10.f90 index 0827be6de97f..93d060dd9aaa 100644 --- a/test/Semantics/canondo10.f90 +++ b/test/Semantics/canondo10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 @@ -5,7 +6,7 @@ ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo11.f90 b/test/Semantics/canondo11.f90 index 9019f34ae09f..8e98a24bb87f 100644 --- a/test/Semantics/canondo11.f90 +++ b/test/Semantics/canondo11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 @@ -5,7 +6,7 @@ ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo12.f90 b/test/Semantics/canondo12.f90 index 1809afaedac1..48fde32faf99 100644 --- a/test/Semantics/canondo12.f90 +++ b/test/Semantics/canondo12.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo13.f90 b/test/Semantics/canondo13.f90 index 09a3e4c13fd7..b317d7963aa3 100644 --- a/test/Semantics/canondo13.f90 +++ b/test/Semantics/canondo13.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo14.f90 b/test/Semantics/canondo14.f90 index f6d422ab7436..69bd748212be 100644 --- a/test/Semantics/canondo14.f90 +++ b/test/Semantics/canondo14.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo15.f90 b/test/Semantics/canondo15.f90 index 2726cd914aa6..f58959898345 100644 --- a/test/Semantics/canondo15.f90 +++ b/test/Semantics/canondo15.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo16.f90 b/test/Semantics/canondo16.f90 index e1819c00049e..d5c5db464930 100644 --- a/test/Semantics/canondo16.f90 +++ b/test/Semantics/canondo16.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard -I../../tools/f18/include %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard -I../../tools/f18/include %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo17.f90 b/test/Semantics/canondo17.f90 index e9194b0fd592..a687fb2fefac 100644 --- a/test/Semantics/canondo17.f90 +++ b/test/Semantics/canondo17.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo18.f90 b/test/Semantics/canondo18.f90 index 6760d20622db..3e3f18b05174 100644 --- a/test/Semantics/canondo18.f90 +++ b/test/Semantics/canondo18.f90 @@ -1,10 +1,11 @@ +! RUN: %S/test_any.sh %s %flang %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/test/Semantics/canondo19.f90 b/test/Semantics/canondo19.f90 index 35da0076422b..82bad39e950f 100644 --- a/test/Semantics/canondo19.f90 +++ b/test/Semantics/canondo19.f90 @@ -1,7 +1,8 @@ +! RUN: %S/test_any.sh %s %flang %t ! Check that if there is a label or a name on an label-do-stmt, ! then it is not lost when rewriting it to an non-label-do-stmt. -! RUN: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard %s 2>&1 | ${FileCheck} %s ! CHECK: end do ! CHECK: 2 do diff --git a/test/Semantics/coarrays01.f90 b/test/Semantics/coarrays01.f90 index 491ebb22cbd8..3e8e1672a47b 100644 --- a/test/Semantics/coarrays01.f90 +++ b/test/Semantics/coarrays01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test selector and team-value in CHANGE TEAM statement ! OK diff --git a/test-lit/Semantics/common.sh b/test/Semantics/common.sh similarity index 100% rename from test-lit/Semantics/common.sh rename to test/Semantics/common.sh diff --git a/test/Semantics/complex01.f90 b/test/Semantics/complex01.f90 index 4fb46ba56b71..c70f0defad6a 100644 --- a/test/Semantics/complex01.f90 +++ b/test/Semantics/complex01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C718 Each named constant in a complex literal constant shall be of type ! integer or real. subroutine s() diff --git a/test/Semantics/computed-goto01.f90 b/test/Semantics/computed-goto01.f90 index f16838e9ca78..9f24996f41a0 100644 --- a/test/Semantics/computed-goto01.f90 +++ b/test/Semantics/computed-goto01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that a basic computed goto compiles INTEGER, DIMENSION (2) :: B diff --git a/test/Semantics/computed-goto02.f90 b/test/Semantics/computed-goto02.f90 index 7c40c65ec6b0..eea61a827052 100644 --- a/test/Semantics/computed-goto02.f90 +++ b/test/Semantics/computed-goto02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that computed goto express must be a scalar integer expression ! TODO: PGI, for example, accepts a float & converts the value to int. diff --git a/test/Semantics/critical01.f90 b/test/Semantics/critical01.f90 index 89d3337ba536..5ca97ade6998 100644 --- a/test/Semantics/critical01.f90 +++ b/test/Semantics/critical01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !C1117 subroutine test1(a, i) diff --git a/test/Semantics/critical02.f90 b/test/Semantics/critical02.f90 index 2c75ac2ab33e..ba5e0f4c55a7 100644 --- a/test/Semantics/critical02.f90 +++ b/test/Semantics/critical02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !C1118 subroutine test1 diff --git a/test/Semantics/critical03.f90 b/test/Semantics/critical03.f90 index 6bf45531a170..2ab60e5d59a9 100644 --- a/test/Semantics/critical03.f90 +++ b/test/Semantics/critical03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !C1119 subroutine test1(a, i) diff --git a/test/Semantics/critical04.f90 b/test/Semantics/critical04.f90 index 3b5f7e8e1383..136e31baa621 100644 --- a/test/Semantics/critical04.f90 +++ b/test/Semantics/critical04.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK-NOT: Control flow escapes from CRITICAL subroutine test1(a, i) diff --git a/test/Semantics/data01.f90 b/test/Semantics/data01.f90 index c8af31a50d07..4bdf7ea9dd4a 100644 --- a/test/Semantics/data01.f90 +++ b/test/Semantics/data01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !Test for checking data constraints, C882-C887 module m1 type person diff --git a/test/Semantics/data02.f90 b/test/Semantics/data02.f90 index 4cd593697b23..ac6902622d83 100644 --- a/test/Semantics/data02.f90 +++ b/test/Semantics/data02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that expressions are analyzed in data statements subroutine s1 diff --git a/test/Semantics/deallocate01.f90 b/test/Semantics/deallocate01.f90 index 2bb4236c3b82..8aaf14496d71 100644 --- a/test/Semantics/deallocate01.f90 +++ b/test/Semantics/deallocate01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test that DEALLOCATE works INTEGER, PARAMETER :: maxvalue=1024 diff --git a/test/Semantics/deallocate04.f90 b/test/Semantics/deallocate04.f90 index 7183e2d3ecb8..2a1ad62b9920 100644 --- a/test/Semantics/deallocate04.f90 +++ b/test/Semantics/deallocate04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for type errors in DEALLOCATE statements INTEGER, PARAMETER :: maxvalue=1024 diff --git a/test/Semantics/deallocate05.f90 b/test/Semantics/deallocate05.f90 index 765753ac0c64..fdc66004e2ce 100644 --- a/test/Semantics/deallocate05.f90 +++ b/test/Semantics/deallocate05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in DEALLOCATE statements Module share diff --git a/test/Semantics/doconcurrent01.f90 b/test/Semantics/doconcurrent01.f90 index bba111ad25c2..a4161a5c3073 100644 --- a/test/Semantics/doconcurrent01.f90 +++ b/test/Semantics/doconcurrent01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1141 ! A reference to the procedure IEEE_SET_HALTING_MODE ! from the intrinsic ! module IEEE_EXCEPTIONS, shall not ! appear within a DO CONCURRENT construct. diff --git a/test/Semantics/doconcurrent02.f90 b/test/Semantics/doconcurrent02.f90 index c09977d23228..db120b62bc45 100644 --- a/test/Semantics/doconcurrent02.f90 +++ b/test/Semantics/doconcurrent02.f90 @@ -1,7 +1,8 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative tests: we don't want DO CONCURRENT semantics constraints checked ! when the loops are not DO CONCURRENT -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK-NOT: image control statement not allowed in DO CONCURRENT ! CHECK-NOT: RETURN not allowed in DO CONCURRENT ! CHECK-NOT: call to impure procedure in DO CONCURRENT not allowed diff --git a/test/Semantics/doconcurrent03.f90 b/test/Semantics/doconcurrent03.f90 index ffaca88b9906..cfefd92cc3b0 100644 --- a/test/Semantics/doconcurrent03.f90 +++ b/test/Semantics/doconcurrent03.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: Control flow escapes from DO CONCURRENT ! CHECK: branch into loop body from outside ! CHECK: the loop branched into diff --git a/test/Semantics/doconcurrent04.f90 b/test/Semantics/doconcurrent04.f90 index 8182477020f0..51ec5737a154 100644 --- a/test/Semantics/doconcurrent04.f90 +++ b/test/Semantics/doconcurrent04.f90 @@ -1,5 +1,6 @@ +! RUN: %S/test_any.sh %s %flang %t ! C1122 The index-name shall be a named scalar variable of type integer. -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: Must have INTEGER type, but is REAL\\(4\\) subroutine do_concurrent_test1(n) diff --git a/test/Semantics/doconcurrent05.f90 b/test/Semantics/doconcurrent05.f90 index 8c46192e915e..d92ef6d18322 100644 --- a/test/Semantics/doconcurrent05.f90 +++ b/test/Semantics/doconcurrent05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if ! it belongs to that construct or an outer construct. diff --git a/test/Semantics/doconcurrent06.f90 b/test/Semantics/doconcurrent06.f90 index 2f181fe9de6b..f178b7a11640 100644 --- a/test/Semantics/doconcurrent06.f90 +++ b/test/Semantics/doconcurrent06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if ! it belongs to that construct or an outer construct. diff --git a/test/Semantics/doconcurrent07.f90 b/test/Semantics/doconcurrent07.f90 index 5cc70c00896a..661d51a71be5 100644 --- a/test/Semantics/doconcurrent07.f90 +++ b/test/Semantics/doconcurrent07.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK-NOT: exit from DO CONCURRENT construct subroutine do_concurrent_test1(n) diff --git a/test/Semantics/doconcurrent08.f90 b/test/Semantics/doconcurrent08.f90 index f6773995e202..91a077fade49 100644 --- a/test/Semantics/doconcurrent08.f90 +++ b/test/Semantics/doconcurrent08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1140 -- A statement that might result in the deallocation of a polymorphic ! entity shall not appear within a DO CONCURRENT construct. module m1 diff --git a/test/Semantics/dosemantics01.f90 b/test/Semantics/dosemantics01.f90 index 6745f1f2740e..2261f184e3cc 100644 --- a/test/Semantics/dosemantics01.f90 +++ b/test/Semantics/dosemantics01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1131 -- check valid and invalid DO loop naming PROGRAM C1131 diff --git a/test/Semantics/dosemantics02.f90 b/test/Semantics/dosemantics02.f90 index 0b3165a88270..96047f0a3678 100644 --- a/test/Semantics/dosemantics02.f90 +++ b/test/Semantics/dosemantics02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1121 -- any procedure referenced in a concurrent header must be pure ! Also, check that the step expressions are not zero. This is prohibited by diff --git a/test/Semantics/dosemantics03.f90 b/test/Semantics/dosemantics03.f90 index 4792ae6572de..c063a7b8c854 100644 --- a/test/Semantics/dosemantics03.f90 +++ b/test/Semantics/dosemantics03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Issue 458 -- semantic checks for a normal DO loop. The DO variable ! and the initial, final, and step expressions must be INTEGER if the ! options for standard conformance and turning warnings into errors diff --git a/test/Semantics/dosemantics04.f90 b/test/Semantics/dosemantics04.f90 index 7c0743517f17..35a3c9493ca2 100644 --- a/test/Semantics/dosemantics04.f90 +++ b/test/Semantics/dosemantics04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1123 -- Expressions in DO CONCURRENT header cannot reference variables ! declared in the same header PROGRAM dosemantics04 diff --git a/test/Semantics/dosemantics05.f90 b/test/Semantics/dosemantics05.f90 index c7e27d53aec4..f565f9b71679 100644 --- a/test/Semantics/dosemantics05.f90 +++ b/test/Semantics/dosemantics05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test DO loop semantics for constraint C1130 -- ! The constraint states that "If the locality-spec DEFAULT ( NONE ) appears in a ! DO CONCURRENT statement; a variable that is a local or construct entity of a diff --git a/test/Semantics/dosemantics06.f90 b/test/Semantics/dosemantics06.f90 index fd5b0a86bab8..41b9598970b5 100644 --- a/test/Semantics/dosemantics06.f90 +++ b/test/Semantics/dosemantics06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1131, C1133 -- check valid and invalid DO loop naming ! C1131 (R1119) If the do-stmt of a do-construct specifies a do-construct-name, ! the corresponding end-do shall be an end-do-stmt specifying the same diff --git a/test/Semantics/dosemantics07.f90 b/test/Semantics/dosemantics07.f90 index 9b871fd6f3e4..f1450dda31eb 100644 --- a/test/Semantics/dosemantics07.f90 +++ b/test/Semantics/dosemantics07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !C1132 ! If the do-stmt is a nonlabel-do-stmt, the corresponding end-do shall be an ! end-do-stmt. diff --git a/test/Semantics/dosemantics08.f90 b/test/Semantics/dosemantics08.f90 index e6e313372ff8..388fb75254f8 100644 --- a/test/Semantics/dosemantics08.f90 +++ b/test/Semantics/dosemantics08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1138 -- ! A branch (11.2) within a DO CONCURRENT construct shall not have a branch ! target that is outside the construct. diff --git a/test/Semantics/dosemantics09.f90 b/test/Semantics/dosemantics09.f90 index 425e71e3db54..46136f29c74e 100644 --- a/test/Semantics/dosemantics09.f90 +++ b/test/Semantics/dosemantics09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !C1129 !A variable that is referenced by the scalar-mask-expr of a !concurrent-header or by any concurrent-limit or concurrent-step in that diff --git a/test/Semantics/dosemantics10.f90 b/test/Semantics/dosemantics10.f90 index 7bd7bbbb7c85..561f9b7fb7ea 100644 --- a/test/Semantics/dosemantics10.f90 +++ b/test/Semantics/dosemantics10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1134 A CYCLE statement must be within a DO construct ! ! C1166 An EXIT statement must be within a DO construct diff --git a/test/Semantics/dosemantics11.f90 b/test/Semantics/dosemantics11.f90 index 50d69608215c..760f9f5f9b60 100644 --- a/test/Semantics/dosemantics11.f90 +++ b/test/Semantics/dosemantics11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1135 A cycle-stmt shall not appear within a CHANGE TEAM, CRITICAL, or DO ! CONCURRENT construct if it belongs to an outer construct. ! diff --git a/test/Semantics/dosemantics12.f90 b/test/Semantics/dosemantics12.f90 index b1ee8a02707d..48ecd14feda5 100644 --- a/test/Semantics/dosemantics12.f90 +++ b/test/Semantics/dosemantics12.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. ! ! Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/Semantics/equivalence01.f90 b/test/Semantics/equivalence01.f90 index a6e70e6ab53f..31b561e33b0d 100644 --- a/test/Semantics/equivalence01.f90 +++ b/test/Semantics/equivalence01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 integer i, j real r(2) diff --git a/test/Semantics/expr-errors01.f90 b/test/Semantics/expr-errors01.f90 index 378bd2d2368e..a479e863dcaf 100644 --- a/test/Semantics/expr-errors01.f90 +++ b/test/Semantics/expr-errors01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1003 - can't parenthesize function call returning procedure pointer module m1 type :: dt diff --git a/test/Semantics/expr-errors02.f90 b/test/Semantics/expr-errors02.f90 index 2df05a2cd523..d1aac68bf008 100644 --- a/test/Semantics/expr-errors02.f90 +++ b/test/Semantics/expr-errors02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test specification expressions module m diff --git a/test/Semantics/forall01.f90 b/test/Semantics/forall01.f90 index e90a17f62978..ecb243bc2a09 100644 --- a/test/Semantics/forall01.f90 +++ b/test/Semantics/forall01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine forall1 real :: a(9) !ERROR: 'i' is already declared in this scoping unit diff --git a/test/Semantics/getdefinition01.f90 b/test/Semantics/getdefinition01.f90 index 880e282bca9f..4a2fdd760568 100644 --- a/test/Semantics/getdefinition01.f90 +++ b/test/Semantics/getdefinition01.f90 @@ -1,5 +1,5 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-definition returning source position of symbol definition. - module m1 private :: f contains @@ -16,12 +16,12 @@ recursive pure function f() result(x) end function end module -! RUN: echo %t 1>&2; -! RUN: ${F18} -fget-definition 7 17 18 -fparse-only %s > %t; -! RUN: ${F18} -fget-definition 8 20 23 -fparse-only %s >> %t; -! RUN: ${F18} -fget-definition 15 3 4 -fparse-only %s >> %t; -! RUN: ${F18} -fget-definition -fparse-only %s >> %t 2>&1; -! RUN: cat %t | ${FileCheck} %s +! EXEC: echo %t 1>&2; +! EXEC: ${F18} -fget-definition 7 17 18 -fparse-only %s > %t; +! EXEC: ${F18} -fget-definition 8 20 23 -fparse-only %s >> %t; +! EXEC: ${F18} -fget-definition 15 3 4 -fparse-only %s >> %t; +! EXEC: ${F18} -fget-definition -fparse-only %s >> %t 2>&1; +! EXEC: cat %t | ${FileCheck} %s ! CHECK:x:.*getdefinition01.f90, 6, 21-22 ! CHECK:yyy:.*getdefinition01.f90, 6, 24-27 ! CHECK:x:.*getdefinition01.f90, 14, 24-25 diff --git a/test/Semantics/getdefinition02.f b/test/Semantics/getdefinition02.f index 3f8ac46a1380..58391a27d530 100644 --- a/test/Semantics/getdefinition02.f +++ b/test/Semantics/getdefinition02.f @@ -1,5 +1,5 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-definition with fixed form. - module m2 private :: f contains @@ -17,10 +17,10 @@ recursive pure function f() result(x) end function end module -! RUN: ${F18} -fget-definition 8 9 10 -fparse-only %s > %t; -! RUN: ${F18} -fget-definition 9 26 29 -fparse-only %s >> %t; -! RUN: ${F18} -fget-definition 16 9 10 -fparse-only %s >> %t; -! RUN: cat %t | ${FileCheck} %s +! EXEC: ${F18} -fget-definition 8 9 10 -fparse-only %s > %t; +! EXEC: ${F18} -fget-definition 9 26 29 -fparse-only %s >> %t; +! EXEC: ${F18} -fget-definition 16 9 10 -fparse-only %s >> %t; +! EXEC: cat %t | ${FileCheck} %s ! CHECK:x:.*getdefinition02.f, 6, 27-28 ! CHECK:yyy:.*getdefinition02.f, 6, 30-33 ! CHECK:x:.*getdefinition02.f, 15, 30-31 diff --git a/test/Semantics/getdefinition03-a.f90 b/test/Semantics/getdefinition03-a.f90 index 5b287d28665c..81ad276ec29a 100644 --- a/test/Semantics/getdefinition03-a.f90 +++ b/test/Semantics/getdefinition03-a.f90 @@ -1,6 +1,6 @@ ! Tests -fget-definition with INCLUDE - -INCLUDE "getdefinition03-b.f90" +!RUN: %S/test_any.sh %s %flang %t +INCLUDE "Inputs/getdefinition03-b.f90" program main use m3 @@ -8,8 +8,8 @@ program main x = f end program -! RUN: ${F18} -fget-definition 8 6 7 -fparse-only %s > %t; -! RUN: ${F18} -fget-definition 8 2 3 -fparse-only %s >> %t; -! RUN: cat %t | ${FileCheck} %s; +! EXEC: ${F18} -fget-definition 8 6 7 -fparse-only %s > %t; +! EXEC: ${F18} -fget-definition 8 2 3 -fparse-only %s >> %t; +! EXEC: cat %t | ${FileCheck} %s; ! CHECK:f:.*getdefinition03-b.f90, 2, 12-13 ! CHECK:x:.*getdefinition03-a.f90, 7, 13-14 diff --git a/test/Semantics/getdefinition03-b.f90 b/test/Semantics/getdefinition03-b.f90 deleted file mode 100644 index 7c1b3ff01903..000000000000 --- a/test/Semantics/getdefinition03-b.f90 +++ /dev/null @@ -1,3 +0,0 @@ -module m3 - public :: f -end module diff --git a/test/Semantics/getdefinition04.f90 b/test/Semantics/getdefinition04.f90 index 80ace6544386..aa143a161852 100644 --- a/test/Semantics/getdefinition04.f90 +++ b/test/Semantics/getdefinition04.f90 @@ -1,5 +1,5 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-definition with COMMON block with same name as variable. - program main integer :: x integer :: y @@ -7,5 +7,5 @@ program main x = y end program -! RUN: ${F18} -fget-definition 7 3 4 -fparse-only %s | ${FileCheck} %s +! EXEC: ${F18} -fget-definition 7 3 4 -fparse-only %s | ${FileCheck} %s ! CHECK:x:.*getdefinition04.f90, 4, 14-15 diff --git a/test/Semantics/getdefinition05.f90 b/test/Semantics/getdefinition05.f90 index 3ad69778ead0..e1115a245611 100644 --- a/test/Semantics/getdefinition05.f90 +++ b/test/Semantics/getdefinition05.f90 @@ -1,6 +1,6 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-symbols-sources with BLOCK that contains same variable name as ! another in an outer scope. - program main integer :: x integer :: y @@ -13,9 +13,9 @@ program main end program !! Inner x -! RUN: ${F18} -fget-definition 10 5 6 -fparse-only %s > %t; +! EXEC: ${F18} -fget-definition 10 5 6 -fparse-only %s > %t; ! CHECK:x:.*getdefinition05.f90, 8, 16-17 !! Outer y -! RUN: ${F18} -fget-definition 12 7 8 -fparse-only %s >> %t; +! EXEC: ${F18} -fget-definition 12 7 8 -fparse-only %s >> %t; ! CHECK:y:.*getdefinition05.f90, 6, 14-15 -! RUN: cat %t | ${FileCheck} %s; +! EXEC: cat %t | ${FileCheck} %s; diff --git a/test/Semantics/getsymbols01.f90 b/test/Semantics/getsymbols01.f90 index 9f754f9374d0..d102807ed482 100644 --- a/test/Semantics/getsymbols01.f90 +++ b/test/Semantics/getsymbols01.f90 @@ -1,5 +1,5 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-symbols-sources finding all symbols in file. - module mm1 private :: f contains @@ -16,7 +16,7 @@ recursive pure function f() result(x) end function end module -! RUN: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s ! CHECK-ONCE:mm1:.*getsymbols01.f90, 3, 8-11 ! CHECK-ONCE:f:.*getsymbols01.f90, 13, 26-27 ! CHECK-ONCE:s:.*getsymbols01.f90, 6, 18-19 diff --git a/test/Semantics/getsymbols02-a.f90 b/test/Semantics/getsymbols02-a.f90 index b9d75fde50af..f571783e6140 100644 --- a/test/Semantics/getsymbols02-a.f90 +++ b/test/Semantics/getsymbols02-a.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -fparse-only %s +!RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -fparse-only %s module mm2a implicit none diff --git a/test/Semantics/getsymbols02-b.f90 b/test/Semantics/getsymbols02-b.f90 deleted file mode 100644 index 7ed4cbe0d894..000000000000 --- a/test/Semantics/getsymbols02-b.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: ${F18} -fparse-only %s - -module mm2b -use mm2a -implicit none -private - public :: callget5 -contains - function callget5() result(ret) - implicit none - INTEGER :: ret - ret = get5() - end function callget5 -end module mm2b diff --git a/test/Semantics/getsymbols02-c.f90 b/test/Semantics/getsymbols02-c.f90 deleted file mode 100644 index cb66680906bb..000000000000 --- a/test/Semantics/getsymbols02-c.f90 +++ /dev/null @@ -1,12 +0,0 @@ -! Tests -fget-symbols-sources with modules. - -PROGRAM helloworld - use mm2b - implicit none - integer::i - i = callget5() -ENDPROGRAM - -! RUN: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s -! CHECK:callget5: mm2b -! CHECK:get5: mm2a diff --git a/test-lit/Semantics/getsymbols02.f90 b/test/Semantics/getsymbols02.f90 similarity index 100% rename from test-lit/Semantics/getsymbols02.f90 rename to test/Semantics/getsymbols02.f90 diff --git a/test/Semantics/getsymbols03-a.f90 b/test/Semantics/getsymbols03-a.f90 index 1d6d3b6aaba2..5616f97629ce 100644 --- a/test/Semantics/getsymbols03-a.f90 +++ b/test/Semantics/getsymbols03-a.f90 @@ -1,6 +1,6 @@ ! Tests -fget-symbols with INCLUDE - -INCLUDE "getsymbols03-b.f90" +!RUN: %S/test_any.sh %s %flang %t +INCLUDE "Inputs/getsymbols03-b.f90" program main use mm3 @@ -8,7 +8,7 @@ program main x = f end program -! RUN: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s ! CHECK:mm3:.*getsymbols03-b.f90, 1, 8-11 ! CHECK:f:.*getsymbols03-b.f90, 2, 12-13 ! CHECK:main:.*getsymbols03-a.f90, 5, 9-13 diff --git a/test/Semantics/getsymbols03-b.f90 b/test/Semantics/getsymbols03-b.f90 deleted file mode 100644 index 030ae31fc3f3..000000000000 --- a/test/Semantics/getsymbols03-b.f90 +++ /dev/null @@ -1,3 +0,0 @@ -module mm3 - public :: f -end module diff --git a/test/Semantics/getsymbols04.f90 b/test/Semantics/getsymbols04.f90 index d4a83aecb5d9..06f739c71137 100644 --- a/test/Semantics/getsymbols04.f90 +++ b/test/Semantics/getsymbols04.f90 @@ -1,5 +1,5 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-symbols-sources with COMMON. - program main integer :: x integer :: y @@ -7,7 +7,7 @@ program main x = y end program -! RUN: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s ! CHECK:x:.*getsymbols04.f90, 4, 14-15 ! CHECK:y:.*getsymbols04.f90, 5, 14-15 ! CHECK:x:.*getsymbols04.f90, 6, 11-12 diff --git a/test/Semantics/getsymbols05.f90 b/test/Semantics/getsymbols05.f90 index c65a2a6f5a99..f905313675cd 100644 --- a/test/Semantics/getsymbols05.f90 +++ b/test/Semantics/getsymbols05.f90 @@ -1,5 +1,5 @@ +!RUN: %S/test_any.sh %s %flang %t ! Tests -fget-symbols-sources with COMMON. - program main integer :: x integer :: y @@ -10,7 +10,7 @@ program main x = y end program -! RUN: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -fget-symbols-sources -fparse-only %s 2>&1 | ${FileCheck} %s ! CHECK:x:.*getsymbols05.f90, 4, 14-15 ! CHECK:y:.*getsymbols05.f90, 5, 14-15 ! CHECK:x:.*getsymbols05.f90, 7, 16-17 diff --git a/test/Semantics/if_arith01.f90 b/test/Semantics/if_arith01.f90 index 43365c64ad3a..5ec06b47485d 100644 --- a/test/Semantics/if_arith01.f90 +++ b/test/Semantics/if_arith01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that a basic arithmetic if compiles. if ( A ) 100, 200, 300 diff --git a/test/Semantics/if_arith02.f90 b/test/Semantics/if_arith02.f90 index fc94e151cf14..f8e24b42dffa 100644 --- a/test/Semantics/if_arith02.f90 +++ b/test/Semantics/if_arith02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that only labels are allowed in arithmetic if statements. ! TODO: Revisit error message "expected 'ASSIGN'" etc. ! TODO: Revisit error message "expected one of '0123456789'" diff --git a/test/Semantics/if_arith03.f90 b/test/Semantics/if_arith03.f90 index fd30eb2ee954..1e5eb67d184c 100644 --- a/test/Semantics/if_arith03.f90 +++ b/test/Semantics/if_arith03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !ERROR: label '600' was not found diff --git a/test/Semantics/if_arith04.f90 b/test/Semantics/if_arith04.f90 index 360d596762b1..9a436cd5eb67 100644 --- a/test/Semantics/if_arith04.f90 +++ b/test/Semantics/if_arith04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Make sure arithmetic if expressions are non-complex numeric exprs. INTEGER I diff --git a/test/Semantics/if_construct01.f90 b/test/Semantics/if_construct01.f90 index 66398def9805..c133b7d8cc9f 100644 --- a/test/Semantics/if_construct01.f90 +++ b/test/Semantics/if_construct01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Simple check that if constructs are ok. if (a < b) then diff --git a/test/Semantics/if_construct02.f90 b/test/Semantics/if_construct02.f90 index 5177f388b493..9ba6caa45355 100644 --- a/test/Semantics/if_construct02.f90 +++ b/test/Semantics/if_construct02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that if constructs only accept scalar logical expressions. ! TODO: expand the test to check this restriction for more types. diff --git a/test/Semantics/if_stmt01.f90 b/test/Semantics/if_stmt01.f90 index e111f6519d26..51454a9d2116 100644 --- a/test/Semantics/if_stmt01.f90 +++ b/test/Semantics/if_stmt01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Simple check that if statements are ok. IF (A > 0.0) A = LOG (A) diff --git a/test/Semantics/if_stmt02.f90 b/test/Semantics/if_stmt02.f90 index 483e92d2c940..71c458381ac2 100644 --- a/test/Semantics/if_stmt02.f90 +++ b/test/Semantics/if_stmt02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !ERROR: IF statement is not allowed in IF statement IF (A > 0.0) IF (B < 0.0) A = LOG (A) END diff --git a/test/Semantics/if_stmt03.f90 b/test/Semantics/if_stmt03.f90 index dd869b2cad0a..2a2595404960 100644 --- a/test/Semantics/if_stmt03.f90 +++ b/test/Semantics/if_stmt03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check that non-logical expressions are not allowed. ! Check that non-scalar expressions are not allowed. ! TODO: Insure all non-logicals are prohibited. diff --git a/test/Semantics/implicit01.f90 b/test/Semantics/implicit01.f90 index 318fe760322c..f0893f7ed33f 100644 --- a/test/Semantics/implicit01.f90 +++ b/test/Semantics/implicit01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 implicit none !ERROR: More than one IMPLICIT NONE statement diff --git a/test/Semantics/implicit02.f90 b/test/Semantics/implicit02.f90 index d77c3f55c6e6..5d2b6e09474f 100644 --- a/test/Semantics/implicit02.f90 +++ b/test/Semantics/implicit02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 implicit none !ERROR: IMPLICIT statement after IMPLICIT NONE or IMPLICIT NONE(TYPE) statement diff --git a/test/Semantics/implicit03.f90 b/test/Semantics/implicit03.f90 index 343471ad5a15..9636743233a3 100644 --- a/test/Semantics/implicit03.f90 +++ b/test/Semantics/implicit03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 implicit integer(a-z) !ERROR: IMPLICIT NONE statement after IMPLICIT statement diff --git a/test/Semantics/implicit04.f90 b/test/Semantics/implicit04.f90 index 004dbe65549d..86adb95f9852 100644 --- a/test/Semantics/implicit04.f90 +++ b/test/Semantics/implicit04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s parameter(a=1.0) !ERROR: IMPLICIT NONE statement after PARAMETER statement diff --git a/test/Semantics/implicit05.f90 b/test/Semantics/implicit05.f90 index 50039a421eaf..7649c228fa44 100644 --- a/test/Semantics/implicit05.f90 +++ b/test/Semantics/implicit05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s !ERROR: 'a' does not follow 'b' alphabetically implicit integer(b-a) diff --git a/test/Semantics/implicit06.f90 b/test/Semantics/implicit06.f90 index 225052cd5e89..3f6672008d53 100644 --- a/test/Semantics/implicit06.f90 +++ b/test/Semantics/implicit06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 implicit integer(a-c) !ERROR: More than one implicit type specified for 'c' diff --git a/test/Semantics/implicit07.f90 b/test/Semantics/implicit07.f90 index 8201c3dcb0e3..68fa37de8ce7 100644 --- a/test/Semantics/implicit07.f90 +++ b/test/Semantics/implicit07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t implicit none(external) external x call x diff --git a/test/Semantics/implicit08.f90 b/test/Semantics/implicit08.f90 index a56382e4154c..44e96d89855e 100644 --- a/test/Semantics/implicit08.f90 +++ b/test/Semantics/implicit08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 block !ERROR: IMPLICIT statement is not allowed in a BLOCK construct diff --git a/test/Semantics/init01.f90 b/test/Semantics/init01.f90 index b160a99dfc2f..1fc1ed877fa3 100644 --- a/test/Semantics/init01.f90 +++ b/test/Semantics/init01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Object pointer initializer error tests subroutine test(j) diff --git a/test/Semantics/int-literals.f90 b/test/Semantics/int-literals.f90 index b3b966996f53..3c48b7e1b7da 100644 --- a/test/Semantics/int-literals.f90 +++ b/test/Semantics/int-literals.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Fortran syntax considers signed int literals in complex literals ! to be a distinct production, not an application of unary +/- to ! an unsigned int literal, so they're used here to test overflow diff --git a/test/Semantics/io01.f90 b/test/Semantics/io01.f90 index c951943a4bc7..81b537d7e4c5 100644 --- a/test/Semantics/io01.f90 +++ b/test/Semantics/io01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t character(len=20) :: access = "direcT" character(len=20) :: access_(2) = (/"direcT", "streaM"/) character(len=20) :: action_(2) = (/"reaD ", "writE"/) diff --git a/test/Semantics/io02.f90 b/test/Semantics/io02.f90 index 65e6b263bb8b..7cb901d34027 100644 --- a/test/Semantics/io02.f90 +++ b/test/Semantics/io02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t integer :: unit10 = 10 integer :: unit11 = 11 diff --git a/test/Semantics/io03.f90 b/test/Semantics/io03.f90 index 71425b8869c5..a6696176b126 100644 --- a/test/Semantics/io03.f90 +++ b/test/Semantics/io03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t character(kind=1,len=50) internal_file character(kind=2,len=50) internal_file2 character(kind=4,len=50) internal_file4 diff --git a/test/Semantics/io04.f90 b/test/Semantics/io04.f90 index 68b217f57a61..09776ef94ab1 100644 --- a/test/Semantics/io04.f90 +++ b/test/Semantics/io04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t character(kind=1,len=50) internal_file character(kind=1,len=100) msg character(20) sign diff --git a/test/Semantics/io05.f90 b/test/Semantics/io05.f90 index 5b36f9ba923e..1df878197237 100644 --- a/test/Semantics/io05.f90 +++ b/test/Semantics/io05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t character*20 c(25), cv character(kind=1,len=59) msg logical*2 v(5), lv diff --git a/test/Semantics/io06.f90 b/test/Semantics/io06.f90 index d4ea73e51154..eba437c86c86 100644 --- a/test/Semantics/io06.f90 +++ b/test/Semantics/io06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t character(kind=1,len=100) msg1 character(kind=2,len=200) msg2 integer(1) stat1 diff --git a/test/Semantics/io07.f90 b/test/Semantics/io07.f90 index 4677be23ec54..9462a099d67e 100644 --- a/test/Semantics/io07.f90 +++ b/test/Semantics/io07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t 1001 format(A) !ERROR: Format statement must be labeled diff --git a/test/Semantics/io08.f90 b/test/Semantics/io08.f90 index db25da188b9f..1b75e8094a9a 100644 --- a/test/Semantics/io08.f90 +++ b/test/Semantics/io08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t write(*,*) write(*,'()') write(*,'(A)') diff --git a/test/Semantics/io09.f90 b/test/Semantics/io09.f90 index dba5ae53692a..5f50e4e0151e 100644 --- a/test/Semantics/io09.f90 +++ b/test/Semantics/io09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !ERROR: String edit descriptor in READ format expression read(*,'("abc")') diff --git a/test/Semantics/io10.f90 b/test/Semantics/io10.f90 index fa38c3d38e3d..90ae8b194330 100644 --- a/test/Semantics/io10.f90 +++ b/test/Semantics/io10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -Mstandard write(*, '(B0)') diff --git a/test/Semantics/kinds01.f90 b/test/Semantics/kinds01.f90 index 3bef1bb39762..388ca2342167 100644 --- a/test/Semantics/kinds01.f90 +++ b/test/Semantics/kinds01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /MainProgram1/jk1 ObjectEntity INTEGER(1) integer(kind=1) jk1 !DEF: /MainProgram1/js1 ObjectEntity INTEGER(1) diff --git a/test/Semantics/kinds02.f90 b/test/Semantics/kinds02.f90 index 9fb921345d85..0983be564738 100644 --- a/test/Semantics/kinds02.f90 +++ b/test/Semantics/kinds02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C712 The value of scalar-int-constant-expr shall be nonnegative and ! shall specify a representation method that exists on the processor. ! C714 The value of kind-param shall be nonnegative. diff --git a/test/Semantics/kinds03.f90 b/test/Semantics/kinds03.f90 index 63239e08d05a..b4ba7e67bb6c 100644 --- a/test/Semantics/kinds03.f90 +++ b/test/Semantics/kinds03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /MainProgram1/ipdt DerivedType !DEF: /MainProgram1/ipdt/k TypeParam INTEGER(4) type :: ipdt(k) diff --git a/test/Semantics/kinds04.f90 b/test/Semantics/kinds04.f90 index ecf3a446cc3d..af6a8965ca65 100644 --- a/test/Semantics/kinds04.f90 +++ b/test/Semantics/kinds04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C716 If both kind-param and exponent-letter appear, exponent-letter ! shall be E. ! C717 The value of kind-param shall specify an approximation method that diff --git a/test/Semantics/label01.F90 b/test/Semantics/label01.F90 index d4fd7331fb5d..e63bd547ee75 100644 --- a/test/Semantics/label01.F90 +++ b/test/Semantics/label01.F90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s -o /dev/null 2>&1 | grep -v 'procedure conflicts' | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s -o /dev/null 2>&1 | grep -v 'procedure conflicts' | ${FileCheck} %s ! CHECK-NOT: error:[[:space:]] ! FIXME: filter out the array/function syntax issues (procedure conflicts) diff --git a/test/Semantics/label02.f90 b/test/Semantics/label02.f90 index f7b61953b630..6aa052d52d66 100644 --- a/test/Semantics/label02.f90 +++ b/test/Semantics/label02.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: label '0' is out of range ! CHECK: label '100000' is out of range ! CHECK: label '123456' is out of range diff --git a/test/Semantics/label03.f90 b/test/Semantics/label03.f90 index 0ee40e95602f..a33b2f33a9b3 100644 --- a/test/Semantics/label03.f90 +++ b/test/Semantics/label03.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: DO loop doesn't properly nest ! CHECK: DO loop conflicts ! CHECK: label '30' cannot be found diff --git a/test/Semantics/label04.f90 b/test/Semantics/label04.f90 index d9de328642cd..a3f3586763ee 100644 --- a/test/Semantics/label04.f90 +++ b/test/Semantics/label04.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: branch into loop body from outside ! CHECK: do 10 i = 1, m ! CHECK: the loop branched into diff --git a/test/Semantics/label05.f90 b/test/Semantics/label05.f90 index 53f99df8fa6b..09bd9fa2b0f0 100644 --- a/test/Semantics/label05.f90 +++ b/test/Semantics/label05.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: label '50' was not found ! CHECK: label '55' is not in scope ! CHECK: '70' not a branch target diff --git a/test/Semantics/label06.f90 b/test/Semantics/label06.f90 index 42f6631f59ab..4e633d3df552 100644 --- a/test/Semantics/label06.f90 +++ b/test/Semantics/label06.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: label '10' is not in scope ! CHECK: label '20' was not found ! CHECK: '30' not a branch target diff --git a/test/Semantics/label07.f90 b/test/Semantics/label07.f90 index 0f6b57c42f5c..62755082e030 100644 --- a/test/Semantics/label07.f90 +++ b/test/Semantics/label07.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: '30' not a branch target ! CHECK: control flow use of '30' ! CHECK: label '10' is not in scope diff --git a/test/Semantics/label08.f90 b/test/Semantics/label08.f90 index db51c6772c34..140ceb33ec68 100644 --- a/test/Semantics/label08.f90 +++ b/test/Semantics/label08.f90 @@ -1,6 +1,7 @@ +! RUN: %S/test_any.sh %s %flang %t ! negative test -- invalid labels, out of range -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: CYCLE construct-name is not in scope ! CHECK: IF construct name unexpected ! CHECK: unnamed IF statement diff --git a/test/Semantics/label09.f90 b/test/Semantics/label09.f90 index 0ec9efabedcb..a74263d58315 100644 --- a/test/Semantics/label09.f90 +++ b/test/Semantics/label09.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: label '60' was not found subroutine s(a) diff --git a/test/Semantics/label10.f90 b/test/Semantics/label10.f90 index 23a0a055cb63..377108c95dd5 100644 --- a/test/Semantics/label10.f90 +++ b/test/Semantics/label10.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: '60' not a FORMAT ! CHECK: data transfer use of '60' diff --git a/test/Semantics/label11.f90 b/test/Semantics/label11.f90 index 5b1866e4b193..924356615e3b 100644 --- a/test/Semantics/label11.f90 +++ b/test/Semantics/label11.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: BLOCK DATA subprogram name mismatch ! CHECK: should be ! CHECK: FUNCTION name mismatch diff --git a/test/Semantics/label12.f90 b/test/Semantics/label12.f90 index bd3455d2fa90..96607bc8e8f0 100644 --- a/test/Semantics/label12.f90 +++ b/test/Semantics/label12.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: expected end of statement subroutine s diff --git a/test/Semantics/label13.f90 b/test/Semantics/label13.f90 index b55ed6d94341..61501804d270 100644 --- a/test/Semantics/label13.f90 +++ b/test/Semantics/label13.f90 @@ -1,4 +1,5 @@ -! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s +! RUN: %S/test_any.sh %s %flang %t +! EXEC: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s ! CHECK: branch into loop body from outside ! CHECK: the loop branched into diff --git a/test/Semantics/label14.f90 b/test/Semantics/label14.f90 index 10a91c755b96..e6eb744f50e3 100644 --- a/test/Semantics/label14.f90 +++ b/test/Semantics/label14.f90 @@ -1,8 +1,9 @@ +! RUN: %S/test_any.sh %s %flang %t ! Tests implemented for this standard ! 11.1.4 - 4 It is permissible to branch to and end-block-stmt only withinh its ! Block Construct -! RUN: ${F18} %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} %s 2>&1 | ${FileCheck} %s ! CHECK: label '20' is not in scope subroutine s1 diff --git a/test/Semantics/misc-declarations.f90 b/test/Semantics/misc-declarations.f90 index a25e5ffbfbf4..9103ad7bcf7d 100644 --- a/test/Semantics/misc-declarations.f90 +++ b/test/Semantics/misc-declarations.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Miscellaneous constraint and requirement checking on declarations: ! - 8.5.6.2 & 8.5.6.3 constraints on coarrays ! - 8.5.19 constraints on the VOLATILE attribute diff --git a/test-lit/Semantics/mod-file-rewriter.f90 b/test/Semantics/mod-file-rewriter.f90 similarity index 100% rename from test-lit/Semantics/mod-file-rewriter.f90 rename to test/Semantics/mod-file-rewriter.f90 diff --git a/test/Semantics/modfile01.f90 b/test/Semantics/modfile01.f90 index 79f5e570bfce..d3cd5273f853 100644 --- a/test/Semantics/modfile01.f90 +++ b/test/Semantics/modfile01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check correct modfile generation for type with private component. module m integer :: i diff --git a/test/Semantics/modfile02.f90 b/test/Semantics/modfile02.f90 index 0f9ba86feb4b..9f460004415d 100644 --- a/test/Semantics/modfile02.f90 +++ b/test/Semantics/modfile02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check modfile generation for private type in public API. module m diff --git a/test/Semantics/modfile03.f90 b/test/Semantics/modfile03.f90 index eedde939b068..9beb5308bd38 100644 --- a/test/Semantics/modfile03.f90 +++ b/test/Semantics/modfile03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check modfile generation with use-association. module m1 diff --git a/test/Semantics/modfile04.f90 b/test/Semantics/modfile04.f90 index 0b5800387255..9dbd3adfeede 100644 --- a/test/Semantics/modfile04.f90 +++ b/test/Semantics/modfile04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! modfile with subprograms module m1 diff --git a/test/Semantics/modfile05.f90 b/test/Semantics/modfile05.f90 index e56023d191cb..49e3f47d4a68 100644 --- a/test/Semantics/modfile05.f90 +++ b/test/Semantics/modfile05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Use-association with VOLATILE or ASYNCHRONOUS module m1 diff --git a/test/Semantics/modfile06.f90 b/test/Semantics/modfile06.f90 index 94fe384dd094..5924b67c7daa 100644 --- a/test/Semantics/modfile06.f90 +++ b/test/Semantics/modfile06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check modfile generation for external interface module m interface diff --git a/test/Semantics/modfile07.f90 b/test/Semantics/modfile07.f90 index 58734b360c1b..b4a49d9924e3 100644 --- a/test/Semantics/modfile07.f90 +++ b/test/Semantics/modfile07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check modfile generation for generic interfaces module m1 interface foo diff --git a/test/Semantics/modfile08.f90 b/test/Semantics/modfile08.f90 index e23078b34dcd..7a2e20195f2d 100644 --- a/test/Semantics/modfile08.f90 +++ b/test/Semantics/modfile08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check modfile generation for external declarations module m real, external :: a diff --git a/test/Semantics/modfile09-a.f90 b/test/Semantics/modfile09-a.f90 deleted file mode 100644 index 1e614ea3cf32..000000000000 --- a/test/Semantics/modfile09-a.f90 +++ /dev/null @@ -1,16 +0,0 @@ -module m - integer :: m1_x - interface - module subroutine s() - end subroutine - end interface -end - -!Expect: m.mod -!module m -!integer(4)::m1_x -!interface -!module subroutine s() -!end -!end interface -!end diff --git a/test/Semantics/modfile09-b.f90 b/test/Semantics/modfile09-b.f90 deleted file mode 100644 index 69c88064f667..000000000000 --- a/test/Semantics/modfile09-b.f90 +++ /dev/null @@ -1,8 +0,0 @@ -submodule(m) s1 - integer s1_x -end - -!Expect: m-s1.mod -!submodule(m) s1 -!integer(4)::s1_x -!end diff --git a/test/Semantics/modfile09-c.f90 b/test/Semantics/modfile09-c.f90 deleted file mode 100644 index 3edb997f5679..000000000000 --- a/test/Semantics/modfile09-c.f90 +++ /dev/null @@ -1,8 +0,0 @@ -submodule(m:s1) s2 - integer s2_x -end - -!Expect: m-s2.mod -!submodule(m:s1) s2 -!integer(4)::s2_x -!end diff --git a/test/Semantics/modfile09-d.f90 b/test/Semantics/modfile09-d.f90 deleted file mode 100644 index 6e8b7caac4c0..000000000000 --- a/test/Semantics/modfile09-d.f90 +++ /dev/null @@ -1,8 +0,0 @@ -submodule(m:s2) s3 - integer s3_x -end - -!Expect: m-s3.mod -!submodule(m:s2) s3 -!integer(4)::s3_x -!end diff --git a/test-lit/Semantics/modfile09.f90 b/test/Semantics/modfile09.f90 similarity index 100% rename from test-lit/Semantics/modfile09.f90 rename to test/Semantics/modfile09.f90 diff --git a/test/Semantics/modfile10.f90 b/test/Semantics/modfile10.f90 index 2340842b2843..dc91d8734b19 100644 --- a/test/Semantics/modfile10.f90 +++ b/test/Semantics/modfile10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test writing procedure bindings in a derived type. module m diff --git a/test/Semantics/modfile11.f90 b/test/Semantics/modfile11.f90 index 89df7d7a068b..ec4dd2f88099 100644 --- a/test/Semantics/modfile11.f90 +++ b/test/Semantics/modfile11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m type t1(a, b, c) integer, kind :: a diff --git a/test/Semantics/modfile12.f90 b/test/Semantics/modfile12.f90 index 89f43ad350eb..ca43611984a4 100644 --- a/test/Semantics/modfile12.f90 +++ b/test/Semantics/modfile12.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m integer(8), parameter :: a = 1, b = 2_8 parameter(n=3,l=-3,e=1.0/3.0) diff --git a/test/Semantics/modfile13.f90 b/test/Semantics/modfile13.f90 index 9205eabf6189..c4fcfe71751b 100644 --- a/test/Semantics/modfile13.f90 +++ b/test/Semantics/modfile13.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m character(2) :: z character(len=3) :: y diff --git a/test/Semantics/modfile14.f90 b/test/Semantics/modfile14.f90 index 16fbbc08b11c..1c4fa0e92076 100644 --- a/test/Semantics/modfile14.f90 +++ b/test/Semantics/modfile14.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m type t1 contains diff --git a/test/Semantics/modfile15.f90 b/test/Semantics/modfile15.f90 index 480ad8e77ab2..4cc8787f5d45 100644 --- a/test/Semantics/modfile15.f90 +++ b/test/Semantics/modfile15.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m type :: t procedure(a), pointer, pass :: c diff --git a/test/Semantics/modfile16.f90 b/test/Semantics/modfile16.f90 index e60106148504..acc17d54a282 100644 --- a/test/Semantics/modfile16.f90 +++ b/test/Semantics/modfile16.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m character(2), parameter :: prefix = 'c_' integer, bind(c, name='c_a') :: a diff --git a/test/Semantics/modfile17.f90 b/test/Semantics/modfile17.f90 index 0b91801e1081..33767a38028c 100644 --- a/test/Semantics/modfile17.f90 +++ b/test/Semantics/modfile17.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Tests parameterized derived type instantiation with KIND parameters module m diff --git a/test/Semantics/modfile18.f90 b/test/Semantics/modfile18.f90 index 39f719e4878a..032b0491045b 100644 --- a/test/Semantics/modfile18.f90 +++ b/test/Semantics/modfile18.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Tests folding of array constructors module m diff --git a/test/Semantics/modfile19.f90 b/test/Semantics/modfile19.f90 index 50d50ee6b1e2..fcb10b54e9d0 100644 --- a/test/Semantics/modfile19.f90 +++ b/test/Semantics/modfile19.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m implicit complex(8)(z) real :: x diff --git a/test/Semantics/modfile20.f90 b/test/Semantics/modfile20.f90 index 8677e3479ad2..90188c177c44 100644 --- a/test/Semantics/modfile20.f90 +++ b/test/Semantics/modfile20.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test modfiles for entities with initialization module m integer, parameter :: k8 = 8 diff --git a/test/Semantics/modfile21.f90 b/test/Semantics/modfile21.f90 index 3618ad0ab027..03349a32682d 100644 --- a/test/Semantics/modfile21.f90 +++ b/test/Semantics/modfile21.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m logical b bind(C) :: /cb2/ diff --git a/test/Semantics/modfile22.f90 b/test/Semantics/modfile22.f90 index deb365a7606c..6279ad78678a 100644 --- a/test/Semantics/modfile22.f90 +++ b/test/Semantics/modfile22.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test character length conversions in constructors module m diff --git a/test/Semantics/modfile23.f90 b/test/Semantics/modfile23.f90 index 8bf33b542ed7..4b5637867e1d 100644 --- a/test/Semantics/modfile23.f90 +++ b/test/Semantics/modfile23.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test that subprogram interfaces get all of the symbols that they need. module m1 diff --git a/test/Semantics/modfile24.f90 b/test/Semantics/modfile24.f90 index dc9c7d52a8df..ec446f9e8d3c 100644 --- a/test/Semantics/modfile24.f90 +++ b/test/Semantics/modfile24.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test declarations with coarray-spec ! Different ways of declaring the same coarray. diff --git a/test/Semantics/modfile25.f90 b/test/Semantics/modfile25.f90 index 5c16ead42951..210935df2515 100644 --- a/test/Semantics/modfile25.f90 +++ b/test/Semantics/modfile25.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test compile-time analysis of shapes. module m1 diff --git a/test/Semantics/modfile26.f90 b/test/Semantics/modfile26.f90 index 44d43c6ca788..5064122a3740 100644 --- a/test/Semantics/modfile26.f90 +++ b/test/Semantics/modfile26.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Intrinsics SELECTED_INT_KIND, SELECTED_REAL_KIND, PRECISION, RANGE, ! RADIX, DIGITS diff --git a/test/Semantics/modfile27.f90 b/test/Semantics/modfile27.f90 index ae577d84985c..2a6e23f6f464 100644 --- a/test/Semantics/modfile27.f90 +++ b/test/Semantics/modfile27.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test folding of combined array references and structure component ! references. diff --git a/test/Semantics/modfile28.f90 b/test/Semantics/modfile28.f90 index c53ab04dfc2d..18a349de5ba1 100644 --- a/test/Semantics/modfile28.f90 +++ b/test/Semantics/modfile28.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test UTF-8 support in character literals ! Note: Module files are encoded in UTF-8. diff --git a/test/Semantics/modfile29.f90 b/test/Semantics/modfile29.f90 index 7753e22d0f3e..7afa55120be1 100644 --- a/test/Semantics/modfile29.f90 +++ b/test/Semantics/modfile29.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Check that implicitly typed entities get a type in the module file. module m diff --git a/test/Semantics/modfile30.f90 b/test/Semantics/modfile30.f90 index 427025b91635..ef05b9395139 100644 --- a/test/Semantics/modfile30.f90 +++ b/test/Semantics/modfile30.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Verify miscellaneous bugs ! The function result must be declared after the dummy arguments diff --git a/test/Semantics/modfile31.f90 b/test/Semantics/modfile31.f90 index ec00f9f0ccb9..a29256fe46a2 100644 --- a/test/Semantics/modfile31.f90 +++ b/test/Semantics/modfile31.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test 7.6 enum values module m1 diff --git a/test/Semantics/modfile32.f90 b/test/Semantics/modfile32.f90 index 6db201e852c0..ea5b55a94d05 100644 --- a/test/Semantics/modfile32.f90 +++ b/test/Semantics/modfile32.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Resolution of generic names in expressions. ! Test by using generic function in a specification expression that needs ! to be written to a .mod file. diff --git a/test/Semantics/modfile33.f90 b/test/Semantics/modfile33.f90 index 23a510bf4008..d5474c799f77 100644 --- a/test/Semantics/modfile33.f90 +++ b/test/Semantics/modfile33.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Resolution of user-defined operators in expressions. ! Test by using generic function in a specification expression that needs ! to be written to a .mod file. diff --git a/test/Semantics/modfile34.f90 b/test/Semantics/modfile34.f90 index 16bacf7ade03..59b0fd1a447f 100644 --- a/test/Semantics/modfile34.f90 +++ b/test/Semantics/modfile34.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t ! Test resolution of type-bound generics. module m1 diff --git a/test/Semantics/modfile35.f90 b/test/Semantics/modfile35.f90 index c1d1c9541b1f..9ef35747e947 100644 --- a/test/Semantics/modfile35.f90 +++ b/test/Semantics/modfile35.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_modfile.sh %s %f18 %t module m1 type :: t1 contains diff --git a/test/Semantics/namelist01.f90 b/test/Semantics/namelist01.f90 index 81acecbfc725..f659c998c7ef 100644 --- a/test/Semantics/namelist01.f90 +++ b/test/Semantics/namelist01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test for checking namelist constraints, C8103-C8105 module dup diff --git a/test/Semantics/null01.f90 b/test/Semantics/null01.f90 index f6f5fa79975e..09c6dce22c48 100644 --- a/test/Semantics/null01.f90 +++ b/test/Semantics/null01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! NULL() intrinsic function error tests subroutine test diff --git a/test/Semantics/nullify01.f90 b/test/Semantics/nullify01.f90 index a8a4c7d1c2b8..9af635f8f08c 100644 --- a/test/Semantics/nullify01.f90 +++ b/test/Semantics/nullify01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test that NULLIFY works Module share diff --git a/test/Semantics/nullify02.f90 b/test/Semantics/nullify02.f90 index 2d611f3b7859..49bcc9ef5d11 100644 --- a/test/Semantics/nullify02.f90 +++ b/test/Semantics/nullify02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Check for semantic errors in NULLIFY statements INTEGER, PARAMETER :: maxvalue=1024 diff --git a/test/Semantics/omp-atomic.f90 b/test/Semantics/omp-atomic.f90 index 9a9d027f82e3..760d1ee4f619 100644 --- a/test/Semantics/omp-atomic.f90 +++ b/test/Semantics/omp-atomic.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP 2.13.6 atomic Construct diff --git a/test/Semantics/omp-clause-validity01.f90 b/test/Semantics/omp-clause-validity01.f90 index d624564cd20b..523b2eeb6c10 100644 --- a/test/Semantics/omp-clause-validity01.f90 +++ b/test/Semantics/omp-clause-validity01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP clause validity for the following directives: diff --git a/test/Semantics/omp-declarative-directive.f90 b/test/Semantics/omp-declarative-directive.f90 index 3a7933d25cb7..639ed7d4d895 100644 --- a/test/Semantics/omp-declarative-directive.f90 +++ b/test/Semantics/omp-declarative-directive.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP declarative directives diff --git a/test/Semantics/omp-device-constructs.f90 b/test/Semantics/omp-device-constructs.f90 index e87cb119dba4..7973dc2ef77f 100644 --- a/test/Semantics/omp-device-constructs.f90 +++ b/test/Semantics/omp-device-constructs.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP clause validity for the following directives: ! 2.10 Device constructs diff --git a/test/Semantics/omp-loop-association.f90 b/test/Semantics/omp-loop-association.f90 index 65b79fd5b476..22e9365b2f3f 100644 --- a/test/Semantics/omp-loop-association.f90 +++ b/test/Semantics/omp-loop-association.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check the association between OpenMPLoopConstruct and DoConstruct diff --git a/test/Semantics/omp-nested01.f90 b/test/Semantics/omp-nested01.f90 index 15b1713f6707..0e7220222217 100644 --- a/test/Semantics/omp-nested01.f90 +++ b/test/Semantics/omp-nested01.f90 @@ -1,3 +1,5 @@ +! RUN: %S/test_errors.sh %s %flang %t +!XFAIL: * ! OPTIONS: -fopenmp ! Check OpenMP 2.17 Nesting of Regions diff --git a/test/Semantics/omp-resolve01.f90 b/test/Semantics/omp-resolve01.f90 index 003de6eae171..528915e88f8d 100644 --- a/test/Semantics/omp-resolve01.f90 +++ b/test/Semantics/omp-resolve01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.4 An array section designates a subset of the elements in an array. Although diff --git a/test/Semantics/omp-resolve02.f90 b/test/Semantics/omp-resolve02.f90 index 3703c74cfa96..3d341662b2da 100644 --- a/test/Semantics/omp-resolve02.f90 +++ b/test/Semantics/omp-resolve02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! Test the effect to name resolution from illegal clause diff --git a/test/Semantics/omp-resolve03.f90 b/test/Semantics/omp-resolve03.f90 index 165bfc35773b..a896ef30c9f4 100644 --- a/test/Semantics/omp-resolve03.f90 +++ b/test/Semantics/omp-resolve03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Although variables in common blocks can be accessed by use association diff --git a/test/Semantics/omp-resolve04.f90 b/test/Semantics/omp-resolve04.f90 index d9ea847cb1b8..234013898b87 100644 --- a/test/Semantics/omp-resolve04.f90 +++ b/test/Semantics/omp-resolve04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Data-Sharing Attribute Clauses diff --git a/test/Semantics/omp-resolve05.f90 b/test/Semantics/omp-resolve05.f90 index 0ba4fd816d92..ebc50476b499 100644 --- a/test/Semantics/omp-resolve05.f90 +++ b/test/Semantics/omp-resolve05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Data-Sharing Attribute Clauses diff --git a/test/Semantics/omp-symbol01.f90 b/test/Semantics/omp-symbol01.f90 index bec8e0450dd5..70782f3adf41 100644 --- a/test/Semantics/omp-symbol01.f90 +++ b/test/Semantics/omp-symbol01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! Test clauses that accept list. diff --git a/test/Semantics/omp-symbol02.f90 b/test/Semantics/omp-symbol02.f90 index 3419c61e13db..eddb6865e88c 100644 --- a/test/Semantics/omp-symbol02.f90 +++ b/test/Semantics/omp-symbol02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! 1.4.1 Structure of the OpenMP Memory Model diff --git a/test/Semantics/omp-symbol03.f90 b/test/Semantics/omp-symbol03.f90 index a158ee87a425..54072a1e1049 100644 --- a/test/Semantics/omp-symbol03.f90 +++ b/test/Semantics/omp-symbol03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! 1.4.1 Structure of the OpenMP Memory Model diff --git a/test/Semantics/omp-symbol04.f90 b/test/Semantics/omp-symbol04.f90 index 4824c78dc92b..052fa859cd32 100644 --- a/test/Semantics/omp-symbol04.f90 +++ b/test/Semantics/omp-symbol04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Data-Sharing Attribute Clauses diff --git a/test/Semantics/omp-symbol05.f90 b/test/Semantics/omp-symbol05.f90 index 7e4e691c5b96..1a4b42e1ce32 100644 --- a/test/Semantics/omp-symbol05.f90 +++ b/test/Semantics/omp-symbol05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.2 threadprivate Directive diff --git a/test/Semantics/omp-symbol06.f90 b/test/Semantics/omp-symbol06.f90 index c1d7581db8be..b8ac0fc06115 100644 --- a/test/Semantics/omp-symbol06.f90 +++ b/test/Semantics/omp-symbol06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Data-Sharing Attribute Clauses diff --git a/test/Semantics/omp-symbol07.f90 b/test/Semantics/omp-symbol07.f90 index 170452959e01..c6cf500b41da 100644 --- a/test/Semantics/omp-symbol07.f90 +++ b/test/Semantics/omp-symbol07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! Generic tests diff --git a/test/Semantics/omp-symbol08.f90 b/test/Semantics/omp-symbol08.f90 index ac09e1690677..3a11933ac023 100644 --- a/test/Semantics/omp-symbol08.f90 +++ b/test/Semantics/omp-symbol08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.1.1 Predetermined rules for associated do-loops index variable diff --git a/test/Semantics/procinterface01.f90 b/test/Semantics/procinterface01.f90 index 5ab53d530ef3..b66206e24134 100644 --- a/test/Semantics/procinterface01.f90 +++ b/test/Semantics/procinterface01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Tests for "proc-interface" semantics. ! These cases are all valid. diff --git a/test/Semantics/resolve01.f90 b/test/Semantics/resolve01.f90 index 0c257fe1be9f..eee8d662517f 100644 --- a/test/Semantics/resolve01.f90 +++ b/test/Semantics/resolve01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t integer :: x !ERROR: The type of 'x' has already been declared real :: x diff --git a/test/Semantics/resolve02.f90 b/test/Semantics/resolve02.f90 index ddc419b392c3..0d8e83b0ed29 100644 --- a/test/Semantics/resolve02.f90 +++ b/test/Semantics/resolve02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s !ERROR: Declaration of 'x' conflicts with its use as internal procedure real :: x diff --git a/test/Semantics/resolve03.f90 b/test/Semantics/resolve03.f90 index 63a88f143adc..773aaab3d453 100644 --- a/test/Semantics/resolve03.f90 +++ b/test/Semantics/resolve03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t implicit none integer :: x !ERROR: No explicit type declared for 'y' diff --git a/test/Semantics/resolve04.f90 b/test/Semantics/resolve04.f90 index 8998acdca244..5132b9f780f6 100644 --- a/test/Semantics/resolve04.f90 +++ b/test/Semantics/resolve04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !ERROR: No explicit type declared for 'f' function f() implicit none diff --git a/test/Semantics/resolve05.f90 b/test/Semantics/resolve05.f90 index d485a34b6532..d1960e1808b1 100644 --- a/test/Semantics/resolve05.f90 +++ b/test/Semantics/resolve05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t program p integer :: p ! this is ok end diff --git a/test/Semantics/resolve06.f90 b/test/Semantics/resolve06.f90 index 12e0e2d4b126..276feb3b4ee4 100644 --- a/test/Semantics/resolve06.f90 +++ b/test/Semantics/resolve06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t implicit none allocatable :: x integer :: x diff --git a/test/Semantics/resolve07.f90 b/test/Semantics/resolve07.f90 index 585bf633b2ad..f2e46f42a9d1 100644 --- a/test/Semantics/resolve07.f90 +++ b/test/Semantics/resolve07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 integer :: x(2) !ERROR: The dimensions of 'x' have already been declared diff --git a/test/Semantics/resolve08.f90 b/test/Semantics/resolve08.f90 index 32274ce49df1..7252c79ef033 100644 --- a/test/Semantics/resolve08.f90 +++ b/test/Semantics/resolve08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t integer :: g(10) f(i) = i + 1 ! statement function g(i) = i + 2 ! mis-parsed array assignment diff --git a/test/Semantics/resolve09.f90 b/test/Semantics/resolve09.f90 index f288dad1a965..5104a371a639 100644 --- a/test/Semantics/resolve09.f90 +++ b/test/Semantics/resolve09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t integer :: y procedure() :: a procedure(real) :: b diff --git a/test/Semantics/resolve10.f90 b/test/Semantics/resolve10.f90 index 75a44a4f5e57..9990935899fa 100644 --- a/test/Semantics/resolve10.f90 +++ b/test/Semantics/resolve10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m public type t diff --git a/test/Semantics/resolve11.f90 b/test/Semantics/resolve11.f90 index 1114339a1bdb..d94c0f8c87d1 100644 --- a/test/Semantics/resolve11.f90 +++ b/test/Semantics/resolve11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m public i integer, private :: j diff --git a/test/Semantics/resolve12.f90 b/test/Semantics/resolve12.f90 index 1d2e1c398642..03bad9f5616f 100644 --- a/test/Semantics/resolve12.f90 +++ b/test/Semantics/resolve12.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 end diff --git a/test/Semantics/resolve13.f90 b/test/Semantics/resolve13.f90 index c67c59287ac3..6fc03b1e8be0 100644 --- a/test/Semantics/resolve13.f90 +++ b/test/Semantics/resolve13.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 integer :: x integer, private :: y diff --git a/test/Semantics/resolve14.f90 b/test/Semantics/resolve14.f90 index d9693e3a1ffd..326fe8e94894 100644 --- a/test/Semantics/resolve14.f90 +++ b/test/Semantics/resolve14.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 integer :: x integer :: y diff --git a/test/Semantics/resolve15.f90 b/test/Semantics/resolve15.f90 index 6ad7b2534797..1cca8ce3dd7b 100644 --- a/test/Semantics/resolve15.f90 +++ b/test/Semantics/resolve15.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m real :: var interface i diff --git a/test/Semantics/resolve16.f90 b/test/Semantics/resolve16.f90 index 798b88bd8b2d..8ce084a26fe9 100644 --- a/test/Semantics/resolve16.f90 +++ b/test/Semantics/resolve16.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m interface subroutine sub0 diff --git a/test/Semantics/resolve17.f90 b/test/Semantics/resolve17.f90 index 360115333235..f9c9451dcfe2 100644 --- a/test/Semantics/resolve17.f90 +++ b/test/Semantics/resolve17.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m integer :: foo !Note: PGI, Intel, and GNU allow this; NAG and Sun do not diff --git a/test/Semantics/resolve18.f90 b/test/Semantics/resolve18.f90 index ed9d301106eb..dff395f4bc9b 100644 --- a/test/Semantics/resolve18.f90 +++ b/test/Semantics/resolve18.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 implicit none contains diff --git a/test/Semantics/resolve19.f90 b/test/Semantics/resolve19.f90 index 15f902a2ba46..f28f2b45abdf 100644 --- a/test/Semantics/resolve19.f90 +++ b/test/Semantics/resolve19.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m interface a subroutine s(x) diff --git a/test/Semantics/resolve20.f90 b/test/Semantics/resolve20.f90 index 33c67dd24923..38dbd2367fe4 100644 --- a/test/Semantics/resolve20.f90 +++ b/test/Semantics/resolve20.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m abstract interface subroutine foo diff --git a/test/Semantics/resolve21.f90 b/test/Semantics/resolve21.f90 index 38fc699ca018..764537a565f5 100644 --- a/test/Semantics/resolve21.f90 +++ b/test/Semantics/resolve21.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 type :: t integer :: i diff --git a/test/Semantics/resolve22.f90 b/test/Semantics/resolve22.f90 index cc8c9ed75dad..3549ec76e777 100644 --- a/test/Semantics/resolve22.f90 +++ b/test/Semantics/resolve22.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 !OK: interface followed by type with same name interface t diff --git a/test/Semantics/resolve23.f90 b/test/Semantics/resolve23.f90 index 504363b458e1..41644843bf1f 100644 --- a/test/Semantics/resolve23.f90 +++ b/test/Semantics/resolve23.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m type :: t real :: y diff --git a/test/Semantics/resolve24.f90 b/test/Semantics/resolve24.f90 index 87917ba09fbc..c2ce595d9054 100644 --- a/test/Semantics/resolve24.f90 +++ b/test/Semantics/resolve24.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine test1 !ERROR: Generic interface 'foo' has both a function and a subroutine interface foo diff --git a/test/Semantics/resolve25.f90 b/test/Semantics/resolve25.f90 index 62e0ba6ff2d0..4d3ec8c81495 100644 --- a/test/Semantics/resolve25.f90 +++ b/test/Semantics/resolve25.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m interface foo subroutine s1(x) diff --git a/test/Semantics/resolve26.f90 b/test/Semantics/resolve26.f90 index 343ee1eb9160..f39366faaef0 100644 --- a/test/Semantics/resolve26.f90 +++ b/test/Semantics/resolve26.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 interface module subroutine s() diff --git a/test/Semantics/resolve27.f90 b/test/Semantics/resolve27.f90 index 3f04c1aa64fa..b10105ed9e7d 100644 --- a/test/Semantics/resolve27.f90 +++ b/test/Semantics/resolve27.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m interface module subroutine s() diff --git a/test/Semantics/resolve28.f90 b/test/Semantics/resolve28.f90 index 2843c2cbb071..0fd81807c97f 100644 --- a/test/Semantics/resolve28.f90 +++ b/test/Semantics/resolve28.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s type t end type diff --git a/test/Semantics/resolve29.f90 b/test/Semantics/resolve29.f90 index f692b0c0e91d..d328eba594e7 100644 --- a/test/Semantics/resolve29.f90 +++ b/test/Semantics/resolve29.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m type t1 end type diff --git a/test/Semantics/resolve30.f90 b/test/Semantics/resolve30.f90 index 69121e03ec1e..98777124b134 100644 --- a/test/Semantics/resolve30.f90 +++ b/test/Semantics/resolve30.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 integer x block diff --git a/test/Semantics/resolve31.f90 b/test/Semantics/resolve31.f90 index 982cb56ad564..3c61cd0bb9dc 100644 --- a/test/Semantics/resolve31.f90 +++ b/test/Semantics/resolve31.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 integer :: t0 !ERROR: 't0' is not a derived type diff --git a/test/Semantics/resolve32.f90 b/test/Semantics/resolve32.f90 index 6f6ed8fb0bf9..317a0ad9ed12 100644 --- a/test/Semantics/resolve32.f90 +++ b/test/Semantics/resolve32.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m2 public s2, s4 private s3 diff --git a/test/Semantics/resolve33.f90 b/test/Semantics/resolve33.f90 index 214a678eb567..4a37c5fb57aa 100644 --- a/test/Semantics/resolve33.f90 +++ b/test/Semantics/resolve33.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Derived type parameters module m diff --git a/test/Semantics/resolve34.f90 b/test/Semantics/resolve34.f90 index c3b28bb929b8..3405dfea3498 100644 --- a/test/Semantics/resolve34.f90 +++ b/test/Semantics/resolve34.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Extended derived types module m1 diff --git a/test/Semantics/resolve35.f90 b/test/Semantics/resolve35.f90 index 6acd24f49b5e..7f6a8ea9492b 100644 --- a/test/Semantics/resolve35.f90 +++ b/test/Semantics/resolve35.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Construct names subroutine s1 diff --git a/test/Semantics/resolve36.f90 b/test/Semantics/resolve36.f90 index e74d6fb62cbf..438ad1aeca92 100644 --- a/test/Semantics/resolve36.f90 +++ b/test/Semantics/resolve36.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 interface module subroutine sub1(arg1) diff --git a/test/Semantics/resolve37.f90 b/test/Semantics/resolve37.f90 index ccc05f3d1715..a07ebbc6625b 100644 --- a/test/Semantics/resolve37.f90 +++ b/test/Semantics/resolve37.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C701 The type-param-value for a kind type parameter shall be a constant ! expression. This constraint looks like a mistake in the standard. integer, parameter :: k = 8 diff --git a/test/Semantics/resolve38.f90 b/test/Semantics/resolve38.f90 index ebc29b7c8ed8..53e8db813380 100644 --- a/test/Semantics/resolve38.f90 +++ b/test/Semantics/resolve38.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C772 module m1 type t1 diff --git a/test/Semantics/resolve39.f90 b/test/Semantics/resolve39.f90 index a5b50afe2062..d0052f16f863 100644 --- a/test/Semantics/resolve39.f90 +++ b/test/Semantics/resolve39.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 implicit none real(8) :: x = 2.0 diff --git a/test/Semantics/resolve40.f90 b/test/Semantics/resolve40.f90 index 1137126740af..95c2c9e8034c 100644 --- a/test/Semantics/resolve40.f90 +++ b/test/Semantics/resolve40.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 namelist /nl/x block diff --git a/test/Semantics/resolve41.f90 b/test/Semantics/resolve41.f90 index 2f618675de60..e2bf877016ed 100644 --- a/test/Semantics/resolve41.f90 +++ b/test/Semantics/resolve41.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m implicit none real, parameter :: a = 8.0 diff --git a/test/Semantics/resolve42.f90 b/test/Semantics/resolve42.f90 index e71e4c881712..5b6ac9f88b2b 100644 --- a/test/Semantics/resolve42.f90 +++ b/test/Semantics/resolve42.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1 !ERROR: Array 'z' without ALLOCATABLE or POINTER attribute must have explicit shape common x, y(4), z(:) diff --git a/test/Semantics/resolve43.f90 b/test/Semantics/resolve43.f90 index ed2454a535ec..385dfedc34bd 100644 --- a/test/Semantics/resolve43.f90 +++ b/test/Semantics/resolve43.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Error tests for structure constructors. ! Errors caught by expression resolution are tested elsewhere; these are the ! errors meant to be caught by name resolution, as well as acceptable use diff --git a/test/Semantics/resolve44.f90 b/test/Semantics/resolve44.f90 index f6e7a89ba5c3..dd082adc89df 100644 --- a/test/Semantics/resolve44.f90 +++ b/test/Semantics/resolve44.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Error tests for recursive use of derived types. program main diff --git a/test/Semantics/resolve45.f90 b/test/Semantics/resolve45.f90 index ebc9e21b5137..e28dc33c4e72 100644 --- a/test/Semantics/resolve45.f90 +++ b/test/Semantics/resolve45.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t function f1(x, y) integer x !ERROR: SAVE attribute may not be applied to dummy argument 'x' diff --git a/test/Semantics/resolve46.f90 b/test/Semantics/resolve46.f90 index 8a0385ae28b7..181ccfb5c280 100644 --- a/test/Semantics/resolve46.f90 +++ b/test/Semantics/resolve46.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C1030 - pointers to intrinsic procedures program main intrinsic :: cos ! a specific & generic intrinsic name diff --git a/test/Semantics/resolve47.f90 b/test/Semantics/resolve47.f90 index 2c5f8141b967..04dab5616855 100644 --- a/test/Semantics/resolve47.f90 +++ b/test/Semantics/resolve47.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t module m1 !ERROR: Logical constant '.true.' may not be used as a defined operator interface operator(.TRUE.) diff --git a/test/Semantics/resolve48.f90 b/test/Semantics/resolve48.f90 index ba3dea3c41f1..887505d16442 100644 --- a/test/Semantics/resolve48.f90 +++ b/test/Semantics/resolve48.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test correct use-association of a derived type. module m1 implicit none diff --git a/test/Semantics/resolve49.f90 b/test/Semantics/resolve49.f90 index ac470834ff91..97d2cbdb1267 100644 --- a/test/Semantics/resolve49.f90 +++ b/test/Semantics/resolve49.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test section subscript program p1 real :: a(10,10) diff --git a/test/Semantics/resolve50.f90 b/test/Semantics/resolve50.f90 index 7d3ad7e105a3..34d6f1c1d5d5 100644 --- a/test/Semantics/resolve50.f90 +++ b/test/Semantics/resolve50.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test coarray association in CHANGE TEAM statement subroutine s1 diff --git a/test/Semantics/resolve51.f90 b/test/Semantics/resolve51.f90 index 73dafaa406b5..de763ef49911 100644 --- a/test/Semantics/resolve51.f90 +++ b/test/Semantics/resolve51.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test SELECT TYPE errors: C1157 subroutine s1() diff --git a/test/Semantics/resolve52.f90 b/test/Semantics/resolve52.f90 index 3ee41dd3503f..846b412f05ca 100644 --- a/test/Semantics/resolve52.f90 +++ b/test/Semantics/resolve52.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Tests for C760: ! The passed-object dummy argument shall be a scalar, nonpointer, nonallocatable ! dummy data object with the same declared type as the type being defined; diff --git a/test/Semantics/resolve53.f90 b/test/Semantics/resolve53.f90 index 5cfe16410500..1aee5e79bcc9 100644 --- a/test/Semantics/resolve53.f90 +++ b/test/Semantics/resolve53.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! 15.4.3.4.5 Restrictions on generic declarations ! Specific procedures of generic interfaces must be distinguishable. diff --git a/test/Semantics/resolve54.f90 b/test/Semantics/resolve54.f90 index aed15410ddbc..f9f895fa7f05 100644 --- a/test/Semantics/resolve54.f90 +++ b/test/Semantics/resolve54.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Tests based on examples in C.10.6 ! C.10.6(10) diff --git a/test/Semantics/resolve55.f90 b/test/Semantics/resolve55.f90 index 59f0027d9aef..98006bc0a07b 100644 --- a/test/Semantics/resolve55.f90 +++ b/test/Semantics/resolve55.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Tests for C1128: ! A variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not ! have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of diff --git a/test/Semantics/resolve56.f90 b/test/Semantics/resolve56.f90 index 65d5fa2c84b8..1efa535bd434 100644 --- a/test/Semantics/resolve56.f90 +++ b/test/Semantics/resolve56.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test that associations constructs can be correctly combined. The intrinsic ! functions are not what is tested here, they are only use to reveal the types ! of local variables. diff --git a/test/Semantics/resolve57.f90 b/test/Semantics/resolve57.f90 index c5e8661206ad..265decd3bcde 100644 --- a/test/Semantics/resolve57.f90 +++ b/test/Semantics/resolve57.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Tests for the last sentence of C1128: !A variable-name that is not permitted to appear in a variable definition !context shall not appear in a LOCAL or LOCAL_INIT locality-spec. diff --git a/test/Semantics/resolve58.f90 b/test/Semantics/resolve58.f90 index 00232dc9d843..db11e6779335 100644 --- a/test/Semantics/resolve58.f90 +++ b/test/Semantics/resolve58.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1(x, y) !ERROR: Array pointer 'x' must have deferred shape or assumed rank real, pointer :: x(1:) ! C832 diff --git a/test/Semantics/resolve59.f90 b/test/Semantics/resolve59.f90 index e34fcaea01d2..0e6965a5d165 100644 --- a/test/Semantics/resolve59.f90 +++ b/test/Semantics/resolve59.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Testing 15.6.2.2 point 4 (What function-name refers to depending on the ! presence of RESULT). diff --git a/test/Semantics/resolve60.f90 b/test/Semantics/resolve60.f90 index 843057d758c8..3232bc0fb87a 100644 --- a/test/Semantics/resolve60.f90 +++ b/test/Semantics/resolve60.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Testing 7.6 enum ! OK diff --git a/test/Semantics/resolve61.f90 b/test/Semantics/resolve61.f90 index 727b2643ca5c..eb5ba13a07a3 100644 --- a/test/Semantics/resolve61.f90 +++ b/test/Semantics/resolve61.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t program p1 integer(8) :: a, b, c, d pointer(a, b) diff --git a/test/Semantics/resolve62.f90 b/test/Semantics/resolve62.f90 index 06c3ed1afe63..5de3a45e900f 100644 --- a/test/Semantics/resolve62.f90 +++ b/test/Semantics/resolve62.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Resolve generic based on number of arguments subroutine s1 interface f diff --git a/test/Semantics/resolve63.f90 b/test/Semantics/resolve63.f90 index 49b4e7b0d20d..07ae767d676b 100644 --- a/test/Semantics/resolve63.f90 +++ b/test/Semantics/resolve63.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Invalid operand types when user-defined operator is available module m1 type :: t diff --git a/test/Semantics/resolve64.f90 b/test/Semantics/resolve64.f90 index 360605a000ec..3be2ae14fd5d 100644 --- a/test/Semantics/resolve64.f90 +++ b/test/Semantics/resolve64.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !OPTIONS: -flogical-abbreviations -fxor-operator ! Like m4 in resolve63 but compiled with different options. diff --git a/test/Semantics/resolve65.f90 b/test/Semantics/resolve65.f90 index 8c3264cc36f9..9e1278b66dd5 100644 --- a/test/Semantics/resolve65.f90 +++ b/test/Semantics/resolve65.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test restrictions on what subprograms can be used for defined assignment. module m1 diff --git a/test/Semantics/resolve66.f90 b/test/Semantics/resolve66.f90 index 2b82b5f0ec13..d54fd2bfe66c 100644 --- a/test/Semantics/resolve66.f90 +++ b/test/Semantics/resolve66.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test that user-defined assignment is used in the right places module m1 diff --git a/test/Semantics/resolve67.f90 b/test/Semantics/resolve67.f90 index 3f2b2572ffc0..7a8537a0a65e 100644 --- a/test/Semantics/resolve67.f90 +++ b/test/Semantics/resolve67.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test restrictions on what subprograms can be used for defined operators. ! See: 15.4.3.4.2 diff --git a/test/Semantics/resolve68.f90 b/test/Semantics/resolve68.f90 index 06cd13716d43..6accdafd5263 100644 --- a/test/Semantics/resolve68.f90 +++ b/test/Semantics/resolve68.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Test resolution of type-bound generics. module m1 diff --git a/test/Semantics/resolve69.f90 b/test/Semantics/resolve69.f90 index bf08c3a706b0..3bbc37e3f7aa 100644 --- a/test/Semantics/resolve69.f90 +++ b/test/Semantics/resolve69.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t subroutine s1() ! C701 (R701) The type-param-value for a kind type parameter shall be a ! constant expression. diff --git a/test/Semantics/resolve70.f90 b/test/Semantics/resolve70.f90 index 8824ea4249af..31f33c345b63 100644 --- a/test/Semantics/resolve70.f90 +++ b/test/Semantics/resolve70.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C703 (R702) The derived-type-spec shall not specify an abstract type (7.5.7). ! This constraint refers to the derived-type-spec in a type-spec. A type-spec ! can appear in an ALLOCATE statement, an ac-spec for an array constructor, and diff --git a/test/Semantics/resolve71.f90 b/test/Semantics/resolve71.f90 index d570233d4633..8c1c56fd9b0e 100644 --- a/test/Semantics/resolve71.f90 +++ b/test/Semantics/resolve71.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C708 An entity declared with the CLASS keyword shall be a dummy argument ! or have the ALLOCATABLE or POINTER attribute. subroutine s() diff --git a/test/Semantics/resolve72.f90 b/test/Semantics/resolve72.f90 index fdead88c8fe8..9963e27223a8 100644 --- a/test/Semantics/resolve72.f90 +++ b/test/Semantics/resolve72.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C709 An assumed-type entity shall be a dummy data object that does not have ! the ALLOCATABLE, CODIMENSION, INTENT (OUT), POINTER, or VALUE attribute and ! is not an explicit-shape array. diff --git a/test/Semantics/resolve73.f90 b/test/Semantics/resolve73.f90 index 191be316b620..35f8429aeacf 100644 --- a/test/Semantics/resolve73.f90 +++ b/test/Semantics/resolve73.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C721 A type-param-value of * shall be used only ! * to declare a dummy argument, ! * to declare a named constant, diff --git a/test/Semantics/resolve74.f90 b/test/Semantics/resolve74.f90 index a674b1f37ac2..60927b198769 100644 --- a/test/Semantics/resolve74.f90 +++ b/test/Semantics/resolve74.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C722 A function name shall not be declared with an asterisk type-param-value ! unless it is of type CHARACTER and is the name of a dummy function or the ! name of the result of an external function. diff --git a/test/Semantics/resolve75.f90 b/test/Semantics/resolve75.f90 index 2c63a36fe523..708ce8ffaeec 100644 --- a/test/Semantics/resolve75.f90 +++ b/test/Semantics/resolve75.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! C726 The length specified for a character statement function or for a ! statement function dummy argument of type character shall be a constant ! expression. diff --git a/test/Semantics/separate-module-procs.f90 b/test/Semantics/separate-module-procs.f90 index ba3b1abcc991..33dfcd557fde 100644 --- a/test/Semantics/separate-module-procs.f90 +++ b/test/Semantics/separate-module-procs.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t !===--- separate-module-procs.f90 - Test separate module procedure ---------=== ! ! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/test/Semantics/stop01.f90 b/test/Semantics/stop01.f90 index 91112b11a801..2ae8d65a84bb 100644 --- a/test/Semantics/stop01.f90 +++ b/test/Semantics/stop01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t program main implicit none integer :: i = -1 diff --git a/test/Semantics/structconst01.f90 b/test/Semantics/structconst01.f90 index a83286c422ab..68f0261cd85d 100644 --- a/test/Semantics/structconst01.f90 +++ b/test/Semantics/structconst01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Error tests for structure constructors. ! Errors caught by name resolution are tested elsewhere; these are the ! errors meant to be caught by expression semantic analysis, as well as diff --git a/test/Semantics/structconst02.f90 b/test/Semantics/structconst02.f90 index 923aa6071b09..22428651fa1c 100644 --- a/test/Semantics/structconst02.f90 +++ b/test/Semantics/structconst02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Error tests for structure constructors: per-component type ! (in)compatibility. diff --git a/test/Semantics/structconst03.f90 b/test/Semantics/structconst03.f90 index e637bc08d3e3..776b4d082309 100644 --- a/test/Semantics/structconst03.f90 +++ b/test/Semantics/structconst03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Error tests for structure constructors: C1594 violations ! from assigning globally-visible data to POINTER components. ! test/Semantics/structconst04.f90 is this same test without type diff --git a/test/Semantics/structconst04.f90 b/test/Semantics/structconst04.f90 index a2d7421945f4..07a9d69df868 100644 --- a/test/Semantics/structconst04.f90 +++ b/test/Semantics/structconst04.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_errors.sh %s %flang %t ! Error tests for structure constructors: C1594 violations ! from assigning globally-visible data to POINTER components. ! This test is structconst03.f90 with the type parameters removed. diff --git a/test/Semantics/symbol01.f90 b/test/Semantics/symbol01.f90 index 7a6476dddded..9d8cacd3d6b8 100644 --- a/test/Semantics/symbol01.f90 +++ b/test/Semantics/symbol01.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Test that intent-stmt and subprogram prefix and suffix are resolved. !DEF: /m Module diff --git a/test/Semantics/symbol02.f90 b/test/Semantics/symbol02.f90 index ba048a20ef91..8f53c50580ed 100644 --- a/test/Semantics/symbol02.f90 +++ b/test/Semantics/symbol02.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Test host association in module subroutine and internal subroutine. !DEF: /m Module diff --git a/test/Semantics/symbol03.f90 b/test/Semantics/symbol03.f90 index 778794c1a14d..41a7cc26e694 100644 --- a/test/Semantics/symbol03.f90 +++ b/test/Semantics/symbol03.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Test host association in internal subroutine of main program. !DEF: /main MainProgram diff --git a/test/Semantics/symbol05.f90 b/test/Semantics/symbol05.f90 index 4bc42aca6296..678b8f19f55d 100644 --- a/test/Semantics/symbol05.f90 +++ b/test/Semantics/symbol05.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Explicit and implicit entities in blocks !DEF: /s1 (Subroutine) Subprogram diff --git a/test/Semantics/symbol06.f90 b/test/Semantics/symbol06.f90 index 804017bbdf13..b3b3e17b10da 100644 --- a/test/Semantics/symbol06.f90 +++ b/test/Semantics/symbol06.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /main MainProgram program main !DEF: /main/t1 DerivedType diff --git a/test/Semantics/symbol07.f90 b/test/Semantics/symbol07.f90 index 787dfc5b0ec7..b387ec6c673b 100644 --- a/test/Semantics/symbol07.f90 +++ b/test/Semantics/symbol07.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /main MainProgram program main implicit complex(z) diff --git a/test/Semantics/symbol08.f90 b/test/Semantics/symbol08.f90 index e0a65b84e7bb..801f7f449b20 100644 --- a/test/Semantics/symbol08.f90 +++ b/test/Semantics/symbol08.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /main MainProgram program main !DEF: /main/x POINTER ObjectEntity REAL(4) diff --git a/test/Semantics/symbol09.f90 b/test/Semantics/symbol09.f90 index 8dca1332a538..77d4a3416df3 100644 --- a/test/Semantics/symbol09.f90 +++ b/test/Semantics/symbol09.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /s1 (Subroutine) Subprogram subroutine s1 !DEF: /s1/a ObjectEntity REAL(4) diff --git a/test/Semantics/symbol10.f90 b/test/Semantics/symbol10.f90 index c9cf1ce6148a..e487764fa5a2 100644 --- a/test/Semantics/symbol10.f90 +++ b/test/Semantics/symbol10.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /m1 Module module m1 contains diff --git a/test/Semantics/symbol11.f90 b/test/Semantics/symbol11.f90 index d3312eaa293b..e759310c8dcb 100644 --- a/test/Semantics/symbol11.f90 +++ b/test/Semantics/symbol11.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t !DEF: /s1 (Subroutine) Subprogram subroutine s1 implicit none diff --git a/test/Semantics/symbol12.f90 b/test/Semantics/symbol12.f90 index e13c09542720..22350f6c25e2 100644 --- a/test/Semantics/symbol12.f90 +++ b/test/Semantics/symbol12.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Verify that SAVE attribute is propagated by EQUIVALENCE !DEF: /s1 (Subroutine) Subprogram diff --git a/test/Semantics/symbol13.f90 b/test/Semantics/symbol13.f90 index 76235db206da..640066ed76ea 100644 --- a/test/Semantics/symbol13.f90 +++ b/test/Semantics/symbol13.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Old-style "*length" specifiers (R723) !DEF: /f1 (Function) Subprogram CHARACTER(1_8,1) diff --git a/test/Semantics/symbol14.f90 b/test/Semantics/symbol14.f90 index c990665e8d6e..d523e8d6f480 100644 --- a/test/Semantics/symbol14.f90 +++ b/test/Semantics/symbol14.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! "Bare" uses of type parameters and components !DEF: /MainProgram1/t1 DerivedType diff --git a/test/Semantics/symbol15.f90 b/test/Semantics/symbol15.f90 index 4ad09b395ffc..00298cfa1d84 100644 --- a/test/Semantics/symbol15.f90 +++ b/test/Semantics/symbol15.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Forward references in pointer initializers and TBP bindings. !DEF: /m Module diff --git a/test/Semantics/symbol16.f90 b/test/Semantics/symbol16.f90 index a90ab83d2ac1..0650222e0833 100644 --- a/test/Semantics/symbol16.f90 +++ b/test/Semantics/symbol16.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Statement functions !DEF: /p1 MainProgram diff --git a/test/Semantics/symbol17.f90 b/test/Semantics/symbol17.f90 index a861e2f6f260..a99c8245f6d7 100644 --- a/test/Semantics/symbol17.f90 +++ b/test/Semantics/symbol17.f90 @@ -1,3 +1,4 @@ +! RUN: %S/test_symbols.sh %s %flang %t ! Forward references to derived types (non-error cases) !DEF: /main MainProgram diff --git a/test-lit/Semantics/test_any.sh b/test/Semantics/test_any.sh similarity index 100% rename from test-lit/Semantics/test_any.sh rename to test/Semantics/test_any.sh diff --git a/test-lit/Semantics/test_errors.sh b/test/Semantics/test_errors.sh similarity index 100% rename from test-lit/Semantics/test_errors.sh rename to test/Semantics/test_errors.sh diff --git a/test-lit/Semantics/test_modfile.sh b/test/Semantics/test_modfile.sh similarity index 100% rename from test-lit/Semantics/test_modfile.sh rename to test/Semantics/test_modfile.sh diff --git a/test-lit/Semantics/test_symbols.sh b/test/Semantics/test_symbols.sh similarity index 100% rename from test-lit/Semantics/test_symbols.sh rename to test/Semantics/test_symbols.sh diff --git a/test-lit/lit.cfg.py b/test/lit.cfg.py similarity index 99% rename from test-lit/lit.cfg.py rename to test/lit.cfg.py index 3ca3c8ad23f7..9aff4577d2a1 100644 --- a/test-lit/lit.cfg.py +++ b/test/lit.cfg.py @@ -35,7 +35,7 @@ # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.flang_obj_root, 'test-lit') +config.test_exec_root = os.path.join(config.flang_obj_root, 'test') config.substitutions.append(('%PATH%', config.environment['PATH'])) @@ -50,7 +50,7 @@ config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.flang_obj_root, 'test-lit') +config.test_exec_root = os.path.join(config.flang_obj_root, 'test') # Tweak the PATH to include the tools dir. llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True) diff --git a/test-lit/lit.site.cfg.py.in b/test/lit.site.cfg.py.in similarity index 92% rename from test-lit/lit.site.cfg.py.in rename to test/lit.site.cfg.py.in index d00f3856fb41..34bcdab11b55 100644 --- a/test-lit/lit.site.cfg.py.in +++ b/test/lit.site.cfg.py.in @@ -23,4 +23,4 @@ import lit.llvm lit.llvm.initialize(lit_config, config) # Let the main config do the real work. -lit_config.load_config(config, "@FLANG_SOURCE_DIR@/test-lit/lit.cfg.py") +lit_config.load_config(config, "@FLANG_SOURCE_DIR@/test/lit.cfg.py")