aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 571566a..dbc9679 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3220,10 +3220,16 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
switch (TREE_CODE (arg0))
{
case INDIRECT_REF:
- if (!(flags & OEP_ADDRESS_OF)
- && (TYPE_ALIGN (TREE_TYPE (arg0))
- != TYPE_ALIGN (TREE_TYPE (arg1))))
- return 0;
+ if (!(flags & OEP_ADDRESS_OF))
+ {
+ if (TYPE_ALIGN (TREE_TYPE (arg0))
+ != TYPE_ALIGN (TREE_TYPE (arg1)))
+ return 0;
+ /* Verify that the access types are compatible. */
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (arg0))
+ != TYPE_MAIN_VARIANT (TREE_TYPE (arg1)))
+ return 0;
+ }
flags &= ~OEP_ADDRESS_OF;
return OP_SAME (0);