From 669141025a2d25735de6fdded6c4836fcff3feec Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 2 Sep 2007 12:23:04 +0000 Subject: [PATCH] re PR fortran/33276 (465.tonto in SPEC CPU 2006 fails to compile) gcc/fortran/ 2007-09-02 H.J. Lu PR fortran/33276 * array.c (expand_iterator): Initialize frame.prev. gcc/testsuite/ 2007-09-02 H.J. Lu PR fortran/33276 * gfortran.fortran-torture/compile/pr33276.f90: New. From-SVN: r128024 --- gcc/fortran/ChangeLog | 5 ++++ gcc/fortran/array.c | 1 + gcc/testsuite/ChangeLog | 5 ++++ .../compile/pr33276.f90 | 27 +++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/gfortran.fortran-torture/compile/pr33276.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9e8abeae125..00f798a8702 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2007-09-02 H.J. Lu + + PR fortran/33276 + * array.c (expand_iterator): Initialize frame.prev. + 2007-08-31 Tobias Burnus PR fortran/33232 diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 149adfa18f9..0c30b3374cc 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1281,6 +1281,7 @@ expand_iterator (gfc_constructor *c) mpz_init (trip); mpz_init (frame.value); + frame.prev = NULL; start = gfc_copy_expr (c->iterator->start); if (gfc_simplify_expr (start, 1) == FAILURE) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2b7b7d0c06..3efc89695ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-09-02 H.J. Lu + + PR fortran/33276 + * gfortran.fortran-torture/compile/pr33276.f90: New. + 2007-09-02 Joseph Myers PR middle-end/33272 diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr33276.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr33276.f90 new file mode 100644 index 00000000000..0eaac1a494d --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr33276.f90 @@ -0,0 +1,27 @@ +! PR fortran/33276 +! this used to crash due to an uninitialized variable in expand_iterator. + +module foo + type buffer_type + integer(kind=kind(1)) :: item_end + character(256) :: string + end type + type textfile_type + type(buffer_type) :: buffer + end type +contains + function rest_of_line(self) result(res) + type(textfile_type) :: self + intent(inout) :: self + character(128) :: res + res = self%buffer%string(self%buffer%item_end+1: ) + end function + + subroutine read_intvec_ptr(v) + integer(kind=kind(1)), dimension(:), pointer :: v + integer(kind=kind(1)) :: dim,f,l,i + + if (dim>0) then; v = (/ (i, i=f,l) /) + end if + end subroutine +end