Bug 9768 - [3.2 regression] [HP-PA] ICE when optimizing inline code at -O2
Summary: [3.2 regression] [HP-PA] ICE when optimizing inline code at -O2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-02-20 06:56 UTC by Randolph Chung
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randolph Chung 2003-02-20 06:56:01 UTC
see below

code works with gcc-3.0 and gcc-3.3 snapshot
also works with gcc-3.2 with -O1

Release:
3.2.3 20030210 (Debian prerelease) (Debian testing/unstable)

Environment:
System: Linux legolas 2.4.20-pa25 #115 Sun Feb 9 20:54:18 PST 2003 parisc unknown unknown GNU/Linux
Architecture: parisc

	<machine, os, target, libraries (multiple lines)>
host: hppa-unknown-linux-gnu
build: hppa-unknown-linux-gnu
target: hppa-unknown-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-objc-gc hppa-linux

How-To-Repeat:
-------8< cut here 8<---------
inline int fixfloor (long x) { if (x >= 0) return (x >> 16); else return ~((~x) >> 16); }
inline int fixtoi (long x) { return fixfloor(x) + ((x & 0x8000) >> 15); }
int foo(long x, long y) { return fixtoi(x*y); }
-------8< cut here 8<---------

legolas% gcc-3.2 -O2 -c bug.i
bug.i: In function `foo':
bug.i:3: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
Comment 1 Randolph Chung 2003-02-20 06:56:01 UTC
Fix:
	unknown
Comment 2 Eric Botcazou 2003-02-20 08:01:37 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed on 3.2 branch. 3.3 (and probably mainline) is not affected.
Comment 3 randolph 2003-02-20 09:09:32 UTC
From: Randolph Chung <randolph@tausq.org>
To: ebotcazou@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/9768: [3.2 regression] [HP-PA] ICE when optimizing inline code at -O2
Date: Thu, 20 Feb 2003 09:09:32 -0800

 This patch "fixes" the problem, but I don't know if it's correct. 3.3
 has a similar check
 
 legolas[9:08] gcc% diff -u bb-reorder.c.orig bb-reorder.c
 --- bb-reorder.c.orig   2003-02-20 09:04:47.000000000 -0800
 +++ bb-reorder.c        2003-02-20 09:05:21.000000000 -0800
 @@ -205,7 +205,7 @@
             e_taken = e;
         }
 
 -      next = (taken ? e_taken : e_fall)->dest;
 +      next = ((taken && e_taken) ? e_taken : e_fall)->dest;
      }
 
    /* In the absence of a prediction, disturb things as little as possible
 
 
 -- 
 Randolph Chung
 Debian GNU/Linux Developer, hppa/ia64 ports
 http://www.tausq.org/

Comment 4 randolph 2003-02-20 10:09:22 UTC
From: Randolph Chung <randolph@tausq.org>
To: Eric Botcazou <ebotcazou@libertysurf.fr>
Cc: gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: optimization/9768: [3.2 regression] [HP-PA] ICE when optimizing inline code at -O2
Date: Thu, 20 Feb 2003 10:09:22 -0800

 > I've submitted the backport patch for approval on the 3.2 branch.
 thanks
 
 > P.S: does the testcase come from Allegro?
 
 yes :)
 
 randolph
 -- 
 Randolph Chung
 Debian GNU/Linux Developer, hppa/ia64 ports
 http://www.tausq.org/

Comment 5 Eric Botcazou 2003-02-20 19:05:51 UTC
From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Randolph Chung <randolph@tausq.org>
Cc: gcc-bugs@gcc.gnu.org,
 nobody@gcc.gnu.org,
 gcc-gnats@gcc.gnu.org
Subject: Re: optimization/9768: [3.2 regression] [HP-PA] ICE when optimizing inline code at -O2
Date: Thu, 20 Feb 2003 19:05:51 +0100

 > This patch "fixes" the problem, but I don't know if it's correct. 3.3
 > has a similar check
 
 I think it is. It comes from:
 
 2002-03-21  DJ Delorie  <dj@redhat.com>
 
 	* bb-reorder.c (make_reorder_chain_1): Protect against
 	when redundant edges are omitted.
 	* predict.c (dump_prediction): Likewise.
 
 I've submitted the backport patch for approval on the 3.2 branch.
 
 P.S: does the testcase come from Allegro?
 
 -- 
 Eric Botcazou

Comment 6 Eric Botcazou 2003-02-20 20:11:05 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9768
Date: 20 Feb 2003 20:11:05 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-02-20 20:11:04
 
 Modified files:
 	gcc            : ChangeLog bb-reorder.c predict.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.c-torture/compile: 20030220-1.c 
 
 Log message:
 	PR optimization/9768
 	Backport patch from mainline:
 	
 	2002-03-21  DJ Delorie  <dj@redhat.com>
 	
 	* bb-reorder.c (make_reorder_chain_1): Protect against
 	when redundant edges are omitted.
 	* predict.c (dump_prediction): Likewise.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.230&r2=1.13152.2.657.2.231
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/bb-reorder.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.43.2.1&r2=1.43.2.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/predict.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.55.2.1&r2=1.55.2.1.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.95&r2=1.1672.2.166.2.96
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20030220-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 
Comment 7 Eric Botcazou 2003-02-20 20:28:41 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed.