OSDN Git Service

2003-08-07 Aldy Hernandez <aldyh@redhat.com>
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Aug 2003 12:49:57 +0000 (12:49 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Aug 2003 12:49:57 +0000 (12:49 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70223 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/call.c
gcc/cp/typeck.c
gcc/testsuite/g++.dg/other/opaque-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/other/opaque-2.C [new file with mode: 0644]

index f6545a8..87f0107 100644 (file)
@@ -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
index 2eeabca..8ab0b55 100644 (file)
@@ -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
index e8b2902..e77aaee 100644 (file)
@@ -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))
     {
index d450d0a..5cb8ed4 100644 (file)
@@ -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 (file)
index 0000000..ad79bfa
--- /dev/null
@@ -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 (file)
index 0000000..efe04e3
--- /dev/null
@@ -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;
+}