public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
@ 2010-12-15 20:11 zsojka at seznam dot cz
  2010-12-16  0:46 ` [Bug tree-optimization/46970] " hjl.tools at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: zsojka at seznam dot cz @ 2010-12-15 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os
                    -ftree-loop-linear
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz


Created attachment 22774
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22774
reduced testcase (from gcc.dg/pr29581-3.c)

Output:
$ gcc -Os -ftree-loop-linear pr46970.c
or
$ gcc -O -fno-tree-ch -ftree-loop-linear pr46970.c
(-Os implies -fno-tree-ch)

$ ./a.out 
Aborted

Tested versions:
r167809 - fail
4.5.1 - fail
4.4.5 - fail
4.3.5 - fail
4.2.4 - ICE
4.1.2 - ICE
4.0.4 - OK


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
@ 2010-12-16  0:46 ` hjl.tools at gmail dot com
  2010-12-16  0:49 ` hjl.tools at gmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2010-12-16  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.16 00:45:57
                 CC|                            |spop at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-16 00:45:57 UTC ---
Revision 131435:

http://gcc.gnu.org/ml/gcc-cvs/2008-01/msg00195.html

fixed ICE and generated wrong code.


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
  2010-12-16  0:46 ` [Bug tree-optimization/46970] " hjl.tools at gmail dot com
@ 2010-12-16  0:49 ` hjl.tools at gmail dot com
  2010-12-16  0:51 ` hjl.tools at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2010-12-16  0:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-16 00:49:40 UTC ---
It is related to PR 34017.


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
  2010-12-16  0:46 ` [Bug tree-optimization/46970] " hjl.tools at gmail dot com
  2010-12-16  0:49 ` hjl.tools at gmail dot com
@ 2010-12-16  0:51 ` hjl.tools at gmail dot com
  2010-12-16 14:55 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2010-12-16  0:51 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-16 00:51:24 UTC ---
Patch was posted at

http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00371.html


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-12-16  0:51 ` hjl.tools at gmail dot com
@ 2010-12-16 14:55 ` rguenth at gcc dot gnu.org
  2010-12-17 16:17 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-16 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.6


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-12-16 14:55 ` rguenth at gcc dot gnu.org
@ 2010-12-17 16:17 ` jakub at gcc dot gnu.org
  2010-12-17 17:14 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-17 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-17 16:17:39 UTC ---
I think the bug is in that gcc_loop_to_lambda_loop doesn't record whether the
SSA_NAME compared in the exit condition was the induction var or incremented
induction var.
E.g. on ltrans-3.c testcase we have
<bb 5>:
  # j_25 = PHI <j_15(4), 0(9)>
...
  j_15 = j_25 + 1;
  if (N.2_3 > j_15)
    goto <bb 4>;
  else
    goto <bb 6>;
and thus the exit condition tests the incremented iv (gcc_loop_to_lambda_loop
btw. doesn't bother to check whether the def stmt of the rhs of exit condition
here actually increments by step, and doesn't bother to check that step fits
into int (so I guess step like 0x100000001ULL would cause trouble).
It just records lower bound 0, upper bound N.2_3 - 1 here and step 1.
But with -Os -ftree-loop-linear on this testcase we have before ltrans:
  j_12 = j_2 + 1;

<bb 4>:
  # j_2 = PHI <0(7), j_12(3)>
  if (j_2 < n_5(D))
    goto <bb 3>;
  else
    goto <bb 5>;
Here similarly it records lower bound 0, upper bound n_5 - 1 and step 1.
But there is an important difference in between the two.
In the former case we correctly use
  gimple_cond_set_condition (exitcond, testtype, newupperbound, ivvarinced);
but we use it in the second case too, which is wrong.


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-12-17 16:17 ` jakub at gcc dot gnu.org
@ 2010-12-17 17:14 ` jakub at gcc dot gnu.org
  2011-01-03 21:01 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-17 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-17 17:14:01 UTC ---
Created attachment 22801
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22801
gcc46-pr46970.patch

Untested patch that fixes this and keeps ltrans-3.c working.

I don't feel very good about the +-1 * stepint extra adjustments the code did
and still does though, I'm afraid there could be problems with that if there is
an overflow, but it would be much more work to adjust lambda-code.c so that it
deals with this properly.


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-12-17 17:14 ` jakub at gcc dot gnu.org
@ 2011-01-03 21:01 ` rguenth at gcc dot gnu.org
  2011-01-18 20:58 ` spop at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-03 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2011-01-03 21:01 ` rguenth at gcc dot gnu.org
@ 2011-01-18 20:58 ` spop at gcc dot gnu.org
  2011-01-18 20:59 ` spop at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: spop at gcc dot gnu.org @ 2011-01-18 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-18 20:54:55 UTC ---
Author: spop
Date: Tue Jan 18 20:54:52 2011
New Revision: 168967

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168967
Log:
Add testcase for PR46970.

2011-01-18  Sebastian Pop  <sebastian.pop@amd.com>

    PR tree-optimization/46970
    * gcc.dg/graphite/pr46970.c: New.

Added:
    branches/graphite/gcc/testsuite/gcc.dg/graphite/pr46970.c
Modified:
    branches/graphite/gcc/ChangeLog.graphite


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2011-01-18 20:58 ` spop at gcc dot gnu.org
@ 2011-01-18 20:59 ` spop at gcc dot gnu.org
  2011-01-25 21:27 ` spop at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: spop at gcc dot gnu.org @ 2011-01-18 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

