[PATCH] FIx PR 28812, wrong code with strict aliasing, struct and mayalias

Andrew Pinski pinskia@gmail.com
Sun Nov 12 01:33:00 GMT 2006


On Thu, 2006-11-09 at 20:13 -0800, Andrew_Pinski@PlayStation.Sony.Com
wrote:
> Hi,
>   The problem here is that we decide that the struct (whos aliasing set is 
> 0) set cannot 
> interfer with the access to the local variable.  This is wrong because the 
> aliasing set of the memory
> access of the struct so we know it can interfer with the local variable. 
> This problem is like mayalias-2.c
> which caused a problem on the tree level but this causes a problem for the 
> RTL level.
> 
> This patch fixes the problem by checking if the aliasing set of the struct 
> memory access is not 0.
> 
> OK? Bootstrapped and tested on i686-linux-gnu with no regressions.


Applied the following patch after approve from Daniel Berlin on IRC and
the suggested change of moving the check of MEM_ALIAS_SET up to the
beginning of the if.

Thanks,
Andrew Pinski


ChangeLog:

	* alias.c (fixed_scalar_and_varying_struct_p): Don't return a
	non null value if the struct memory access is in the 0th
	aliasing set.


        * gcc.c-torture/execute/mayalias-3.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixmayalias.diff.txt
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061112/518d3e50/attachment.bin>


More information about the Gcc-patches mailing list