public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17679] New: Aliasing problem with ivopts
@ 2004-09-26 15:55 rakdver at gcc dot gnu dot org
  2004-09-26 17:20 ` [Bug tree-optimization/17679] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-09-26 15:55 UTC (permalink / raw)
  To: gcc-bugs

The following testcase is misscompiled with -O2 -ftree-loop-ivcanon.  The
reason is that ivopts rewrite the first loop into (equivalent of)

b[0] = 1;
b[1] = 2;
b[2] = 3;
for (tmp = &a, cnt = 3; cnt != 0; tmp += 4B, cnt--)
  if (*tmp != *(tmp - &a + &b))
    { puts ("ERR 1"); break; }

Rtl alias analysis concludes that "a" is base for the register in that
(tmp - &a + &b) is computed.  Store motion than decides that the stores
to "b" before the loop are not used inside loop and moves them after the loop,
thus causing the error.

Reason for this behavior is that the code above is illegal in C (you cannot
take difference of two different arrays).  However ivopts needs to produce
this type of expressions.

int a[3] = {1,2,3};
int c[3] = {4,5,6};

int main(void)
{
  int b[3];
  int i;

  b[0] = 1;
  b[1] = 2;
  b[2] = 3;

  for (i = 0; i < 3; i++)
    if (a[i] != b[i])
      {
        puts ("ERR 1");
        break;
      }

  b[0] = 4;
  b[1] = 5;
  b[2] = 6;

  for (i = 0; i < 3; i++)
    if (c[i] != b[i])
      {
        puts ("ERR 2");
        break;
      }

  return 0;
}

-- 
           Summary: Aliasing problem with ivopts
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: rakdver at gcc dot gnu dot org
        ReportedBy: rakdver at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
@ 2004-09-26 17:20 ` pinskia at gcc dot gnu dot org
  2004-09-26 17:24 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26 17:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
           Keywords|                            |alias, ice-on-valid-code
            Summary|Aliasing problem with ivopts|[4.0 Regression] Aliasing
                   |                            |problem with ivopts
   Target Milestone|---                         |4.0.0


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
  2004-09-26 17:20 ` [Bug tree-optimization/17679] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-09-26 17:24 ` pinskia at gcc dot gnu dot org
  2004-09-26 17:29 ` rakdver at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26 17:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 17:24 -------
As I said in another bug, this really should not be done with the subtraction at all, on PPC at least it is 
better to have different IV's for the arrays.

-- 


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
  2004-09-26 17:20 ` [Bug tree-optimization/17679] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-09-26 17:24 ` pinskia at gcc dot gnu dot org
@ 2004-09-26 17:29 ` rakdver at gcc dot gnu dot org
  2004-09-26 17:32 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-09-26 17:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at gcc dot gnu dot org  2004-09-26 17:29 -------
Does not ICE

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-valid-code           |


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-26 17:29 ` rakdver at gcc dot gnu dot org
@ 2004-09-26 17:32 ` pinskia at gcc dot gnu dot org
  2004-09-26 17:33 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26 17:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 17:32 -------
wrong keyword, woops :).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-26 17:32 ` pinskia at gcc dot gnu dot org
@ 2004-09-26 17:33 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
  2004-09-28  9:34 ` rakdver at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rakdver at atrey dot karlin dot mff dot cuni dot cz @ 2004-09-26 17:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni dot cz  2004-09-26 17:33 -------
Subject: Re:  [4.0 Regression] Aliasing problem with ivopts

Hello,

> As I said in another bug, this really should not be done with the
> subtraction at all, on PPC at least it is better to have different
> IV's for the arrays.

I do not think the memory reference would get expressed in this way on
PPC (if it does, it is a bug in cost function for ivopts and please
create a bugreport for it).  However on i686 this seems to be the best
option, taking the register pressure into account.

Zdenek


-- 


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-09-26 17:33 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
@ 2004-09-28  9:34 ` rakdver at gcc dot gnu dot org
  2004-09-28 11:37 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-09-28  9:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at gcc dot gnu dot org  2004-09-28 09:34 -------
Patch:

http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02849.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-09-28  9:34 ` rakdver at gcc dot gnu dot org
@ 2004-09-28 11:37 ` pinskia at gcc dot gnu dot org
  2004-10-18  3:55 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-28 11:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-28 11:37 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-28 11:37:15
               date|                            |


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-09-28 11:37 ` pinskia at gcc dot gnu dot org
@ 2004-10-18  3:55 ` pinskia at gcc dot gnu dot org
  2004-10-18  6:46 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-18  3:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-18 03:55 -------
Zdenek are you going to apply the patch, it has been approved?

-- 


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-10-18  3:55 ` pinskia at gcc dot gnu dot org
@ 2004-10-18  6:46 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
  2004-11-27  0:04 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rakdver at atrey dot karlin dot mff dot cuni dot cz @ 2004-10-18  6:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni dot cz  2004-10-18 06:46 -------
Subject: Re:  [4.0 Regression] Aliasing problem with ivopts

> Zdenek are you going to apply the patch, it has been approved?

the patch was approved, but after thinking about it more, I noted that
it works by pure luck only, and that the fix for find_base_value
would need to be more complicated.

However in the meantime the patch to prevent ivopts from producing the
type of expressions that caused the problem was commited, so the PR
should no longer reproduce.

Zdenek


-- 


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-10-18  6:46 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
@ 2004-11-27  0:04 ` pinskia at gcc dot gnu dot org
  2004-11-27 20:09 ` giovannibajo at libero dot it
  2004-11-27 20:32 ` rakdver at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-27  0:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-27 00:04 -------
Then should we close this bug as fixed or at least move it from being a 4.0 regression?

-- 


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-11-27  0:04 ` pinskia at gcc dot gnu dot org
@ 2004-11-27 20:09 ` giovannibajo at libero dot it
  2004-11-27 20:32 ` rakdver at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-27 20:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-11-27 20:09 -------
Zdenek, can you check if this bug still makes sense or close it if it does not 
reproduce anymore? You are the one that knows if there is still an underlying 
problem to fix or not.

-- 


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


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

* [Bug tree-optimization/17679] [4.0 Regression] Aliasing problem with ivopts
  2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2004-11-27 20:09 ` giovannibajo at libero dot it
@ 2004-11-27 20:32 ` rakdver at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-11-27 20:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at gcc dot gnu dot org  2004-11-27 20:32 -------
The code in find_base_value very likely is not entirely OK, but I do not know 
about a way how it could cause problems with just the currently used 
optimizations.  Since this code will disappear once we start using results of 
tree alias analysis at rtl level, I think we can consider the bug fixed.

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


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


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

end of thread, other threads:[~2004-11-27 20:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-26 15:55 [Bug tree-optimization/17679] New: Aliasing problem with ivopts rakdver at gcc dot gnu dot org
2004-09-26 17:20 ` [Bug tree-optimization/17679] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-09-26 17:24 ` pinskia at gcc dot gnu dot org
2004-09-26 17:29 ` rakdver at gcc dot gnu dot org
2004-09-26 17:32 ` pinskia at gcc dot gnu dot org
2004-09-26 17:33 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2004-09-28  9:34 ` rakdver at gcc dot gnu dot org
2004-09-28 11:37 ` pinskia at gcc dot gnu dot org
2004-10-18  3:55 ` pinskia at gcc dot gnu dot org
2004-10-18  6:46 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2004-11-27  0:04 ` pinskia at gcc dot gnu dot org
2004-11-27 20:09 ` giovannibajo at libero dot it
2004-11-27 20:32 ` rakdver 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).