diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acdc3d162233..41aaf4b3ba84 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cfe27b11937e..9ec417833d6e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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. diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 04fe61bc0b96..9f7ea2ea08db 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -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. */ - 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); @@ -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; - 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); diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index e0c0065a652e..e11ce2bef1f3 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -2983,7 +2983,7 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) gnat_poplevel (); - allocate_struct_function (gnu_stub_decl); + allocate_struct_function (gnu_stub_decl, false); end_subprog_body (gnu_body); } diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e0eb450ef9b2..1da57c2c9982 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6625,7 +6625,7 @@ store_parm_decls (void) 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 (); diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 11a625d0812e..7215f1a10f85 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1481,7 +1481,7 @@ cgraph_build_static_cdtor (char which, tree body, int priority) 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; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cd0ceb373835..293238eab30f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 7d1451c1fbe4..6cbf1f142c36 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; - 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 diff --git a/gcc/function.c b/gcc/function.c index 249d715004b3..fe70cbf47acc 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -247,7 +247,7 @@ push_function_context_to (tree context ATTRIBUTE_UNUSED) struct function *p; if (cfun == 0) - allocate_struct_function (NULL); + allocate_struct_function (NULL, false); 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. -*/ + + 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 -allocate_struct_function (tree fndecl) +allocate_struct_function (tree fndecl, bool abstract_p) { 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); - 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; @@ -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); - allocate_struct_function (fndecl); + allocate_struct_function (fndecl, false); } /* 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 - allocate_struct_function (subr); + allocate_struct_function (subr, false); prepare_function_start (); /* Warn if this value is an aggregate type, diff --git a/gcc/function.h b/gcc/function.h index ff71c9ab516c..eb2a7530b9f0 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -360,14 +360,6 @@ struct function GTY(()) 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; @@ -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; + + /* 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 diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 65c4482ac3be..354a25700a64 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -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 diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 2cf87c2aa361..d60af8d0e29d 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1850,7 +1850,7 @@ finish_method (tree fndecl) 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a67d23975352..05e3960c5d6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/template/dependent-expr6.C b/gcc/testsuite/g++.dg/template/dependent-expr6.C new file mode 100644 index 000000000000..423f1aeeceac --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-expr6.C @@ -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; +}; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index afa2ed523e1e..dafcdaa569fb 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1248,7 +1248,7 @@ create_loop_fn (void) 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. */ diff --git a/gcc/tree.h b/gcc/tree.h index 0ac57be9c8b5..c98a921fec6a 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -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 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); diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index f39d5c318d3f..428c37ccc812 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -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. diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index 54e5ada376bb..18354dc79f36 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -457,7 +457,7 @@ tree_code_create_function_wrapup (location_t loc) 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. */