Sebastian Pop <spop at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |spop at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #7 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-18 20:56:30 UTC ---
Fixed on the graphite branch.


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (8 preceding siblings ...)
  2011-01-18 20:59 ` spop at gcc dot gnu.org
@ 2011-01-25 21:27 ` spop at gcc dot gnu.org
  2011-01-25 21:54 ` spop at gcc dot gnu.org
  2011-02-02 17:54 ` dnovillo at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: spop at gcc dot gnu.org @ 2011-01-25 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-25 21:25:35 UTC ---
Author: spop
Date: Tue Jan 25 21:25:24 2011
New Revision: 169257

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169257
Log:
Add testcase for PR46970.

2011-01-18  Sebastian Pop  <sebastian.pop@amd.com>

    PR tree-optimization/46970
    * gcc.dg/graphite/pr46970.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/graphite/pr46970.c
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (9 preceding siblings ...)
  2011-01-25 21:27 ` spop at gcc dot gnu.org
@ 2011-01-25 21:54 ` spop at gcc dot gnu.org
  2011-02-02 17:54 ` dnovillo at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: spop at gcc dot gnu.org @ 2011-01-25 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Sebastian Pop <spop at gcc dot gnu.org> changed:

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

--- Comment #9 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-25 21:28:37 UTC ---
Fixed.


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

* [Bug tree-optimization/46970] [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear
  2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
                   ` (10 preceding siblings ...)
  2011-01-25 21:54 ` spop at gcc dot gnu.org
@ 2011-02-02 17:54 ` dnovillo at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2011-02-02 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Diego Novillo <dnovillo at gcc dot gnu.org> 2011-02-02 17:49:01 UTC ---
Author: dnovillo
Date: Wed Feb  2 17:48:51 2011
New Revision: 169596

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169596
Log:
Add testcase for PR46970.

2011-01-18  Sebastian Pop  <sebastian.pop@amd.com>

    PR tree-optimization/46970
    * gcc.dg/graphite/pr46970.c: New.

Added:
    branches/google/integration/gcc/testsuite/gcc.dg/graphite/pr46970.c
Modified:
    branches/google/integration/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2011-02-02 17:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-15 20:11 [Bug tree-optimization/46970] New: [4.3/4.4/4.5/4.6 Regression] wrong code with -Os -ftree-loop-linear zsojka at seznam dot cz
2010-12-16  0:46 ` [Bug tree-optimization/46970] " hjl.tools at gmail dot com
2010-12-16  0:49 ` hjl.tools at gmail dot com
2010-12-16  0:51 ` hjl.tools at gmail dot com
2010-12-16 14:55 ` rguenth at gcc dot gnu.org
2010-12-17 16:17 ` jakub at gcc dot gnu.org
2010-12-17 17:14 ` jakub at gcc dot gnu.org
2011-01-03 21:01 ` rguenth at gcc dot gnu.org
2011-01-18 20:58 ` spop at gcc dot gnu.org
2011-01-18 20:59 ` spop at gcc dot gnu.org
2011-01-25 21:27 ` spop at gcc dot gnu.org
2011-01-25 21:54 ` spop at gcc dot gnu.org
2011-02-02 17:54 ` dnovillo at gcc dot gnu.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).