Commit 270e749d by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/34914 (Member pointer to vector rejected)

	PR c++/34914
	* c-common.c (handle_vector_size_attribute): Only allow
	integral, scalar float and fixed point types.  Handle OFFSET_TYPE
	the same way as pointer, array etc. types.
	* tree.c (reconstruct_complex_type): Handle OFFSET_TYPE.

	* g++.dg/ext/vector10.C: New test.

From-SVN: r131729
parent 2ddd2871
2008-01-22 Jakub Jelinek <jakub@redhat.com> 2008-01-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34914
* c-common.c (handle_vector_size_attribute): Only allow
integral, scalar float and fixed point types. Handle OFFSET_TYPE
the same way as pointer, array etc. types.
* tree.c (reconstruct_complex_type): Handle OFFSET_TYPE.
PR c++/34917 PR c++/34917
* tree.c (build_type_attribute_qual_variant): Call * tree.c (build_type_attribute_qual_variant): Call
build_qualified_type if attributes are equal, but quals are not. build_qualified_type if attributes are equal, but quals are not.
......
...@@ -6031,15 +6031,16 @@ handle_vector_size_attribute (tree *node, tree name, tree args, ...@@ -6031,15 +6031,16 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
while (POINTER_TYPE_P (type) while (POINTER_TYPE_P (type)
|| TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE || TREE_CODE (type) == METHOD_TYPE
|| TREE_CODE (type) == ARRAY_TYPE) || TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == OFFSET_TYPE)
type = TREE_TYPE (type); type = TREE_TYPE (type);
/* Get the mode of the type being modified. */ /* Get the mode of the type being modified. */
orig_mode = TYPE_MODE (type); orig_mode = TYPE_MODE (type);
if (TREE_CODE (type) == RECORD_TYPE if ((!INTEGRAL_TYPE_P (type)
|| TREE_CODE (type) == UNION_TYPE && !SCALAR_FLOAT_TYPE_P (type)
|| TREE_CODE (type) == VECTOR_TYPE && !FIXED_POINT_TYPE_P (type))
|| (!SCALAR_FLOAT_MODE_P (orig_mode) || (!SCALAR_FLOAT_MODE_P (orig_mode)
&& GET_MODE_CLASS (orig_mode) != MODE_INT && GET_MODE_CLASS (orig_mode) != MODE_INT
&& !ALL_SCALAR_FIXED_POINT_MODE_P (orig_mode)) && !ALL_SCALAR_FIXED_POINT_MODE_P (orig_mode))
......
2008-01-22 Jakub Jelinek <jakub@redhat.com> 2008-01-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34914
* g++.dg/ext/vector10.C: New test.
PR c++/34918 PR c++/34918
* g++.dg/other/error23.C: New test. * g++.dg/other/error23.C: New test.
// PR c++/34914
// { dg-do compile }
struct A { int __attribute ((vector_size (8))) x; };
void
foo ()
{
__attribute ((vector_size (8))) int A::*p;
p == 0;
}
...@@ -7631,6 +7631,11 @@ reconstruct_complex_type (tree type, tree bottom) ...@@ -7631,6 +7631,11 @@ reconstruct_complex_type (tree type, tree bottom)
inner, inner,
TREE_CHAIN (TYPE_ARG_TYPES (type))); TREE_CHAIN (TYPE_ARG_TYPES (type)));
} }
else if (TREE_CODE (type) == OFFSET_TYPE)
{
inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
outer = build_offset_type (TYPE_OFFSET_BASETYPE (type), inner);
}
else else
return bottom; return bottom;
......
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