From a426543a1f31388186edb92036a87032c66bcd17 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Fri, 23 Mar 2018 19:31:00 +0000 Subject: [PATCH] re PR inline-asm/85030 (internal compiler error: Floating point exception (validate_subreg())) 2018-03-23 Vladimir Makarov PR inline-asm/85030 * lra-constraints.c (process_alt_operands): Don't match BLKmode and non BLKmode operands. 2018-03-23 Vladimir Makarov PR inline-asm/85030 * testsuite/gcc.target/i386/pr85030.c: New. From-SVN: r258820 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr85030.c | 10 ++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr85030.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53b67fb832b..2fd85d7889d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-23 Vladimir Makarov + + PR inline-asm/85030 + * lra-constraints.c (process_alt_operands): Don't match BLKmode + and non BLKmode operands. + 2018-03-23 Kyrylo Tkachov PR target/85026 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 31faefab9c2..0dd4787ff54 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2118,6 +2118,14 @@ process_alt_operands (int only_alternative) GET_MODE_SIZE (biggest_mode[nop]))) break; + /* Don't match wrong asm insn operands for proper + diagnostic later. */ + if (INSN_CODE (curr_insn) < 0 + && (curr_operand_mode[m] == BLKmode + || curr_operand_mode[nop] == BLKmode) + && curr_operand_mode[m] != curr_operand_mode[nop]) + break; + this_alternative_matches = m; m_hregno = get_hard_regno (*curr_id->operand_loc[m], false); /* We are supposed to match a previous operand. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e709ff18b48..503ddaa6053 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-23 Vladimir Makarov + + PR inline-asm/85030 + * testsuite/gcc.target/i386/pr85030.c: New. + 2018-03-23 Kyrylo Tkachov PR target/85026 diff --git a/gcc/testsuite/gcc.target/i386/pr85030.c b/gcc/testsuite/gcc.target/i386/pr85030.c new file mode 100644 index 00000000000..ff41df6bb64 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr85030.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +struct S { int c, *b, *e; }; + +void +foo () +{ + struct S a; + asm volatile ("" : "=rm" (a) : "0" (1)); /* { dg-error "inconsistent operand constraints in an 'asm'" } */ +} -- 2.30.2