aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2003-05-05 19:21:10 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2003-05-05 19:21:10 +0000
commit6035d635b5b0bfb86fcb6413f6828d18ab4cf1f2 (patch)
tree4a6192afeb9e6bb64833b9f3b01f7344ede8dac9
parent50b97e0f2b93e0f715d902301e543ebe71a00b99 (diff)
downloadgcc-6035d635b5b0bfb86fcb6413f6828d18ab4cf1f2.zip
gcc-6035d635b5b0bfb86fcb6413f6828d18ab4cf1f2.tar.gz
gcc-6035d635b5b0bfb86fcb6413f6828d18ab4cf1f2.tar.bz2
20030505.c: New.
2003-05-05 Aldy Hernandez <aldyh@redhat.com> * testsuite/gcc.dg/20030505.c: New. * c-typeck.c (convert_for_assignment): Opaque pointers can interconvert. * config/rs6000/rs6000.c: New global opaque_p_V2SI_type_node. (rs6000_init_builtins): Initialize opaque_p_V2SI_type_node. (spe_init_builtins): Rename all pv2si_type_node to opaque_p_V2SI_type_node. Remove declaration of pv2si_type_node. (is_ev64_opaque_type): Accept opaque pointers. From-SVN: r66495
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/c-typeck.c8
-rw-r--r--gcc/config/rs6000/rs6000.c14
-rw-r--r--gcc/testsuite/gcc.dg/20030505.c21
4 files changed, 50 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4d765a3..a28796e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2003-05-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.dg/20030505.c: New.
+
+ * c-typeck.c (convert_for_assignment): Opaque pointers can
+ interconvert.
+
+ * config/rs6000/rs6000.c: New global opaque_p_V2SI_type_node.
+ (rs6000_init_builtins): Initialize opaque_p_V2SI_type_node.
+ (spe_init_builtins): Rename all pv2si_type_node to
+ opaque_p_V2SI_type_node.
+ Remove declaration of pv2si_type_node.
+ (is_ev64_opaque_type): Accept opaque pointers.
+
2003-05-05 Geoffrey Keating <geoffk@apple.com>
* toplev.c (check_global_declarations): Suppress not-used warning
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 92c64cd..23b7d2d 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4209,12 +4209,20 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
{
tree ttl = TREE_TYPE (type);
tree ttr = TREE_TYPE (rhstype);
+ bool is_opaque_pointer;
+
+ /* Opaque pointers are treated like void pointers. */
+ is_opaque_pointer = ((*targetm.vector_opaque_p) (type)
+ || (*targetm.vector_opaque_p) (rhstype))
+ && TREE_CODE (ttl) == VECTOR_TYPE
+ && TREE_CODE (ttr) == VECTOR_TYPE;
/* Any non-function converts to a [const][volatile] void *
and vice versa; otherwise, targets must be the same.
Meanwhile, the lhs target must have all the qualifiers of the rhs. */
if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
|| comp_target_types (type, rhstype, 0)
+ || is_opaque_pointer
|| (c_common_unsigned_type (TYPE_MAIN_VARIANT (ttl))
== c_common_unsigned_type (TYPE_MAIN_VARIANT (ttr))))
{
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 2f28301..695443a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -147,11 +147,10 @@ const char *rs6000_debug_name;
int rs6000_debug_stack; /* debug stack applications */
int rs6000_debug_arg; /* debug argument handling */
-/* A copy of V2SI_type_node to be used as an opaque type. */
+/* Opaque types. */
static GTY(()) tree opaque_V2SI_type_node;
-
-/* Same, but for V2SF. */
static GTY(()) tree opaque_V2SF_type_node;
+static GTY(()) tree opaque_p_V2SI_type_node;
const char *rs6000_traceback_name;
static enum {
@@ -5645,6 +5644,7 @@ rs6000_init_builtins ()
{
opaque_V2SI_type_node = copy_node (V2SI_type_node);
opaque_V2SF_type_node = copy_node (V2SF_type_node);
+ opaque_p_V2SI_type_node = build_pointer_type (opaque_V2SI_type_node);
if (TARGET_SPE)
spe_init_builtins ();
@@ -5689,7 +5689,6 @@ spe_init_builtins ()
tree endlink = void_list_node;
tree puint_type_node = build_pointer_type (unsigned_type_node);
tree pushort_type_node = build_pointer_type (short_unsigned_type_node);
- tree pv2si_type_node = build_pointer_type (opaque_V2SI_type_node);
struct builtin_description *d;
size_t i;
@@ -5746,7 +5745,7 @@ spe_init_builtins ()
tree void_ftype_v2si_pv2si_int
= build_function_type (void_type_node,
tree_cons (NULL_TREE, opaque_V2SI_type_node,
- tree_cons (NULL_TREE, pv2si_type_node,
+ tree_cons (NULL_TREE, opaque_p_V2SI_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink))));
@@ -5754,7 +5753,7 @@ spe_init_builtins ()
tree void_ftype_v2si_pv2si_char
= build_function_type (void_type_node,
tree_cons (NULL_TREE, opaque_V2SI_type_node,
- tree_cons (NULL_TREE, pv2si_type_node,
+ tree_cons (NULL_TREE, opaque_p_V2SI_type_node,
tree_cons (NULL_TREE,
char_type_node,
endlink))));
@@ -5769,7 +5768,7 @@ spe_init_builtins ()
tree v2si_ftype_pv2si_int
= build_function_type (opaque_V2SI_type_node,
- tree_cons (NULL_TREE, pv2si_type_node,
+ tree_cons (NULL_TREE, opaque_p_V2SI_type_node,
tree_cons (NULL_TREE, integer_type_node,
endlink)));
@@ -14044,6 +14043,7 @@ is_ev64_opaque_type (type)
return (TARGET_SPE
&& (type == opaque_V2SI_type_node
|| type == opaque_V2SF_type_node
+ || type == opaque_p_V2SI_type_node
|| (TREE_CODE (type) == VECTOR_TYPE
&& TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
diff --git a/gcc/testsuite/gcc.dg/20030505.c b/gcc/testsuite/gcc.dg/20030505.c
new file mode 100644
index 0000000..1cd80a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030505.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target powerpc-eabi* } } */
+/* { dg-options "-W" } */
+
+#define __vector __attribute__((vector_size(8)))
+
+typedef float __vector __ev64_fs__;
+typedef int __vector __ev64_opaque__;
+
+__ev64_opaque__ *p1;
+__ev64_fs__ *p2;
+int *x;
+
+extern void f (__ev64_opaque__ *);
+
+int main ()
+{
+ f (x); /* { dg-warning "incompatible pointer type" } */
+ f (p1);
+ f (p2);
+ return 0;
+}