This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50981] [4.4/4.5/4.6 Regression] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Jan 2012 23:38:28 +0000
- Subject: [Bug fortran/50981] [4.4/4.5/4.6 Regression] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument
- Auto-submitted: auto-generated
- References: <bug-50981-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50981
--- Comment #29 from Mikael Morin <mikael at gcc dot gnu.org> 2012-01-25 23:38:28 UTC ---
(In reply to comment #27)
> (In reply to comment #22)
> > Created attachment 26386 [details]
> > Updated patch
>
> +gfc_array_spec *
> +symbol_as (gfc_symbol *sym)
> +{
> + if (sym->ts.type == BT_CLASS)
> + return CLASS_DATA (sym)->as;
>
> I think the function rather belongs to symbol.c than to resolve.c, unless it is
> "static". But the real issue is the "if" condition. It should be:
> if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
> otherwise, one might get a segfault with gfortran.dg/coarray_poly_1.f90
Sorry, I didn't see your comment.
I solved the issue differently, but I'll try with your suggestion.
The test in comment #23 should be rejected, as sub_ctae is elemental with a
non-scalar dummy. Otherwise, it should work with the just posted patch.