+2015-01-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/64336
+ * tree.c (build2_stat): Fix up initialization of TREE_READONLY
+ and TREE_THIS_VOLATILE for MEM_REFs.
+ (build5_stat): Fix up initialization of TREE_READONLY and
+ TREE_THIS_VOLATILE for TARGET_MEM_REFs.
+
2015-01-08 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/64533
PROCESS_ARG (0);
PROCESS_ARG (1);
- TREE_READONLY (t) = read_only;
- TREE_CONSTANT (t) = constant;
TREE_SIDE_EFFECTS (t) = side_effects;
- TREE_THIS_VOLATILE (t)
- = (TREE_CODE_CLASS (code) == tcc_reference
- && arg0 && TREE_THIS_VOLATILE (arg0));
+ if (code == MEM_REF)
+ {
+ if (arg0 && TREE_CODE (arg0) == ADDR_EXPR)
+ {
+ tree o = TREE_OPERAND (arg0, 0);
+ TREE_READONLY (t) = TREE_READONLY (o);
+ TREE_THIS_VOLATILE (t) = TREE_THIS_VOLATILE (o);
+ }
+ }
+ else
+ {
+ TREE_READONLY (t) = read_only;
+ TREE_CONSTANT (t) = constant;
+ TREE_THIS_VOLATILE (t)
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_THIS_VOLATILE (arg0));
+ }
return t;
}
PROCESS_ARG (4);
TREE_SIDE_EFFECTS (t) = side_effects;
- TREE_THIS_VOLATILE (t)
- = (TREE_CODE_CLASS (code) == tcc_reference
- && arg0 && TREE_THIS_VOLATILE (arg0));
+ if (code == TARGET_MEM_REF)
+ {
+ if (arg0 && TREE_CODE (arg0) == ADDR_EXPR)
+ {
+ tree o = TREE_OPERAND (arg0, 0);
+ TREE_READONLY (t) = TREE_READONLY (o);
+ TREE_THIS_VOLATILE (t) = TREE_THIS_VOLATILE (o);
+ }
+ }
+ else
+ TREE_THIS_VOLATILE (t)
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_THIS_VOLATILE (arg0));
return t;
}