OSDN Git Service

2005-07-12 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jul 2005 02:33:10 +0000 (02:33 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jul 2005 02:33:10 +0000 (02:33 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101960 138bc75d-0d04-0410-961f-82ee72b054a4

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

index bb00a8f..3f3d0fe 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 db5906c..15b1c4d 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 eab18d3..fbfda11 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);