public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] bb-reorder: Fix assertion
@ 2024-03-08  8:34 Jakub Jelinek
  2024-03-08  8:41 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2024-03-08  8:34 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

When touching bb-reorder yesterday, I've noticed the checking assert
doesn't actually check what it meant to.
Because asm_noperands returns >= 0 for inline asm patterns (in that case
number of input+output+label operands, so asm goto has at least one)
and -1 if it isn't inline asm.

The following patch fixes the assertion to actually check that it is
asm goto.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2024-03-08  Jakub Jelinek  <jakub@redhat.com>

	* bb-reorder.cc (fix_up_fall_thru_edges): Fix up checking assert,
	asm_noperands < 0 means it is not asm goto too.

--- gcc/bb-reorder.cc.jj	2024-03-07 10:06:56.086285875 +0100
+++ gcc/bb-reorder.cc	2024-03-07 10:11:44.745261926 +0100
@@ -2024,7 +2024,8 @@ fix_up_fall_thru_edges (void)
 			     See PR108596.  */
 			  rtx_insn *j = BB_END (cur_bb);
 			  gcc_checking_assert (JUMP_P (j)
-					       && asm_noperands (PATTERN (j)));
+					       && (asm_noperands (PATTERN (j))
+						   > 0));
 			  edge e2 = find_edge (cur_bb, e->dest);
 			  if (e2)
 			    e2->flags |= EDGE_CROSSING;

	Jakub


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

* Re: [PATCH] bb-reorder: Fix assertion
  2024-03-08  8:34 [PATCH] bb-reorder: Fix assertion Jakub Jelinek
@ 2024-03-08  8:41 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-03-08  8:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Fri, 8 Mar 2024, Jakub Jelinek wrote:

> Hi!
> 
> When touching bb-reorder yesterday, I've noticed the checking assert
> doesn't actually check what it meant to.
> Because asm_noperands returns >= 0 for inline asm patterns (in that case
> number of input+output+label operands, so asm goto has at least one)
> and -1 if it isn't inline asm.
> 
> The following patch fixes the assertion to actually check that it is
> asm goto.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2024-03-08  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* bb-reorder.cc (fix_up_fall_thru_edges): Fix up checking assert,
> 	asm_noperands < 0 means it is not asm goto too.
> 
> --- gcc/bb-reorder.cc.jj	2024-03-07 10:06:56.086285875 +0100
> +++ gcc/bb-reorder.cc	2024-03-07 10:11:44.745261926 +0100
> @@ -2024,7 +2024,8 @@ fix_up_fall_thru_edges (void)
>  			     See PR108596.  */
>  			  rtx_insn *j = BB_END (cur_bb);
>  			  gcc_checking_assert (JUMP_P (j)
> -					       && asm_noperands (PATTERN (j)));
> +					       && (asm_noperands (PATTERN (j))
> +						   > 0));
>  			  edge e2 = find_edge (cur_bb, e->dest);
>  			  if (e2)
>  			    e2->flags |= EDGE_CROSSING;
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

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

end of thread, other threads:[~2024-03-08 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08  8:34 [PATCH] bb-reorder: Fix assertion Jakub Jelinek
2024-03-08  8:41 ` 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).