re PR target/8795 ([PPC] Altivec related bugs concerning gcc 3.3 and mainline)

PR c++/8795
	* tree.h (build_method_type_directly): Declare.
	* c-common.c (handle_vector_size_attributes): Handle METHOD_TYPEs.
	(vector_size_helper): Likewise.
	* tree.c (build_method_type_directly): New function.
	(build_method_type): Use it.

	PR c++/8795
	* cp-tree.h (build_cplus_method_type): Remove.
	* call.c (standard_conversion): Use build_method_type_directly
	instead of build_cplus_method_type.
	* class.c (build_clone): Likewise.
	(adjust_clone_args): Likewise.
	* decl.c (build_ptrmem_type): Likewise.
	(grokdeclarator): Likewise.
	(check_function_type): Likewise.
	* decl2.c (grok_method_quals): Likewise.
	(maybe_retrofit_in_chrg): Likewise.
	* pt.c (copy_default_args_to_explicit_spec): Likewise.
	(tsubst_function_type): Likewise.
	(tsubst): Likewise.
	* tree.c (build_cplus_method_type): Remove.
	* typeck.c (merge_types): Use build_method_type_directly.

	PR c++/8795
	* g++.dg/ext/altivec-1.C: New test.

From-SVN: r70773
This commit is contained in:
Mark Mitchell 2003-08-25 15:47:43 +00:00 committed by Mark Mitchell
parent a30b683917
commit 43dc123f52
14 changed files with 102 additions and 77 deletions

View File

@ -1,3 +1,12 @@
2003-08-25 Mark Mitchell <mark@codesourcery.com>
PR c++/8795
* tree.h (build_method_type_directly): Declare.
* c-common.c (handle_vector_size_attributes): Handle METHOD_TYPEs.
(vector_size_helper): Likewise.
* tree.c (build_method_type_directly): New function.
(build_method_type): Use it.
2003-08-24 Richard Henderson <rth@redhat.com>
* config/i386.i386.c (ix86_return_in_memory): Reformat. Return true

View File

@ -5086,6 +5086,7 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
while (POINTER_TYPE_P (type)
|| TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE
|| TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
@ -5216,12 +5217,19 @@ vector_size_helper (tree type, tree bottom)
else if (TREE_CODE (type) == ARRAY_TYPE)
{
inner = vector_size_helper (TREE_TYPE (type), bottom);
outer = build_array_type (inner, TYPE_VALUES (type));
outer = build_array_type (inner, TYPE_DOMAIN (type));
}
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
inner = vector_size_helper (TREE_TYPE (type), bottom);
outer = build_function_type (inner, TYPE_VALUES (type));
outer = build_function_type (inner, TYPE_ARG_TYPES (type));
}
else if (TREE_CODE (type) == METHOD_TYPE)
{
inner = vector_size_helper (TREE_TYPE (type), bottom);
outer = build_method_type_directly (TYPE_METHOD_BASETYPE (type),
inner,
TYPE_ARG_TYPES (type));
}
else
return bottom;

View File

@ -1,3 +1,22 @@
2003-08-25 Mark Mitchell <mark@codesourcery.com>
PR c++/8795
* cp-tree.h (build_cplus_method_type): Remove.
* call.c (standard_conversion): Use build_method_type_directly
instead of build_cplus_method_type.
* class.c (build_clone): Likewise.
(adjust_clone_args): Likewise.
* decl.c (build_ptrmem_type): Likewise.
(grokdeclarator): Likewise.
(check_function_type): Likewise.
* decl2.c (grok_method_quals): Likewise.
(maybe_retrofit_in_chrg): Likewise.
* pt.c (copy_default_args_to_explicit_spec): Likewise.
(tsubst_function_type): Likewise.
(tsubst): Likewise.
* tree.c (build_cplus_method_type): Remove.
* typeck.c (merge_types): Use build_method_type_directly.
2003-08-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/3765

View File

