OSDN Git Service

2007-11-26 Andreas Krebbel <krebbel1@de.ibm.com>
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Nov 2007 17:33:23 +0000 (17:33 +0000)
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Nov 2007 17:33:23 +0000 (17:33 +0000)
PR 34081/C++
* c-decl.c (store_parm_decls): Pass 'false' for the new
allocate_struct_function parameter.
* cgraphunit.c (cgraph_build_static_cdtor): Likewise.
* tree-parloops.c (create_loop_fn): Likewise.
* function.c (push_function_context_to, push_struct_function,
init_function_start): Likewise.
(allocate_struct_function): Add boolean parameter.
* tree.h (allocate_struct_function): Add boolean parameter.
* function.h (struct function): Move returns_struct and
returns_pcc_struct to the end of the structure definiton.

2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>

        PR 34081/C++
        * trans.c (Subprogram_Body_to_gnu, Compilation_Unit_to_gnu):
        Pass 'false' for the new allocate_struct_function parameter.
        * utils.c (build_function_stub): Likewise.

2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>

PR 34081/C++
* decl.c (finish_method): Pass 'false' for the new
allocate_struct_function parameter.

2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>

PR 34081/C++
* treetree.c (tree_code_create_function_wrapup): Pass 'false'
for the new allocate_struct_function parameter.

2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>

PR 34081/C++
* decl.c (start_preparsed_function): Pass
processing_template_decl for the new allocate_struct_function
parameter.

2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>

PR 34081/C++
* g++.dg/template/dependent-expr6.C: New testcase.

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

18 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/trans.c
gcc/ada/utils.c
gcc/c-decl.c
gcc/cgraphunit.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/function.c
gcc/function.h
gcc/java/ChangeLog
gcc/java/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/dependent-expr6.C [new file with mode: 0644]
gcc/tree-parloops.c
gcc/tree.h
gcc/treelang/ChangeLog
gcc/treelang/treetree.c

index acdc3d1..41aaf4b 100644 (file)
@@ -1,3 +1,17 @@
+2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR 34081/C++
+       * c-decl.c (store_parm_decls): Pass 'false' for the new
+       allocate_struct_function parameter.
+       * cgraphunit.c (cgraph_build_static_cdtor): Likewise.
+       * tree-parloops.c (create_loop_fn): Likewise.
+       * function.c (push_function_context_to, push_struct_function,
+       init_function_start): Likewise.
+       (allocate_struct_function): Add boolean parameter.
+       * tree.h (allocate_struct_function): Add boolean parameter.
+       * function.h (struct function): Move returns_struct and
+       returns_pcc_struct to the end of the structure definiton.
+
 2007-11-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/34215
 2007-11-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/34215
index cfe27b1..9ec4178 100644 (file)
@@ -1,3 +1,10 @@
+2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+        PR 34081/C++
+        * trans.c (Subprogram_Body_to_gnu, Compilation_Unit_to_gnu):
+        Pass 'false' for the new allocate_struct_function parameter.
+        * utils.c (build_function_stub): Likewise.
+
 2007-11-25  Richard Guenther  <rguenther@suse.de>
 
        utils.c (gnat_pushlevel): Use BLOCK_CHAIN.
 2007-11-25  Richard Guenther  <rguenther@suse.de>
 
        utils.c (gnat_pushlevel): Use BLOCK_CHAIN.
index 04fe61b..9f7ea2e 100644 (file)
@@ -1776,7 +1776,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
   Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (gnu_subprog_decl));
 
   /* Initialize the information structure for the function.  */
   Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (gnu_subprog_decl));
 
   /* Initialize the information structure for the function.  */
-  allocate_struct_function (gnu_subprog_decl);
+  allocate_struct_function (gnu_subprog_decl, false);
   DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language
     = GGC_CNEW (struct language_function);
 
   DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language
     = GGC_CNEW (struct language_function);
 
@@ -2914,7 +2914,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
   push_stack (&gnu_elab_proc_stack, NULL_TREE, gnu_elab_proc_decl);
 
   DECL_ELABORATION_PROC_P (gnu_elab_proc_decl) = 1;
   push_stack (&gnu_elab_proc_stack, NULL_TREE, gnu_elab_proc_decl);
 
   DECL_ELABORATION_PROC_P (gnu_elab_proc_decl) = 1;
