]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR inline-asm/84625 (ICE with empty constraint and vector constant)
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 17:25:41 +0000 (19:25 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:25:41 +0000 (19:25 +0200)
Backported from mainline
2018-03-02  Jakub Jelinek  <jakub@redhat.com>

PR inline-asm/84625
* config/i386/i386.c (ix86_print_operand): Use conditional
output_operand_lossage instead of gcc_assert if CONST_VECTOR is not
zero vector.

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

From-SVN: r262068

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

index fb2454f7e3146b7f3c514bb677c4ede914ef0984..350caf5d93821494acf65a1c03ee16e9c7eed758 100644 (file)
@@ -1,6 +1,13 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR inline-asm/84625
+       * config/i386/i386.c (ix86_print_operand): Use conditional
+       output_operand_lossage instead of gcc_assert if CONST_VECTOR is not
+       zero vector.
+
        2018-02-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR ipa/84425
index a989fbd78c894371dd5ce9ecdfb5dbcbb9a3907f..e9935eb012685eb31debe065ec79a8a84463f356 100644 (file)
@@ -17736,7 +17736,8 @@ ix86_print_operand (FILE *file, rtx x, int code)
         since we can in fact encode that into an immediate.  */
       if (GET_CODE (x) == CONST_VECTOR)
        {
-         gcc_assert (x == CONST0_RTX (GET_MODE (x)));
+         if (x != CONST0_RTX (GET_MODE (x)))
+           output_operand_lossage ("invalid vector immediate");
          x = const0_rtx;
        }
 
index 401bf84ec515db249b9e054c51db234546d264fc..df087263678672bbd2a32f709f2523b5f18eaf14 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/84625
+       * gcc.target/i386/pr84625.c: New test.
+
        PR sanitizer/70875
        * gcc.dg/ubsan/bounds-3.c: Add -fno-sanitize-recover=bounds to
        dg-options and dg-shouldfail "ubsan" directive.
diff --git a/gcc/testsuite/gcc.target/i386/pr84625.c b/gcc/testsuite/gcc.target/i386/pr84625.c
new file mode 100644 (file)
index 0000000..600a6f1
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR inline-asm/84625 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef int V __attribute__((vector_size (16)));
+
+void
+foo (void)
+{
+  asm volatile ("# %0" : : "X" ((V) { 1, 2, 3, 4 }));  // { dg-error "invalid vector immediate" }
+  asm volatile ("# %0" : : "" ((V) { 2, 3, 4, 5 }));   // { dg-error "invalid vector immediate" }
+}