This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR 177757, ICE in fold
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 1 Oct 2004 14:21:10 -0400
- Subject: [PATCH] Fix PR 177757, ICE in fold
The problem here is that we are using an already released as we have not
rewritten it back into SSA because jump threading does not keep the SSA
information up to date. This patch just works around the issue but the
correct fix would be rewrite jump threading (but that is not going to
happen for 4.0.0, see previous discussions about it for more
information).
We set the variable of the SSA_NAME back but not the type which is what
this patch does.
OK? Bootstrapped on powerpc-apple-darwin with no regressions.
Thanks,
Andrew Pinski
Testcase which is derived from the fortran code.
The reason why I will add a new testcase as the fortran
front-end should have marked its abort as noreturn which
is another PR and marking it as noreturn just works around
the problem.
void abort1(void);
int main()
{
int i;
i = 1;
if (i > 0)
i = 2;
if (i != 2) abort1();
if (i==0);
else if (i == 2)
i = 3;
if (i != 3) abort1();
}
ChangeLog:
* tree-ssanames.c (release_ssa_name): Also set the type after
"releasing" the SSA_NAME.
Index: tree-ssanames.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssanames.c,v
retrieving revision 2.15
diff -u -p -r2.15 tree-ssanames.c
--- tree-ssanames.c 21 Sep 2004 03:19:00 -0000 2.15
+++ tree-ssanames.c 1 Oct 2004 18:12:22 -0000
@@ -270,6 +270,7 @@ release_ssa_name (tree var)
/* Hopefully this can go away once we have the new incremental
SSA updating code installed. */
SSA_NAME_VAR (var) = saved_ssa_name_var;
+ TREE_TYPE (var) = TREE_TYPE (saved_ssa_name_var);
/* Note this SSA_NAME is now in the first list. */
SSA_NAME_IN_FREE_LIST (var) = 1;