1! RUN: %S/test_errors.sh %s %t %flang_fc1 2! REQUIRES: shell 3 character(len=20) :: access = "direcT" 4 character(len=20) :: access_(2) = (/"direcT", "streaM"/) 5 character(len=20) :: action_(2) = (/"reaD ", "writE"/) 6 character(len=20) :: asynchronous_(2) = (/"nO ", "yeS"/) 7 character(len=20) :: blank_(2) = (/"nulL", "zerO"/) 8 character(len=20) :: decimal_(2) = (/'commA', 'poinT'/) 9 character(len=20) :: delim_(2) = (/"nonE ", "quotE"/) 10 character(len=20) :: encoding_(2) = (/"defaulT", "utF-8 "/) 11 character(len=20) :: form_(2) = (/"formatteD ", "unformatteD"/) 12 character(len=20) :: pad_(2) = (/"nO ", "yeS"/) 13 character(len=20) :: position_(3) = (/"appenD", "asiS ", "rewinD"/) 14 character(len=20) :: round_(2) = (/"dowN", "zerO"/) 15 character(len=20) :: sign_(2) = (/"pluS ", "suppresS"/) 16 character(len=20) :: status_(2) = (/"neW", "olD"/) 17 character(len=20) :: convert_(2) = (/"big_endiaN", "nativE "/) 18 character(len=20) :: dispose_(2) = (/ "deletE", "keeP "/) 19 character(len=66) :: cc, msg 20 21 integer :: new_unit 22 integer :: unit10 = 10 23 integer :: unit11 = 11 24 integer :: n = 40 25 integer, parameter :: const_new_unit = 66 26 27 integer(kind=1) :: stat1 28 integer(kind=2) :: stat2 29 integer(kind=4) :: stat4 30 integer(kind=8) :: stat8 31 32 cc = 'scratch' 33 34 open(unit10) 35 open(blank='null', unit=unit10, pad='no') 36 open(unit=unit11, err=3) 373 continue 38 39 open(20, access='sequential') 40 open(21, access=access, recl=n) 41 open(22, access=access_(2), iostat=stat1, iomsg=msg) 42 43 open(30, action='readwrite', asynchronous='n'//'o', blank='zero') 44 open(31, action=action_(2), asynchronous=asynchronous_(2), blank=blank_(2)) 45 46 open(unit=40, decimal="comma", delim="apostrophe", encoding="utf-8") 47 open(unit=41, decimal=decimal_(2), delim=delim_(2), encoding=encoding_(2)) 48 49 open(50, file='abc', status='unknown', form='formatted') 50 open(51, file=access, status=status_(2), form=form_(2)) 51 52 open(newunit=new_unit, pad=pad_(2), status='scr'//'atch'//'') 53 open(newunit=new_unit, pad=pad_(2), status=cc) 54 55 open(unit=60, position='rewind', recl=(30+20/2), round='zero') 56 open(position=position_(1), recl=n, round=round_(2), unit=61) 57 58 open(unit=70, sign='suppress', & 59 status='unknown', iostat=stat2) 60 open(unit=70, sign=sign_(2), status=status_(2)) 61 62 open(80, convert='big_endian', dispose='delete') 63 open(81, convert=convert_(2), dispose=dispose_(2)) 64 65 open(access='STREAM', 90) ! nonstandard 66 open (unit=91, file='xfile', carriagecontrol='list') ! nonstandard 67 68 !ERROR: OPEN statement must have a UNIT or NEWUNIT specifier 69 !ERROR: If ACCESS='DIRECT' appears, RECL must also appear 70 open(access='direct') 71 72 !ERROR: If STATUS='STREAM' appears, RECL must not appear 73 open(10, access='st'//'ream', recl=13) 74 75 !ERROR: Duplicate NEWUNIT specifier 76 !ERROR: If NEWUNIT appears, FILE or STATUS must also appear 77 open(newunit=n, newunit=nn, iostat=stat4) 78 79 !ERROR: NEWUNIT variable 'const_new_unit' must be definable 80 open(newunit=const_new_unit, status=cc) 81 82 !ERROR: Duplicate UNIT specifier 83 open(unit=100, unit=100) 84 85 !ERROR: Duplicate UNIT specifier 86 open(101, delim=delim_(1), unit=102) 87 88 !ERROR: Duplicate UNIT specifier 89 open(unit=103, & 90 unit=104, iostat=stat8) 91 92 !ERROR: Duplicate UNIT specifier 93 !ERROR: If ACCESS='DIRECT' appears, RECL must also appear 94 open(access='dir'//'ect', 9, 9) ! nonstandard 95 96 !ERROR: Duplicate ROUND specifier 97 open(105, round=round_(1), pad='no', round='nearest') 98 99 !ERROR: If NEWUNIT appears, UNIT must not appear 100 !ERROR: If NEWUNIT appears, FILE or STATUS must also appear 101 open(106, newunit=n) 102 103 !ERROR: RECL value (-30) must be positive 104 open(107, recl=40-70) 105 106 !ERROR: RECL value (-36) must be positive 107 open(108, recl=- - (-36)) ! nonstandard 108 109 !ERROR: Invalid ACTION value 'reedwrite' 110 open(109, access=Access, action='reedwrite', recl=77) 111 112 !ERROR: Invalid ACTION value 'nonsense' 113 open(110, action=''//'non'//'sense', recl=77) 114 115 !ERROR: Invalid STATUS value 'cold' 116 open(111, status='cold') 117 118 !ERROR: Invalid STATUS value 'Keep' 119 open(112, status='Keep') 120 121 !ERROR: If STATUS='NEW' appears, FILE must also appear 122 open(113, status='new') 123 124 !ERROR: If STATUS='REPLACE' appears, FILE must also appear 125 open(114, status='replace') 126 127 !ERROR: If STATUS='SCRATCH' appears, FILE must not appear 128 open(115, file='abc', status='scratch') 129 130 !ERROR: If NEWUNIT appears, FILE or STATUS='SCRATCH' must also appear 131 open(newunit=nn, status='old') 132 133 !ERROR: Unimplemented CARRIAGECONTROL value 'fortran' 134 open (unit=116, file='xfile', carriagecontrol='fortran') ! nonstandard 135 136 !ERROR: Invalid CARRIAGECONTROL value 'nonsense' 137 open (unit=116, file='xfile', carriagecontrol='nonsense') ! nonstandard 138end 139