This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] execute/20021120-1.c


> > > On Fri, 2003-11-21 at 13:39, Jan Hubicka wrote:
> > > > Hi,
> > > > I am looking into reason for failure in execute/20021120-1.c.  It is
> > > > caused by get_expr_operands not being able to deal with:
> > > > 
> > > Why is this not folded into an array reference?
> > Not sure, probably because fold_stmt can't do that.  It happens during
> > ssa-ccp...
> We do folding into ARRAY_REF only for ARRAY_TYPE, not POINTER_TYPE.
> It is probably related to following comment in gimplify.c:
>     FIXME: ARRAY_REF currently doesn't accept a pointer as the array
>     argument, so this gimplification uses an INDIRECT_REF of ARRAY_TYPE.
>     ARRAY_REF should be extended.  */
> 
> Anyway it seems to me that not all such INDIRECT_REFs are foldable to
> ARRAY_REFs, at least in case where the offset is not multiple of the
> type size, right?
> So we shall extend get_expr_operands to cope with this....
oops, too fast.
The problem actualy is the test in maybe_fold_addr_expr:

1505      if (TYPE_MAIN_VARIANT (orig_type) != TYPE_MAIN_VARIANT (elt_type))
(gdb)
1506        return NULL_TREE;
(gdb) p debug_tree (orig_type)
 <real_type 0x40175c3c double DF
    size <integer_cst 0x4016d6d8 type <integer_type 0x401757b4 bit_size_type> constant invariant 64>
    unit size <integer_cst 0x4016d930 type <integer_type 0x40175740 unsigned int> constant invariant 8>
    align 64 symtab 0 alias set 2 precision 64
    pointer_to_this <pointer_type 0x40175d98>>
$9 = void
(gdb) p debug_tree (elt_type)
 <real_type 0x4021a4fc double volatile DF
    size <integer_cst 0x4016d6d8 type <integer_type 0x401757b4 bit_size_type> constant invariant 64>
    unit size <integer_cst 0x4016d930 type <integer_type 0x40175740 unsigned int> constant invariant 8>
    align 64 symtab 0 alias set -1 precision 64
    pointer_to_this <pointer_type 0x4021a570>>
$10 = void

Perhaps we can allow types to be different this way and produce NOP
expr, but I am not quite sure how to verify that types differ only by
flags such as volatile...
It is not even useless_type_conversion as it probably can be, Jeff?

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]