diff options
author | Daniel Kraft <d@domob.eu> | 2008-09-21 17:33:37 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2008-09-21 17:33:37 +0200 |
commit | 4b7f8314ba66ab03974e94bf80718b157cc1350f (patch) | |
tree | 7e12ab2f71e4936cfd889e91f274ac7585d3640b /gcc/testsuite | |
parent | 74a9b8976475b250d6d9d68b2ea557cc0e778f4e (diff) | |
download | gcc-4b7f8314ba66ab03974e94bf80718b157cc1350f.zip gcc-4b7f8314ba66ab03974e94bf80718b157cc1350f.tar.gz gcc-4b7f8314ba66ab03974e94bf80718b157cc1350f.tar.bz2 |
re PR fortran/35846 (ICE on nested character constructors)
2008-09-21 Daniel Kraft <d@domob.eu>
PR fortran/35846
* trans.h (gfc_conv_string_length): New argument `expr'.
* trans-expr.c (flatten_array_ctors_without_strlen): New method.
(gfc_conv_string_length): New argument `expr' that is used in a new
special case handling if cl->length is NULL.
(gfc_conv_subref_array_arg): Pass expr to gfc_conv_string_length.
* trans-array.c (gfc_conv_expr_descriptor): Ditto.
(gfc_trans_auto_array_allocation): Pass NULL as new expr.
(gfc_trans_g77_array), (gfc_trans_dummy_array_bias): Ditto.
(gfc_trans_deferred_array): Ditto.
(gfc_trans_array_constructor): Save and restore old values of globals
used for bounds checking.
* trans-decl.c (gfc_trans_dummy_character): Ditto.
(gfc_trans_auto_character_variable): Ditto.
2008-09-21 Daniel Kraft <d@domob.eu>
PR fortran/35846
* gfortran.dg/nested_array_constructor_1.f90: New test.
* gfortran.dg/nested_array_constructor_2.f90: New test.
* gfortran.dg/nested_array_constructor_3.f90: New test.
* gfortran.dg/nested_array_constructor_4.f90: New test.
* gfortran.dg/nested_array_constructor_5.f90: New test.
* gfortran.dg/nested_array_constructor_6.f90: New test.
From-SVN: r140529
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nested_array_constructor_1.f90 | 19 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nested_array_constructor_2.f90 | 22 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nested_array_constructor_3.f90 | 22 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nested_array_constructor_4.f90 | 17 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nested_array_constructor_5.f90 | 16 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nested_array_constructor_6.f90 | 15 |
7 files changed, 121 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7498f6e..7ffa03a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,15 @@ 2008-09-21 Daniel Kraft <d@domob.eu> + PR fortran/35846 + * gfortran.dg/nested_array_constructor_1.f90: New test. + * gfortran.dg/nested_array_constructor_2.f90: New test. + * gfortran.dg/nested_array_constructor_3.f90: New test. + * gfortran.dg/nested_array_constructor_4.f90: New test. + * gfortran.dg/nested_array_constructor_5.f90: New test. + * gfortran.dg/nested_array_constructor_6.f90: New test. + +2008-09-21 Daniel Kraft <d@domob.eu> + * gfortran.dg/typebound_proc_4.f03: Changed expected error for not yet implemented PROCEDURE(interface). diff --git a/gcc/testsuite/gfortran.dg/nested_array_constructor_1.f90 b/gcc/testsuite/gfortran.dg/nested_array_constructor_1.f90 new file mode 100644 index 0000000..54417a0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nested_array_constructor_1.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! This test is run with result-checking and -fbounds-check as +! nested_array_constructor_2.f90 + +! PR fortran/35846 +! This used to ICE because the charlength of the trim-expression was +! NULL. + +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +implicit none +character(len=2) :: c(3) + +c = 'a' +c = (/ (/ trim(c(1)), 'a' /)//'c', 'cd' /) + +print *, c + +end diff --git a/gcc/testsuite/gfortran.dg/nested_array_constructor_2.f90 b/gcc/testsuite/gfortran.dg/nested_array_constructor_2.f90 new file mode 100644 index 0000000..28c2b49 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nested_array_constructor_2.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } + +! PR fortran/35846 +! This used to ICE because the charlength of the trim-expression was +! NULL. + +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +implicit none +character(len=2) :: c(3) + +c = 'a' +c = (/ (/ trim(c(1)), 'a' /)//'c', 'cd' /) + +print *, c + +if (c(1) /= 'ac' .or. c(2) /= 'ac' .or. c(3) /= 'cd') then + call abort () +end if + +end diff --git a/gcc/testsuite/gfortran.dg/nested_array_constructor_3.f90 b/gcc/testsuite/gfortran.dg/nested_array_constructor_3.f90 new file mode 100644 index 0000000..dd10e5f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nested_array_constructor_3.f90 @@ -0,0 +1,22 @@ +! { dg-do run } + +! PR fortran/35846 +! Alternate test that also produced an ICE because of a missing length. + +PROGRAM test + IMPLICIT NONE + CHARACTER(LEN=2) :: x + + x = 'a' + CALL sub ( (/ TRIM(x), 'a' /) // 'c') +END PROGRAM + +SUBROUTINE sub(str) + IMPLICIT NONE + CHARACTER(LEN=*) :: str(2) + WRITE (*,*) str + + IF (str(1) /= 'ac' .OR. str(2) /= 'ac') THEN + CALL abort () + END IF +END SUBROUTINE sub diff --git a/gcc/testsuite/gfortran.dg/nested_array_constructor_4.f90 b/gcc/testsuite/gfortran.dg/nested_array_constructor_4.f90 new file mode 100644 index 0000000..cb113e9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nested_array_constructor_4.f90 @@ -0,0 +1,17 @@ +! { dg-do run } + +! PR fortran/35846 +! Alternate test that also produced an ICE because of a missing length. + +PROGRAM test + IMPLICIT NONE + CHARACTER(LEN=2) :: x + INTEGER :: length + + x = 'a' + length = LEN ( (/ TRIM(x), 'a' /) // 'c') + + IF (length /= 2) THEN + CALL abort () + END IF +END PROGRAM diff --git a/gcc/testsuite/gfortran.dg/nested_array_constructor_5.f90 b/gcc/testsuite/gfortran.dg/nested_array_constructor_5.f90 new file mode 100644 index 0000000..7744f1f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nested_array_constructor_5.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } + +! PR fortran/35846 +! This used to ICE because the charlength of the trim-expression was +! NULL, but it is switched around to test for the right operand of // being +! not a constant, too. + +implicit none +character(len=2) :: c(2) + +c = 'a' +c = (/ (/ trim(c(1)), 'a' /) // (/ trim(c(1)), 'a' /) /) + +print *, c + +end diff --git a/gcc/testsuite/gfortran.dg/nested_array_constructor_6.f90 b/gcc/testsuite/gfortran.dg/nested_array_constructor_6.f90 new file mode 100644 index 0000000..6eee6d0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nested_array_constructor_6.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } + +! PR fortran/35846 +! Nested three levels deep. + +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +implicit none +character(len=3) :: c(3) +c = 'a' +c = (/ (/ 'A'//(/ trim(c(1)), 'a' /)/)//'c', 'dcd' /) +print *, c(1) +print *, c(2) +print *, c(3) +end |