]> gcc.gnu.org Git - gcc.git/commitdiff
re PR middle-end/21840 (ICE while building Linux kernel (seg fault), missing cast)
authorAndrew Pinski <pinskia@physics.uc.edu>
Wed, 13 Jul 2005 02:33:10 +0000 (02:33 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 13 Jul 2005 02:33:10 +0000 (19:33 -0700)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr21840.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index bb00a8fc7bcfe5b47c34d91979c37bd8a232e7d8..3f3d0feb01e839deb73535476ca7ffc05190b3e4 100644 (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 
index db5906ccd8a70a53cca52c54f03271718d9421eb..15b1c4dbd4d3b5f767e94dd0c4abdfb325d358a8 100644 (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.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21840.c b/gcc/testsuite/gcc.c-torture/compile/pr21840.c
new file mode 100644 (file)
index 0000000..bec3d6b
--- /dev/null
@@ -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]();
+}
index eab18d34a16cadb816c7d5bc2273e0e57f6cf9ad..fbfda11cebe12040c2d32b9e7caa4c98c9140e07 100644 (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);
This page took 0.108163 seconds and 5 git commands to generate.