This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/58099] [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 17 Nov 2013 13:46:48 +0000
- Subject: [Bug fortran/58099] [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking
- Auto-submitted: auto-generated
- References: <bug-58099-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58099
--- Comment #25 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #22)
> (In reply to janus from comment #19)
> > (In reply to janus from comment #18)
> > That version still yields a good number of testsuite failures, but it seems
> > like most of them are due to invalid code that was not detected previously:
>
> Well, sizeof_proc.f90 looks like a bug in the checking code:
>
> procedure(real), pointer :: pp
> pp => sin
> ! Error: Explicit interface required for '' at (1): elemental procedure
There might be a bug here, but I don't quite follow your argument (see below).
> The quote in comment 2 has: "If proc-pointer-object has an explicit
> interfaceâ" which is not fulfilled as "pp" has an implicit interface.
Agreed. The quote continues "... its characteristics shall be the same as
proc-target except ...". The error is not about the characteristics being
different, but about the target being elemental at all. Everything is fine so
far.
> There is in addition the following constraint, but sin is an intrinsic:
> "C730 (R740) The proc-target shall not be a nonintrinsic elemental
> procedure."
Yes. As you say, this is not applicable here (and is again not what the error
is about). Still everything fine.
The relevant quote for the above error message is F08:12.4.2.2, which says:
" A procedure other than a statement function shall have an explicit interface
if it is referenced and ... (4) the procedure is elemental, or ..."
In our case it applies to the proc-pointer 'pp', which itself is not elemental,
but (validly) points to the elemental intrinsic 'sin'.
Therefore I would say the logic in gfc_check_pointer_assign is wrong after all:
if (s1->attr.if_source == IFSRC_UNKNOWN
&& gfc_explicit_interface_required (s2, err, sizeof(err)))
{
gfc_error ("Explicit interface required for '%s' at %L: %s",
name1, &lvalue->where, err);
I guess we should not require an explicit interface for the pointer, if the
target is elemental. Right?