This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Valid optimization with constant arrays
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 18 Nov 2008 07:21:52 -0800
- Subject: Re: Valid optimization with constant arrays
- References: <de8d50360811171846k3789a7d6nf75332584a1837f3@mail.gmail.com>
On Mon, Nov 17, 2008 at 06:46:38PM -0800, Andrew Pinski wrote:
> I noticed that for a simple testcase:
> int t;
> void abort (void);
>
> int f(int t, const int *a)
> {
> const int b[] = { 1, 2, 3};
> if (!t)
> return f(1, b);
> return b == a;
> }
Note that in the above function, called with (0,0),
we can know that it will return 0 even if we treat
the b array in the recursive call as a distinct
variable.