[Bug tree-optimization/38645] [4.4 Regression] ICE with volatile

jamborm at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Dec 30 13:09:00 GMT 2008



------- Comment #2 from jamborm at gcc dot gnu dot org  2008-12-30 13:08 -------
Apparently, the  problem is that  when some expression  arithmetics is
folded  to  D.1241_18 = a[0], the statement  volatile flag is  not set
which triggers the assert.

The following  simple patch makes  the ICE go  away, I'll test  it and
prepare  a proper  patch with  a test  case  if I  get an  ACK from  a
gimple/middle-end maintainer.

2008-12-30  Martin Jambor  <mjambor@suse.cz>

        * gimple.c (gimple_assign_set_rhs_from_tree): Set volatile
        statement flag if necessary.


Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c        (revision 142962)
+++ gcc/gimple.c        (working copy)
@@ -1985,6 +1985,10 @@ gimple_assign_set_rhs_from_tree (gimple_

   extract_ops_from_tree (expr, &subcode, &op1, &op2);
   gimple_assign_set_rhs_with_ops (gsi, subcode, op1, op2);
+
+  if (TREE_SIDE_EFFECTS (op1) || TREE_THIS_VOLATILE (op1)
+      || (op2 && (TREE_SIDE_EFFECTS (op2) || TREE_THIS_VOLATILE (op2))))
+    gimple_set_has_volatile_ops (gsi_stmt (*gsi), true);
 }


-- 


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



More information about the Gcc-bugs mailing list