Bug 9888 - [3.2 regression] -mcpu=k6 -Os produces out of range loop instructions
Summary: [3.2 regression] -mcpu=k6 -Os produces out of range loop instructions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: ---
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code
: 10752 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-28 17:46 UTC by jb
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
find-reloads-test.c (606 bytes, application/octet-stream)
2003-05-21 15:17 UTC, jb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jb 2003-02-28 17:46:00 UTC
  I have attached code, hopefully suitable for a testsuite
item, derived from gcc/gcc/find-reloads.c. Compiling
this with  -m<any k6 option> -Os causes an ICE. A loop
insn is generated (compiling with say -mi586 generates
a jump insn instead), the target of which is outside of the
+/-127 range of the loop.

Release:
3.2.2

Environment:
 not significant

How-To-Repeat:
 run the attached file with -m<any k6 option> -Os
Comment 1 Eric Botcazou 2003-03-04 08:41:39 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed on 3.2 branch. 3.3 and mainline are not affected.
Comment 2 Eric Botcazou 2003-03-05 10:23:49 UTC
Responsible-Changed-From-To: unassigned->ebotcazou
Responsible-Changed-Why: Already fixed something very similar.
Comment 3 Eric Botcazou 2003-03-09 15:51:41 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 9 Mar 2003 15:51:41 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-09 15:51:41
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: i386-loop-1.c 
 
 Log message:
 	PR optimization/9888
 	Backport patch from mainline:
 	
 	2002-07-03  Eric Botcazou  <ebotcazou@multimania.com>
 	Jeff Law  <law@redhat.com>
 	
 	* i386.md (length_immediate attribute): Fix typo.
 	(length_address attribute): Likewise.
 	(modrm attribute): Set it to 0 for immediate call instructions.
 	(jcc_1 pattern): Set modrm attribute to 0.
 	(jcc_2 pattern ): Likewise.
 	(jump pattern): Likewise.
 	(doloop_end_internal pattern): Explicitly set length.
 	(leave pattern): Fix typo.
 	(leave_rex64 pattern): 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.250&r2=1.13152.2.657.2.251
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.339.2.13.2.2&r2=1.339.2.13.2.3
 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.105&r2=1.1672.2.166.2.106
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/i386-loop-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.4.1
 

Comment 4 Eric Botcazou 2003-03-12 08:53:28 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 08:53:28 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 08:53:28
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md i386.c 
 
 Log message:
 	PR optimization/9888
 	* config/i386/i386.md (movsi_1): Remove special alternatives
 	for %eax register.
 	(movsi_1_nointernunit): Likewise.
 	(movhi_1): Likewise.
 	* config/i386/i386.c (memory_address_length): Do not use
 	short displacement when there is no base.
 	(ix86_attr_length_address_default): Handle LEA instructions.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17038&r2=1.17039
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.446&r2=1.447
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.546&r2=1.547
 

Comment 5 Eric Botcazou 2003-03-12 08:58:55 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 08:58:55 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 08:58:55
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md i386.c 
 
 Log message:
 	PR optimization/9888
 	* config/i386/i386.md (movsi_1): Remove special alternatives
 	for %eax register.
 	(movhi_1): Likewise.
 	* config/i386/i386.c (memory_address_length): Do not use
 	short displacement when there is no base.
 	(ix86_attr_length_address_default): Handle LEA instructions.
 
 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.285&r2=1.16114.2.286
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.404.2.8&r2=1.404.2.9
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.495.2.16&r2=1.495.2.17
 

Comment 6 Eric Botcazou 2003-03-12 09:04:02 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 09:04:02 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 09:04:02
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md i386.c 
 
 Log message:
 	PR optimization/9888
 	* config/i386/i386.md (movsi_1): Remove special alternatives
 	for %eax register.
 	(movhi_1): Likewise.
 	* config/i386/i386.c (memory_address_length): Do not use
 	short displacement when there is no base.
 	(ix86_attr_length_address_default): Handle LEA instructions.
 
 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.251&r2=1.13152.2.657.2.252
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.339.2.13.2.3&r2=1.339.2.13.2.4
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.368.2.19.2.11&r2=1.368.2.19.2.12
 

Comment 7 Eric Botcazou 2003-03-12 09:08:36 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 09:08:36 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 09:08:36
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md 
 
 Log message:
 	PR optimization/9888
 	Backport patch from mainline:
 	
 	Tue Nov 19 23:50:56 CET 2002  Jan Hubicka  <jh@suse.cz>
 	
 	* i386.md (length_immediate): Do not refer to insn address.
 	(jcc*, jmp patterns): Compute length explicitly.
 	(doloop_end_internal pattern): Unconditionally set the type to "ibr".
 
 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.252&r2=1.13152.2.657.2.253
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.339.2.13.2.4&r2=1.339.2.13.2.5
 

