public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janus Weil <janus@gcc.gnu.org>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
		Mikael Morin <mikael.morin@sfr.fr>
Subject: Re: [Patch, fortran] PR54286 - [4.8 Regression] Accepts invalid proc-pointer assignments involving proc-ptr function result
Date: Sat, 12 Jan 2013 19:35:00 -0000	[thread overview]
Message-ID: <CAKwh3qjgqzc5_xkiswS3P=+tjM1H+496-qEfFkHu-D3C8FAecg@mail.gmail.com> (raw)
In-Reply-To: <CAGkQGi+uw8HC+3Ab2tDj+8rO79=Co3k0Oy6KBs14vz9sn0M-XA@mail.gmail.com>

Hi Paul,

> It is something of an exaggeration to say that this PR is a regession,
> although it is true that gcc-4.7 gives error messages for the testcase
> in the correct places.  In fact, these messages disappear if IMPLICIT
> INTEGER (a) at the start of the testcase.
>
> The fix ensures that the interfaces are selected and checked
> symmetrically in gfc_compare_interfaces.
>
> The submitted testcase only checks the errors.  The other tests in the
> testsuite adequately check the functionality of procedure pointer
> assignments.
>
> Bootstrapped and regtested on FC17/i86_64 - OK for trunk

thanks for the patch. It looks mostly good to me.

Just one question: Why is the symmetrization actually needed? I.e. in
what respect is 'gfc_compare_interfaces' asymmetric? I don't directly
see that. To the contrary, it seems to me that gfc_compare_interfaces
is (at least in parts) already symmetrized internally, as e.g. in:

      if (count_types_test (f1, f2, p1, p2)
      || count_types_test (f2, f1, p2, p1))
    return 0;
      if (generic_correspondence (f1, f2, p1, p2)
      || generic_correspondence (f2, f1, p2, p1))
    return 0;

Also, note that gfc_compare_interfaces is never really called in a
symmetrized fashion elsewhere. Would we need this symmetrization in
other places too?

Cheers,
Janus



> 2013-01-12  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/54286
>     * expr.c (gfc_check_pointer_assign): Ensure that both lvalue
>     and rvalue interfaces are presented to gfc_compare_interfaces.
>     Simplify references to interface names by using the symbols
>     themselves. Call gfc_compare_interfaces with s1 and s2 inter-
>     changed to overcome the asymmetry of this function. Do not
>     repeat the check for the presence of s1 and s2.
>
> 2013-01-12  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/54286
>     * gfortran.dg/proc_ptr_result_8.f90 : New test.

  reply	other threads:[~2013-01-12 19:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12 11:25 Paul Richard Thomas
2013-01-12 19:35 ` Janus Weil [this message]
2013-01-13  9:07   ` Paul Richard Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKwh3qjgqzc5_xkiswS3P=+tjM1H+496-qEfFkHu-D3C8FAecg@mail.gmail.com' \
    --to=janus@gcc.gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikael.morin@sfr.fr \
    --cc=paul.richard.thomas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).