public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Verify that labels are sorted in tree_verify_flow_info
@ 2004-06-03 16:55 Steven Bosscher
  2004-06-07  2:37 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Bosscher @ 2004-06-03 16:55 UTC (permalink / raw)
  To: gcc-patches

Hi,

We rely on this for finding edges, so this checking is really
necessary.
Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

Gr.
Steven

	* tree-cfg.c (tree_verify_flow_info): Make sure that labels
	SWITCH_LABELS is always sorted.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.7
diff -c -3 -p -r2.7 tree-cfg.c
*** tree-cfg.c	2 Jun 2004 21:13:55 -0000	2.7
--- tree-cfg.c	3 Jun 2004 14:04:43 -0000
*************** tree_verify_flow_info (void)
*** 3603,3608 ****
--- 3603,3609 ----
  
  	case SWITCH_EXPR:
  	  {
+ 	    tree prev;
  	    edge e;
  	    size_t i, n;
  	    tree vec;
*************** tree_verify_flow_info (void)
*** 3621,3626 ****
--- 3622,3650 ----
  		label_bb->aux = (void *)1;
  	      }
  
+ 	    /* Verify that the case labels are sorted.  */
+ 	    prev = TREE_VEC_ELT (vec, 0);
+ 	    for (i = 1; i < n - 1; ++i)
+ 	      {
+ 		tree c = TREE_VEC_ELT (vec, i);
+ 		if (! CASE_LOW (c))
+ 		  {
+ 		    error ("Found default case not at end of case vector");
+ 		    err = 1;
+ 		    continue;
+ 		  }
+ 		if (! tree_int_cst_lt (CASE_LOW (prev), CASE_LOW (c)))
+ 		  {
+ 		    error ("Case labels not sorted:\n ");
+ 		    print_generic_expr (stderr, prev, 0);
+ 		    fprintf (stderr," is greater than ");
+ 		    print_generic_expr (stderr, c, 0);
+ 		    fprintf (stderr," but comes before it.\n");
+ 		    err = 1;
+ 		  }
+ 		prev = c;
+ 	      }
+ 
  	    for (e = bb->succ; e; e = e->succ_next)
  	      {
  		if (!e->dest->aux)

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

* Re: Verify that labels are sorted in tree_verify_flow_info
  2004-06-03 16:55 Verify that labels are sorted in tree_verify_flow_info Steven Bosscher
@ 2004-06-07  2:37 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2004-06-07  2:37 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc-patches

On Thu, Jun 03, 2004 at 04:07:45PM +0200, Steven Bosscher wrote:
> 	* tree-cfg.c (tree_verify_flow_info): Make sure that labels
> 	SWITCH_LABELS is always sorted.

Ok.


r~

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

end of thread, other threads:[~2004-06-07  0:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-03 16:55 Verify that labels are sorted in tree_verify_flow_info Steven Bosscher
2004-06-07  2:37 ` Richard Henderson

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).