re PR middle-end/21840 (ICE while building Linux kernel (seg fault), missing cast)

2005-07-12  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/21840
        * tree-ssa-pre.c (eliminate): Convert the sprime to the correct type
        if *rhs_p is not a SSA_NAME.

2005-07-12  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/21840
        * gcc.c-torture/compile/pr21840.c: New test.

From-SVN: r101960
This commit is contained in:
Andrew Pinski 2005-07-13 02:33:10 +00:00 committed by Andrew Pinski
parent 13c2c08bad
commit fe83f5439a
4 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-07-12 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/21840
* tree-ssa-pre.c (eliminate): Convert the sprime to the correct type
if *rhs_p is not a SSA_NAME.
2005-07-12 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/22422

View File

@ -1,3 +1,8 @@
2005-07-12 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/21840
* gcc.c-torture/compile/pr21840.c: New test.
2005-07-12 Jan Hubicka <jh@suse.cz>
* gcc.c-torture/compile/pr22379.c: New test.

View File

@ -0,0 +1,11 @@
void fn_show_state(void);
typedef void (*fn_handler_fn)(void);
static fn_handler_fn fn_handler[1];
void k_spec(unsigned char value)
{
void *func = fn_handler[value];
if (func == fn_show_state )
return;
fn_handler[value]();
}

View File

@ -2334,8 +2334,17 @@ eliminate (void)
fprintf (dump_file, " in ");
print_generic_stmt (dump_file, stmt, 0);
}
if (TREE_CODE (sprime) == SSA_NAME)
NECESSARY (SSA_NAME_DEF_STMT (sprime)) = 1;
/* We need to make sure the new and old types actually match,
which may require adding a simple cast, which fold_convert
will do for us. */
if (TREE_CODE (*rhs_p) != SSA_NAME
&& !tree_ssa_useless_type_conversion_1 (TREE_TYPE (*rhs_p),
TREE_TYPE (sprime)))
sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);
pre_stats.eliminations++;
propagate_tree_value (rhs_p, sprime);
update_stmt (stmt);