* [PATCH] Fix recent OEP_ADDRESS_OF change
@ 2015-03-12 12:57 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-03-12 12:57 UTC (permalink / raw)
To: gcc-patches
This fixes sth noticed by Honza - I was resetting OEP_ADDRESS_OF
before actually testing for it in MEM_REF/TARGET_MEM_REF handling.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2015-03-12 Richard Biener <rguenther@suse.de>
PR middle-end/65270
* fold-const.c (operand_equal_p): Fix ordering of resetting
OEP_ADDRESS_OF and checking for it in the [TARGET_]MEM_REF case.
Index: gcc/fold-const.c
===================================================================
*** gcc/fold-const.c (revision 221324)
--- gcc/fold-const.c (working copy)
*************** operand_equal_p (const_tree arg0, const_
*** 2934,2954 ****
return OP_SAME (0);
case TARGET_MEM_REF:
- flags &= ~(OEP_CONSTANT_ADDRESS_OF|OEP_ADDRESS_OF);
- /* Require equal extra operands and then fall through to MEM_REF
- handling of the two common operands. */
- if (!OP_SAME_WITH_NULL (2)
- || !OP_SAME_WITH_NULL (3)
- || !OP_SAME_WITH_NULL (4))
- return 0;
- /* Fallthru. */
case MEM_REF:
- flags &= ~(OEP_CONSTANT_ADDRESS_OF|OEP_ADDRESS_OF);
/* Require equal access sizes, and similar pointer types.
We can have incomplete types for array references of
variable-sized arrays from the Fortran frontend
though. Also verify the types are compatible. */
! return ((TYPE_SIZE (TREE_TYPE (arg0)) == TYPE_SIZE (TREE_TYPE (arg1))
|| (TYPE_SIZE (TREE_TYPE (arg0))
&& TYPE_SIZE (TREE_TYPE (arg1))
&& operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)),
--- 2934,2945 ----
return OP_SAME (0);
case TARGET_MEM_REF:
case MEM_REF:
/* Require equal access sizes, and similar pointer types.
We can have incomplete types for array references of
variable-sized arrays from the Fortran frontend
though. Also verify the types are compatible. */
! if (!((TYPE_SIZE (TREE_TYPE (arg0)) == TYPE_SIZE (TREE_TYPE (arg1))
|| (TYPE_SIZE (TREE_TYPE (arg0))
&& TYPE_SIZE (TREE_TYPE (arg1))
&& operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)),
*************** operand_equal_p (const_tree arg0, const_
*** 2963,2970 ****
&& (MR_DEPENDENCE_BASE (arg0)
== MR_DEPENDENCE_BASE (arg1))
&& (TYPE_ALIGN (TREE_TYPE (arg0))
! == TYPE_ALIGN (TREE_TYPE (arg1)))))
! && OP_SAME (0) && OP_SAME (1));
case ARRAY_REF:
case ARRAY_RANGE_REF:
--- 2954,2968 ----
&& (MR_DEPENDENCE_BASE (arg0)
== MR_DEPENDENCE_BASE (arg1))
&& (TYPE_ALIGN (TREE_TYPE (arg0))
! == TYPE_ALIGN (TREE_TYPE (arg1)))))))
! return 0;
! flags &= ~(OEP_CONSTANT_ADDRESS_OF|OEP_ADDRESS_OF);
! return (OP_SAME (0) && OP_SAME (1)
! /* TARGET_MEM_REF require equal extra operands. */
! && (TREE_CODE (arg0) != TARGET_MEM_REF
! || (OP_SAME_WITH_NULL (2)
! && OP_SAME_WITH_NULL (3)
! && OP_SAME_WITH_NULL (4))));
case ARRAY_REF:
case ARRAY_RANGE_REF:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-12 12:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 12:57 [PATCH] Fix recent OEP_ADDRESS_OF change Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).