Hi,
this fixes an ICE that happens when an asm statement tries to print
the flags output operand.
Boot-strapped and reg-tested on x86_64-linux-gnu.
OK for trunk?
Thanks
Bernd.
gcc:
2016-06-11 Bernd Edlinger <bernd.edlin...@hotmail.de>
* config/i386/i386.c (print_reg): Emit an error message on attempt to
print FLAGS_REG.
testsuite:
2016-06-11 Bernd Edlinger <bernd.edlin...@hotmail.de>
* gcc.target/i386/asm-flag-7.c: New test.
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 237323)
+++ gcc/config/i386/i386.c (working copy)
@@ -17180,10 +17180,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: gcc/testsuite/gcc.target/i386/asm-flag-7.c
===================================================================
--- gcc/testsuite/gcc.target/i386/asm-flag-7.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/asm-flag-7.c (working copy)
@@ -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" } */
+}