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 PR82991


On Thu, Nov 23, 2017 at 12:37:31PM +0100, Richard Biener wrote:
> Hum.  But that pessimizes a _lot_ of early folding.  Like we'd no
> longer optimize
> 
>   r = &a.a[4];
>   r = r + 1;
>   if (r != &a.a[0])
> 
> and similar stuff exposed a lot by C++ abstraction.  We really only
> want to avoid elimination in certain places.

But we can fold the above before IPA, just not to &MEM[&a, 5], but e.g. to
&a.a[5]; if the array has 5 elements.  So for int a[10]; field fold
&a.a[4] + -4 to &a.a[4] + 6 -> &a.a[0] to &a.a[10], don't fold out of bounds
accesses (and only fold those to MEM_REF later).

> So I have the following testsuite adjustment for the builtins.exp
> FAILs.  Two of them quite obvious - just hide the conditional equivalence
> we exposed.  The strncat-chk.c is a little less obvious.  We have

What I'm worried is that testsuite adjustment isn't sufficient, that doesn't
protect the real-world code which doesn't have asm stuff like that.
While the tests are artificial, they were written to show various cases that
do happen in real-world.

	Jakub


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