This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR15791
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Jan 2005 16:14:26 +0100 (CET)
- Subject: 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];
> }
In fact, the generic dump for C looks like:
f ()
{
int D.1120;
struct a b[2];
D.1120 = 1;
return D.1120;
}
and the generic dump for C++:
int f() ()
{
int D.1567;
{
struct a b[2];
D.1567 = &b[0] == &b[1];
return D.1567;
}
}
so somehow it magically works (it just doesn't detect that in the
C++ case it is false). Humm, it doesn't work for C++ at all it
seems - I guess there &b[1] is in another internal form again...
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/