public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34363]  New: Aliasing failure during tree fre
@ 2007-12-06 18:35 davidu at mips dot com
  2007-12-07  0:14 ` [Bug c/34363] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: davidu at mips dot com @ 2007-12-06 18:35 UTC (permalink / raw)
  To: gcc-bugs

Simple test case:

unsigned n;

void foo (unsigned *p)
{
  n = 4;
  *p = 0;
  if (n != 0)
    abort ();
}

main ()
{
  foo (&n);
  return 0;
}

Tested cross-compiling for MIPS, also verified that x86 also has the same
problem.
attached dump from the fre pass.
**** basically n.0_4 should not be assigned the value of 4, since *p can alias
it.

;; Function foo (foo)

Created value VH.0 for p_3
exp_gen[0] := {  }
tmp_gen[0] := { p_3 (VH.0)  }
avail_out[0] := { p_3 (VH.0)  }
exp_gen[2] := {  }
tmp_gen[2] := {  }
avail_out[2] := { p_3 (VH.0)  }
exp_gen[3] := {  }
tmp_gen[3] := {  }
avail_out[3] := { p_3 (VH.0)  }
exp_gen[4] := {  }
tmp_gen[4] := {  }
avail_out[4] := { p_3 (VH.0)  }
exp_gen[1] := {  }
tmp_gen[1] := {  }
avail_out[1] := {  }
Replaced n with 4 in n.0_4 = n;
foo (p)
{
  unsigned int n.0;

<bb 2>:
  n = 4;
  *p_3 = 0;
  n.0_4 = 4;                                    *****
  if (n.0_4 != 0) goto <L0>; else goto <L1>;

<L0>:;
  abort ();

<L1>:;
  return;

}


-- 
           Summary: Aliasing failure during tree fre
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: davidu at mips dot com


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


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

* [Bug c/34363] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
@ 2007-12-07  0:14 ` pinskia at gcc dot gnu dot org
  2007-12-07 10:25 ` [Bug tree-optimization/34363] [4.2 Regression] " rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-07  0:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-12-07 00:14 -------
This worked in "4.3.0 20071127".


-- 


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
  2007-12-07  0:14 ` [Bug c/34363] " pinskia at gcc dot gnu dot org
@ 2007-12-07 10:25 ` rguenth at gcc dot gnu dot org
  2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-12-07 10:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-12-07 10:25 -------
Confirmed.  Wrong alias info:

foo (p)
{
  unsigned int n.0;

<bb 2>:
  #   n_2 = V_MUST_DEF <n_1>;
  n = 4;
  #   NONLOCAL.6_6 = V_MAY_DEF <NONLOCAL.6_5>;
  *p_3 = 0;
  #   VUSE <n_2>;
  n.0_4 = n;
  if (n.0_4 != 0) goto <L0>; else goto <L1>;

<L0>:;
  #   VUSE <n_2>;
  #   VUSE <NONLOCAL.6_6>;
  abort ();

<L1>:;
  return;


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |tree-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |alias, wrong-code
      Known to fail|                            |4.2.2
      Known to work|                            |4.1.3 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-07 10:25:13
               date|                            |
            Summary|Aliasing failure during tree|[4.2 Regression] Aliasing
                   |fre                         |failure during tree fre
   Target Milestone|---                         |4.2.3


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
  2007-12-07  0:14 ` [Bug c/34363] " pinskia at gcc dot gnu dot org
  2007-12-07 10:25 ` [Bug tree-optimization/34363] [4.2 Regression] " rguenth at gcc dot gnu dot org
@ 2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
  2008-02-08  0:31 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-02-01 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jsm28 at gcc dot gnu dot org  2008-02-01 16:55 -------
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.3                       |4.2.4


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
                   ` (2 preceding siblings ...)
  2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
@ 2008-02-08  0:31 ` pinskia at gcc dot gnu dot org
  2008-04-30 20:18 ` sandra at codesourcery dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-08  0:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-02-08 00:30 -------
*** Bug 35134 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amylaar at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
                   ` (3 preceding siblings ...)
  2008-02-08  0:31 ` pinskia at gcc dot gnu dot org
@ 2008-04-30 20:18 ` sandra at codesourcery dot com
  2008-04-30 21:24 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sandra at codesourcery dot com @ 2008-04-30 20:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from sandra at codesourcery dot com  2008-04-30 20:17 -------
Here's another testcase for the same bug, or one closely related to it:

#include <stdio.h>
unsigned x = 8;
unsigned *addr()
{
  return &x;
}
int main()
{
  x = 4;
  *addr() = *addr() / 2;
  printf ("*addr() = %d, x = %d\n", *addr(), x);
  return 0;
}

I've determined that both this test case and the original one reported with
this issue were fixed on mainline by the commit r119502, this patch:

http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00225.html

I'm not familiar enough with this code (yet!) to be able to tell whether this
was a lurking bug fixed by that patch, or whether it is a lurking bug that was
merely obscured by that patch and is still present on mainline.


-- 

sandra at codesourcery dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandra at codesourcery dot
                   |                            |com


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
                   ` (4 preceding siblings ...)
  2008-04-30 20:18 ` sandra at codesourcery dot com
@ 2008-04-30 21:24 ` rguenth at gcc dot gnu dot org
  2008-05-19 20:31 ` jsm28 at gcc dot gnu dot org
  2009-03-31  1:39 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-30 21:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-04-30 21:24 -------
The problem is that NONLOCAL has to alias all global symbols but does not:

  #   x_2 = V_MUST_DEF <x_1>;
  x = 4;
...
  #   NONLOCAL.53_13 = V_MAY_DEF <NONLOCAL.53_12>;
  *D.2057_3 = D.2060_6;

That is, during flow insensitive alias computation we'd need to add these, but
this makes the whole point of the NONLOCAL tag moot.  So getting rid of it
is the "fix".

But this is way too invasive for 4.2, so 4.2 joins 4.1 in the set of
worst-aliasing-bugs-since-ever releases ;)


-- 


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
                   ` (5 preceding siblings ...)
  2008-04-30 21:24 ` rguenth at gcc dot gnu dot org
@ 2008-05-19 20:31 ` jsm28 at gcc dot gnu dot org
  2009-03-31  1:39 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-05-19 20:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2008-05-19 20:23 -------
4.2.4 is being released, changing milestones to 4.2.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.4                       |4.2.5


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


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

* [Bug tree-optimization/34363] [4.2 Regression] Aliasing failure during tree fre
  2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
                   ` (6 preceding siblings ...)
  2008-05-19 20:31 ` jsm28 at gcc dot gnu dot org
@ 2009-03-31  1:39 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31  1:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2009-03-31 01:39 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.2.1 4.2.2 4.2.3           |4.2.1 4.2.2 4.2.3 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-31  1:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 18:35 [Bug c/34363] New: Aliasing failure during tree fre davidu at mips dot com
2007-12-07  0:14 ` [Bug c/34363] " pinskia at gcc dot gnu dot org
2007-12-07 10:25 ` [Bug tree-optimization/34363] [4.2 Regression] " rguenth at gcc dot gnu dot org
2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
2008-02-08  0:31 ` pinskia at gcc dot gnu dot org
2008-04-30 20:18 ` sandra at codesourcery dot com
2008-04-30 21:24 ` rguenth at gcc dot gnu dot org
2008-05-19 20:31 ` jsm28 at gcc dot gnu dot org
2009-03-31  1:39 ` jsm28 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).