Commit 7d149679 by Aldy Hernandez Committed by Aldy Hernandez

Make-lang.in (cp/call.o): Add dependency for target.h.

2003-08-07  Aldy Hernandez  <aldyh@redhat.com>

	* cp/Make-lang.in (cp/call.o): Add dependency for target.h.

	* cp/call.c (standard_conversion): Support opaque types.
	Include target.h.
	(strip_top_quals): Use cp_build_qualified_type instead of
	TYPE_MAIN_VARIANT.

	* cp/typeck.c (convert_for_assignment): Support opaque types.

	* testsuite/g++.dg/other/opaque-1.C: New.

	* testsuite/g++.dg/other/opaque-2.C: New.

From-SVN: r70223
parent d40c829f
2003-08-07 Aldy Hernandez <aldyh@redhat.com>
* cp/Make-lang.in (cp/call.o): Add dependency for target.h.
* cp/call.c (standard_conversion): Support opaque types.
Include target.h.
(strip_top_quals): Use cp_build_qualified_type instead of
TYPE_MAIN_VARIANT.
* cp/typeck.c (convert_for_assignment): Support opaque types.
* testsuite/g++.dg/other/opaque-1.C: New.
* testsuite/g++.dg/other/opaque-2.C: New.
2003-08-06 Aldy Hernandez <aldyh@redhat.com>
* decl.c (grokparms): Use cp_build_qualified_type instead
......
......@@ -249,7 +249,7 @@ cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev
diagnostic.h convert.h
cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(TARGET_H) convert.h
cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
diagnostic.h intl.h gt-cp-call.h convert.h
diagnostic.h intl.h gt-cp-call.h convert.h target.h
cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
except.h
......
......@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */
#include "expr.h"
#include "diagnostic.h"
#include "intl.h"
#include "target.h"
#include "convert.h"
static tree build_field_call (tree, tree, tree);
......@@ -568,7 +569,7 @@ strip_top_quals (tree t)
{
if (TREE_CODE (t) == ARRAY_TYPE)
return t;
return TYPE_MAIN_VARIANT (t);
return cp_build_qualified_type (t, 0);
}
/* Returns the standard conversion path (see [conv]) from type FROM to type
......@@ -792,6 +793,10 @@ standard_conversion (tree to, tree from, tree expr)
&& ICS_STD_RANK (TREE_OPERAND (conv, 0)) <= PROMO_RANK)
ICS_STD_RANK (conv) = PROMO_RANK;
}
else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
&& ((*targetm.vector_opaque_p) (from)
|| (*targetm.vector_opaque_p) (to)))
return build_conv (STD_CONV, to, conv);
else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
&& is_properly_derived_from (from, to))
{
......
......@@ -5533,6 +5533,11 @@ convert_for_assignment (tree type, tree rhs,
rhstype = TREE_TYPE (rhs);
coder = TREE_CODE (rhstype);
if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE
&& ((*targetm.vector_opaque_p) (type)
|| (*targetm.vector_opaque_p) (rhstype)))
return convert (type, rhs);
if (rhs == error_mark_node || rhstype == error_mark_node)
return error_mark_node;
if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
......
/* { dg-do run { target powerpc-*-eabispe* } } */
#define __vector __attribute__((vector_size(8)))
typedef float __vector __ev64_fs__;
__ev64_fs__ f;
__ev64_opaque__ o;
int here = 0;
void bar (__ev64_opaque__ x)
{
here = 0;
}
void bar (__ev64_fs__ x)
{
here = 888;
}
int main ()
{
f = o;
o = f;
bar (f);
if (here != 888)
return 1;
return 0;
}
/* { dg-do compile { target powerpc-*-eabi* } } */
/* { dg-options "-mcpu=8540 -mabi=spe" } */
#define __vector __attribute__((vector_size(8)))
typedef float __vector __ev64_fs__;
__ev64_fs__ f;
__ev64_opaque__ o;
extern void bar (__ev64_opaque__);
int main ()
{
f = o;
o = f;
bar (f);
return 0;
}
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