-  allocate_struct_function (gnu_elab_proc_decl);
+  allocate_struct_function (gnu_elab_proc_decl, false);
   Sloc_to_locus (Sloc (gnat_unit_entity), &cfun->function_end_locus);
   set_cfun (NULL);
 
   Sloc_to_locus (Sloc (gnat_unit_entity), &cfun->function_end_locus);
   set_cfun (NULL);
 
index e0c0065..e11ce2b 100644 (file)
@@ -2983,7 +2983,7 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
 
   gnat_poplevel ();
 
 
   gnat_poplevel ();
 
-  allocate_struct_function (gnu_stub_decl);
+  allocate_struct_function (gnu_stub_decl, false);
   end_subprog_body (gnu_body);
 }
 \f
   end_subprog_body (gnu_body);
 }
 \f
index e0eb450..1da57c2 100644 (file)
@@ -6625,7 +6625,7 @@ store_parm_decls (void)
   gen_aux_info_record (fndecl, 1, 0, proto);
 
   /* Initialize the RTL code for the function.  */
   gen_aux_info_record (fndecl, 1, 0, proto);
 
   /* Initialize the RTL code for the function.  */
-  allocate_struct_function (fndecl);
+  allocate_struct_function (fndecl, false);
 
   /* Begin the statement tree for this function.  */
   DECL_SAVED_TREE (fndecl) = push_stmt_list ();
 
   /* Begin the statement tree for this function.  */
   DECL_SAVED_TREE (fndecl) = push_stmt_list ();
index 11a625d..7215f1a 100644 (file)
@@ -1481,7 +1481,7 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
   DECL_ARTIFICIAL (resdecl) = 1;
   DECL_RESULT (decl) = resdecl;
 
   DECL_ARTIFICIAL (resdecl) = 1;
   DECL_RESULT (decl) = resdecl;
 
-  allocate_struct_function (decl);
+  allocate_struct_function (decl, false);
 
   TREE_STATIC (decl) = 1;
   TREE_USED (decl) = 1;
 
   TREE_STATIC (decl) = 1;
   TREE_USED (decl) = 1;
index cd0ceb3..293238e 100644 (file)
@@ -1,3 +1,10 @@
+2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR 34081/C++
+       * decl.c (start_preparsed_function): Pass 
+       processing_template_decl for the new allocate_struct_function
+       parameter.
+
 2007-11-25  Richard Guenther  <rguenther@suse.de>
 
        decl.c (poplevel): Use BLOCK_CHAIN.
 2007-11-25  Richard Guenther  <rguenther@suse.de>
 
        decl.c (poplevel): Use BLOCK_CHAIN.
index 7d1451c..6cbf1f1 100644 (file)
@@ -11211,7 +11211,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
      CFUN set up, and our per-function variables initialized.
      FIXME factor out the non-RTL stuff.  */
   bl = current_binding_level;
      CFUN set up, and our per-function variables initialized.
      FIXME factor out the non-RTL stuff.  */
   bl = current_binding_level;
-  allocate_struct_function (decl1);
+  allocate_struct_function (decl1, processing_template_decl);
   current_binding_level = bl;
 
   /* Even though we're inside a function body, we still don't want to
   current_binding_level = bl;
 
   /* Even though we're inside a function body, we still don't want to
index 249d715..fe70cbf 100644 (file)
@@ -247,7 +247,7 @@ push_function_context_to (tree context ATTRIBUTE_UNUSED)
   struct function *p;
 
   if (cfun == 0)
   struct function *p;
 
   if (cfun == 0)
-    allocate_struct_function (NULL);
+    allocate_struct_function (NULL, false);
   p = cfun;
 
   p->outer = outer_function_chain;
   p = cfun;
 
   p->outer = outer_function_chain;
@@ -3881,10 +3881,14 @@ get_next_funcdef_no (void)
    directly into cfun and invoke the back end hook explicitly at the
    very end, rather than initializing a temporary and calling set_cfun
    on it.
    directly into cfun and invoke the back end hook explicitly at the
    very end, rather than initializing a temporary and calling set_cfun
    on it.
-*/
+
+   ABSTRACT_P is true if this is a function that will never be seen by
+   the middle-end.  Such functions are front-end concepts (like C++
+   function templates) that do not correspond directly to functions
+   placed in object files.  */
 
 void
 
 void
