OSDN Git Service

gcc/fortran/
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 2 Sep 2007 12:23:04 +0000 (12:23 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 2 Sep 2007 12:23:04 +0000 (12:23 +0000)
2007-09-02  H.J. Lu  <hongjiu.lu@intel.com>

PR fortran/33276
* array.c (expand_iterator): Initialize frame.prev.

gcc/testsuite/

2007-09-02  H.J. Lu  <hongjiu.lu@intel.com>

PR fortran/33276
* gfortran.fortran-torture/compile/pr33276.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128024 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr33276.f90 [new file with mode: 0644]

index 9e8abea..00f798a 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR fortran/33276
+       * array.c (expand_iterator): Initialize frame.prev.
+
 2007-08-31  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/33232
index 149adfa..0c30b33 100644 (file)
@@ -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)
index d2b7b7d..3efc896 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR fortran/33276
+       * gfortran.fortran-torture/compile/pr33276.f90: New.
+
 2007-09-02  Joseph Myers  <joseph@codesourcery.com>
 
        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 (file)
index 0000000..0eaac1a
--- /dev/null
@@ -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