[Bug middle-end/32813] [4.3 Regression] ICE for array expression in empty if statement, compiled with -fbounds-check

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jul 19 07:28:00 GMT 2007



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-07-19 07:28 -------
And here is the patch which fixes the issue:
Index: fold-const.c
===================================================================
--- fold-const.c        (revision 126739)
+++ fold-const.c        (working copy)
@@ -3278,6 +3278,9 @@
 {
   tree t = fold_convert (type, result);

+  if (IS_EMPTY_STMT (t) && TREE_SIDE_EFFECTS (omitted))
+    return build1 (NOP_EXPR, void_type_node, fold_ignored_result (omitted));
+
   if (TREE_SIDE_EFFECTS (omitted))
     return build2 (COMPOUND_EXPR, type, fold_ignored_result (omitted), t);

@@ -3291,6 +3294,9 @@
 {
   tree t = fold_convert (type, result);

+  if (IS_EMPTY_STMT (t) && TREE_SIDE_EFFECTS (omitted))
+    return build1 (NOP_EXPR, void_type_node, fold_ignored_result (omitted));
+
   if (TREE_SIDE_EFFECTS (omitted))
     return build2 (COMPOUND_EXPR, type, fold_ignored_result (omitted), t);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32813



More information about the Gcc-bugs mailing list