This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tuples][patch] Check for return value from gimplify_expr in gimplify_switch_expr


Hi,

I'm adding a check for the return value from gimplify_expr to prevent
the construction of a GIMPLE_SWITCH from invalid operands.
Testing on i686-linux.
OK, provided no regressions?

Oleg

2008-03-28  Oleg Ryjkov  <olegr@google.com>

        * gimplify.c (gimplify_switch_expr): Verify the return value from
        gimplify_expr.
Index: ChangeLog.tuples
===================================================================
--- ChangeLog.tuples	(revision 133694)
+++ ChangeLog.tuples	(working copy)
@@ -1,5 +1,10 @@
 2008-03-28  Oleg Ryjkov  <olegr@google.com>
 
+	* gimplify.c (gimplify_switch_expr): Verify the return value from
+	gimplify_expr.
+
+2008-03-28  Oleg Ryjkov  <olegr@google.com>
+
 	* tree-eh.c (replace_goto_queue_1): Do a deep copy of the replacement
 	sequence.
 	(maybe_record_in_goto_queue): Set is_label flag when recording
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 133692)
+++ gimplify.c	(working copy)
@@ -1458,10 +1458,13 @@ gimplify_switch_expr (tree *expr_p, gimp
 {
   tree switch_expr = *expr_p;
   gimple_seq switch_body_seq = NULL;
-  
-  gimplify_expr (&SWITCH_COND (switch_expr), pre_p, NULL, is_gimple_val,
-                 fb_rvalue);
-  
+  enum gimplify_status ret;
+
+  ret = gimplify_expr (&SWITCH_COND (switch_expr), pre_p, NULL, is_gimple_val,
+                       fb_rvalue);
+  if (ret != GS_OK)
+    return ret;
+
   if (SWITCH_BODY (switch_expr))
     {
       VEC (tree,heap) *labels;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]