This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR40646 - ICE assigning array return value from type-bound procedure
> Please ignore the
>
> --- gcc/fortran/trans-expr.c ? ?(revision 149062)
> +++ gcc/fortran/trans-expr.c ? ?(working copy)
> @@ -4054,7 +4054,6 @@
> ? ? ? /* Scalar pointers. ?*/
> ? ? ? lse.want_pointer = 1;
> ? ? ? gfc_conv_expr (&lse, expr1);
> - ? ? ?gcc_assert (rss == gfc_ss_terminator);
> ? ? ? gfc_init_se (&rse, NULL);
> ? ? ? rse.want_pointer = 1;
> ? ? ? gfc_conv_expr (&rse, expr2);
>
> in the latest offering - I was trying to fix Janus' problem.
I think the proper fix for this problem would be:
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c (revision 149230)
+++ gcc/fortran/primary.c (working copy)
@@ -1727,7 +1727,10 @@ gfc_match_varspec (gfc_expr *primary, in
gfc_gobble_whitespace ();
if ((equiv_flag && gfc_peek_ascii_char () == '(')
- || (sym->attr.dimension && !sym->attr.proc_pointer))
+ || (sym->attr.dimension && !sym->attr.proc_pointer
+ && !is_proc_ptr_comp (primary, NULL)
+ && !(gfc_matching_procptr_assignment
+ && sym->attr.flavor == FL_PROCEDURE)))
{
/* In EQUIVALENCE, we don't know yet whether we are seeing
an array, character variable or array of character
At least this fixes the proc-pointer assignments in comment #2 and #4.
Comment #4 runs fine then, but calling the PPC in comment #2 still
gives an ICE. I'm working on it ...
Cheers,
Janus