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 PR15791


On Thu, 27 Jan 2005, Andrew Pinski wrote:

>
> On Jan 27, 2005, at 9:57 AM, Richard Guenther wrote:
>
> > Hi!
> >
> > This patch adds the capability to fold comparisons of the form
> > &a[i] OP &a[j] (or plain a) as in PR15791.  It does not handle
> > &x.a[i] OP &x.a[j] currently, as these are presented in a
> > different lowered form to fold.
> >
> > Bootstrapped and tested on i686-pc-linux-gnu.  Ok?
> > (if yes, please apply)
> >
> > Richard.
>
> I don't think it handles the following C testcase (which should return
> true)
> as the size of the struct is zero (this is unlike C++):
>
> struct a{};
>
> int f()
> {
>    struct a b[2];
>    return &b[0] == &b[1];
> }

Handling the C++ way of handing the comparison to fold() works,
folding it to return 0 for C++ and return 1 for C.  But now the
code looks ugly and I need to factor out some code.

Richard.


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