90 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in error stop statements based on the3! statement specification in section 11.4 of the Fortran 2018 standard.4 5program test_error_stop6 implicit none7 8 integer int_code, int_array(1), int_coarray[*], array_coarray(1)[*]9 integer(kind=1) non_default_int_kind10 character(len=128) char_code, char_array(1), char_coarray[*], non_logical11 character(kind=4, len=128) non_default_char_kind12 logical bool, logical_array(1), logical_coarray[*], non_integer, non_character13 14 !___ standard-conforming statements ____________________________15 error stop16 17 !___ standard-conforming statements with stop-code ______________18 error stop int_code19 error stop 520 error stop (5)21 error stop ((5 + 8) * 2)22 error stop char_code23 error stop 'c'24 error stop ('c')25 error stop ('program failed')26 error stop int_array(1)27 error stop char_array(1)28 error stop int_coarray29 error stop int_coarray[1]30 error stop char_coarray31 error stop char_coarray[1]32 error stop array_coarray(1)33 error stop array_coarray(1)[1]34 35 !___ standard-conforming statements with stop-code and quiet= ___36 error stop int_code, quiet=bool37 error stop int_code, quiet=logical_array(1)38 error stop int_code, quiet=logical_coarray39 error stop int_code, quiet=logical_coarray[1]40 error stop int_code, quiet=.true.41 error stop (int_code), quiet=.false.42 43 !___ non-standard-conforming statements _________________________44 45 ! unknown stop-code46 !ERROR: expected end of statement47 error stop code=int_code48 49 ! missing 'quiet='50 !ERROR: expected end of statement51 error stop int_code, bool52 53 ! incorrect spelling for 'quiet='54 !ERROR: expected end of statement55 error stop int_code, quiets=bool56 57 ! missing scalar-logical-expr for quiet=58 !ERROR: expected end of statement59 error stop int_code, quiet60 61 ! superfluous stop-code62 !ERROR: expected end of statement63 error stop int_code, char_code64 65 ! repeated quiet=66 !ERROR: expected end of statement67 error stop int_code, quiet=bool, quiet=.true.68 69 ! superfluous stop-code70 !ERROR: expected end of statement71 error stop int_code, char_code, quiet=bool72 73 ! superfluous integer74 !ERROR: expected end of statement75 error stop int_code, quiet=bool, 576 77 ! quiet= appears without stop-code78 !ERROR: expected end of statement79 error stop quiet=bool80 81 ! incorrect syntax82 !ERROR: expected end of statement83 error stop ()84 85 ! incorrect syntax86 !ERROR: expected end of statement87 error stop (2, quiet=.true.)88 89end program test_error_stop90