Bug 56745 - [4.8/4.9 Regression] ICE in merge_if_block
Summary: [4.8/4.9 Regression] ICE in merge_if_block
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-26 17:26 UTC by Jakub Jelinek
Modified: 2013-04-03 06:30 UTC (History)
2 users (show)

See Also:
Host:
Target: arm-linux-gnueabi
Build:
Known to work: 4.7.2
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2013-03-26 17:26:02 UTC
unsigned char a[6];

void
foo ()
{
  int i;
  for (i = 5; i >= 0; i++)
    {
      if (++a[i] != 0)
	break;
      ++a[i];
    }
}

ICEs on arm-linux-gnueabi at -O2 with:
rh927931.i: In function ‘foo’:
rh927931.i:13:1: internal compiler error: in merge_if_block, at ifcvt.c:3188
 }
 ^
0xcd8a6c merge_if_block
	../../gcc/ifcvt.c:3187
0xcd8a6c cond_exec_process_if_block
	../../gcc/ifcvt.c:706
0xcdc23e cond_exec_find_if_block
	../../gcc/ifcvt.c:3578
0xcdc23e find_if_header
	../../gcc/ifcvt.c:3261
0xcdc23e if_convert
	../../gcc/ifcvt.c:4381
0xcdc438 rest_of_handle_if_after_reload
	../../gcc/ifcvt.c:4527
, 4.7 didn't ICE.
Comment 1 Mikael Pettersson 2013-03-27 11:20:58 UTC
Started with http://gcc.gnu.org/r193098.
Comment 2 Jakub Jelinek 2013-04-03 06:29:48 UTC
Author: jakub
Date: Tue Apr  2 18:29:18 2013
New Revision: 197371

URL: http://gcc.gnu.org/viewcvs?rev=197371&root=gcc&view=rev
Log:
	PR rtl-optimization/56745
	* ifcvt.c (cond_exec_find_if_block): Don't try to optimize
	if then_bb has no successors and else_bb is EXIT_BLOCK_PTR.

	* gcc.c-torture/compile/pr56745.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr56745.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ifcvt.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jakub Jelinek 2013-04-03 06:30:06 UTC
Author: jakub
Date: Tue Apr  2 18:31:37 2013
New Revision: 197372

URL: http://gcc.gnu.org/viewcvs?rev=197372&root=gcc&view=rev
Log:
	PR rtl-optimization/56745
	* ifcvt.c (cond_exec_find_if_block): Don't try to optimize
	if then_bb has no successors and else_bb is EXIT_BLOCK_PTR.

	* gcc.c-torture/compile/pr56745.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/compile/pr56745.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/ifcvt.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2013-04-03 06:30:26 UTC
Should be fixed now for 4.8.1+.