This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix reg-stack error-recovery ICE (PR inline-asm/84683)
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 6 Mar 2018 09:03:07 +0100
- Subject: Re: [PATCH] Fix reg-stack error-recovery ICE (PR inline-asm/84683)
- Authentication-results: sourceware.org; auth=none
- References: <20180305204251.GS5867@tucnak>
On Mon, Mar 5, 2018 at 9:42 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> If we discover some bad inline-asm during reg-stack processing and we
> error on those, we replace that inline-asm with a (use (const_int 0))
> and therefore the various assumptions of reg-stack pass may not hold.
> Seems we already have a couple of spots which are more permissive if
> any_malformed_asm is true, this patch just adds another one.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-03-05 Jakub Jelinek <jakub@redhat.com>
>
> PR inline-asm/84683
> * reg-stack.c (move_for_stack_reg): If any_malformed_asm, avoid
> assertion failure.
>
> * g++.dg/ext/pr84683.C: New test.
LGTM.
Uros.
> --- gcc/reg-stack.c.jj 2018-01-03 10:19:55.000000000 +0100
> +++ gcc/reg-stack.c 2018-03-05 17:41:15.558415480 +0100
> @@ -1170,7 +1170,8 @@ move_for_stack_reg (rtx_insn *insn, stac
> && XINT (SET_SRC (XVECEXP (pat, 0, 1)), 1) == UNSPEC_TAN)
> emit_swap_insn (insn, regstack, dest);
> else
> - gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG);
> + gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG
> + || any_malformed_asm);
>
> gcc_assert (regstack->top < REG_STACK_SIZE);
>
> --- gcc/testsuite/g++.dg/ext/pr84683.C.jj 2018-03-05 17:45:32.901475529 +0100
> +++ gcc/testsuite/g++.dg/ext/pr84683.C 2018-03-05 17:44:52.527467872 +0100
> @@ -0,0 +1,13 @@
> +// PR inline-asm/84683
> +// { dg-do compile { target i?86-*-* x86_64-*-* } }
> +// { dg-options "-O2" }
> +
> +void
> +foo (float b, double c)
> +{
> + for (int e = 0; e < 2; e++)
> + {
> + asm volatile ("" : "+f" (c)); // { dg-error "must specify a single register" }
> + asm ("" : "+rm" (c = b));
> + }
> +}
>
> Jakub