From: Justin Seyster Date: Tue, 17 Aug 2010 00:03:17 +0000 (-0400) Subject: Fixed bug involving labels in GIMPLE_COND statements. X-Git-Tag: release-v1.0~66 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=65a8a8480bf84c7aaa0b24ddfa3aadca717fb853;p=interaspect.git Fixed bug involving labels in GIMPLE_COND statements. Turns out that once we're at the GIMPLE level, GIMPLE_CONDs should no longer have labels. The optimization routine that gets rid of "forwarder" basic blocks is aware of this, so it does not update the labes in the GIMPLE_COND when it redirects an edge. The routine that cleans up unnecessary labels, however, sees these labels, which may have been destroyed by the forwarder optimization, and can crash as a result. --- diff --git a/src/aop-duplicate.c b/src/aop-duplicate.c index 69f1913..3cc03e5 100644 --- a/src/aop-duplicate.c +++ b/src/aop-duplicate.c @@ -260,8 +260,6 @@ duplicate_function_body (const char *tmpvar_name, gimple call) basic_block old_first_bb; basic_block new_first_bb; - tree old_label; - tree new_label; tree tmpvar; gimple cond; @@ -273,11 +271,6 @@ duplicate_function_body (const char *tmpvar_name, gimple call) new_first_bb = new_bb_for_old (bb_pairs, old_first_bb); aop_assert (new_first_bb != NULL); - old_label = gimple_block_label (old_first_bb); - new_label = gimple_block_label (new_first_bb); - - /* TODO: Can this line be removed? */ - DECL_SOURCE_LOCATION(new_label) = DECL_SOURCE_LOCATION(old_label); distributor_bb = split_edge(e); tmpvar = create_tmp_var(integer_type_node, tmpvar_name); @@ -320,7 +313,7 @@ duplicate_function_body (const char *tmpvar_name, gimple call) /* insert: if (tmpvar) goto else goto */ cond = gimple_build_cond (NE_EXPR, tmpvar, build_int_cst (integer_type_node, 0), - new_label, old_label); + NULL_TREE, NULL_TREE); gsi_insert_before (&gsi, cond, GSI_SAME_STMT); remove_edge(single_succ_edge(distributor_bb));