Commit 2bb5d995 by Jason Merrill

init.c (build_new_1): Bail early if the call to new fails.

        * init.c (build_new_1): Bail early if the call to new fails.

        * decl.c (compute_array_index_type): Check specifically for
        an INTEGER_CST, not just TREE_CONSTANT.

        * decl.c (duplicate_decls): Don't call duplicate_decls on
        the DECL_TEMPLATE_RESULT.
        (decls_match): Return 0 if the DECL_TEMPLATE_RESULTs have different
        codes.

        * error.c (dump_template_bindings): Don't crash if we had an
        invalid argument list.

        * typeck.c (c_expand_start_case): Do narrowing here.
        * semantics.c (finish_switch_cond): Not here.

        * parse.y (asm_clobbers): Do string concatenation.

From-SVN: r34938
parent 089acd57
2000-07-09 Jason Merrill <jason@redhat.com>
* init.c (build_new_1): Bail early if the call to new fails.
* decl.c (compute_array_index_type): Check specifically for
an INTEGER_CST, not just TREE_CONSTANT.
* decl.c (duplicate_decls): Don't call duplicate_decls on
the DECL_TEMPLATE_RESULT.
(decls_match): Return 0 if the DECL_TEMPLATE_RESULTs have different
codes.
* error.c (dump_template_bindings): Don't crash if we had an
invalid argument list.
* typeck.c (c_expand_start_case): Do narrowing here.
* semantics.c (finish_switch_cond): Not here.
2000-07-09 Hidvegi Zoli <hzoli@austin.ibm.com>
* parse.y (asm_clobbers): Do string concatenation.
2000-07-09 Mark Mitchell <mark@codesourcery.com>
* decl.c (pushtag): Don't put local classes in template functions
......@@ -1114,6 +1136,43 @@ Mon Jun 5 06:48:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
(tinfo_base_init): Likewise. Mangle typeinfo string name with
mangle_typeinfo_string_for_type.
2000-06-03 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (TMPL_ARGS_LEVEL): Clarify comment.
(INNERMOST_TEMPLATE_ARGS): New macro.
(innermost_args): Remove.
(get_innermost_template_args): New function.
* decl2.c (arg_assoc_class): Use INNERMOST_TEMPLATE_ARGS.
* error.c (dump_function_decl): Be caution when using
most_general_template.
* method.c (build_template_parm_names): Use
INNERMOST_TEMPLATE_ARGS.
* pt.c (add_to_template_args): Tidy comment
(get_innermost_template_args): New function.
(check_explicit_specialization): Clear DECL_INITIAL for a new
specialization.
(process_partial_specialization): Use INNERMOST_TEMPLATE_ARGS.
Tidy.
(push_template_decl): Always register specializations of the most
general template.
(convert_template_argument): Use INNERMOST_TEMPLATE_ARGS.
(coerce_template_parms): Likewise.
(lookup_template_class): Likewise.
(innermost_args): Remove.
(tsubst_decl): Use INNERMOST_TEMPLATE_ARGS.
(tsubst_decl): Handle tricky specializations. Use
get_innermost_template_args.
(instantiate_template): Simplify handling of partial
instantiations.
(get_class_bindings): Use INNERMOST_TEMPLATE_ARGS.
(most_general_template): Reimplement, in a more straightforward
manner.
(regenerate_decl_from_template): Tweak formatting. Use
TMPL_ARGS_DEPTH for clarity.
(set_mangled_name_for_template_decl): Use INNERMOST_ARGS.
* dump.c (dequeue_and_dump): Dump information about thunks.
2000-06-01 Richard Henderson <rth@cygnus.com>
* decl.c (init_decl_processing): Set lang_get_alias_set first thing.
......
......@@ -3050,6 +3050,10 @@ decls_match (newdecl, olddecl)
DECL_TEMPLATE_PARMS (olddecl)))
return 0;
if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl))
!= TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)))
return 0;
if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
types_match = 1;
else
......@@ -3499,9 +3503,6 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
if (! duplicate_decls (DECL_TEMPLATE_RESULT (newdecl),
DECL_TEMPLATE_RESULT (olddecl)))
cp_error ("invalid redeclaration of %D", newdecl);
TREE_TYPE (olddecl) = TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl));
DECL_TEMPLATE_SPECIALIZATIONS (olddecl)
= chainon (DECL_TEMPLATE_SPECIALIZATIONS (olddecl),
......@@ -9341,7 +9342,7 @@ compute_array_index_type (name, size)
}
/* Normally, the array-bound will be a constant. */
if (TREE_CONSTANT (size))
if (TREE_CODE (size) == INTEGER_CST)
{
/* Check to see if the array bound overflowed. Make that an
error, no matter how generous we're being. */
......@@ -9372,6 +9373,15 @@ compute_array_index_type (name, size)
cp_pedwarn ("ISO C++ forbids zero-size array");
}
}
else if (TREE_CONSTANT (size))
{
/* `(int) &fn' is not a valid array bound. */
if (name)
cp_error ("size of array `%D' is not an integral constant-expression",
name);
else
cp_error ("size of array is not an integral constant-expression");
}
/* Compute the index of the largest element in the array. It is
one less than the number of elements in the array. */
......
......@@ -305,7 +305,15 @@ dump_template_bindings (parms, args)
for (i = 0; i < TREE_VEC_LENGTH (p); ++i)
{
tree arg = TMPL_ARG (args, lvl, arg_idx);
tree arg = NULL_TREE;
/* Don't crash if we had an invalid argument list. */
if (TMPL_ARGS_DEPTH (args) >= lvl)
{
tree lvl_args = TMPL_ARGS_LEVEL (args, lvl);
if (NUM_TMPL_ARGS (lvl_args) > arg_idx)
arg = TREE_VEC_ELT (lvl_args, arg_idx);
}
if (need_comma)
OB_PUTS (", ");
......
......@@ -2356,6 +2356,9 @@ build_new_1 (exp)
rval = cp_convert (build_pointer_type (true_type), rval);
}
if (rval == error_mark_node)
return error_mark_node;
/* unless an allocation function is declared with an empty excep-
tion-specification (_except.spec_), throw(), it indicates failure to
allocate storage by throwing a bad_alloc exception (clause _except_,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3536,10 +3536,10 @@ asm_operand:
;
asm_clobbers:
STRING
{ $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
| asm_clobbers ',' STRING
{ $$ = tree_cons (NULL_TREE, $3, $$); }
string
{ $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE);}
| asm_clobbers ',' string
{ $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
;
/* This is what appears inside the parens in a function declarator.
......
......@@ -564,21 +564,8 @@ finish_switch_cond (cond, switch_stmt)
}
if (cond != error_mark_node)
{
tree idx;
tree type;
cond = default_conversion (cond);
type = TREE_TYPE (cond);
idx = get_unwidened (cond, 0);
/* We can't strip a conversion from a signed type to an unsigned,
because if we did, int_fits_type_p would do the wrong thing
when checking case values for being in range,
and it's too hard to do the right thing. */
if (TREE_UNSIGNED (TREE_TYPE (cond))
== TREE_UNSIGNED (TREE_TYPE (idx)))
cond = idx;
cond = fold (build1 (CLEANUP_POINT_EXPR, type, cond));
cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond));
}
}
FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
......
......@@ -6905,7 +6905,20 @@ tree
c_expand_start_case (exp)
tree exp;
{
expand_start_case (1, exp, TREE_TYPE (exp), "switch statement");
tree type;
tree index;
type = TREE_TYPE (exp);
index = get_unwidened (exp, NULL_TREE);
/* We can't strip a conversion from a signed type to an unsigned,
because if we did, int_fits_type_p would do the wrong thing
when checking case values for being in range,
and it's too hard to do the right thing. */
if (TREE_UNSIGNED (TREE_TYPE (exp))
== TREE_UNSIGNED (TREE_TYPE (index)))
exp = index;
expand_start_case (1, exp, type, "switch statement");
return exp;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment