re PR middle-end/46637 (SIGSEGV in if_then_else_cond - too deep recursion)

PR middle-end/46637
	* combine.c (try_combine): When substing i2dest for i2src, pass
	1 as last argument even if
	i0_feeds_i1_n && i1_feeds_i2_n && i0dest_in_i0src.

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

From-SVN: r167148
This commit is contained in:
Jakub Jelinek 2010-11-25 19:00:47 +01:00 committed by Jakub Jelinek
parent 27f2c348e9
commit 01e512e27c
4 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2010-11-25 Jakub Jelinek <jakub@redhat.com>
PR middle-end/46637
* combine.c (try_combine): When substing i2dest for i2src, pass
1 as last argument even if
i0_feeds_i1_n && i1_feeds_i2_n && i0dest_in_i0src.
2010-11-25 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/46647

View File

@ -3096,10 +3096,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p)
/* If I1 feeds into I2 and I1DEST is in I1SRC, we need to make a unique
copy of I2SRC each time we substitute it, in order to avoid creating
self-referential RTL when we will be substituting I1SRC for I1DEST
later. Likewise if I0 feeds into I2 and I0DEST is in I0SRC. */
later. Likewise if I0 feeds into I2, either directly or indirectly
through I1, and I0DEST is in I0SRC. */
newpat = subst (PATTERN (i3), i2dest, i2src, 0,
(i1_feeds_i2_n && i1dest_in_i1src)
|| (i0_feeds_i2_n && i0dest_in_i0src));
|| ((i0_feeds_i2_n || (i0_feeds_i1_n && i1_feeds_i2_n))
&& i0dest_in_i0src));
substed_i2 = 1;
/* Record whether I2's body now appears within I3's body. */

View File

@ -1,3 +1,8 @@
2010-11-25 Jakub Jelinek <jakub@redhat.com>
PR middle-end/46637
* gcc.c-torture/compile/pr46637.c: New test.
2010-11-25 H.J. Lu <hongjiu.lu@intel.com>
* gfortran.dg/pr46519-1.f: Add -mtune=generic.

View File

@ -0,0 +1,11 @@
/* PR middle-end/46637 */
struct S { int s[5]; } *p;
void
foo (long x)
{
long a = x == 1 ? 4L : 1L;
asm ("" : "+m" (p->s[a]));
p->s[0]++;
}