Scalarization of subcomponent-references

Daniel Kraft d@domob.eu
Mon Jan 26 19:33:00 GMT 2009


Hi Paul, hi Mikael,

I hope you can help me with a problem I came across while trying to fix 
PR 38883.  The test program is as follows:

module yg0009_stuff
   implicit none
   type unseq
      integer I
   end type
contains
   SUBROUTINE YG0009(A,N2)
     TYPE(UNSEQ) A(2)
     TYPE(UNSEQ) B(2)
     integer :: N2
     CALL MVBITS (A(1:2)%I,1, 1, A(1:N2)%I, 1)
   END SUBROUTINE
end module yg0009_stuff

In trans-stmt.c:gfc_conv_elemental_dependencies (which is called for 
MVBITS since my patch to correctly handle dependencies there), there's 
code like this:

   /* Obtain the argument descriptor for unpacking.  */
   gfc_init_se (&parmse, NULL);
   parmse.want_pointer = 1;
   gfc_conv_expr_descriptor (&parmse, e, gfc_walk_expr (e));
   gfc_add_block_to_block (&se->pre, &parmse.pre);

   /* If we've got INTENT(INOUT), initialize the array temporary with
      a copy of the values.  */
   if (fsym->attr.intent == INTENT_INOUT)
     initial = parmse.expr;
   else
     initial = NULL_TREE;

With the program above, this code is run with the "A(1:N2)%I" expression 
and the debugger confirms that "e" is really this expression in 
gfortran's internal tree format.  However, parmse.expr (which is used to 
initialize the allocated temporary for the INTENT(INOUT) argument) is 
simply "&parmse.0" of type "struct array1_unseq*".  I would expect it to 
be of type integer array instead of record array (and this is also what 
leads to the ICE later on)!  What's wrong here with my understanding?

Thanks a lot,
Daniel

-- 
Done:  Arc-Bar-Cav-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran



More information about the Fortran mailing list