re PR tree-optimization/44937 (IPA-split causes crash due to null pointer deref)

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

	PR tree-optimization/44937
	PR tree-optimization/45412
	* ipa-split.c (split_function): Properly remove PHI nodes.

	* g++.dg/opt/pr45412.C: New testcase.
	* gcc.c-torture/compile/pr45412.c: Likewise.
	* gcc.c-torture/compile/pr44937.c: Likewise.

From-SVN: r163775
This commit is contained in:
Richard Guenther 2010-09-02 13:42:25 +00:00 committed by Richard Biener
parent c330d181bc
commit 6b8c9df822
6 changed files with 94 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-09-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44937
PR tree-optimization/45412
* ipa-split.c (split_function): Properly remove PHI nodes.
2010-09-02 Joseph Myers <joseph@codesourcery.com>
* opts.h (struct cl_option): Add warn_message field.

View File

@ -993,8 +993,8 @@ split_function (struct split_point *split_point)
{
gimple stmt = gsi_stmt (gsi);
gcc_assert (!is_gimple_reg (gimple_phi_result (stmt)));
mark_sym_for_renaming (SSA_NAME_VAR (PHI_RESULT (stmt)));
gsi_remove (&gsi, false);
mark_virtual_phi_result_for_renaming (stmt);
remove_phi_node (&gsi, true);
}
}
/* When we pass aorund the value, use existing return block. */

View File

@ -1,3 +1,11 @@
2010-09-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44937
PR tree-optimization/45412
* g++.dg/opt/pr45412.C: New testcase.
* gcc.c-torture/compile/pr45412.c: Likewise.
* gcc.c-torture/compile/pr44937.c: Likewise.
2010-09-02 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/cpp/warn-comments-3.c: New. Based on warn-comments-2.c

View File

@ -0,0 +1,26 @@
// { dg-do compile }
// { dg-options "-O2 -fipa-cp-clone -ftracer" }
int foo (int *);
void bar ();
struct S
{
virtual int vm ();
~S ();
};
int
S::vm ()
{
int state;
switch (foo (&state))
{
case 0:
bar ();
case 1:
delete this;
}
return state;
}

View File

@ -0,0 +1,30 @@
int g_19;
int *g_42;
int **volatile g = &g_42;
int g_67[5][9][2][1] = {
};
int
func_4 (int p_5, unsigned char p_6, unsigned char p_7)
{
unsigned char l_8[1];
if (p_6)
goto lbl_13;
for (p_6 = 0; p_6; p_6 = (p_6, 0))
if (0)
{
}
else
lbl_13:for (p_6 = 0; p_6 < 1; p_6 += 1)
l_8[p_6] = 0;
return 0;
}
int *
func_45 (unsigned long p_46, unsigned char p_47)
{
int *l_56 = &g_19;
(void *)&l_56 != (void *)&g | !1 == func_4 (0, g_67[2][6][1][0], 0) ^ func_4 (1, 0, 0);
return 0;
}

View File

@ -0,0 +1,22 @@
extern void baz (int, int, int);
int j;
int
bar (void)
{
int n = 0, *np = &n;
if (j)
baz (0, 0, 0);
if (j)
baz (0, 0, 0);
return n;
}
void
foo (void)
{
bar ();
bar ();
}