fix gcc.dg/switch-2.c
Geoffrey Keating
gkeating@apple.com
Fri May 2 18:06:00 GMT 2003
My recent c-semantics.c patch broke gcc.dg/switch-2, as pointed out by
several people.
Tested on powerpc-eabisim. I have high confidence in it because
Richard Sandiford proposed a nearly-identical patch, thanks Richard!
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-unreachablestkoverflowfix.patch=======
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.17666
diff -u -p -u -p -r1.17666 ChangeLog
--- ChangeLog 2 May 2003 15:27:05 -0000 1.17666
+++ ChangeLog 2 May 2003 18:04:21 -0000
@@ -1,3 +1,8 @@
+2003-05-02 Geoffrey Keating <geoffk@apple.com>
+
+ * c-semantics.c (genrtl_switch_stmt, genrtl_if_stmt): Call
+ expand_stmt on result of expand_unreachable_stmt.
+
2003-05-02 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/contrib.texi (Contributors): Add Daniel Berlin.
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.57
diff -u -p -u -p -r1.57 c-semantics.c
--- c-semantics.c 1 May 2003 16:13:28 -0000 1.57
+++ c-semantics.c 2 May 2003 18:04:21 -0000
@@ -416,19 +416,20 @@ genrtl_if_stmt (t)
expand_start_cond (cond, 0);
if (THEN_CLAUSE (t))
{
+ tree nextt = THEN_CLAUSE (t);
+
if (cond && integer_zerop (cond))
- expand_unreachable_stmt (THEN_CLAUSE (t), warn_notreached);
- else
- expand_stmt (THEN_CLAUSE (t));
+ nextt = expand_unreachable_stmt (nextt, warn_notreached);
+ expand_stmt (nextt);
}
if (ELSE_CLAUSE (t))
{
+ tree nextt = ELSE_CLAUSE (t);
expand_start_else ();
if (cond && integer_nonzerop (cond))
- expand_unreachable_stmt (ELSE_CLAUSE (t), warn_notreached);
- else
- expand_stmt (ELSE_CLAUSE (t));
+ nextt = expand_unreachable_stmt (nextt, warn_notreached);
+ expand_stmt (nextt);
}
expand_end_cond ();
}
@@ -687,7 +688,7 @@ genrtl_switch_stmt (t)
emit_line_note (input_filename, input_line);
expand_start_case (1, cond, TREE_TYPE (cond), "switch statement");
- expand_unreachable_stmt (SWITCH_BODY (t), warn_notreached);
+ expand_stmt (expand_unreachable_stmt (SWITCH_BODY (t), warn_notreached));
expand_end_case_type (cond, SWITCH_TYPE (t));
}
============================================================
More information about the Gcc-patches
mailing list