@ -758,8 +758,9 @@ standard_conversion (tree to, tree from, tree expr)
return 0;
from = cp_build_qualified_type (tbase, cp_type_quals (fbase));
from = build_cplus_method_type (from, TREE_TYPE (fromfn),
TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
from = build_method_type_directly (from,
TREE_TYPE (fromfn),
TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
from = build_ptrmemfunc_type (build_pointer_type (from));
conv = build_conv (PMEM_CONV, from, conv);
}

View File

@ -3833,9 +3833,9 @@ build_clone (tree fn, tree name)
/* If this is subobject constructor or destructor, add the vtt
parameter. */
TREE_TYPE (clone)
= build_cplus_method_type (basetype,
TREE_TYPE (TREE_TYPE (clone)),
parmtypes);
= build_method_type_directly (basetype,
TREE_TYPE (TREE_TYPE (clone)),
parmtypes);
if (exceptions)
TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone),
exceptions);
@ -4012,9 +4012,9 @@ adjust_clone_args (tree decl)
clone_parms);
TREE_TYPE (clone_parms) = TREE_TYPE (orig_clone_parms);
}
type = build_cplus_method_type (basetype,
TREE_TYPE (TREE_TYPE (clone)),
clone_parms);
type = build_method_type_directly (basetype,
TREE_TYPE (TREE_TYPE (clone)),
clone_parms);
if (exceptions)
type = build_exception_variant (type, exceptions);
TREE_TYPE (clone) = type;

View File

@ -4170,7 +4170,6 @@ extern tree build_min (enum tree_code, tree,
extern tree build_min_nt (enum tree_code, ...);
extern tree build_cplus_new (tree, tree);
extern tree get_target_expr (tree);
extern tree build_cplus_method_type (tree, tree, tree);
extern tree build_cplus_staticfn_type (tree, tree, tree);
extern tree build_cplus_array_type (tree, tree);
extern tree hash_tree_cons (tree, tree, tree);

View File

@ -9259,9 +9259,9 @@ build_ptrmem_type (tree class_type, tree member_type)
(class_type,
cp_type_quals (TREE_TYPE (TREE_VALUE (arg_types)))));
member_type
= build_cplus_method_type (class_type,
TREE_TYPE (member_type),
TREE_CHAIN (arg_types));
= build_method_type_directly (class_type,
TREE_TYPE (member_type),
TREE_CHAIN (arg_types));
return build_ptrmemfunc_type (build_pointer_type (member_type));
}
else
@ -10933,7 +10933,9 @@ grokdeclarator (tree declarator,
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
if (current_class_type == NULL_TREE || friendp)
type = build_cplus_method_type (ctype, TREE_TYPE (type),
type
= build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
else
{
@ -10975,8 +10977,9 @@ grokdeclarator (tree declarator,
/* In this case, we will deal with it later. */
;
else if (TREE_CODE (type) == FUNCTION_TYPE)
type = build_cplus_method_type (ctype, TREE_TYPE (type),
TYPE_ARG_TYPES (type));
type = build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
}
}
break;
@ -11412,8 +11415,9 @@ grokdeclarator (tree declarator,
}
}
else if (staticp < 2)
type = build_cplus_method_type (ctype, TREE_TYPE (type),
TYPE_ARG_TYPES (type));
type = build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
}
/* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */
@ -11649,8 +11653,9 @@ grokdeclarator (tree declarator,
}
}
else if (TREE_CODE (type) == FUNCTION_TYPE && staticp < 2)
type = build_cplus_method_type (ctype, TREE_TYPE (type),
TYPE_ARG_TYPES (type));
type = build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
/* Record presence of `static'. */
publicp = (ctype != NULL_TREE
@ -13317,9 +13322,9 @@ check_function_type (tree decl, tree current_function_parms)
{
tree ctype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype)));
TREE_TYPE (decl)
= build_cplus_method_type (ctype,
void_type_node,
FUNCTION_ARG_CHAIN (decl));
= build_method_type_directly (ctype,
void_type_node,
FUNCTION_ARG_CHAIN (decl));
}
else
TREE_TYPE (decl)

View File

@ -154,10 +154,10 @@ grok_method_quals (tree ctype, tree function, tree quals)
? "member function" : "type");
ctype = cp_build_qualified_type (ctype, type_quals);
fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype),
(TREE_CODE (fntype) == METHOD_TYPE
? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
: TYPE_ARG_TYPES (fntype)));
fntype = build_method_type_directly (ctype, TREE_TYPE (fntype),
(TREE_CODE (fntype) == METHOD_TYPE
? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
: TYPE_ARG_TYPES (fntype)));
if (raises)
fntype = build_exception_variant (fntype, raises);
@ -309,8 +309,8 @@ maybe_retrofit_in_chrg (tree fn)
TREE_CHAIN (DECL_ARGUMENTS (fn)) = parms;
/* And rebuild the function type. */
fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)),
arg_types);
fntype = build_method_type_directly (basetype, TREE_TYPE (TREE_TYPE (fn)),
arg_types);
if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)))
fntype = build_exception_variant (fntype,
TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)));

