diff options
author | Jason Merrill <jason@redhat.com> | 2000-08-09 01:52:17 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-08-09 01:52:17 -0400 |
commit | 08e72a192902ca20803e5b423bfb6cfdc983642e (patch) | |
tree | 01a455aef1e2f902417b766e340519db5cd654a3 | |
parent | 8e32b501b82f3ea5e8615d41ef18267308c654cf (diff) | |
download | gcc-08e72a192902ca20803e5b423bfb6cfdc983642e.zip gcc-08e72a192902ca20803e5b423bfb6cfdc983642e.tar.gz gcc-08e72a192902ca20803e5b423bfb6cfdc983642e.tar.bz2 |
pt.c (tsubst_aggr_type): Bail if creating the argvec fails.
* pt.c (tsubst_aggr_type): Bail if creating the argvec fails.
(tsubst_template_arg_vector): Likewise.
* decl2.c (build_anon_union_vars): Choose the largest field; don't
assume that one will be as large as the union.
From-SVN: r35581
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 15 | ||||
-rw-r--r-- | gcc/cp/pt.c | 5 |
3 files changed, 23 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5d124c9..b7b7df8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2000-08-08 Jason Merrill <jason@redhat.com> + + * pt.c (tsubst_aggr_type): Bail if creating the argvec fails. + (tsubst_template_arg_vector): Likewise. + + * decl2.c (build_anon_union_vars): Choose the largest field; don't + assume that one will be as large as the union. + 2000-08-07 Kazu Hirata <kazu@hxi.com> * cp-tree.h (CLASSTYPE_HAS_PRIMARY_BASE_P): Fix a comment typo. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 514b9c6..cf1feb6 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2190,12 +2190,17 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p) DECL_INITIAL (decl) = NULL_TREE; } - /* Only write out one anon union element--choose the one that - can hold them all. */ + /* Only write out one anon union element--choose the largest + one. We used to try to find one the same size as the union, + but that fails if the ABI forces us to align the union more + strictly. */ if (main_decl == NULL_TREE - && simple_cst_equal (DECL_SIZE (decl), - DECL_SIZE (anon_decl)) == 1) - main_decl = decl; + || tree_int_cst_lt (DECL_SIZE (main_decl), DECL_SIZE (decl))) + { + if (main_decl) + TREE_ASM_WRITTEN (main_decl) = 1; + main_decl = decl; + } else /* ??? This causes there to be no debug info written out about this decl. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 12ba705..3d0a1b3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5261,6 +5261,9 @@ tsubst_template_arg_vector (t, args, complain) (tsubst_expr (TREE_VEC_ELT (t, i), args, complain, NULL_TREE)); + if (elts[i] == error_mark_node) + return error_mark_node; + if (elts[i] != TREE_VEC_ELT (t, i)) need_new = 1; } @@ -5380,6 +5383,8 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope) S we only want {double}. */ argvec = tsubst_template_arg_vector (TYPE_TI_ARGS (t), args, complain); + if (argvec == error_mark_node) + return error_mark_node; r = lookup_template_class (t, argvec, in_decl, context, entering_scope); |