[patch] broken tree-cfg checking?

Richard Guenther rguenther@suse.de
Tue Dec 30 17:28:00 GMT 2008


On Tue, 30 Dec 2008, Steven Bosscher wrote:

> Hi,
> 
> Looks to me like the EH stmt table checking is broken, we stop after
> visiting the first statement in the table.
> 
> From include/hashtab.h:
> /* Function called by htab_traverse for each live element.  The first
>    arg is the slot of the element (which can be passed to htab_clear_slot
>    if desired), the second arg is the auxiliary pointer handed to
>    htab_traverse.  Return 1 to continue scan, 0 to stop.  */
> typedef int (*htab_trav) (void **, void *);
> 
> From tree-cfg.c:
> static int
> verify_eh_throw_stmt_node (void **slot, void *data)
> {
>   struct throw_stmt_node *node = (struct throw_stmt_node *)*slot;
>   struct pointer_set_t *visited = (struct pointer_set_t *) data;
> 
>   if (!pointer_set_contains (visited, node->stmt))
>     {
>       error ("Dead STMT in EH table");
>       debug_generic_stmt (node->stmt);
>       eh_error_found = true;
>     }
>   return 0; // i.e. stop traversing the table, which seems wrong
> }
> ...
>   if (get_eh_throw_stmt_table (cfun))
>     htab_traverse (get_eh_throw_stmt_table (cfun),
> 		   verify_eh_throw_stmt_node,
> 		   visited_stmts);
> 
> Untested patch below. I have no cycles to spare to test this. Richi,
> if you agree, can you put this on a tester please?

Bootstrapped and tested on x86_64-unknown-linux-gnu.  The patch is ok
with a proper ChangeLog entry.

Thanks,
Richard.

> 
> Gr.
> Steven
> 
> 
> Index: tree-cfg.c
> ===================================================================
> --- tree-cfg.c	(revision 142962)
> +++ tree-cfg.c	(working copy)
> @@ -4149,7 +4149,7 @@ verify_eh_throw_stmt_node (void **slot, void *data
>        debug_gimple_stmt (node->stmt);
>        eh_error_found = true;
>      }
> -  return 0;
> +  return 1;
>  }
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex



More information about the Gcc-patches mailing list