This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: PPC ICE
Hi Steve,
>> > troutmask:sgk[206] gfc4x -c -std=f95 r.f90
>> > r.f90:4.38:
>> >
>> > ? ? procedure (), pointer, nopass :: f
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1
>> > Error: Fortran 2003: Procedure pointer at (1)
>> > f951: internal compiler error: Segmentation fault: 11
thanks for reporting this.
> The ICE goes away with the following patch.
>
> 2009-08-18 ?Steven G. Kargl ?<kargl@gcc.gnu.org>
>
> ? ? ? ?* resolve.c (resolve_fl_derived): ?Don't dereference a NULL pointer.
>
> Index: resolve.c
> ===================================================================
> --- resolve.c ? (revision 150866)
> +++ resolve.c ? (working copy)
> @@ -9494,7 +9494,8 @@ resolve_fl_derived (gfc_symbol *sym)
> ? ? ? ?}
>
> ? ? ? /* Procedure pointer components: Check PASS arg. ?*/
> - ? ? ?if (c->attr.proc_pointer && !c->tb->nopass && c->tb->pass_arg_num == 0)
> + ? ? ?if (c->attr.proc_pointer
> + ? ? ? ? && (c->tb && !c->tb->nopass && c->tb->pass_arg_num == 0))
> ? ? ? ?{
> ? ? ? ? ?gfc_symbol* me_arg;
In principle the patch is ok. An alternative solution would be to
check for -std=... earlier (before the PPC is even added to the
derived type, so that we don't have to resolve it later on). I'd
propose the following:
Index: decl.c
===================================================================
--- decl.c (revision 150888)
+++ decl.c (working copy)
@@ -4448,6 +4448,10 @@ match_ppc_decl (void)
return MATCH_ERROR;
}
+ if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Procedure pointer
component"
+ " at %C") == FAILURE)
+ return MATCH_ERROR;
+
/* Match PPC names. */
ts = current_ts;
for(num=1;;num++)
We do have such a check already (for all procedure pointers), but it
comes too late in the case at hand.
Steve, please feel free to commit whatever version you like best
(together with the dejagnuified test case).
Cheers,
Janus