[Patch, fortran]Pr30876 - Array valued recursive function rejected

FX Coudert fxcoudert@gmail.com
Thu May 10 22:11:00 GMT 2007


:REVIEWMAIL:

> The explanation for this patch is to be found at comment #3 on the PR

Yeah, I remember reading this and thinking that it was very simple  
and yet contrary to what I thought at the time.

What I don't understand, though, is the following. I understand why  
there could be too much indirection, but I don't see what can trigger  
two "if" conditions individually. In particular, I wonder in which  
case the first "tmp != NULL_TREE" could be true and the second one  
false. (I do understand that the two "tmp" are not the same, mind you :)

> ! 	  /* Sometimes, too much indirection can be applied; eg. for
> ! 	     function_result = array_valued_recursive_function.  */
> ! 	  tmp = TREE_TYPE (TREE_TYPE (se->expr));
> ! 	  if (tmp != NULL_TREE)
> ! 	    tmp = TREE_TYPE (tmp);
> ! 	  if ((tmp != NULL_TREE) && GFC_DESCRIPTOR_TYPE_P (tmp))
> ! 	    se->expr = build_fold_indirect_ref (se->expr);


Thus,

> 2007-05-08  Paul Thomas  <pault@gcc.gnu.org>
>
> 	PR fortran/30876
> 	* trans-expr.c (gfc_conv_function_call): Reduce indirection for
> 	direct assignments of recursive array valued functions.
> 	* primary.c (gfc_match_rvalue): Correct error for recursive
> 	function calls such that directly recursive calls of scalar
> 	function without an explicit result are disallowed.

is OK if you provide comments a bit more explicit on the code above,  
or an answer explaining why my question is stupid.

FX



More information about the Gcc-patches mailing list