From patchwork Sun Oct 7 10:44:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Check that unlinked uses do not contain ssa-names when renaming. Date: Sun, 07 Oct 2012 00:44:43 -0000 From: Tom de Vries X-Patchwork-Id: 189798 Message-Id: <50715D1B.3080203@mentor.com> To: Richard Guenther Cc: "gcc-patches@gcc.gnu.org" Richard, attached patch checks that unlinked uses do not contain ssa-names when renaming. This assert triggers when compiling (without the fix) the PR54735 example. AFAIU, it was due to chance that we caught the PR54735 bug by hitting the verification failure, because the new vdef introduced by renaming happened to be the same name as the ssa name referenced in the invalid unlinked use (in terms of maybe_replace_use: rdef == use). The assert from this patch catches all cases that an unlinked use contains an ssa-name. Bootstrapped and reg-tested on x86_64 (Ada inclusive). OK for trunk? Thanks, - Tom 2012-10-07 Tom de Vries * tree-into-ssa.c (maybe_replace_use): Add assert. Index: gcc/tree-into-ssa.c =================================================================== --- gcc/tree-into-ssa.c (revision 192023) +++ gcc/tree-into-ssa.c (working copy) @@ -1773,6 +1773,9 @@ rdef = get_reaching_def (sym); else if (is_old_name (use)) rdef = get_reaching_def (use); + + if (use_p->prev == NULL && use_p->next == NULL) + gcc_assert (TREE_CODE (use) != SSA_NAME); if (rdef && rdef != use) SET_USE (use_p, rdef);