diff options
Diffstat (limited to 'gcc/testsuite')
| -rw-r--r-- | gcc/testsuite/ChangeLog | 17 | ||||
| -rwxr-xr-x | gcc/testsuite/gfortran.dg/arrayio_0.f90 | 19 | ||||
| -rw-r--r-- | gcc/testsuite/gfortran.dg/data_constraints_1.f90 | 30 | ||||
| -rw-r--r-- | gcc/testsuite/gfortran.dg/data_constraints_2.f90 | 15 | ||||
| -rw-r--r-- | gcc/testsuite/gfortran.dg/data_initialized.f90 | 10 | ||||
| -rwxr-xr-x | gcc/testsuite/gfortran.dg/pointer_assign_1.f90 | 17 | ||||
| -rw-r--r-- | gcc/testsuite/gfortran.dg/private_type_2.f90 | 13 |
7 files changed, 119 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 212f2328295..0dca65ba811 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2005-11-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/24534 + gfortran.dg/private_type_2.f90: Modified to check that case with + PRIVATE declaration within derived type is accepted. + + PR fortran/20838 + gfortran.dg/pointer_assign_1.f90: New test. + + PR fortran/20840 + * gfortran.dg/arrayio_0.f90: New test. + + PR fortran/17737 + gfortran.dg/data_initialized.f90: New test. + gfortran.dg/data_constraints_1.f90: New test. + gfortran.dg/data_constraints_2.f90: New test. + 2005-11-06 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/24174 diff --git a/gcc/testsuite/gfortran.dg/arrayio_0.f90 b/gcc/testsuite/gfortran.dg/arrayio_0.f90 new file mode 100755 index 00000000000..1331cf2edda --- /dev/null +++ b/gcc/testsuite/gfortran.dg/arrayio_0.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! Tests fix for PR20840 - would ICE with vector subscript in +! internal unit. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! + character(len=12), dimension(4) :: iu, buff + character(len=48), dimension(2) :: iue + equivalence (iu, iue) + integer, dimension(4) :: v = (/2,1,4,3/) + iu = (/"Vector","subscripts","not","allowed!"/) + read (iu, '(a12/)') buff + read (iue(1), '(4a12)') buff + read (iu(4:1:-1), '(a12/)') buff + read (iu(v), '(a12/)') buff ! { dg-error "with vector subscript" } + read (iu((/2,4,3,1/)), '(a12/)') buff ! { dg-error "with vector subscript" } + print *, buff + end + diff --git a/gcc/testsuite/gfortran.dg/data_constraints_1.f90 b/gcc/testsuite/gfortran.dg/data_constraints_1.f90 new file mode 100644 index 00000000000..5f11ffdbaea --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_constraints_1.f90 @@ -0,0 +1,30 @@ +! { dg-do compile } +! Tests standard indepedendent constraints for variables in a data statement +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! + module global + integer n + end module global + + use global + integer q + data n /0/ ! { dg-error "Cannot change attributes" } + n = 1 + n = foo (n) +contains + function foo (m) result (bar) + integer p (m), bar + integer, allocatable :: l(:) + allocate (l(1)) + data l /42/ ! { dg-error "conflicts with ALLOCATABLE" } + data p(1) /1/ ! { dg-error "non-constant array in DATA" } + data q /1/ ! { dg-error "Host associated variable" } + data m /1/ ! { dg-error "conflicts with DUMMY attribute" } + data bar /99/ ! { dg-error "conflicts with RESULT" } + end function foo + function foobar () + integer foobar + data foobar /0/ ! { dg-error "conflicts with FUNCTION" } + end function foobar +end diff --git a/gcc/testsuite/gfortran.dg/data_constraints_2.f90 b/gcc/testsuite/gfortran.dg/data_constraints_2.f90 new file mode 100644 index 00000000000..46de3c81434 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_constraints_2.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-std=f95" } +! Tests constraints for variables in a data statement that are commonly +! relaxed. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! + common // a + common /b/ c + integer d + data a /1/ ! { dg-error "common block variable" } + data c /2/ ! { dg-error "common block variable" } + data d /3/ + data d /4/ ! { dg-error " re-initialization" } +end diff --git a/gcc/testsuite/gfortran.dg/data_initialized.f90 b/gcc/testsuite/gfortran.dg/data_initialized.f90 new file mode 100644 index 00000000000..56cf059ae36 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_initialized.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! { dg-options "-std=f95" } +! Tests fix for PR17737 - already initialized variable cannot appear +! in data statement + integer :: i, j = 1 + data i/0/ + data i/0/ ! { dg-error "Extension: re-initialization" } + data j/2/ ! { dg-error "Extension: re-initialization" } + end + diff --git a/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 b/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 new file mode 100755 index 00000000000..cfe8ad17006 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! Tests fix for PR20838 - would ICE with vector subscript in +! pointer assignment. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! + integer, parameter, dimension(3) :: i = (/2,1,3/) + integer, dimension(3), target :: tar + integer, dimension(2, 3), target :: tar2 + integer, dimension(:), pointer :: ptr + ptr => tar + ptr => tar(3:1:-1) + ptr => tar(i) ! { dg-error "with vector subscript" } + ptr => tar2(1, :) + ptr => tar2(2, i) ! { dg-error "with vector subscript" } + end + diff --git a/gcc/testsuite/gfortran.dg/private_type_2.f90 b/gcc/testsuite/gfortran.dg/private_type_2.f90 index 6078293743f..9cb0b380703 100644 --- a/gcc/testsuite/gfortran.dg/private_type_2.f90 +++ b/gcc/testsuite/gfortran.dg/private_type_2.f90 @@ -1,5 +1,9 @@ ! { dg-do compile } -! PR16404 test 6 - A public type cannot have private-type components. +! PR16404 test 6 - If a component of a derived type is of a type declared to +! be private, either the derived type definition must contain the PRIVATE +! statement, or the derived type must be private. +! Modified on 20051105 to test PR24534. +! ! Contributed by Joost VandeVondele <jv244@cam.ac.uk> MODULE TEST PRIVATE @@ -9,7 +13,12 @@ MODULE TEST TYPE :: all_type! { dg-error "PRIVATE type and cannot be a component" } TYPE(info_type) :: info END TYPE - public all_type + TYPE :: any_type! This is OK because of the PRIVATE statement. + PRIVATE + TYPE(info_type) :: info + END TYPE + public all_type, any_type END MODULE END + |

