re PR rtl-optimization/78580 (Segfault in gcc with multilib (-m32) and -ffixed-*)
authorVladimir Makarov <vmakarov@redhat.com>
Wed, 21 Dec 2016 22:20:11 +0000 (22:20 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Wed, 21 Dec 2016 22:20:11 +0000 (22:20 +0000)
2016-12-21  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/78580
* ira-costs.c (find_costs_and_classes): Make regno_aclass
translated into an allocno class.

2016-12-21  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/78580
* gcc.target/i386/pr78580.c: New.

From-SVN: r243875

gcc/ChangeLog
gcc/ira-costs.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr78580.c [new file with mode: 0644]

index e9ce90d530cce97d2e5235d1bf88f0fe0fe66461..45743607cdb3d9f550e2af28817ba27af21ac8e7 100644 (file)
@@ -1,3 +1,9 @@
+2016-12-21  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/78580
+       * ira-costs.c (find_costs_and_classes): Make regno_aclass
+       translated into an allocno class.
+
 2016-12-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/78817
index bdd5cb5ceb6abaf7b3c7f3dd4e6c6ecde6190674..7b44f5ce40e9a9570964ce9fa29ee6d269f24883 100644 (file)
@@ -1846,14 +1846,19 @@ find_costs_and_classes (FILE *dump_file)
               short in -O0 code and so register pressure tends to be low.
 
               Avoid that by ignoring the alternative class if the best
-              class has plenty of registers.  */
-           regno_aclass[i] = best;
+              class has plenty of registers.
+
+              The union class arrays give important classes and only
+              part of it are allocno classes.  So translate them into
+              allocno classes.  */
+           regno_aclass[i] = ira_allocno_class_translate[best];
          else
            {
              /* Make the common class the biggest class of best and
-                alt_class.  */
-             regno_aclass[i]
-               = ira_reg_class_superunion[best][alt_class];
+                alt_class.  Translate the common class into an
+                allocno class too.  */
+             regno_aclass[i] = (ira_allocno_class_translate
+                                [ira_reg_class_superunion[best][alt_class]]);
              ira_assert (regno_aclass[i] != NO_REGS
                          && ira_reg_allocno_class_p[regno_aclass[i]]);
            }
index 2da0d44dfb7addfe3583c96f0d4f1f9173768ff8..40f671fee287345f25a175407be95f8c0d7b6c61 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-21  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/78580
+       * gcc.target/i386/pr78580.c: New.
+
 2016-12-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/77830
diff --git a/gcc/testsuite/gcc.target/i386/pr78580.c b/gcc/testsuite/gcc.target/i386/pr78580.c
new file mode 100644 (file)
index 0000000..fcf36f1
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/78580 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -ffixed-ebx" } */
+
+extern const signed char a;
+
+int
+foo (signed char x)
+{
+  return x;
+}
+
+int
+main ()
+{
+  foo (a);
+  return 0;
+}