-allocate_struct_function (tree fndecl)
+allocate_struct_function (tree fndecl, bool abstract_p)
 {
   tree result;
   tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE;
 {
   tree result;
   tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE;
@@ -3910,7 +3914,7 @@ allocate_struct_function (tree fndecl)
       cfun->decl = fndecl;
 
       result = DECL_RESULT (fndecl);
       cfun->decl = fndecl;
 
       result = DECL_RESULT (fndecl);
-      if (aggregate_value_p (result, fndecl))
+      if (!abstract_p && aggregate_value_p (result, fndecl))
        {
 #ifdef PCC_STATIC_STRUCT_RETURN
          current_function_returns_pcc_struct = 1;
        {
 #ifdef PCC_STATIC_STRUCT_RETURN
          current_function_returns_pcc_struct = 1;
@@ -3943,7 +3947,7 @@ push_struct_function (tree fndecl)
   VEC_safe_push (function_p, heap, cfun_stack, cfun);
   if (fndecl)
     in_system_header = DECL_IN_SYSTEM_HEADER (fndecl);
   VEC_safe_push (function_p, heap, cfun_stack, cfun);
   if (fndecl)
     in_system_header = DECL_IN_SYSTEM_HEADER (fndecl);
-  allocate_struct_function (fndecl);
+  allocate_struct_function (fndecl, false);
 }
 
 /* Reset cfun, and other non-struct-function variables to defaults as
 }
 
 /* Reset cfun, and other non-struct-function variables to defaults as
@@ -3998,7 +4002,7 @@ init_function_start (tree subr)
   if (subr && DECL_STRUCT_FUNCTION (subr))
     set_cfun (DECL_STRUCT_FUNCTION (subr));
   else
   if (subr && DECL_STRUCT_FUNCTION (subr))
     set_cfun (DECL_STRUCT_FUNCTION (subr));
   else
-    allocate_struct_function (subr);
+    allocate_struct_function (subr, false);
   prepare_function_start ();
 
   /* Warn if this value is an aggregate type,
   prepare_function_start ();
 
   /* Warn if this value is an aggregate type,
index ff71c9a..eb2a753 100644 (file)
@@ -360,14 +360,6 @@ struct function GTY(())
      probabilities pass.  */
   ENUM_BITFIELD (function_frequency) function_frequency : 2;
 
      probabilities pass.  */
   ENUM_BITFIELD (function_frequency) function_frequency : 2;
 
-  /* Nonzero if function being compiled needs to be given an address
-     where the value should be stored.  */
-  unsigned int returns_struct : 1;
-
-  /* Nonzero if function being compiled needs to
-     return the address of where it has put a structure value.  */
-  unsigned int returns_pcc_struct : 1;
-
   /* Nonzero if function being compiled can call setjmp.  */
   unsigned int calls_setjmp : 1;
 
   /* Nonzero if function being compiled can call setjmp.  */
   unsigned int calls_setjmp : 1;
 
@@ -456,6 +448,17 @@ struct function GTY(())
      function has been gimplified, so we can make sure we're not
      creating non GIMPLE tuples after gimplification.  */
   unsigned int gimplified : 1;
      function has been gimplified, so we can make sure we're not
      creating non GIMPLE tuples after gimplification.  */
   unsigned int gimplified : 1;
+
+  /* Fields below this point are not set for abstract functions; see
+     allocate_struct_function.  */
+
+  /* Nonzero if function being compiled needs to be given an address
+     where the value should be stored.  */
+  unsigned int returns_struct : 1;
+
+  /* Nonzero if function being compiled needs to
+     return the address of where it has put a structure value.  */
+  unsigned int returns_pcc_struct : 1;
 };
 
 /* If va_list_[gf]pr_size is set to this, it means we don't know how
 };
 
 /* If va_list_[gf]pr_size is set to this, it means we don't know how
index 65c4482..354a257 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR 34081/C++
+       * decl.c (finish_method): Pass 'false' for the new
+       allocate_struct_function parameter.
+
 2007-11-26  Alexandre Oliva  <aoliva@redhat.com>
 
        * expr.c (build_jni_stub): Use the computed jni func type for
 2007-11-26  Alexandre Oliva  <aoliva@redhat.com>
 
        * expr.c (build_jni_stub): Use the computed jni func type for
index 2cf87c2..d60af8d 100644 (file)
@@ -1850,7 +1850,7 @@ finish_method (tree fndecl)
   if (DECL_STRUCT_FUNCTION (fndecl))
     set_cfun (DECL_STRUCT_FUNCTION (fndecl));
   else
   if (DECL_STRUCT_FUNCTION (fndecl))
     set_cfun (DECL_STRUCT_FUNCTION (fndecl));
   else
-    allocate_struct_function (fndecl);
+    allocate_struct_function (fndecl, false);
 #ifdef USE_MAPPED_LOCATION
   cfun->function_end_locus = DECL_FUNCTION_LAST_LINE (fndecl);
 #else
 #ifdef USE_MAPPED_LOCATION
   cfun->function_end_locus = DECL_FUNCTION_LAST_LINE (fndecl);
 #else
index a67d239..05e3960 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR 34081/C++
+       * g++.dg/template/dependent-expr6.C: New testcase.
+
 2007-11-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/34215
 2007-11-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/34215
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr6.C b/gcc/testsuite/g++.dg/template/dependent-expr6.C
new file mode 100644 (file)
index 0000000..423f1ae
--- /dev/null
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+// Copyright 2007 Free Software Foundation
+// Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+// PR C++ 34081 ICE
+
+class Foo;
+
+template < class Foo > class Bar
+{
+  enum Status
+  { OK, NO };
+
+  enum Status getStatus ()
+  {
+    return status;
+  }
+
+  Status status;
+};
index afa2ed5..dafcdaa 100644 (file)
@@ -1248,7 +1248,7 @@ create_loop_fn (void)
   TREE_USED (t) = 1;
   DECL_ARGUMENTS (decl) = t;
 
   TREE_USED (t) = 1;
   DECL_ARGUMENTS (decl) = t;
 
-  allocate_struct_function (decl);
+  allocate_struct_function (decl, false);
 
   /* The call to allocate_struct_function clobbers CFUN, so we need to restore
      it.  */
 
   /* The call to allocate_struct_function clobbers CFUN, so we need to restore
      it.  */
index 0ac57be..c98a921 100644 (file)
@@ -4936,7 +4936,7 @@ extern void expand_main_function (void);
 extern void init_dummy_function_start (void);
 extern void expand_dummy_function_end (void);
 extern unsigned int init_function_for_compilation (void);
 extern void init_dummy_function_start (void);
 extern void expand_dummy_function_end (void);
 extern unsigned int init_function_for_compilation (void);
-extern void allocate_struct_function (tree);
+extern void allocate_struct_function (tree, bool);
 extern void push_struct_function (tree fndecl);
 extern void init_function_start (tree);
 extern bool use_register_for_decl (const_tree);
 extern void push_struct_function (tree fndecl);
 extern void init_function_start (tree);
 extern bool use_register_for_decl (const_tree);
index f39d5c3..428c37c 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-26  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR 34081/C++
+       * treetree.c (tree_code_create_function_wrapup): Pass 'false' 
+       for the new allocate_struct_function parameter.
+
 2007-09-12  Jan Hubicka  <jh@suse.cz>
 
        * treetree.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
 2007-09-12  Jan Hubicka  <jh@suse.cz>
 
        * treetree.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
index 54e5ada..18354dc 100644 (file)
@@ -457,7 +457,7 @@ tree_code_create_function_wrapup (location_t loc)
                                       BLOCK_VARS (block),
                                      stmts, block);
 
                                       BLOCK_VARS (block),
                                      stmts, block);
 
-  allocate_struct_function (fn_decl);
+  allocate_struct_function (fn_decl, false);
   cfun->function_end_locus = loc;
 
   /* Dump the original tree to a file.  */
   cfun->function_end_locus = loc;
 
   /* Dump the original tree to a file.  */