This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Re: ref_contains_indirect_ref always false?
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Nov 2005 14:34:42 +0100 (CET)
- Subject: [PATCH] Re: ref_contains_indirect_ref always false?
- References: <Pine.LNX.4.63.0511041229400.6049@t148.fhfr.qr>
On Fri, 4 Nov 2005, Richard Guenther wrote:
> Hi!
>
> it seems that
>
> static inline bool
> ref_contains_indirect_ref (tree ref)
> {
> while (handled_component_p (ref))
> {
> if (TREE_CODE (ref) == INDIRECT_REF)
> return true;
> ref = TREE_OPERAND (ref, 0);
> }
> return false;
> }
>
> always returns false, because handled_component_p (ref) returns
> false for INDIRECT_REF.
The following patch "fixes" this by imitating ref_contains_array_ref
semantics. Bootstrapped on x86_64-unknonw-linux-gnu, regtest in
progress, ok for mainline if it succeeds?
Thanks,
Richard.
2005-11-04 Richard Guenther <rguenther@suse.de>
* tree-flow-inline.h (ref_contains_indirect_ref): Deal
with INDIRECT_REF not in handled_component_p.
Index: tree-flow-inline.h
===================================================================
--- tree-flow-inline.h (revision 106485)
+++ tree-flow-inline.h (working copy)
@@ -1413,11 +1413,13 @@
static inline bool
ref_contains_indirect_ref (tree ref)
{
+ if (TREE_CODE (ref) == INDIRECT_REF)
+ return true;
while (handled_component_p (ref))
{
+ ref = TREE_OPERAND (ref, 0);
if (TREE_CODE (ref) == INDIRECT_REF)
return true;
- ref = TREE_OPERAND (ref, 0);
}
return false;
}