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

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sun Sep 2 10:14:00 GMT 2007


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



More information about the Gcc-patches mailing list