------- Additional Comments From Tobias dot Schlueter at physik dot 
uni-muenchen dot de  2005-07-10 17:37 -------
Subject: Re:  problem with structure and calling a function

paulthomas2 at wanadoo dot fr wrote:
> --- 2213,2226 ----
>     tree tmp;
>     stmtblock_t block;
>     stmtblock_t body;
> !  
> !   /* Special case a single function returning an array. Note
> !      that derived type components on lhs do not benefit from
> !      this optimization and so are excluded by testing that 
> !      the expression and symbol types are the same.  */
> !   if (expr2->expr_type == EXPR_FUNCTION && expr2->rank > 0
> !       && expr1->symtree->n.sym->ts.derived
> !       == expr1->ts.derived)
>       {
>         tmp = gfc_trans_arrayfunc_assign (expr1, expr2);
>         if (tmp)

I should probably have said why I don't like this: this will probably not work
with derived types which have a component of the same type as is common e.g.
in linked lists.

Hm, thinking about it a second longer makes it seem that this is really wrong:
expr1->ts.type should be BT_REAL in our case, so you're checing something
random, but maybe I've stared at code too long today, having turned in our
second-round ICFPC submission and reviewing patches.

- Tobi


-- 


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

Reply via email to