patch to fix PR84014

Message ID 6061f1f4-3ed8-3920-3366-42e1faa64061@redhat.com
State New
Headers show
Series
  • patch to fix PR84014
Related show

Commit Message

Vladimir Makarov Jan. 24, 2018, 7:50 p.m.
The following patch fixes

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84014

The patch was tested on powerpc64 and bootstrapped on x86-64.

Committed as rev. 257029.

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 257028)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2018-01-24  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR target/84014
+	* ira-build.c (setup_min_max_allocno_live_range_point): Set up
+	min/max for never referenced object.
+
 2018-01-24  Jakub Jelinek  <jakub@redhat.com>
 
 	PR middle-end/83977
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 257028)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2018-01-24  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR target/84014
+	* gcc.target/powerpc/pr84014.c: New.
+
 2018-01-24  Jakub Jelinek  <jakub@redhat.com>
 
 	PR middle-end/83977
Index: ira-build.c
===================================================================
--- ira-build.c	(revision 256891)
+++ ira-build.c	(working copy)
@@ -2728,7 +2728,13 @@  setup_min_max_allocno_live_range_point (
 	    ira_object_t parent_obj;
 
 	    if (OBJECT_MAX (obj) < 0)
-	      continue;
+	      {
+		/* The object is not used and hence does not live.  */
+		ira_assert (OBJECT_LIVE_RANGES (obj) == NULL);
+		OBJECT_MAX (obj) = 0;
+		OBJECT_MIN (obj) = 1;
+		continue;
+	      }
 	    ira_assert (ALLOCNO_CAP_MEMBER (a) == NULL);
 	    /* Accumulation of range info.  */
 	    if (ALLOCNO_CAP (a) != NULL)
Index: testsuite/gcc.target/powerpc/pr84014.c
===================================================================
--- testsuite/gcc.target/powerpc/pr84014.c	(nonexistent)
+++ testsuite/gcc.target/powerpc/pr84014.c	(working copy)
@@ -0,0 +1,20 @@ 
+/* { dg-do compile { target powerpc*-*-* } }*/
+/* { dg-options "-O1 -fno-split-wide-types -m32 -mcpu=e300c3" } */
+
+int
+nh (void)
+{
+}
+
+long long int
+si (void)
+{
+}
+
+int
+xf (int fg)
+{
+  int y5 = nh ();
+  fg += !!y5 ? y5 : si ();
+  return fg;
+}