diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-02-13 21:22:55 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-02-13 21:22:55 +0000 |
commit | 2ed8d2241e1e3ba077fc6dc3813f202f45414fbe (patch) | |
tree | ca9b226f8f8ef512a3cc36a94a5c973a3b92f259 /gcc/testsuite | |
parent | 7cdfcf600a86aa589584192c963a9cc5fa1a12b3 (diff) | |
download | gcc-2ed8d2241e1e3ba077fc6dc3813f202f45414fbe.zip gcc-2ed8d2241e1e3ba077fc6dc3813f202f45414fbe.tar.gz gcc-2ed8d2241e1e3ba077fc6dc3813f202f45414fbe.tar.bz2 |
re PR fortran/26074 (Module array cannot be automatic or assumed shape)
2006-02-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/26074
PR fortran/25103
* resolve.c (resolve_symbol): Extend the requirement that module
arrays have constant bounds to those in the main program. At the
same time simplify the array bounds, to avoiding trapping parameter
array references, and exclude automatic character length from main
and modules. Rearrange resolve_symbol and resolve_derived to put as
each flavor together, as much as is possible and move all specific
code for flavors FL_VARIABLE, FL_PROCEDURE and FL_PARAMETER into new
functions.
(resolve_fl_var_and_proc, resolve_fl_variable, resolve_fl_procedure):
New functions to do work of resolve_symbol.
(resolve_index_expr): New function that is called from resolved_symbol
and is extracted from resolve_charlen.
(resolve_charlen): Call this new function.
(resolve_fl_derived): Renamed resolve_derived to be consistent with
the naming of the new functions for the other flavours. Change the
charlen checking so that the style is consistent with other similar
checks. Add the generation of the gfc_dt_list, removed from resolve_
symbol.
PR fortran/20861
* resolve.c (resolve_actual_arglist): Prevent internal procedures
from being dummy arguments.
PR fortran/20871
* resolve.c (resolve_actual_arglist): Prevent pure but non-intrinsic
procedures from being dummy arguments.
PR fortran/25083
* resolve.c (check_data_variable): Add test that data variable is in
COMMON.
PR fortran/25088
* resolve.c (resolve_call): Add test that the subroutine does not
have a type.
2006-02-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/26074
PR fortran/25103
* gfortran.dg/module_parameter_array_refs_1.f90: New test.
* gfortran.dg/bad_automatic_objects_1.f90: New test.
* gfortran.dg/automatic_module_variable.f90: Change error message.
PR fortran/20861
* gfortran.dg/internal_dummy_1.f90: New test.
PR fortran/20871
* gfortran.dg/elemental_non_intrinsic_dummy_1.f90: New test.
PR fortran/25083
* gfortran.dg/uncommon_block_data_1.f90: New test.
* gfortran.dg/equiv_constraint_7.f90: Correct non-compliance of test
with standard.
PR fortran/25088
* gfortran.dg/typed_subroutine_1.f90: New test.
From-SVN: r110926
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 23 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/automatic_module_variable.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90 | 20 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90 | 21 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/equiv_constraint_7.f90 | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/internal_dummy_1.f90 | 19 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90 | 13 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/typed_subroutine_1.f90 | 11 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/uncommon_block_data_1.f90 | 11 |
9 files changed, 123 insertions, 3 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c0b1911..1139140 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,26 @@ +2006-02-13 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/26074 + PR fortran/25103 + * gfortran.dg/module_parameter_array_refs_1.f90: New test. + * gfortran.dg/bad_automatic_objects_1.f90: New test. + * gfortran.dg/automatic_module_variable.f90: Change error message. + + PR fortran/20861 + * gfortran.dg/internal_dummy_1.f90: New test. + + PR fortran/20871 + * gfortran.dg/elemental_non_intrinsic_dummy_1.f90: New test. + + + PR fortran/25083 + * gfortran.dg/uncommon_block_data_1.f90: New test. + * gfortran.dg/equiv_constraint_7.f90: Correct non-compliance of test + with standard. + + PR fortran/25088 + * gfortran.dg/typed_subroutine_1.f90: New test. + 2006-02-13 Geoffrey Keating <geoffk@apple.com> * objc.dg/dwarf-1.m: New. diff --git a/gcc/testsuite/gfortran.dg/automatic_module_variable.f90 b/gcc/testsuite/gfortran.dg/automatic_module_variable.f90 index 0cf43f7..201dcf4 100644 --- a/gcc/testsuite/gfortran.dg/automatic_module_variable.f90 +++ b/gcc/testsuite/gfortran.dg/automatic_module_variable.f90 @@ -4,7 +4,7 @@ module sd integer, parameter :: n = 20 integer :: i(n) - integer :: j(m) ! { dg-error "cannot be automatic or assumed shape" } + integer :: j(m) ! { dg-error "must have constant shape" } integer, pointer :: p(:) integer, allocatable :: q(:) contains diff --git a/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90 b/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90 new file mode 100644 index 0000000..2734418 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! Tests the fix for 25103, in which the presence of automatic objects +! in the main program and the specification part of a module was not +! detected. +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! +module foo + integer :: i +end module foo +module bar + use foo + integer, dimension (i) :: j ! { dg-error "must have constant shape" } + character (len = i) :: c1 ! { dg-error "must have constant character length" } +end module bar +program foobar + use foo + integer, dimension (i) :: k ! { dg-error "must have constant shape" } + character (len = i) :: c2 ! { dg-error "must have constant character length" } +end program foobar diff --git a/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90 b/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90 new file mode 100644 index 0000000..c14a5d8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! Tests the fix for 20871, in which elemental non-intrinsic procedures were +! permitted to be dummy arguments. +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! +MODULE TT +CONTAINS + ELEMENTAL INTEGER FUNCTION two(N) + INTEGER, INTENT(IN) :: N + two=2**N + END FUNCTION +END MODULE +USE TT + INTEGER, EXTERNAL :: SUB + write(6,*) SUB(two) ! { dg-error "not allowed as an actual argument " } +END +INTEGER FUNCTION SUB(XX) + INTEGER :: XX + SUB=XX() +END diff --git a/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90 b/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90 index ec4579f..207b7d3 100644 --- a/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90 +++ b/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90 @@ -2,8 +2,10 @@ ! { dg-options "-O0" } ! PR20890 - Equivalence cannot contain more than one initialized variables. ! Contributed by Joost VandeVondele <jv244@cam.ac.uk> - BLOCK DATA +! Started out being in BLOCK DATA; however, blockdata variables must be in +! COMMON and therefore cannot have F95 style initializers.... + MODULE DATA INTEGER :: I=1,J=2 EQUIVALENCE(I,J) ! { dg-error "cannot both be in the EQUIVALENCE" } - END BLOCK DATA + END MODULE DATA END diff --git a/gcc/testsuite/gfortran.dg/internal_dummy_1.f90 b/gcc/testsuite/gfortran.dg/internal_dummy_1.f90 new file mode 100644 index 0000000..cae187e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/internal_dummy_1.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! Tests the fix for 20861, in which internal procedures were permitted to +! be dummy arguments. +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! +CALL DD(TT) ! { dg-error "is not allowed as an actual argument" } +CONTAINS +SUBROUTINE DD(F) + INTERFACE + SUBROUTINE F(X) + REAL :: X + END SUBROUTINE F + END INTERFACE +END SUBROUTINE DD +SUBROUTINE TT(X) + REAL :: X +END SUBROUTINE +END diff --git a/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90 b/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90 new file mode 100644 index 0000000..a78b525 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! Tests the fix for 26074, in which the array reference below would +! be determined not to be constant within modules. +! +! Contributed by Jonathan Dursi <ljdursi@cita.utoronto.ca> +! +module foo + + integer, parameter :: len = 5 + integer :: arr(max(len,1)) + +end + diff --git a/gcc/testsuite/gfortran.dg/typed_subroutine_1.f90 b/gcc/testsuite/gfortran.dg/typed_subroutine_1.f90 new file mode 100644 index 0000000..38619e7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typed_subroutine_1.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Tests the fix for 25088, in which the compiler failed to detect that +! a called object had a type. +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! + INTEGER :: S ! { dg-error "has a type, which is not consistent with the CALL " } + CALL S() ! { dg-error "has a type, which is not consistent with the CALL " } + END + SUBROUTINE S + END SUBROUTINE diff --git a/gcc/testsuite/gfortran.dg/uncommon_block_data_1.f90 b/gcc/testsuite/gfortran.dg/uncommon_block_data_1.f90 new file mode 100644 index 0000000..54547e8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/uncommon_block_data_1.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Tests the fix for 25083, in which the compiler failed to detect that +! data variables in BLOCK DATA were not in COMMON. +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! + BLOCK DATA D + INTEGER I ! { dg-error "must be in COMMON" } + DATA I /1/ + END BLOCK DATA +END |