Comment 8 Eric Botcazou 2003-03-12 09:21:47 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 09:21:47 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 09:21:47
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: i386-loop-2.c 
 
 Log message:
 	PR optimization/9888
 	* config/i386/i386.md (jcc_1): Fix range.
 	(jcc_2): Likewise.
 	(jump): LIkewise.
 	(doloop_end_internal): Likewise.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17040&r2=1.17041
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.447&r2=1.448
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2498&r2=1.2499
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/i386-loop-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 9 Eric Botcazou 2003-03-12 09:35:32 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 09:35:32 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 09:35:32
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: i386-loop-2.c 
 
 Log message:
 	PR optimization/9888
 	* config/i386/i386.md (jcc_1): Fix range.
 	(jcc_2): Likewise.
 	(jump): LIkewise.
 	(doloop_end_internal): 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.286&r2=1.16114.2.287
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.404.2.9&r2=1.404.2.10
 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.91&r2=1.2261.2.92
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/i386-loop-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 10 Eric Botcazou 2003-03-12 09:42:00 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/9888
Date: 12 Mar 2003 09:42:00 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-12 09:42:00
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/i386: i386.md 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: i386-loop-2.c 
 
 Log message:
 	PR optimization/9888
 	* config/i386/i386.md (jcc_1): Fix range.
 	(jcc_2): Likewise.
 	(jump): LIkewise.
 	(doloop_end_internal): 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.253&r2=1.13152.2.657.2.254
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.339.2.13.2.5&r2=1.339.2.13.2.6
 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.106&r2=1.1672.2.166.2.107
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/i386-loop-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.4.1
 
Comment 12 jb 2003-03-12 10:48:50 UTC
From: Jim Bray <jb@as220.org>
To: ebotcazou@gcc.gnu.org, ebotcazou@gcc.gnu.org, Eric Botcazou <ebotcazou@libertysurf.fr>, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,  jb@as220.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/9888: [3.2 regression] -mcpu=k6 -Os produces out
	of range loop instructions
Date: 12 Mar 2003 10:48:50 -0500

 Hi Eric,
 
   Looks like this is in the 3.2-branch, not 3.2.2-release. Please
 correct me if I'm wrong.
 
   At present I can't get either one. I'm still getting:
 
 cvs server: Updating gcc
 cvs server: [10:47:02] waiting for anoncvs's lock in /cvsroot/gcc/gcc
 
   I haven't seen that before, and don't know what is going on there.
 I'll try again later and hope it clears. I'd like to build and test
 whatever branch/release you checked in to, and then advise Martin the
 Gentoo GCC guy to pick it up.
 
 Thanks,
 
 Jim
 
 
 
 
 
 On Wed, 2003-03-12 at 05:10, ebotcazou@gcc.gnu.org wrote:
 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9888
 -- 
 Jim
 

Comment 13 jb 2003-03-12 11:09:22 UTC
From: Jim Bray <jb@as220.org>
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@libertysurf.fr>
Subject: Re: optimization/9888: [3.2 regression] -mcpu=k6 -Os produces out
	of range loop instructions
Date: 12 Mar 2003 11:09:22 -0500

 Dang reply-to... I didn't mean for this to go out to the whole
 wide world. Sorry... but if anyone out there in the World knows
 why I'm getting this anoncvs lock, please let me know.
 
 Thanks,
 
 Jim
 
 On Wed, 2003-03-12 at 10:48, Jim Bray wrote:
 > Hi Eric,
 > 
 >   Looks like this is in the 3.2-branch, not 3.2.2-release. Please
 > correct me if I'm wrong.
 > 
 >   At present I can't get either one. I'm still getting:
 > 
 > cvs server: Updating gcc
 > cvs server: [10:47:02] waiting for anoncvs's lock in /cvsroot/gcc/gcc
 > 
 >   I haven't seen that before, and don't know what is going on there.
 > I'll try again later and hope it clears. I'd like to build and test
 > whatever branch/release you checked in to, and then advise Martin the
 > Gentoo GCC guy to pick it up.
 > 
 > Thanks,
 > 
 > Jim
 > 
 > 
 > 
 > 
 > 
 > On Wed, 2003-03-12 at 05:10, ebotcazou@gcc.gnu.org wrote:
 > 
 > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9888
 -- 
 Jim
Comment 14 Eric Botcazou 2003-03-12 16:59:22 UTC
From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Jim Bray <jb@as220.org>
Cc: gcc-bugs@gcc.gnu.org,
 gcc-prs@gcc.gnu.org,
 gcc-gnats@gcc.gnu.org
Subject: Re: optimization/9888: [3.2 regression] -mcpu=k6 -Os produces out of range loop instructions
Date: Wed, 12 Mar 2003 16:59:22 +0100

 >   Looks like this is in the 3.2-branch, not 3.2.2-release. Please
 > correct me if I'm wrong.
 
 The fix has been checked in on all active branches, but certainly not 
 retroactively in the 3.2.2 release.
 
 >   At present I can't get either one. I'm still getting:
 >
 > cvs server: Updating gcc
 > cvs server: [10:47:02] waiting for anoncvs's lock in /cvsroot/gcc/gcc
 
 The subversion CVS server has had problems for about a week.
 
 -- 
 Eric Botcazou