diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/elemental_optional_args_1.f90 | 52 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/generic_5.f90 | 29 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/io_constraints_2.f90 | 3 |
4 files changed, 96 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e7e540c9fa..68b45a291ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2006-07-16 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/20844 + * gfortran.dg/io_constaints_2.f90: Add the test for ADVANCE + specifiers requiring an explicit format tag.. + + PR fortran/28201 + * gfortran.dg/generic_5: New test. + + PR fortran/20893 + * gfortran.dg/elemental_optional_args_1.f90: New test. + 2006-07-16 Olivier Hainque <hainque@adacore.com> * gnat.dg/assert.ads: New file. diff --git a/gcc/testsuite/gfortran.dg/elemental_optional_args_1.f90 b/gcc/testsuite/gfortran.dg/elemental_optional_args_1.f90 new file mode 100644 index 00000000000..258b6b0f76a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/elemental_optional_args_1.f90 @@ -0,0 +1,52 @@ +! { dg-do compile } +! Check the fix for PR20893, in which actual arguments could violate: +! "(5) If it is an array, it shall not be supplied as an actual argument to +! an elemental procedure unless an array of the same rank is supplied as an +! actual argument corresponding to a nonoptional dummy argument of that +! elemental procedure." (12.4.1.5) +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! + CALL T1(1,2) +CONTAINS + SUBROUTINE T1(A1,A2,A3) + INTEGER :: A1,A2, A4(2) + INTEGER, OPTIONAL :: A3(2) + interface + elemental function efoo (B1,B2,B3) result(bar) + INTEGER, intent(in) :: B1, B2 + integer :: bar + INTEGER, OPTIONAL, intent(in) :: B3 + end function efoo + end interface + +! check an intrinsic function + write(6,*) MAX(A1,A2,A3) ! { dg-error "array and OPTIONAL" } + write(6,*) MAX(A1,A3,A2) + write(6,*) MAX(A1,A4,A3) +! check an internal elemental function + write(6,*) foo(A1,A2,A3) ! { dg-error "array and OPTIONAL" } + write(6,*) foo(A1,A3,A2) + write(6,*) foo(A1,A4,A3) +! check an external elemental function + write(6,*) efoo(A1,A2,A3) ! { dg-error "array and OPTIONAL" } + write(6,*) efoo(A1,A3,A2) + write(6,*) efoo(A1,A4,A3) +! check an elemental subroutine + call foobar (A1,A2,A3) ! { dg-error "array and OPTIONAL" } + call foobar (A1,A2,A4) + call foobar (A1,A4,A4) + END SUBROUTINE + elemental function foo (B1,B2,B3) result(bar) + INTEGER, intent(in) :: B1, B2 + integer :: bar + INTEGER, OPTIONAL, intent(in) :: B3 + bar = 1 + end function foo + elemental subroutine foobar (B1,B2,B3) + INTEGER, intent(OUT) :: B1 + INTEGER, optional, intent(in) :: B2, B3 + B1 = 1 + end subroutine foobar + +END
\ No newline at end of file diff --git a/gcc/testsuite/gfortran.dg/generic_5.f90 b/gcc/testsuite/gfortran.dg/generic_5.f90 new file mode 100644 index 00000000000..037dba27c65 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/generic_5.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! Tests the patch for PR28201, in which the call to ice would cause an ICE +! because resolve.c(resolve_generic_s) would try to look in the parent +! namespace to see if the subroutine was part of a legal generic interface. +! In this case, there is nothing to test, hence the ICE. +! +! Contributed by Daniel Franke <franke.daniel@gmail.com> +! +! +MODULE ice_gfortran + INTERFACE ice + MODULE PROCEDURE ice_i + END INTERFACE + +CONTAINS + SUBROUTINE ice_i(i) + INTEGER, INTENT(IN) :: i + ! do nothing + END SUBROUTINE +END MODULE + +MODULE provoke_ice +CONTAINS + SUBROUTINE provoke + USE ice_gfortran + CALL ice(23.0) ! { dg-error "is not an intrinsic subroutine" } + END SUBROUTINE +END MODULE + diff --git a/gcc/testsuite/gfortran.dg/io_constraints_2.f90 b/gcc/testsuite/gfortran.dg/io_constraints_2.f90 index ec0bd7a967f..c2a49e29d16 100644 --- a/gcc/testsuite/gfortran.dg/io_constraints_2.f90 +++ b/gcc/testsuite/gfortran.dg/io_constraints_2.f90 @@ -1,6 +1,7 @@ ! { dg-do compile } ! Part II of the test of the IO constraints patch, which fixes PRs: ! PRs 25053, 25063, 25064, 25066, 25067, 25068, 25069, 25307 and 20862. +! Modified2006-07-08 to check the patch for PR20844. ! ! Contributed by Paul Thomas <pault@gcc.gnu.org> ! @@ -52,6 +53,8 @@ end module global READ(buffer, fmt='(i6)', advance='YES') a ! { dg-error "internal file" } READ(1, NML=NL, advance='YES') ! { dg-error "NAMELIST IO is not allowed" } + READ(1, advance='YES') ! { dg-error "must appear with an explicit format" } + write(1, fmt='(i6)', advance='YES', size = c(1)) a ! { dg-error "output" } write(1, fmt='(i6)', advance='YES', eor = 100) a ! { dg-error "output" } |