This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42104] [F03] runtime segfault with procedure pointer component
- From: "janus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Nov 2009 21:09:29 -0000
- Subject: [Bug fortran/42104] [F03] runtime segfault with procedure pointer component
- References: <bug-42104-15250@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from janus at gcc dot gnu dot org 2009-11-19 21:09 -------
(In reply to comment #5)
> The fix is to make use of the fact a proc_pointer component call is already
> detected and can be used to suppress the internal_pack. Thusly:
>
> Index: gcc/fortran/trans-expr.c
> ===================================================================
> --- gcc/fortran/trans-expr.c (revision 153651)
> +++ gcc/fortran/trans-expr.c (working copy)
> @@ -2918,7 +2918,7 @@
> f = (fsym != NULL)
> && !(fsym->attr.pointer || fsym->attr.allocatable)
> && fsym->as->type != AS_ASSUMED_SHAPE;
> - f = f || !sym->attr.always_explicit;
> + f = f || (!sym->attr.always_explicit && !comp);
>
> if (e->expr_type == EXPR_VARIABLE
> && is_subref_array (e))
>
> This fixes the PR but has not been regtested. I will do this tonight. If all
> is well, I will commit as obvious, although your OK would be helpful, Janus!
The question is if you want to do this for *all* PPCs. It seems the
'always_explicit' flag is correctly set for PPCs (by the same criteria as for
normal procedures). Therefore I would propose the following:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 154327)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -2979,7 +2979,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
f = (fsym != NULL)
&& !(fsym->attr.pointer || fsym->attr.allocatable)
&& fsym->as->type != AS_ASSUMED_SHAPE;
- f = f || !sym->attr.always_explicit;
+ if (comp)
+ f = f || !comp->attr.always_explicit;
+ else
+ f = f || !sym->attr.always_explicit;
if (e->expr_type == EXPR_VARIABLE
&& is_subref_array (e))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42104