public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@codesourcery.com>
To: "Richard Biener" <rguenther@suse.de>, "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [patch] Fix PR fortran/72743
Date: Wed, 31 Aug 2016 10:10:00 -0000	[thread overview]
Message-ID: <2ebcf9da-519e-e2c7-0a52-779c96323496@codesourcery.com> (raw)

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

Hi Richard, Martin,
this issue is actually sort of like PR 70856, basically the same ICE
after IPA-ICF, due to DECL_PT_UIDs not consistent after reaching for the
ultimate_alias_target().

The reason this wasn't covered by the PR70856 fix is that, in this case,
the DECL_PT_UID was not set in original->decl, evading the condition, and
hence the the merged alias doesn't have DECL_PT_UID set, and causes the
ICE in the second round of IPA-PTA (under -fopenacc).

My fix is to simply remove the DECL_PT_UID_SET_P (original->decl) guard,
and allow the DECL_PT_UID to be set using the DECL_UID in this case.

Does this fix make sense?
Testing does show no regressions, and the PR testcase ICE is fixed.

Thanks,
Chung-Lin

	PR fortran/72743
	* ipa-icf.c (sem_variable::merge): Remove guard condition for
	setting DECL_PT_UID (alias->decl).

	testsuite/
	* gfortran.dg/goacc/pr72743.f90: New test.



[-- Attachment #2: x.diff --]
[-- Type: text/plain, Size: 1107 bytes --]

Index: ipa-icf.c
===================================================================
--- ipa-icf.c	(revision 239624)
+++ ipa-icf.c	(working copy)
@@ -2258,8 +2258,7 @@ sem_variable::merge (sem_item *alias_item)
 
       varpool_node::create_alias (alias_var->decl, decl);
       alias->resolve_alias (original);
-      if (DECL_PT_UID_SET_P (original->decl))
-	SET_DECL_PT_UID (alias->decl, DECL_PT_UID (original->decl));
+      SET_DECL_PT_UID (alias->decl, DECL_PT_UID (original->decl));
 
       if (dump_file)
 	fprintf (dump_file, "Unified; Variable alias has been created.\n\n");
Index: testsuite/gfortran.dg/goacc/pr72743.f90
===================================================================
--- testsuite/gfortran.dg/goacc/pr72743.f90	(revision 0)
+++ testsuite/gfortran.dg/goacc/pr72743.f90	(revision 0)
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-additional-options "-O2" }
+
+program p
+   integer, parameter :: n = 8
+   integer :: i, z(n)
+   z = [(i, i=1,n)]
+   print *, z
+end
+subroutine s
+   integer, parameter :: n = 8
+   integer :: i, z(n)
+   z = [(i, i=1,n)]
+   print *, z
+end

             reply	other threads:[~2016-08-31 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 10:10 Chung-Lin Tang [this message]
2016-09-01  7:14 ` Richard Biener
2016-09-09 14:33   ` Chung-Lin Tang
2016-09-14  9:00     ` Richard Biener

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=2ebcf9da-519e-e2c7-0a52-779c96323496@codesourcery.com \
    --to=cltang@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=rguenther@suse.de \
    /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).