]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix SSA inconsistencies with invalid asm reg names (PR67639)
authorBernd Schmidt <bernds@redhat.com>
Thu, 7 Jan 2016 12:17:39 +0000 (12:17 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Thu, 7 Jan 2016 12:17:39 +0000 (12:17 +0000)
PR middle-end/67639
* varasm.c (make_decl_rtl): Mark invalid register vars as
DECL_EXTERNAL.

testsuite/
PR middle-end/67639
* c-c++-common/pr67639.c: New test.

From-SVN: r232125

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr67639.c [new file with mode: 0644]
gcc/varasm.c

index 62ad1590969c3d7e67d6e75ec97e6356ebfe9405..21a95fd1ca49cc190ad60846f2a149afb35c3ac7 100644 (file)
@@ -1,5 +1,9 @@
 2015-12-15  Bernd Schmidt  <bschmidt@redhat.com>
 
+       PR middle-end/67639
+       * varasm.c (make_decl_rtl): Mark invalid register vars as
+       DECL_EXTERNAL.
+
        PR rtl-optimization/66206
        * bt-load.c (find_btr_use): Change first arg to be a pointer to an rtx.
        All callers changed.
index e21b7188c4fdadf8d6292e2292a5440c709731ea..29894213bcc7083059aaa2e4a37a0301c987356c 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-15  Bernd Schmidt  <bschmidt@redhat.com>
+
+       PR middle-end/67639
+       * c-c++-common/pr67639.c: New test.
+
 2016-01-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/69141
diff --git a/gcc/testsuite/c-c++-common/pr67639.c b/gcc/testsuite/c-c++-common/pr67639.c
new file mode 100644 (file)
index 0000000..aa19ba4
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+void
+foo (int p)
+{
+  int t; 
+  register long x asm ("rhubarb") = p; /* { dg-error "register name" } */
+  __asm ("" : "=r" (t), "=r" (t), "=r" (t), "=r" (x) : "0" (x));
+}
index e0c1fd89f2658bb0921c219851ea50d093431bbb..3a3573e53951d5aacad7a93abb1b435fb534a7dc 100644 (file)
@@ -1420,6 +1420,9 @@ make_decl_rtl (tree decl)
         specifications.  */
       SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
       DECL_HARD_REGISTER (decl) = 0;
+      /* Also avoid SSA inconsistencies by pretending this is an external
+        decl now.  */
+      DECL_EXTERNAL (decl) = 1;
       return;
     }
   /* Now handle ordinary static variables and functions (in memory).