public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael.morin@sfr.fr>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, gfortran <fortran@gcc.gnu.org>
Subject: [fortran, committed] Forward port test generic_31.f90 from the 5 branch
Date: Wed, 19 Aug 2015 15:01:00 -0000	[thread overview]
Message-ID: <55D4987B.60307@sfr.fr> (raw)
In-Reply-To: <CAGkQGiKcJSEPUOND-wn9DBRPBmTV_HrAMKDR7dK3SpwTjvizew@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

Hello,

I have forward-ported the test that justified backport of the pr66929 
patch on the 5 branch:
https://gcc.gnu.org/r227010

Mikael




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: r227010.diff --]
[-- Type: text/x-patch; name="r227010.diff", Size: 1485 bytes --]

Index: gcc/testsuite/gfortran.dg/generic_31.f90
===================================================================
--- gcc/testsuite/gfortran.dg/generic_31.f90	(révision 0)
+++ gcc/testsuite/gfortran.dg/generic_31.f90	(révision 227010)
@@ -0,0 +1,35 @@
+! { dg-do run }
+!
+! PR fortran/66929
+! Check that the specific FIRST symbol is used for the call to FOO,
+! so that the J argument is not assumed to be present
+
+module m
+  interface foo
+    module procedure first
+  end interface foo
+contains
+  elemental function bar(j) result(r)
+    integer, intent(in), optional :: j
+    integer :: r, s(2)
+    ! We used to have NULL dereference here, in case of a missing J argument
+    s = foo(j, [3, 7])
+    r = sum(s)
+  end function bar
+  elemental function first(i, j) result(r)
+    integer, intent(in), optional :: i
+    integer, intent(in) :: j
+    integer :: r
+    if (present(i)) then
+      r = i
+    else
+      r = -5
+    end if
+  end function first
+end module m
+program p
+  use m
+  integer :: i
+  i = bar()
+  if (i /= -10) call abort
+end program p
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(révision 227009)
+++ gcc/testsuite/ChangeLog	(révision 227010)
@@ -1,3 +1,8 @@
+2015-08-19  Mikael Morin  <mikael@gcc.gnu.org>
+
+	PR fortran/66929
+	* gfortran.dg/generic_31.f90: New.
+
 2015-08-19  Marek Polacek  <polacek@redhat.com>
 
 	PR middle-end/67133




      reply	other threads:[~2015-08-19 14:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 13:20 [Patch, fortran] PR66929 fix iso_varying_string ICE Mikael Morin
2015-07-21 22:53 ` Paul Richard Thomas
2015-07-25 19:01   ` Mikael Morin
2015-08-06 10:09     ` *ping* " Mikael Morin
2015-08-06 10:22       ` Paul Richard Thomas
2015-08-19 15:01         ` Mikael Morin [this message]

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=55D4987B.60307@sfr.fr \
    --to=mikael.morin@sfr.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --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).