public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PR fortran/77583, patch ]- ICE in pp_quoted_string, at pretty-print.c:966
Date: Fri, 01 Mar 2019 23:12:00 -0000	[thread overview]
Message-ID: <5C79BC4A.2030103@gmx.de> (raw)

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

The attached patch (originally by Steve Kargl) fixes a NULL pointer
dereference that may occur when checking for a conflict.

Regtested successfully.

OK for trunk?  Backport to active branches?

Thanks,
Harald

2019-03-02  Harald Anlauf  <anlauf@gmx.de>
	    Steve Kargl  <sgk@troutmask.apl.washington.edu>

	PR fortran/77583
	* symbol.c (check_conflict): Check for valid procedure name
	passed to error reporting routine.

2019-03-02  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/77583
	* gfortran.dg/pr77583.f90: New test.


[-- Attachment #2: patch-pr77583 --]
[-- Type: text/plain, Size: 601 bytes --]

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(revision 269332)
+++ gcc/fortran/symbol.c	(working copy)
@@ -525,7 +525,7 @@
   /* The copying of procedure dummy arguments for module procedures in
      a submodule occur whilst the current state is COMP_CONTAINS. It
      is necessary, therefore, to let this through.  */
-  if (attr->dummy
+  if (name && attr->dummy
       && (attr->function || attr->subroutine)
       && gfc_current_state () == COMP_CONTAINS
       && !(gfc_new_block && gfc_new_block->abr_modproc_decl))

[-- Attachment #3: patch-pr77583-testcase --]
[-- Type: text/plain, Size: 531 bytes --]

Index: gcc/testsuite/gfortran.dg/pr77583.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77583.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77583.f90	(working copy)
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR fortran/77583 - ICE in pp_quoted_string, at pretty-print.c:966
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+pure subroutine sub(s)
+contains
+   pure subroutine s  ! { dg-error "conflicts with DUMMY argument" }
+   end
+end

             reply	other threads:[~2019-03-01 23:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 23:12 Harald Anlauf [this message]
2019-03-01 23:16 ` Steve Kargl
2019-03-03 20:40   ` Harald Anlauf

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=5C79BC4A.2030103@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).