This is the mail archive of the 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] Do better in folding of &a[i] COMPARE &a[j]

On Thu, 2005-05-19 at 16:23 +0200, Richard Guenther wrote:
> This is another pre-requesite (actually only the part that handles
> arrays of empty structures explicitly) for the switch of the C
> frontend to no longer emit &a for &a[0].  While I was at it I
> cleaned the helper routine and made it fold things like
> char *a;
> int foo(char *b)
> {
>         return a+5+(long)b == (long)b+a;
> }
> to false.
> Bootstrapped and tested on x86_64-unknown-linux-gnu for all
> languages except ada.
> Ok for mainline?
> Thanks,
> Richard.
> 2005-05-19  Richard Guenther  <>
> 	* fold-const.c (extract_array_ref): Handle more cases,
> 	do some useful canonicalization of the base.
> 	(fold_binary): Explicitly deal with arrays of zero-sized
> 	structures during folding of &a[i] == &a[j].
Thanks.  I re-bootstrapped and tested on i686-pc-linux-gnu given the
length of time that had passed since this patch was submitted.  I
also added your test to the testsuite.  In the future it would be
helpful if you could go ahead turn whatever tests you're using to
validate proper operation of optimization patches into testcases
for our testsuite.



Attachment: PPP
Description: Text document

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