]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/79559 (ICE in ix86_print_operand, at config/i386/i386.c:18189)
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:59:29 +0000 (09:59 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:59:29 +0000 (09:59 +0200)
Backported from mainline
2017-02-18  Jakub Jelinek  <jakub@redhat.com>

PR target/79559
* config/i386/i386.c (ix86_print_operand): Use output_operand_lossage
instead of gcc_assert for K, r and R code checks.  Formatting fixes.

* gcc.target/i386/pr79559.c: New test.

From-SVN: r248644

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr79559.c [new file with mode: 0644]

index a776f6fc28ef1667158140bf4a0807fb9d3dbed8..fc6155647c52a4ddb0118f1cb32996137bd0e825 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2017-02-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/79559
+       * config/i386/i386.c (ix86_print_operand): Use output_operand_lossage
+       instead of gcc_assert for K, r and R code checks.  Formatting fixes.
+
        2017-02-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/79411
index 79fb328b6d8c409fda8a79539f476797a920fd72..ae3aa226b754ce5e057c0badb55054bc16a63dba 100644 (file)
@@ -15581,8 +15581,8 @@ ix86_print_operand (FILE *file, rtx x, int code)
              break;
 
            default:
-             output_operand_lossage
-               ("invalid operand size for operand code 'O'");
+             output_operand_lossage ("invalid operand size for operand "
+                                     "code 'O'");
              return;
            }
 
@@ -15616,15 +15616,14 @@ ix86_print_operand (FILE *file, rtx x, int code)
                  return;
 
                default:
-                 output_operand_lossage
-                   ("invalid operand size for operand code 'z'");
+                 output_operand_lossage ("invalid operand size for operand "
+                                         "code 'z'");
                  return;
                }
            }
 
          if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
-           warning
-             (0, "non-integer operand used with operand code 'z'");
+           warning (0, "non-integer operand used with operand code 'z'");
          /* FALLTHRU */
 
        case 'Z':
@@ -15686,13 +15685,12 @@ ix86_print_operand (FILE *file, rtx x, int code)
            }
          else
            {
-             output_operand_lossage
-               ("invalid operand type used with operand code 'Z'");
+             output_operand_lossage ("invalid operand type used with "
+                                     "operand code 'Z'");
              return;
            }
 
-         output_operand_lossage
-           ("invalid operand size for operand code 'Z'");
+         output_operand_lossage ("invalid operand size for operand code 'Z'");
          return;
 
        case 'd':
@@ -15884,7 +15882,12 @@ ix86_print_operand (FILE *file, rtx x, int code)
          break;
 
        case 'K':
-         gcc_assert (CONST_INT_P (x));
+         if (!CONST_INT_P (x))
+           {
+             output_operand_lossage ("operand is not an integer, invalid "
+                                     "operand code 'K'");
+             return;
+           }
 
          if (INTVAL (x) & IX86_HLE_ACQUIRE)
 #ifdef HAVE_AS_IX86_HLE
@@ -15907,8 +15910,12 @@ ix86_print_operand (FILE *file, rtx x, int code)
          return;
 
        case 'r':
-         gcc_assert (CONST_INT_P (x));
-         gcc_assert (INTVAL (x) == ROUND_SAE);
+         if (!CONST_INT_P (x) || INTVAL (x) != ROUND_SAE)
+           {
+             output_operand_lossage ("operand is not a specific integer, "
+                                     "invalid operand code 'r'");
+             return;
+           }
 
          if (ASSEMBLER_DIALECT == ASM_INTEL)
            fputs (", ", file);
@@ -15921,7 +15928,12 @@ ix86_print_operand (FILE *file, rtx x, int code)
          return;
 
        case 'R':
-         gcc_assert (CONST_INT_P (x));
+         if (!CONST_INT_P (x))
+           {
+             output_operand_lossage ("operand is not an integer, invalid "
+                                     "operand code 'R'");
+             return;
+           }
 
          if (ASSEMBLER_DIALECT == ASM_INTEL)
            fputs (", ", file);
@@ -16036,7 +16048,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
          return;
 
        default:
-           output_operand_lossage ("invalid operand code '%c'", code);
+         output_operand_lossage ("invalid operand code '%c'", code);
        }
     }
 
index 31c5c72c522f9a23466c47d5008f4cade10fa0b7..826a35d61197eb1721c0f38472972487e8399722 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2017-02-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/79559
+       * gcc.target/i386/pr79559.c: New test.
+
        2017-02-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/79512
diff --git a/gcc/testsuite/gcc.target/i386/pr79559.c b/gcc/testsuite/gcc.target/i386/pr79559.c
new file mode 100644 (file)
index 0000000..2eeb652
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/79559 */
+/* { dg-do compile } */
+
+void
+foo (int x)
+{
+  __asm__ volatile ("# %K0" : : "r" (x));      /* { dg-error "invalid operand code" } */
+  __asm__ volatile ("# %r0" : : "r" (x));      /* { dg-error "invalid operand code" } */
+  __asm__ volatile ("# %r0" : : "n" (129));    /* { dg-error "invalid operand code" } */
+  __asm__ volatile ("# %R0" : : "r" (x));      /* { dg-error "invalid operand code" } */
+}