aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2003-08-07 12:49:57 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2003-08-07 12:49:57 +0000
commit7d1496792bf96d5364e31b90656539ce3539c608 (patch)
treef526fe69ca18f05fe4d77fb26284e92bd09419cf
parentd40c829f55c0b35e9b6ce9e9b7da9e6dc56a7941 (diff)
downloadgcc-7d1496792bf96d5364e31b90656539ce3539c608.zip
gcc-7d1496792bf96d5364e31b90656539ce3539c608.tar.gz
gcc-7d1496792bf96d5364e31b90656539ce3539c608.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog15
-rw-r--r--gcc/cp/Make-lang.in2
-rw-r--r--gcc/cp/call.c7
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/testsuite/g++.dg/other/opaque-1.C29
-rw-r--r--gcc/testsuite/g++.dg/other/opaque-2.C18
6 files changed, 74 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f6545a8..87f0107 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,18 @@
+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
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 2eeabca..8ab0b55 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index e8b2902..e77aaee 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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))
{
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d450d0a..5cb8ed4 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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)
diff --git a/gcc/testsuite/g++.dg/other/opaque-1.C b/gcc/testsuite/g++.dg/other/opaque-1.C
new file mode 100644
index 0000000..ad79bfa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/opaque-1.C
@@ -0,0 +1,29 @@
+/* { 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;
+}
diff --git a/gcc/testsuite/g++.dg/other/opaque-2.C b/gcc/testsuite/g++.dg/other/opaque-2.C
new file mode 100644
index 0000000..efe04e3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/opaque-2.C
@@ -0,0 +1,18 @@
+/* { 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;
+}