i386.c (print_reg): Emit an error message on attempt to print FLAGS_REG.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 22 Jun 2016 13:01:11 +0000 (13:01 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Wed, 22 Jun 2016 13:01:11 +0000 (13:01 +0000)
gcc:
2016-06-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * config/i386/i386.c (print_reg): Emit an error message on attempt to
        print FLAGS_REG.

testsuite:
2016-06-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * gcc.target/i386/asm-flag-7.c: New test.

From-SVN: r237702

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/asm-flag-7.c [new file with mode: 0644]

index b779396..909a742 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * config/i386/i386.c (print_reg): Emit an error message on attempt to
+       print FLAGS_REG.
+
 2016-06-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/arm.c (arm_cortex_a73_tune): New struct.
index 9d36106..1e87286 100644 (file)
@@ -17246,10 +17246,15 @@ print_reg (rtx x, int code, FILE *file)
 
   gcc_assert (regno != ARG_POINTER_REGNUM
              && regno != FRAME_POINTER_REGNUM
-             && regno != FLAGS_REG
              && regno != FPSR_REG
              && regno != FPCR_REG);
 
+  if (regno == FLAGS_REG)
+    {
+      output_operand_lossage ("invalid use of asm flag output");
+      return;
+    }
+
   duplicated = code == 'd' && TARGET_AVX;
 
   switch (msize)
index 31300ec..b8546af 100644 (file)
@@ -1,3 +1,7 @@
+2016-06-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * gcc.target/i386/asm-flag-7.c: New test.
+
 2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
 
        * gcc.dg/tree-ssa/forwprop-28.c: Remove mep-* support.
diff --git a/gcc/testsuite/gcc.target/i386/asm-flag-7.c b/gcc/testsuite/gcc.target/i386/asm-flag-7.c
new file mode 100644 (file)
index 0000000..1130997
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test error conditions of asm flag outputs.  */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void test(void)
+{
+  char x;
+  asm("# %0" : "=@ccz"(x)); /* { dg-error "invalid use of asm flag output" } */
+}