From 8749b11fe2ec93c604a5c45e44d2e0bccceffb47 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 20 Apr 2017 22:25:17 +0200 Subject: [PATCH] re PR target/79804 (ICE in print_reg, at config/i386/i386.c:17637) PR target/79804 * config/i386/i386.c (print_reg): Remove assert for disalowed regno values, call output_operand_lossage instead. testsuite/ChangeLog: PR target/79804 * gcc.target/i386/pr79804.c: New test. From-SVN: r247037 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 16 ++++++++++------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr79804.c | 10 ++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr79804.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f4cb9193169..9a94fe68ddc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-04-20 Uros Bizjak + + PR target/79804 + * config/i386/i386.c (print_reg): Remove assert for disalowed + regno values, call output_operand_lossage instead. + 2017-04-20 Uros Bizjak PR target/78090 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 0b2fa1b1f9f..535181cb4a4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -17650,12 +17650,16 @@ print_reg (rtx x, int code, FILE *file) regno = REGNO (x); - gcc_assert (regno != ARG_POINTER_REGNUM - && regno != FRAME_POINTER_REGNUM - && regno != FPSR_REG - && regno != FPCR_REG); - - if (regno == FLAGS_REG) + if (regno == ARG_POINTER_REGNUM + || regno == FRAME_POINTER_REGNUM + || regno == FPSR_REG + || regno == FPCR_REG) + { + output_operand_lossage + ("invalid use of register '%s'", reg_names[regno]); + return; + } + else if (regno == FLAGS_REG) { output_operand_lossage ("invalid use of asm flag output"); return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5b5c02a899..f0a4f46967b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-20 Uros Bizjak + + PR target/79804 + * gcc.target/i386/pr79804.c: New test. + 2017-04-20 Uros Bizjak PR target/78090 diff --git a/gcc/testsuite/gcc.target/i386/pr79804.c b/gcc/testsuite/gcc.target/i386/pr79804.c new file mode 100644 index 00000000000..4325131ded6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79804.c @@ -0,0 +1,10 @@ +/* PR target/79804 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void foo (void) +{ + register int r20 asm ("20"); + + asm volatile ("# %0" : "=r"(r20)); /* { dg-error "invalid use of register" } */ +} -- 2.30.2