This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR22146 - ICE on elemental subroutine calls with array-valued actual arguments


Paul Thomas wrote:
> The line   "call foobar (cos (x) + u, y)" in the first test case produces:
> 
>     {
>       int4 S.12;
> 
>       S.12 = 1;
>       while (1)
>         {
>           if (S.12 > 2) goto L.10; else (void) 0;
>           {
>             real4 D.861;
> 
>             D.861 = __builtin_cosf (x[NON_LVALUE_EXPR <S.12> + -1]) + D.859;
>             foobar (&D.861, &y[NON_LVALUE_EXPR <S.12> + -1]);
>           }
>           S.12 = S.12 + 1;
>         }
>       L.10:;
>     }
> 
> which seems to be entirely as it ought to be.

Beautiful.

> OK for trunk and 4.1?

Yes, except for the issues I point out below.

> --- 49,60 ----
>   /* Generate scalarization information for an expression.  */
>   gfc_ss *gfc_walk_expr (gfc_expr *);
>   /* Walk the arguments of an intrinsic function.  */
> ! gfc_ss *gfc_walk_elemental_function_args (gfc_ss *, gfc_actual_arglist *, gfc_ss_type);

Please fix the comment, while you're there.

> + 
> +   /* An elemental subroutine call with array valued arguments has
> +      to be scalarized.  */
>     else
> !     {

At the risk of looking creative in inventing problems, I'd prefer if the
comment be inside the curly braces, so that the if ... else ... clearly visible.

> !       gfc_loopinfo loop;
> !       stmtblock_t body;
> !       stmtblock_t block;
> !       gfc_se loopse;
> ! 
> !       /* gfc_walk_elemental_function_args renders the ss chain in the
> !          reverse order to the actual argument order.  */
> !       ss = gfc_reverse_ss (ss);

How is this achieved in the case of functions?  I didn't see any such magic in
that case, and I verified that the argument chains are worked off in the right
order.

- Tobi

:REVIEWMAIL:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]