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: [PATCH] Fix PR33122, wrong types with pointer-plus


On Tue, 21 Aug 2007, Richard Guenther wrote:

> On Tue, 21 Aug 2007, Andrew Pinski wrote:
> 
> > On 8/21/07, Richard Guenther <rguenther@suse.de> wrote:
> > > -       /* index +p PTR -> PTR +p index */
> > > -       if (POINTER_TYPE_P (TREE_TYPE (arg1))
> > > -         && INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
> > > -         return fold_build2 (POINTER_PLUS_EXPR, type,
> > > -                           fold_convert (type, arg1), fold_convert (sizetype, arg0));
> > 
> > Wait how is this wrong again?
> > 
> > Type will always be pointer, if it is not then that is a bug as
> > pointer plus will only work with resulting point types.
> 
> I missed we strip NOPs so if we enter with (ptr *)int +p (sizetype)ptr
> then this folding will trigger.  I reverted this part of the patch.

And added a testcase.

Richard.


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