equal if they have no side effects. If we have two identical
expressions with side effects that should be treated the same due
to the only side effects being identical SAVE_EXPR's, that will
- be detected in the recursive calls below. */
+ be detected in the recursive calls below.
+ If we are taking an invariant address of two identical objects
+ they are necessarily equal as well. */
if (arg0 == arg1 && ! (flags & OEP_ONLY_CONST)
&& (TREE_CODE (arg0) == SAVE_EXPR
+ || (flags & OEP_CONSTANT_ADDRESS_OF)
|| (! TREE_SIDE_EFFECTS (arg0) && ! TREE_SIDE_EFFECTS (arg1))))
return 1;
case ADDR_EXPR:
return operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0),
- 0);
+ TREE_CONSTANT (arg0) && TREE_CONSTANT (arg1)
+ ? OEP_CONSTANT_ADDRESS_OF : 0);
default:
break;
}
+2011-04-26 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/48694
+ * gcc.dg/torture/pr48694-1.c: New testcase.
+ * gcc.dg/torture/pr48694-2.c: Likewise.
+
2011-04-25 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/ext/underlying_type1.C: New.
--- /dev/null
+/* { dg-do compile } */
+
+extern volatile int g_4[1][4];
+extern int g_7;
+void modify(int *);
+void func_2()
+{
+ int l_46 = 4;
+ if (g_7)
+ modify(&l_46);
+ else
+ {
+ int i;
+ for (i = 0; i != 5; i += 1)
+ {
+ volatile int *vp = &g_4[0][l_46];
+ *vp = 0;
+ }
+ }
+}
enum operand_equal_flag
{
OEP_ONLY_CONST = 1,
- OEP_PURE_SAME = 2
+ OEP_PURE_SAME = 2,
+ OEP_CONSTANT_ADDRESS_OF = 4
};
extern int operand_equal_p (const_tree, const_tree, unsigned int);