Bug 21330 - [4.0 Regression] ICE in compare_and_jump_seq, at loop-unswitch.c:120
Summary: [4.0 Regression] ICE in compare_and_jump_seq, at loop-unswitch.c:120
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.1
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2005-05-02 09:08 UTC by Jakub Jelinek
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-*-*
Build:
Known to work: 3.4.4 3.3.2 4.1.0
Known to fail: 4.0.0
Last reconfirmed:


Attachments
Patch I'm about to test. (784 bytes, patch)
2005-05-02 10:38 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2005-05-02 09:08:59 UTC
extern int baz (int);
int bar (void *);

void foo (void *w, char *x, bool y, bool z)
{
  char c = bar (w);
  int i = 0;

  while (1)
    {
      x[i++] = c;
      c = bar (w);
      if (y && c == '\'')
        break;
      if (z && c == '\"')
        break;
      if (!y && !z && !baz (c))
        break;
    }
   x[i]=0;
}

causes ICE in compare_and_jump_seq on powerpc-linux, with both -O3 -m32 and
-O3 -m64.
Comment 1 Jakub Jelinek 2005-05-02 10:38:31 UTC
Created attachment 8792 [details]
Patch I'm about to test.
Comment 2 GCC Commits 2005-05-03 13:10:10 UTC
Subject: Bug 21330

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-05-03 13:09:54

Modified files:
	gcc            : ChangeLog loop-unswitch.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20050502-1.c 

Log message:
	PR rtl-optimization/21330
	* loop-unswitch.c (may_unswitch_on): Set *cinsn only when
	returning non-NULL.
	(unswitch_single_loop): Clear cinsn when retrying.
	
	* gcc.c-torture/execute/20050502-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8573&r2=2.8574
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop-unswitch.c.diff?cvsroot=gcc&r1=1.29&r2=1.30
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5434&r2=1.5435
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050502-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 3 GCC Commits 2005-05-06 10:53:08 UTC
Subject: Bug 21330

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jakub@gcc.gnu.org	2005-05-06 10:52:39

Modified files:
	gcc            : ChangeLog loop-unswitch.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20050502-1.c 

Log message:
	PR rtl-optimization/21330
	* loop-unswitch.c (may_unswitch_on): Set *cinsn only when
	returning non-NULL.
	(unswitch_single_loop): Clear cinsn when retrying.
	
	* gcc.c-torture/execute/20050502-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.223&r2=2.7592.2.224
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop-unswitch.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.25&r2=1.25.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.163&r2=1.5084.2.164
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050502-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 4 Andrew Pinski 2005-05-06 13:46:33 UTC
Fixed.