[Patch, Fortran, OOP] PR 45438: [4.6 Regression] ICE with -fcheck=pointer

Mikael Morin mikael.morin@sfr.fr
Mon Sep 20 20:34:00 GMT 2010


On Monday 20 September 2010 21:28:52 Janus Weil wrote:
> Hi all,
> 
> this patch fixes the runtime pointer checking for PPCs & TBPs (as
> actual arguments). The regression was supposedly introduced by the new
> implementation of TBPs in 4.6.
> 
> The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?
> 
> Cheers,
> Janus
> 
> 
> 
> 2010-09-20  Janus Weil  <janus@gcc.gnu.org>
> 
> 	PR fortran/45438
> 	* trans-expr.c (gfc_conv_procedure_call): Fix pointer checking for
> 	TBPs and PPCs.
> 
> 2010-09-20  Janus Weil  <janus@gcc.gnu.org>
> 
> 	PR fortran/45438
> 	* gfortran.dg/pointer_check_7.f90: New.

Hello,

> Index: gcc/fortran/trans-expr.c
> ===================================================================
> --- gcc/fortran/trans-expr.c	(revision 164445)
> +++ gcc/fortran/trans-expr.c	(working copy)
> @@ -3169,27 +3169,30 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
> 
>        if (gfc_option.rtcheck & GFC_RTCHECK_POINTER && e != NULL)
>        
>          {
> 
> -	  symbol_attribute *attr;
> +	  symbol_attribute attr;
> 
>  	  char *msg;
>  	  tree cond;
>  	  
>  	  if (e->expr_type == EXPR_VARIABLE)
> 
> -	    attr = &e->symtree->n.sym->attr;
> +	    attr = e->symtree->n.sym->attr;
> 
>  	  else if (e->expr_type == EXPR_FUNCTION)
>  	  
>  	    {
>  	    
>  	      /* For intrinsic functions, the gfc_attr are not available.  */
>  	      if (e->symtree->n.sym->attr.generic && e->value.function.isym)
>  		
>  		goto end_pointer_check;
> 
> -	      if (e->symtree->n.sym->attr.generic)
> -		attr = &e->value.function.esym->attr;
> +	      if (e->ref)
> +		/* TBPs & PPCs.  */
> +		attr = gfc_expr_attr (e);
Would it be possible to use gfc_expr_attr in all cases ?


> +	      else if (e->symtree->n.sym->attr.generic)
> +		attr = e->value.function.esym->attr;
> 
>  	      else
> 
> -		attr = &e->symtree->n.sym->result->attr;
> +		attr = e->symtree->n.sym->result->attr;
> 
>  	    }

Mikael



More information about the Fortran mailing list