diff options
author | Richard Guenther <rguenther@suse.de> | 2012-03-14 13:01:46 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-03-14 13:01:46 +0000 |
commit | 7501ca28e3358bc324c0ef417e397c521283c845 (patch) | |
tree | c482a8cab046d7847c7b229b48ad57f4bc5f609e | |
parent | c205d0b3f5d47699977946add69e4409898d5cbc (diff) | |
download | gcc-7501ca28e3358bc324c0ef417e397c521283c845.tar.gz |
re PR c++/52582 (g++ ICE when compiling qt-4.8.0 with -O2 on PPC (32bit))
2012-03-14 Richard Guenther <rguenther@suse.de>
PR middle-end/52582
* gimple-fold.c (canonicalize_constructor_val): Make sure
we have a cgraph node for a FUNCTION_DECL that comes from
a constructor.
(gimple_get_virt_method_for_binfo): Likewise.
From-SVN: r185381
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 21 |
2 files changed, 25 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3eaf5648185..eca4d0b50f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2012-03-14 Richard Guenther <rguenther@suse.de> + PR middle-end/52582 + * gimple-fold.c (canonicalize_constructor_val): Make sure + we have a cgraph node for a FUNCTION_DECL that comes from + a constructor. + (gimple_get_virt_method_for_binfo): Likewise. + +2012-03-14 Richard Guenther <rguenther@suse.de> + PR tree-optimization/52571 * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Move flag_section_anchors check ... diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 5ba7178b0da..d4028398079 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -131,18 +131,26 @@ canonicalize_constructor_val (tree cval) if (TREE_CODE (cval) == ADDR_EXPR) { tree base = get_base_address (TREE_OPERAND (cval, 0)); + if (!base) + return NULL_TREE; - if (base - && (TREE_CODE (base) == VAR_DECL - || TREE_CODE (base) == FUNCTION_DECL) + if ((TREE_CODE (base) == VAR_DECL + || TREE_CODE (base) == FUNCTION_DECL) && !can_refer_decl_in_current_unit_p (base)) return NULL_TREE; - if (base && TREE_CODE (base) == VAR_DECL) + if (TREE_CODE (base) == VAR_DECL) { TREE_ADDRESSABLE (base) = 1; if (cfun && gimple_referenced_vars (cfun)) add_referenced_var (base); } + else if (TREE_CODE (base) == FUNCTION_DECL) + { + /* Make sure we create a cgraph node for functions we'll reference. + They can be non-existent if the reference comes from an entry + of an external vtable for example. */ + cgraph_get_create_node (base); + } /* Fixup types in global initializers. */ if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) cval = build_fold_addr_expr (TREE_OPERAND (cval, 0)); @@ -3115,6 +3123,11 @@ gimple_get_virt_method_for_binfo (HOST_WIDE_INT token, tree known_binfo) if (!can_refer_decl_in_current_unit_p (fn)) return NULL_TREE; + /* Make sure we create a cgraph node for functions we'll reference. + They can be non-existent if the reference comes from an entry + of an external vtable for example. */ + cgraph_get_create_node (fn); + return fn; } |