public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/41033]  New: RTL alias-oracle does not honor -fno-strict-aliasing
@ 2009-08-11 12:02 rguenth at gcc dot gnu dot org
  2009-08-12  7:41 ` [Bug rtl-optimization/41033] " abel at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-11 12:02 UTC (permalink / raw)
  To: gcc-bugs

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;
}

is miscompiled at -O1.


-- 
           Summary: RTL alias-oracle does not honor -fno-strict-aliasing
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41033


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/41033] RTL alias-oracle does not honor -fno-strict-aliasing
  2009-08-11 12:02 [Bug rtl-optimization/41033] New: RTL alias-oracle does not honor -fno-strict-aliasing rguenth at gcc dot gnu dot org
@ 2009-08-12  7:41 ` abel at gcc dot gnu dot org
  2009-08-12 11:50 ` abel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-08-12  7:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from abel at gcc dot gnu dot org  2009-08-12 07:40 -------
Confirmed on trunk.  As we discussed on IRC, the below obvious patch makes
nonoverlapping_component_refs_p punt when !flag_strict_aliasing and thus fixes
the testcase.  I have looked at the other rtl alias oracle functions used in
*_dependence, and it seems that they are safe.  E.g.,
fixed_scalar_and_varying_struct_p already punts when fno-strict-aliasing, and
the other stuff mainly deals with base+offset disambiguations.

(Interestingly enough, I couldn't make a test case in which incorrect PRE or
CSE (not DSE) would happen, as these probably don't look through stores.  On
some platforms though, the scheduler will likely fail.)

I will post the patch after bootstrap+regtest. 


Index: alias.c
===================================================================
*** alias.c     (revision 150675)
--- 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


-- 

abel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abel at gcc dot gnu dot org
         AssignedTo|unassigned at gcc dot gnu   |abel at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-12 07:40:55
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41033


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/41033] RTL alias-oracle does not honor -fno-strict-aliasing
  2009-08-11 12:02 [Bug rtl-optimization/41033] New: RTL alias-oracle does not honor -fno-strict-aliasing rguenth at gcc dot gnu dot org
  2009-08-12  7:41 ` [Bug rtl-optimization/41033] " abel at gcc dot gnu dot org
@ 2009-08-12 11:50 ` abel at gcc dot gnu dot org
  2009-08-13  6:29 ` abel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-08-12 11:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from abel at gcc dot gnu dot org  2009-08-12 11:50 -------
Subject: Bug 41033

Author: abel
Date: Wed Aug 12 11:50:22 2009
New Revision: 150680

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150680
Log:
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.


Added:
    trunk/gcc/testsuite/gcc.dg/pr41033.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41033


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/41033] RTL alias-oracle does not honor -fno-strict-aliasing
  2009-08-11 12:02 [Bug rtl-optimization/41033] New: RTL alias-oracle does not honor -fno-strict-aliasing rguenth at gcc dot gnu dot org
  2009-08-12  7:41 ` [Bug rtl-optimization/41033] " abel at gcc dot gnu dot org
  2009-08-12 11:50 ` abel at gcc dot gnu dot org
@ 2009-08-13  6:29 ` abel at gcc dot gnu dot org
  2009-08-13  8:11 ` abel at gcc dot gnu dot org
  2009-08-13  8:12 ` abel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-08-13  6:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from abel at gcc dot gnu dot org  2009-08-13 06:28 -------
Subject: Bug 41033

Author: abel
Date: Thu Aug 13 06:28:28 2009
New Revision: 150713

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150713
Log:
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. 

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41033.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/alias.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41033


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/41033] RTL alias-oracle does not honor -fno-strict-aliasing
  2009-08-11 12:02 [Bug rtl-optimization/41033] New: RTL alias-oracle does not honor -fno-strict-aliasing rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-08-13  6:29 ` abel at gcc dot gnu dot org
@ 2009-08-13  8:11 ` abel at gcc dot gnu dot org
  2009-08-13  8:12 ` abel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-08-13  8:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from abel at gcc dot gnu dot org  2009-08-13 08:10 -------
Subject: Bug 41033

Author: abel
Date: Thu Aug 13 08:10:21 2009
New Revision: 150714

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150714
Log:
2009-08-13  Andrey Belevantsev  <abel@ispras.ru>

    PR rtl-optimization/41033
    * alias.c (nonoverlapping_component_refs_p): Punt if strict aliasing is
disabled.

2009-08-13  Richard Guenther  <rguenther@suse.de>

    PR rtl-optimization/41033
    * gcc.dg/pr41033.c: New test.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/pr41033.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/alias.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41033


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/41033] RTL alias-oracle does not honor -fno-strict-aliasing
  2009-08-11 12:02 [Bug rtl-optimization/41033] New: RTL alias-oracle does not honor -fno-strict-aliasing rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-08-13  8:11 ` abel at gcc dot gnu dot org
@ 2009-08-13  8:12 ` abel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-08-13  8:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from abel at gcc dot gnu dot org  2009-08-13 08:12 -------
Fixed in trunk, 4.3 and 4.4.


-- 

abel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41033


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-13  8:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-11 12:02 [Bug rtl-optimization/41033] New: RTL alias-oracle does not honor -fno-strict-aliasing rguenth at gcc dot gnu dot org
2009-08-12  7:41 ` [Bug rtl-optimization/41033] " abel at gcc dot gnu dot org
2009-08-12 11:50 ` abel at gcc dot gnu dot org
2009-08-13  6:29 ` abel at gcc dot gnu dot org
2009-08-13  8:11 ` abel at gcc dot gnu dot org
2009-08-13  8:12 ` abel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).