[gfortran,patch] Fix wrong-code for ASSOCIATED

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Jun 18 16:23:00 GMT 2006


On Sat, Jun 17, 2006 at 11:06:33AM +0200, FX Coudert wrote:
> :ADDPATCH fortran:
> 
> The two-lines attached patch fixes PR fortran/26801, where we used to 
> segfault at run-time on the following valid code:
>   integer :: i = 1
>   logical :: l
>   type dt
>     integer, pointer :: a
>   end type dt
>   type(dt) :: obj(1)
> 
>   l = associated(obj(i)%a)
>   print *, l
>   end
> 
> While building the code to check whether obj(i)%a is associated, we used 
> to call gfc_conv_expr (&arg1se, arg1->expr), while never actually adding 
> the arg1se.pre (and arg1se.post) blocks the final code block. This 
> missing block of code could later lead to variables being used without 
> begin initialized.
> 
> Regtested on i686-linux. Comes with a testcase from the PR.
> OK for mainline and 4.1?
> 

The patch is ok.  

I noticed that in the ELSE portion of outer ithe IF statement, there
is an "if (ss1 == gfc_ss_terminator)" block (see line 2858).  Do
we need to insert the same two lines above the "tmp = " (line 2866)?


-- 
Steve



More information about the Gcc-patches mailing list