View File

@ -1382,9 +1382,9 @@ copy_default_args_to_explicit_spec (tree decl)
TREE_VALUE (in_charge),
new_spec_types);
new_type = build_cplus_method_type (object_type,
TREE_TYPE (old_type),
new_spec_types);
new_type = build_method_type_directly (object_type,
TREE_TYPE (old_type),
new_spec_types);
}
else
new_type = build_function_type (TREE_TYPE (old_type),
@ -6293,8 +6293,8 @@ tsubst_function_type (tree t,
return error_mark_node;
}
fntype = build_cplus_method_type (r, return_type, TREE_CHAIN
(arg_types));
fntype = build_method_type_directly (r, return_type,
TREE_CHAIN (arg_types));
}
fntype = cp_build_qualified_type_real (fntype, TYPE_QUALS (t), complain);
fntype = build_type_attribute_variant (fntype, TYPE_ATTRIBUTES (t));
@ -6761,9 +6761,9 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
*/
tree method_type;
method_type = build_cplus_method_type (TYPE_MAIN_VARIANT (r),
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
method_type = build_method_type_directly (TYPE_MAIN_VARIANT (r),
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
return build_ptrmemfunc_type (build_pointer_type (method_type));
}
else

View File

@ -373,43 +373,6 @@ get_target_expr (tree init)
}
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments are described by ARGTYPES and whose values
are described by RETTYPE. If each type exists already, reuse it. */
tree
build_cplus_method_type (tree basetype, tree rettype, tree argtypes)
{
register tree t;
tree ptype;
int hashcode;
/* Make a node of the sort we want. */
t = make_node (METHOD_TYPE);
TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
TREE_TYPE (t) = rettype;
ptype = build_pointer_type (basetype);
/* The actual arglist for this function includes a "hidden" argument
which is "this". Put it into the list of argument types. */
argtypes = tree_cons (NULL_TREE, ptype, argtypes);
TYPE_ARG_TYPES (t) = argtypes;
TREE_SIDE_EFFECTS (argtypes) = 1; /* Mark first argtype as "artificial". */
/* If we already have such a type, use the old one and free this one.
Note that it also frees up the above cons cell if found. */
hashcode = TYPE_HASH (basetype) + TYPE_HASH (rettype) +
type_hash_list (argtypes);
t = type_hash_canon (hashcode, t);
if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;
}
static tree
build_cplus_array_type_1 (tree elt_type, tree index_type)
{

View File

@ -708,8 +708,8 @@ merge_types (tree t1, tree t2)
t2 = build_function_type (TREE_TYPE (t2),
TREE_CHAIN (TYPE_ARG_TYPES (t2)));
t3 = merge_types (t1, t2);
t3 = build_cplus_method_type (basetype, TREE_TYPE (t3),
TYPE_ARG_TYPES (t3));
t3 = build_method_type_directly (basetype, TREE_TYPE (t3),
TYPE_ARG_TYPES (t3));
t1 = build_exception_variant (t3, raises);
break;
}

View File

@ -1,3 +1,8 @@
2003-08-25 Mark Mitchell <mark@codesourcery.com>
PR c++/8795
* g++.dg/ext/altivec-1.C: New test.
2003-08-24 Richard Henderson <rth@redhat.com>
* g++.dg/eh/simd-2.C: Add -w for x86.

View File

@ -0,0 +1,15 @@
// { dg-do compile { target powerpc-*-* } } */
/* { dg-options "-maltivec" } */
#include <altivec.h>
int main()
{
return 0;
}
class F32vec4 {
public:
vector float val;
vector float operator++(void) { return val;}
};

View File

@ -2107,6 +2107,7 @@ extern tree build_index_2_type (tree, tree);
extern tree build_array_type (tree, tree);
extern tree build_function_type (tree, tree);
extern tree build_function_type_list (tree, ...);
extern tree build_method_type_directly (tree, tree, tree);
extern tree build_method_type (tree, tree);
extern tree build_offset_type (tree, tree);
extern tree build_complex_type (tree);