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] | |
:ADDPATCH <fortran>:
Hi!
I've been looking at PR 17740, where we get an ICE when calling
elemental functions via a generic names. The problem seems to be
the check if the called function is elemental in
gfc_trans_arrayfunc_assign():
/* Elemental functions don't need a temporary anyway. */
if (expr2->symtree->n.sym->attr.elemental)
return NULL;
The problem is that expr2->symtree->n.sym is (appearantly) the
symbol of the generic name, not the specific function called. I
wrote a patch (attached) that checks the symbol
expr2->value.function.esym instead. With the patch, the testcase
in the PR compiles, and the patch passes reg. testing (Linux/x86,
4.0 and mainline).
There is however, one thing that I am still a bit unsure about (I
hope this question doesn't sound too stupid); I learned (the hard
way) that expr2->value.function.esym is NULL sometimes (which is
why the patch checks that first). Can I trust
expr2->value.function.esym to allways be non-NULL for elemental
functions? I browsed the gfortran source code, but found no
definite answer to that question.
(If the patch is OK, feel free to commit it)
Erik
2005-08-21 Erik Edelmann <erik.edelmann@iki.fi>
* trans-expr.c (gfc_trans_arrayfunc_assign): Check value
of attr.elemental for specific function instead of generic name.
2005-08-21 Erik Edelmann <erik.edelmann@iki.fi>
* gfortran.dg/generic_4.f90: New test.
Attachment:
diff
Description: Text document
Attachment:
generic_4.f90
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |