This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lno] Fix possible ICE with tree-ssa-return
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Fri, 12 Mar 2004 16:58:40 -0800
- Subject: [lno] Fix possible ICE with tree-ssa-return
I forgot that the return statement can not have a modify expression
so this patch fixes that.
Thanks,
Andrew Pinski
Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.85
diff -u -p -r1.1.2.85 ChangeLog.lno
--- ChangeLog.lno 12 Mar 2004 17:18:20 -0000 1.1.2.85
+++ ChangeLog.lno 13 Mar 2004 00:56:12 -0000
@@ -1,6 +1,9 @@
2004-03-12 Andrew Pinski <pinskia@physics.uc.edu>
* tree-ssa-return.c (tree_ssa_return):
+ Only do it when we have a modify expr.
+
+ * tree-ssa-return.c (tree_ssa_return):
Add new comments and fix some old ones.
2004-03-12 Falk Hueffner <falk@debian.org>
Index: tree-ssa-return.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-return.c,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 tree-ssa-return.c
--- tree-ssa-return.c 12 Mar 2004 17:18:20 -0000 1.1.2.2
+++ tree-ssa-return.c 13 Mar 2004 00:56:12 -0000
@@ -130,6 +130,14 @@ tree_ssa_return (void)
if (!returnstmt_other || TREE_CODE (returnstmt_other) !=
RETURN_EXPR)
continue;
+ /* If we do not have a modify expression on both returns, there
is no point
+ in doing this optimization. */
+ if (TREE_CODE (TREE_OPERAND (returnstmt, 0)) != MODIFY_EXPR)
+ continue;
+
+ if (TREE_CODE (TREE_OPERAND (returnstmt_other, 0)) !=
MODIFY_EXPR)
+ continue;
+
/* No reason to do this if we are not returning a value. */
if (TREE_OPERAND (returnstmt_other, 0) == NULL)
continue;
@@ -144,6 +152,7 @@ tree_ssa_return (void)
bsi = bsi_last (bb);
bsi_other = bsi_last (bb_other);
+
ret_decl = TREE_OPERAND (TREE_OPERAND (returnstmt, 0), 0);