re PR tree-optimization/42871 (g++: Internal error: Segmentation fault (program cc1plus))

2010-02-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42871
	* tree-ssa-pre.c (phi_translate_set): Make sure to retain
	leaders.

	* g++.dg/torture/pr42871.C: New testcase.

From-SVN: r156750
This commit is contained in:
Richard Guenther 2010-02-13 14:50:50 +00:00 committed by Richard Biener
parent 6e86cd0e0a
commit 1a18412b99
4 changed files with 62 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2010-02-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42871
* tree-ssa-pre.c (phi_translate_set): Make sure to retain
leaders.
2010-02-10 Daniel Gutson <dgutson@codesourcery.com>
* config/arm/lib1funcs.asm (__ARM_ARCH__): __ARM_ARCH_7EM__

View File

@ -1,3 +1,8 @@
2010-02-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42871
* g++.dg/torture/pr42871.C: New testcase.
2010-02-12 Jakub Jelinek <jakub@redhat.com>
PR c++/43033

View File

@ -0,0 +1,40 @@
struct C
{
~C ();
int c3;
};
C *b2;
static void
b1 (const C &x, unsigned b3, unsigned b4)
{
unsigned i = 0;
for (; i < b3; i++)
if (i < b4)
{
b2[0].c3 = x.c3;
return;
}
}
int a ();
void
bar (unsigned b3, unsigned b4)
{
C c[100];
for (int i = 0; i < 100; i++)
{
c[i].c3 = i;
for (int j = 0; j < b3; j++)
if (j < b4)
{
b2[0].c3 = 0;
break;
}
b1 (c[i], b3, b4);
a ();
}
}

View File

@ -1731,10 +1731,18 @@ phi_translate_set (bitmap_set_t dest, bitmap_set_t set, basic_block pred,
translated = phi_translate (expr, set, NULL, pred, phiblock);
/* Don't add empty translations to the cache */
if (translated)
phi_trans_add (expr, translated, pred);
if (!translated)
continue;
if (translated != NULL)
phi_trans_add (expr, translated, pred);
/* We might end up with multiple expressions from SET being
translated to the same value. In this case we do not want
to retain the NARY or REFERENCE expression but prefer a NAME
which would be the leader. */
if (translated->kind == NAME)
bitmap_value_replace_in_set (dest, translated);
else
bitmap_value_insert_into_set (dest, translated);
}
VEC_free (pre_expr, heap, exprs);