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: Fix PR 41033


2009/8/12 Andrey Belevantsev <abel@ispras.ru>:
> Hello,
>
> This patch makes nonoverlapping_component_refs_p from RTL alias oracle punt
> if strict aliasing is disabled. ?This function disambiguates component-refs
> searching for the common type of the references and checking whether access
> is done through different fields. ?This seems wrong when
> -fno-strict-aliasing, which is demonstrated by the Richard's test in the PR
> that is miscompiled with -O1. ?Other functions of the RTL alias oracle look
> fine wrt strict aliasing.
>
> Bootstrapped and tested on x86-64. ?(I get some graphite failures which are
> probably because of my ppl/cloog setup.) ?OK for trunk? ?Do I need to put
> this on 4.3/4.4 branch?

Ok for trunk.  The patch is also ok for the branches if you bootstrap
and test it there.

Thanks,
Richard.

> Andrey
>
>
> 2009-08-12 ?Andrey Belevantsev ?<abel@ispras.ru>
>
> ? ? ? ?PR rtl-optimization/41033
> ? ? ? ?* alias.c (nonoverlapping_component_refs_p): Punt if strict aliasing
> is disabled.
>
>
>
> 2009-08-12 ?Richard Guenther ?<rguenther@suse.de>
>
> ? ? ? ?PR rtl-optimization/41033
> ? ? ? ?* gcc.dg/pr41033.c: New test.
>
>
> Index: gcc/testsuite/gcc.dg/pr41033.c
> ===================================================================
> *** gcc/testsuite/gcc.dg/pr41033.c ? ? ?(revision 0)
> --- gcc/testsuite/gcc.dg/pr41033.c ? ? ?(revision 0)
> ***************
> *** 0 ****
> --- 1,24 ----
> + /* { dg-options "-O1 -fno-strict-aliasing" } */
> + /* PR rtl-optimization/41033 */
> +
> + struct X {
> + ? int i;
> + ? int j;
> + };
> +
> + int foo(struct X *p, struct X *q)
> + {
> + ? p->j = 1;
> + ? q->i = 0;
> + ? return p->j;
> + }
> +
> + extern void abort (void);
> +
> + int main()
> + {
> + ? struct X x;
> + ? if (foo (&x, (struct X *)&x.j) != 0)
> + ? ? abort ();
> + ? return 0;
> + }
> Index: gcc/alias.c
> ===================================================================
> *** gcc/alias.c (revision 150675)
> --- gcc/alias.c (working copy)
> *************** nonoverlapping_component_refs_p (const_t
> *** 1980,1985 ****
> --- 1980,1988 ----
> ?{
> ? ?const_tree fieldx, fieldy, typex, typey, orig_y;
>
> + ? if (!flag_strict_aliasing)
> + ? ? return false;
> +
> ? ?do
> ? ? ?{
> ? ? ? ?/* The comparison has to be done at a common type, since we don't
>


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