From b60fc3bdf81ecc19693a5e8bab1ab079fa8f085d Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Wed, 22 Jun 2016 13:01:11 +0000 Subject: [PATCH] i386.c (print_reg): Emit an error message on attempt to print FLAGS_REG. gcc: 2016-06-22 Bernd Edlinger * config/i386/i386.c (print_reg): Emit an error message on attempt to print FLAGS_REG. testsuite: 2016-06-22 Bernd Edlinger * gcc.target/i386/asm-flag-7.c: New test. From-SVN: r237702 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/i386.c | 7 ++++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/asm-flag-7.c | 9 +++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/asm-flag-7.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b779396ed81..909a7429f86 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-22 Bernd Edlinger + + * config/i386/i386.c (print_reg): Emit an error message on attempt to + print FLAGS_REG. + 2016-06-22 Kyrylo Tkachov * config/arm/arm.c (arm_cortex_a73_tune): New struct. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9d3610647f0..1e872860fbc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 31300ec195c..b8546af8dbe 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-22 Bernd Edlinger + + * gcc.target/i386/asm-flag-7.c: New test. + 2016-06-21 Trevor Saunders * 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 index 00000000000..11309972f69 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/asm-flag-7.c @@ -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" } */ +} -- 2.30.2