OSDN Git Service

2009-04-22 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Apr 2009 11:30:04 +0000 (11:30 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Apr 2009 11:30:04 +0000 (11:30 +0000)
PR tree-optimization/39845
* tree-switch-conversion.c (build_arrays): Add new referenced vars.
(gen_inbound_check): Likewise.

* gcc.c-torture/compile/pr39845.c: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr39845.c [new file with mode: 0644]
gcc/tree-switch-conversion.c

index 056f732..27182fb 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-22  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39845
+       * tree-switch-conversion.c (build_arrays): Add new referenced vars.
+       (gen_inbound_check): Likewise.
+
 2009-04-22  Nathan Sidwell  <nathan@codesourcery.com>
 
        * gthr-vxworks.h (struct __gthread_once_t): Add alignment and
index ad4e6dd..6fa530d 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-22  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39845
+       * gcc.c-torture/compile/pr39845.c: New testcase.
+
 2009-04-22  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/39735
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39845.c b/gcc/testsuite/gcc.c-torture/compile/pr39845.c
new file mode 100644 (file)
index 0000000..beade5f
--- /dev/null
@@ -0,0 +1,43 @@
+typedef union tree_node *tree;
+enum tree_code { EXCESS_PRECISION_EXPR };
+enum built_in_function { BUILT_IN_ACOS, BUILT_IN_FPCLASSIFY, BUILT_IN_ISFINITE };
+struct tree_base {
+    __extension__ enum tree_code code : 16;
+    unsigned side_effects_flag : 1;
+};
+struct tree_exp {
+    tree     operands[1];
+};
+struct tree_function_decl {
+    __extension__ enum built_in_function function_code : 11;
+    unsigned static_ctor_flag : 1;
+};
+union tree_node {
+    struct tree_base base;
+    struct tree_function_decl function_decl;
+    struct tree_exp exp;
+};
+static tree
+convert_arguments (tree fundecl)
+{
+  tree val = (void *)0;
+  unsigned int parmnum;
+  unsigned char type_generic_remove_excess_precision = 0;
+  switch (((fundecl)->function_decl.function_code))
+    {
+      case BUILT_IN_ISFINITE:
+      case BUILT_IN_FPCLASSIFY:
+         type_generic_remove_excess_precision = 1;
+    }
+  for (parmnum = 0;; ++parmnum)
+    if (((enum tree_code) (val)->base.code) == EXCESS_PRECISION_EXPR
+       && !type_generic_remove_excess_precision)
+      val = ((val)->exp.operands[0]);
+  return val;
+}
+tree
+build_function_call_vec (tree function)
+{
+  return convert_arguments (function);
+}
+
index eade177..6f0343f 100644 (file)
@@ -547,7 +547,7 @@ static void
 build_arrays (gimple swtch)
 {
   tree arr_index_type;
-  tree tidx, sub;
+  tree tidx, sub, tmp;
   gimple stmt;
   gimple_stmt_iterator gsi;
   int i;
@@ -555,7 +555,9 @@ build_arrays (gimple swtch)
   gsi = gsi_for_stmt (swtch);
 
   arr_index_type = build_index_type (info.range_size);
-  tidx = make_ssa_name (create_tmp_var (arr_index_type, "csti"), NULL);
+  tmp = create_tmp_var (arr_index_type, "csti");
+  add_referenced_var (tmp);
+  tidx = make_ssa_name (tmp, NULL);
   sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr,
                     fold_convert (TREE_TYPE (info.index_expr),
                                   info.range_min));
@@ -694,6 +696,7 @@ gen_inbound_check (gimple swtch)
   /* (end of) block 0 */
   gsi = gsi_for_stmt (info.arr_ref_first);
   tmp_u_var = create_tmp_var (utype, "csui");
+  add_referenced_var (tmp_u_var);
   tmp_u_1 = make_ssa_name (tmp_u_var, NULL);
 
   cast = fold_convert (utype, info.index_expr);