URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [namelist_19.f90] - Rev 302
Compare with Previous | Blame | View Log
!{ dg-do run }!{ dg-options "-std=legacy" }!! Test namelist error trapping.! provided by Paul Thomas - pault@gcc.gnu.orgprogram namelist_19character*80 wrong, right! "=" before any object namewrong = "&z = i = 1,2 /"right = "&z i = 1,2 /"call test_err(wrong, right)! &* instead of &end for terminationwrong = "&z i = 1,2 &xxx"right = "&z i = 1,2 &end"call test_err(wrong, right)! bad datawrong = "&z i = 1,q /"right = "&z i = 1,2 /"call test_err(wrong, right)! object name not matchedwrong = "&z j = 1,2 /"right = "&z i = 1,2 /"call test_err(wrong, right)! derived type component for intrinsic typewrong = "&z i%j = 1,2 /"right = "&z i = 1,2 /"call test_err(wrong, right)! step other than 1 for substring qualifierwrong = "&z ch(1:2:2) = 'a'/"right = "&z ch(1:2) = 'ab' /"call test_err(wrong, right)! qualifier for scalarwrong = "&z k(2) = 1 /"right = "&z k = 1 /"call test_err(wrong, right)! no '=' after object namewrong = "&z i 1,2 /"right = "&z i = 1,2 /"call test_err(wrong, right)! repeat count too largewrong = "&z i = 3*2 /"right = "&z i = 2*2 /"call test_err(wrong, right)! too much datawrong = "&z i = 1 2 3 /"right = "&z i = 1 2 /"call test_err(wrong, right)! no '=' after object namewrong = "&z i 1,2 /"right = "&z i = 1,2 /"call test_err(wrong, right)! bad number of index fieldswrong = "&z i(1,2) = 1 /"right = "&z i(1) = 1 /"call test_err(wrong, right)! bad character in index fieldwrong = "&z i(x) = 1 /"right = "&z i(1) = 1 /"call test_err(wrong, right)! null index fieldwrong = "&z i( ) = 1 /"right = "&z i(1) = 1 /"call test_err(wrong, right)! null index fieldwrong = "&z i(1::) = 1 2/"right = "&z i(1:2:1) = 1 2 /"call test_err(wrong, right)! null index fieldwrong = "&z i(1:2:) = 1 2/"right = "&z i(1:2:1) = 1 2 /"call test_err(wrong, right)! index out of rangewrong = "&z i(10) = 1 /"right = "&z i(1) = 1 /"call test_err(wrong, right)! index out of rangewrong = "&z i(0:1) = 1 /"right = "&z i(1:1) = 1 /"call test_err(wrong, right)! bad rangewrong = "&z i(1:2:-1) = 1 2 /"right = "&z i(1:2: 1) = 1 2 /"call test_err(wrong, right)! bad rangewrong = "&z i(2:1: 1) = 1 2 /"right = "&z i(2:1:-1) = 1 2 /"call test_err(wrong, right)containssubroutine test_err(wrong, right)character*80 wrong, rightinteger :: i(2) = (/0, 0/)integer :: k =0character*2 :: ch = " "namelist /z/ i, k, ch! Check that wrong namelist input gives an erroropen (10, status = "scratch")write (10, '(A)') wrongrewind (10)read (10, z, iostat = ier)close(10)if (ier == 0) call abort ()! Check that right namelist input gives no erroropen (10, status = "scratch")write (10, '(A)') rightrewind (10)read (10, z, iostat = ier)close(10)if (ier /= 0) call abort ()end subroutine test_errend program namelist_19
