public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix reg-stack error-recovery on pr84828 testcase (PR target/84828)
@ 2018-04-23 18:35 Jakub Jelinek
  2018-04-24  7:10 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-04-23 18:35 UTC (permalink / raw)
  To: Uros Bizjak, Richard Biener; +Cc: gcc-patches

Hi!

My earlier attempts to replace bogus inline asm with something that
reg-stack.c would be happy about failed, so this is just a quick hack to
help the error-recovery on the pr84828.C testcase with -m32.

I bet bunch of other spots will need any_malformed_asm tweaks, just don't
have testcases for those.

Bootstrapped/regtested on x86_64-linux and i686-linux, fixes:
-FAIL: g++.dg/ext/pr84828.C  -std=gnu++11 (internal compiler error)
-FAIL: g++.dg/ext/pr84828.C  -std=gnu++11 (test for excess errors)
-FAIL: g++.dg/ext/pr84828.C  -std=gnu++14 (internal compiler error)
-FAIL: g++.dg/ext/pr84828.C  -std=gnu++14 (test for excess errors)
-FAIL: g++.dg/ext/pr84828.C  -std=gnu++98 (internal compiler error)
-FAIL: g++.dg/ext/pr84828.C  -std=gnu++98 (test for excess errors)
on i686-linux, ok for trunk?

2018-04-23  Jakub Jelinek  <jakub@redhat.com>

	PR target/84828
	* reg-stack.c (move_for_stack_reg): Don't fail assertion about dead
	destination if any_malformed_asm.

--- gcc/reg-stack.c.jj	2018-03-16 13:42:37.118852524 +0100
+++ gcc/reg-stack.c	2018-04-23 17:16:41.085198214 +0200
@@ -1105,13 +1105,16 @@ move_for_stack_reg (rtx_insn *insn, stac
 	}
 
       /* The destination ought to be dead.  */
-      gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG);
+      if (get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
+	gcc_assert (any_malformed_asm);
+      else
+	{
+	  replace_reg (psrc, get_hard_regnum (regstack, src));
 
-      replace_reg (psrc, get_hard_regnum (regstack, src));
-
-      regstack->reg[++regstack->top] = REGNO (dest);
-      SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
-      replace_reg (pdest, FIRST_STACK_REG);
+	  regstack->reg[++regstack->top] = REGNO (dest);
+	  SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
+	  replace_reg (pdest, FIRST_STACK_REG);
+	}
     }
   else if (STACK_REG_P (src))
     {

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix reg-stack error-recovery on pr84828 testcase (PR target/84828)
  2018-04-23 18:35 [PATCH] Fix reg-stack error-recovery on pr84828 testcase (PR target/84828) Jakub Jelinek
@ 2018-04-24  7:10 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-04-24  7:10 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Uros Bizjak, gcc-patches

On Mon, 23 Apr 2018, Jakub Jelinek wrote:

> Hi!
> 
> My earlier attempts to replace bogus inline asm with something that
> reg-stack.c would be happy about failed, so this is just a quick hack to
> help the error-recovery on the pr84828.C testcase with -m32.
> 
> I bet bunch of other spots will need any_malformed_asm tweaks, just don't
> have testcases for those.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, fixes:
> -FAIL: g++.dg/ext/pr84828.C  -std=gnu++11 (internal compiler error)
> -FAIL: g++.dg/ext/pr84828.C  -std=gnu++11 (test for excess errors)
> -FAIL: g++.dg/ext/pr84828.C  -std=gnu++14 (internal compiler error)
> -FAIL: g++.dg/ext/pr84828.C  -std=gnu++14 (test for excess errors)
> -FAIL: g++.dg/ext/pr84828.C  -std=gnu++98 (internal compiler error)
> -FAIL: g++.dg/ext/pr84828.C  -std=gnu++98 (test for excess errors)
> on i686-linux, ok for trunk?

OK.

Thanks,
Richard.

> 2018-04-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/84828
> 	* reg-stack.c (move_for_stack_reg): Don't fail assertion about dead
> 	destination if any_malformed_asm.
> 
> --- gcc/reg-stack.c.jj	2018-03-16 13:42:37.118852524 +0100
> +++ gcc/reg-stack.c	2018-04-23 17:16:41.085198214 +0200
> @@ -1105,13 +1105,16 @@ move_for_stack_reg (rtx_insn *insn, stac
>  	}
>  
>        /* The destination ought to be dead.  */
> -      gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG);
> +      if (get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
> +	gcc_assert (any_malformed_asm);
> +      else
> +	{
> +	  replace_reg (psrc, get_hard_regnum (regstack, src));
>  
> -      replace_reg (psrc, get_hard_regnum (regstack, src));
> -
> -      regstack->reg[++regstack->top] = REGNO (dest);
> -      SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
> -      replace_reg (pdest, FIRST_STACK_REG);
> +	  regstack->reg[++regstack->top] = REGNO (dest);
> +	  SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
> +	  replace_reg (pdest, FIRST_STACK_REG);
> +	}
>      }
>    else if (STACK_REG_P (src))
>      {
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-24  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 18:35 [PATCH] Fix reg-stack error-recovery on pr84828 testcase (PR target/84828) Jakub Jelinek
2018-04-24  7:10 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).