Hello!

2012-02-22  Uros Bizjak  <ubiz...@gmail.com>

        PR target/52330
        * config/i386/i386.c (ix86_print_operand) <case 'H'>: Error out if x
        is not offsettable memory reference.

testsuite/ChangeLog:

2012-02-22  Uros Bizjak  <ubiz...@gmail.com>

        PR target/52330
        * gcc.target/i386/pr52330.c: New test.

Tested on x86_64-pc-linux-gnu, will commit to mainline SVN and release branches.

Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 184483)
+++ config/i386/i386.c  (working copy)
@@ -14091,6 +14091,13 @@ ix86_print_operand (FILE *file, rtx x, int code)
          return;
 
        case 'H':
+         if (!offsettable_memref_p (x))
+           {
+             output_operand_lossage ("operand is not an offsettable memory "
+                                     "reference, invalid operand "
+                                     "code 'H'");
+             return;
+           }
          /* It doesn't actually matter what mode we use here, as we're
             only going to use this for printing.  */
          x = adjust_address_nv (x, DImode, 8);
Index: testsuite/gcc.target/i386/pr52330.c
===================================================================
--- testsuite/gcc.target/i386/pr52330.c (revision 0)
+++ testsuite/gcc.target/i386/pr52330.c (revision 0)
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+
+void foo (int a)
+{
+  asm volatile ("# %H0" : : "r" (a));  /* { dg-error "not an offsettable" } */
+}

Reply via email to