OSDN Git Service

* c-typeck.c (digest_init): Add conversion for VECTOR_TYPEs.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Aug 2003 15:17:35 +0000 (15:17 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Aug 2003 15:17:35 +0000 (15:17 +0000)
testsuite:
* gcc.dg/spe1.c: New test.

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

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/spe1.c [new file with mode: 0644]

index 5d2d0a6..e94265e 100644 (file)
@@ -1,3 +1,7 @@
+2003-08-10  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * c-typeck.c (digest_init): Add conversion for VECTOR_TYPEs.
+
 2003-08-10  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.c (mips_no_mips16_string): Remove.
index 922cda8..7d29b19 100644 (file)
@@ -4018,6 +4018,11 @@ digest_init (tree type, tree init, int require_constant)
     {
       if (code == POINTER_TYPE)
        inside_init = default_function_array_conversion (inside_init);
+      
+      if (code == VECTOR_TYPE)
+       /* Although the types are compatible, we may require a
+          conversion.  */
+       inside_init = convert (type, inside_init);
 
       if (require_constant && !flag_isoc99
          && TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR)
index efdfe31..0c82d52 100644 (file)
@@ -1,5 +1,7 @@
 2003-08-10  Nathan Sidwell  <nathan@codesourcery.com>
 
+       * gcc.dg/spe1.c: New test.
+
        PR c++/11670
        * g++.dg/expr/cast2.C: New test.
        
diff --git a/gcc/testsuite/gcc.dg/spe1.c b/gcc/testsuite/gcc.dg/spe1.c
new file mode 100644 (file)
index 0000000..9ce56e0
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile { target powerpc-*-eabi* } } */
+/* { dg-options "-mcpu=8540 -mabi=spe -O0" } */
+
+/* (Test with -O0 so we don't optimize any of them away).  */
+
+
+typedef float __attribute__((vector_size(8))) __ev64_fs__;
+
+static __ev64_opaque__ Foo (void);
+
+void Bar ()
+{
+  __ev64_fs__ fs = Foo ();
+}