http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55072



--- Comment #13 from Mikael Morin <mikael at gcc dot gnu.org> 2012-12-15 
16:16:57 UTC ---

(In reply to comment #10)

> Here is a reduced version of internal_pack_10.f90, which is the only

> runtime-failure in the testsuite for the patch in comment #9:

> 

[...]

>   call set_set_v (ru(1)%c)

> end program

> 

> 

> The problem is that, without the patch, an array descriptor is generated for

> the argument to 'set_set_v':

> 

>     parm.3.data = (void *) &ru[0].c[0];

>     parm.3.offset = -1;

>     set_set_v ((struct t_set[0:] *) parm.3.data);

> 

> which is not the case with the patch:

> 

>   set_set_v (&ru);



Well, it seems that an array descriptor isn't even necessary. But the

non-descriptor case should look like:



set_set_v (&(ru[0].c[0]));







(In reply to comment #11)

> Ok, revised version of the patch from comment 9, which fixes the runtime

> failure on internal_pack_10.f90:

> 

> 

> Index: gcc/fortran/trans-array.c

> ===================================================================

> --- gcc/fortran/trans-array.c    (revision 194517)

> +++ gcc/fortran/trans-array.c    (working copy)

> @@ -6995,20 +6995,14 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr *

>      this_array_result = false;

> 

>    /* Passing address of the array if it is not pointer or assumed-shape.  */

> -  if (full_array_var && g77 && !this_array_result)

> +  if (full_array_var && g77 && !this_array_result

> +      && sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS)

>      {

>        tmp = gfc_get_symbol_decl (sym);

> 

It feels like a hack (that what there before) to blindly disable derived types

here.  The real problem is that the code under the if condition supports only

bare variables without subreferences.

On the other hand it looks like a correct hack WRT the existing behaviour.

Reply via email to