public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code
@ 2003-09-19 15:47 rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-19 15:59 ` [Bug c++/12340] " rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2003-09-19 15:47 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: [3.2 regression] loop unroller + gcse produces wrong
                    code
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
                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

If compiling with -O2 -fno-exceptions -funroll-loops the testcase segfaults in a
destructor, with -fno-gcse added or -funroll-loops removed, the testcase is
fine. This problem does not appear on gcc 3.2.3 or gcc 3.4 with either
-funroll-loops or -fold-unroll-loops.

Testcase is available from

http://www.tat.physik.uni-tuebingen.de/~rguenth/gcc/brick_test1.bug.ii.gz

gcc-3.3 version tested is

g++-3.3 (GCC) 3.3.2 20030919 (prerelease)

Richard.


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

* [Bug c++/12340] [3.2 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
@ 2003-09-19 15:59 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-19 17:40 ` [Bug optimization/12340] [3.3 " pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2003-09-19 15:59 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


rguenth at tat dot physik dot uni-tuebingen dot de changed:

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


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-19 15:59 ` [Bug c++/12340] " rguenth at tat dot physik dot uni-tuebingen dot de
@ 2003-09-19 17:40 ` pinskia at gcc dot gnu dot org
  2003-09-22  7:11 ` ebotcazou at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-19 17:40 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |optimization
            Summary|[3.2 regression] loop       |[3.3 regression] loop
                   |unroller + gcse produces    |unroller + gcse produces
                   |wrong code                  |wrong code
   Target Milestone|---                         |3.3.2


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-19 15:59 ` [Bug c++/12340] " rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-19 17:40 ` [Bug optimization/12340] [3.3 " pinskia at gcc dot gnu dot org
@ 2003-09-22  7:11 ` ebotcazou at gcc dot gnu dot org
  2003-09-22  8:17 ` rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-22  7:11 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-22 06:03 -------
Any chance that you could shrink down the 50000-line testcase? Trying to do it
without knowing the code is a bit painful.


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (2 preceding siblings ...)
  2003-09-22  7:11 ` ebotcazou at gcc dot gnu dot org
@ 2003-09-22  8:17 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-22 15:20 ` ebotcazou at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2003-09-22  8:17 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2003-09-22 08:01 -------
Subject: Re:  [3.3 regression] loop unroller + gcse
 produces wrong code

On 22 Sep 2003, ebotcazou at gcc dot gnu dot org wrote:

> ------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-22 06:03 -------
> Any chance that you could shrink down the 50000-line testcase? Trying to do it
> without knowing the code is a bit painful.

The testcase is

#include "Domain/Interval.h"
#include "Engine/BrickEngine.h"

#include "../../Engine/BrickBase.cpp"
#include "../../Utilities/Unique.cmpl.cpp"

namespace Pooma {
   int myContext_g;
}

typedef Engine<1,double,Brick>         Array_t;

int main(int argc, char *argv[])
{
    Interval<1> I(10);
    Array_t A(I);
    for (int i = 0; i < 10; i++)
      A(Loc<1>(i)) = 2.0 + i - i*i;
    return 0;
}

unfortunately, this pulls in nearly all of the POOMA library (although
most of it is unused, of course). Sadly delta is not very good/fast at
reducing C++ testcases. Maybe the tree-ssa pretty-printer can output
only the used parts? Or maybe you can assist me in reducing such C++
testcases (aka stripping unused parts of the code).

After all, the assembly file of the testcase is only 11k big and it seems
to be a problem with the destructor handling? But I can't see anything
obvious either.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (3 preceding siblings ...)
  2003-09-22  8:17 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2003-09-22 15:20 ` ebotcazou at gcc dot gnu dot org
  2003-09-22 15:25 ` ebotcazou at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-22 15:20 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-22 15:14 -------
Is it mandatory to include the two *.cpp files? Can you break them apart and
include only the necessary bits?


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (4 preceding siblings ...)
  2003-09-22 15:20 ` ebotcazou at gcc dot gnu dot org
@ 2003-09-22 15:25 ` ebotcazou at gcc dot gnu dot org
  2003-09-22 17:04 ` rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-22 15:25 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|WAITING                     |ASSIGNED


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-22 15:17 -------
The loop optimizer thinks the loop in main() is executed 6 times!!! I'm going to
teach it how to count :-)


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (5 preceding siblings ...)
  2003-09-22 15:25 ` ebotcazou at gcc dot gnu dot org
@ 2003-09-22 17:04 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2003-09-22 20:39 ` ebotcazou at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2003-09-22 17:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2003-09-22 15:25 -------
Subject: Re:  [3.3 regression] loop unroller + gcse
 produces wrong code

On 22 Sep 2003, ebotcazou at gcc dot gnu dot org wrote:

> The loop optimizer thinks the loop in main() is executed 6 times!!! I'm going to
> teach it how to count :-)

I cannot see how this then should produce a SIGSEGV at destruction time,
but if it is true, then its worth to fix for sure ;)

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (6 preceding siblings ...)
  2003-09-22 17:04 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2003-09-22 20:39 ` ebotcazou at gcc dot gnu dot org
  2003-09-27 17:43 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-22 20:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-22 16:37 -------
This fools the loop unroller, which produces code that overwrites some fields of
the object on the stack.


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (7 preceding siblings ...)
  2003-09-22 20:39 ` ebotcazou at gcc dot gnu dot org
@ 2003-09-27 17:43 ` cvs-commit at gcc dot gnu dot org
  2003-09-27 18:38 ` cvs-commit at gcc dot gnu dot org
  2003-09-27 20:17 ` ebotcazou at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-27 17:43 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-27 17:18 -------
Subject: Bug 12340

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ebotcazou@gcc.gnu.org	2003-09-27 17:18:25

Modified files:
	gcc            : ChangeLog loop.h unroll.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: unroll1.C 

Log message:
	PR optimization/12340
	* loop.h (struct induction): Document the new semantics
	of the 'same' field for bivs.
	* unroll.c (biv_total_increment): Don't count the same
	biv increment several times.
	(loop_iterations) [GENERAL_INDUCT]: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1196&r2=2.1197
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.h.diff?cvsroot=gcc&r1=1.68&r2=1.69
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/unroll.c.diff?cvsroot=gcc&r1=1.202&r2=1.203
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3082&r2=1.3083
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/unroll1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (8 preceding siblings ...)
  2003-09-27 17:43 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-27 18:38 ` cvs-commit at gcc dot gnu dot org
  2003-09-27 20:17 ` ebotcazou at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-27 18:38 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-27 17:23 -------
Subject: Bug 12340

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	ebotcazou@gcc.gnu.org	2003-09-27 17:23:23

Modified files:
	gcc            : ChangeLog loop.h unroll.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: unroll1.C 

Log message:
	PR optimization/12340
	* loop.h (struct induction): Document the new semantics
	of the 'same' field for bivs.
	* unroll.c (biv_total_increment): Don't count the same
	biv increment several times.
	(loop_iterations) [GENERAL_INDUCT]: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.755&r2=1.16114.2.756
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.65&r2=1.65.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/unroll.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.184.2.5&r2=1.184.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.288&r2=1.2261.2.289
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/unroll1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1


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

* [Bug optimization/12340] [3.3 regression] loop unroller + gcse produces wrong code
  2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (9 preceding siblings ...)
  2003-09-27 18:38 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-27 20:17 ` ebotcazou at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-09-27 20:17 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

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


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-27 17:26 -------
See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01649.html


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

end of thread, other threads:[~2003-09-27 17:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-19 15:47 [Bug c++/12340] New: [3.2 regression] loop unroller + gcse produces wrong code rguenth at tat dot physik dot uni-tuebingen dot de
2003-09-19 15:59 ` [Bug c++/12340] " rguenth at tat dot physik dot uni-tuebingen dot de
2003-09-19 17:40 ` [Bug optimization/12340] [3.3 " pinskia at gcc dot gnu dot org
2003-09-22  7:11 ` ebotcazou at gcc dot gnu dot org
2003-09-22  8:17 ` rguenth at tat dot physik dot uni-tuebingen dot de
2003-09-22 15:20 ` ebotcazou at gcc dot gnu dot org
2003-09-22 15:25 ` ebotcazou at gcc dot gnu dot org
2003-09-22 17:04 ` rguenth at tat dot physik dot uni-tuebingen dot de
2003-09-22 20:39 ` ebotcazou at gcc dot gnu dot org
2003-09-27 17:43 ` cvs-commit at gcc dot gnu dot org
2003-09-27 18:38 ` cvs-commit at gcc dot gnu dot org
2003-09-27 20:17 ` ebotcazou 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).