This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR fortran/33276: [4.3 Regression] 465.tonto in SPEC CPU 2006 fails to compile


H.J. Lu wrote:
On Sun, Sep 02, 2007 at 01:12:21AM +0200, Tobias Schlüter wrote:
H.J. Lu wrote:
frame.prev in expand_iterator may be uninitialized. In expand_iterator,
there are

cleanup:
 gfc_free_expr (start);
 gfc_free_expr (end);
 gfc_free_expr (step);

 mpz_clear (trip);
 mpz_clear (frame.value);

iter_stack = frame.prev;

 return t;
}

But frame.prev may be uninitialized when one of goto cleanup is called.
This patch initializes frame.prev. Shouldn't gcc warn about this?
Ok with a testcase.


Here is a testcase.


---
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
---

[hjl@gnu-27 build_base_o2.0000]$ /usr/gcc-4.3/bin/gfortran -S foo.f90
foo.f90:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-27 build_base_o2.0000]$

However, given the nature of this bug, I don't know if it will fail
for everyone.

As long as it succeeds for everyone after your patch, I don't see how that could be an issue :-)


Thanks,
- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]