Bug 16180 - [3.4 Regression] gcc crashes when optimization is turned on
Summary: [3.4 Regression] gcc crashes when optimization is turned on
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-06-24 18:37 UTC by Robert Entner
Modified: 2004-10-30 21:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2004-06-25 05:36:33


Attachments
This is the precompiled file (34.11 KB, application/x-bzip2)
2004-06-24 18:38 UTC, Robert Entner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Entner 2004-06-24 18:37:09 UTC
Hi GCC Team!

I used a freshly downloaded GCC 3.4.0 and compiled it without special configure
parameters on my SuSE 9.0 with 2.4.21 kernel.

Compiler command and error message:
entner@in5:~/gcc-bughunt> /home/entner2/software/gcc-3.4.0/bin/gcc -c -x c -O2
-Wall -finline-functions savetemps.ii
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac: In function `grsReadGridAtt':
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:197: warning: unused variable
`dummyobj'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:198: warning: unused variable
`attrname'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:199: warning: unused variable
`valtype'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:200: warning: unused variable
`numdim'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:200: warning: unused variable
`dimension'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:201: warning: unused variable
`numhandles'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:202: warning: unused variable
`refdhandle'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:203: warning: unused variable
`index'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:203: warning: unused variable
`numvalues'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:204: warning: unused variable
`values'
/home/entner/gcc3.4.0-test-vproject/grs/intp.ac:246: internal compiler error:
Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

With -O1 it works fine. The Segfault also occurs on my systems GCC (gcc version
3.3.1 (SuSE Linux)). Without -finline-functions the systems compiler works, gcc
3.4.0 does not.
On a Fedora Core 2 with gcc 3.3.3 20040412 it works even with -O3. On SuSE 8.2
with gcc version 3.3 20030226 (prerelease) (SuSE Linux) it works with -O2 but
not with -O3.
I am sorry if my writing is a bit confusing.

I hope you have all information you need. As there is no upload file dialog in
Bugzilla, I guess I can include the precompiled file afterwards. If not you can
download it from here:
http://kochecke.at/savetemps.ii.bz2

Thanks,
Robert
Comment 1 Robert Entner 2004-06-24 18:38:16 UTC
Created attachment 6620 [details]
This is the precompiled file
Comment 2 Andrew Pinski 2004-06-24 18:43:04 UTC
Here is the backtrace:
#0  loop_optimize (f=0x403f1620, dumpfile=0xffffffa3, flags=8) at ../../gcc/loop.c:2773
#1  0x08273730 in rest_of_handle_loop_optimize (decl=0x0, insns=0x403f1620) at ../../gcc/toplev.c:
3036
#2  0x08274be4 in rest_of_compilation (decl=0x403bc000) at ../../gcc/toplev.c:3328
#3  0x082ae5bb in tree_rest_of_compilation (fndecl=0x403bc000, nested_p=false) at ../../gcc/tree-
optimize.c:168
#4  0x0805c5d7 in c_expand_body_1 (fndecl=0x403bc000, nested_p=0) at ../../gcc/c-decl.c:6153
#5  0x082afa99 in cgraph_expand_function (node=0x403e3ec4) at ../../gcc/cgraphunit.c:533
#6  0x082b0fbc in cgraph_optimize () at ../../gcc/cgraphunit.c:1537
#7  0x08086f04 in c_objc_common_finish_file () at ../../gcc/c-objc-common.c:245
#8  0x0827606d in toplev_main (argc=4294967203, argv=0xbffec53f) at ../../gcc/toplev.c:1822
#9  0x0809962e in main (argc=-93, argv=0xffffffa3) at ../../gcc/main.c:35
Comment 3 Serge Belyshev 2004-06-25 05:36:33 UTC
small testcase:
-------------------------------------------------------------------------------
extern int b;
int foo (int a)
{
  if (a)
    {
      b = 0;
      for(;;)
	goto L;
    }
 L:
  for(;;)
    return 0;
}
-------------------------------------------------------------------------------

Confirmed.
Comment 4 GCC Commits 2004-08-24 01:44:09 UTC
Subject: Bug 16180

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-08-24 01:44:05

Modified files:
	gcc            : ChangeLog jump.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: loop-5.c 

Log message:
	PR c/16180
	* jump.c (duplicate_loop_exit_test): If the location reached by
	the unconditional jump at the top of the loop is outside the loop,
	then do not treat it as the exit test.
	
	PR c/16180
	* gcc.dg/loop-5.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.587&r2=2.2326.2.588
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/jump.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.236&r2=1.236.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.254&r2=1.3389.2.255
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/loop-5.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 5 GCC Commits 2004-08-24 01:45:25 UTC
Subject: Bug 16180

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-08-24 01:45:24

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: loop-5.c 

Log message:
	PR c/16180
	* jump.c (duplicate_loop_exit_test): If the location reached by
	the unconditional jump at the top of the loop is outside the loop,
	then do not treat it as the exit test.
	
	PR c/16180
	* gcc.dg/loop-5.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4175&r2=1.4176
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/loop-5.c.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 6 Mark Mitchell 2004-08-24 01:47:16 UTC
Fixed in GCC 3.4.2.