From: Jakub Jelinek Date: Thu, 22 Mar 2018 12:31:46 +0000 (+0100) Subject: re PR inline-asm/84941 (internal compiler error: in reg_overlap_mentioned_p, at rtlan... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c896da0fd831fac95a6e9a846bd8c19fa79f338;p=gcc.git re PR inline-asm/84941 (internal compiler error: in reg_overlap_mentioned_p, at rtlanal.c:1870 (reg_overlap_mentioned_p()/match_asm_constraints_1())) PR inline-asm/84941 * function.c (match_asm_constraints_1): Don't do the optimization if input isn't a REG, SUBREG, MEM or constant. * gcc.dg/pr84941.c: New test. From-SVN: r258764 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06320e4c802..5a748b6aac6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-22 Jakub Jelinek + + PR inline-asm/84941 + * function.c (match_asm_constraints_1): Don't do the optimization + if input isn't a REG, SUBREG, MEM or constant. + 2018-03-22 Tom de Vries PR tree-optimization/84956 diff --git a/gcc/function.c b/gcc/function.c index 1a09ff0d31e..485ddfbd642 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6662,7 +6662,9 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs) if (! REG_P (output) || rtx_equal_p (output, input) || (GET_MODE (input) != VOIDmode - && GET_MODE (input) != GET_MODE (output))) + && GET_MODE (input) != GET_MODE (output)) + || !(REG_P (input) || SUBREG_P (input) + || MEM_P (input) || CONSTANT_P (input))) continue; /* We can't do anything if the output is also used as input, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index abc1b9fb76a..4039a011cf8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-22 Jakub Jelinek + + PR inline-asm/84941 + * gcc.dg/pr84941.c: New test. + 2018-03-22 Tom de Vries PR tree-optimization/84956 diff --git a/gcc/testsuite/gcc.dg/pr84941.c b/gcc/testsuite/gcc.dg/pr84941.c new file mode 100644 index 00000000000..6f4674e54f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84941.c @@ -0,0 +1,10 @@ +/* PR inline-asm/84941 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo (void) +{ + short *b[1] = { 0 }; + asm volatile ("" : "=m,m" (b), "=r,r" (b) : "1,p" (b)); +}