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.
Any chance that you could shrink down the 50000-line testcase? Trying to do it without knowing the code is a bit painful.
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/
Is it mandatory to include the two *.cpp files? Can you break them apart and include only the necessary bits?
The loop optimizer thinks the loop in main() is executed 6 times!!! I'm going to teach it how to count :-)
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/
This fools the loop unroller, which produces code that overwrites some fields of the object on the stack.
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
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
See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01649.html