]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-typeck.c (digest_init): Add conversion for VECTOR_TYPEs.
authorNathan Sidwell <nathan@codesourcery.com>
Sun, 10 Aug 2003 15:17:35 +0000 (15:17 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Sun, 10 Aug 2003 15:17:35 +0000 (15:17 +0000)
* c-typeck.c (digest_init): Add conversion for VECTOR_TYPEs.
testsuite:
* gcc.dg/spe1.c: New test.

From-SVN: r70296

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

index 5d2d0a6786743ce45e4c9469b73fc8a495b0caae..e94265ec929c4fffc9977fd2dd8bac16223d411d 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 922cda89cf092a16ae60c198e69352103ed90967..7d29b196e957d3f200c6984271391646786f873f 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 efdfe31f3a2a014086c4a48b4d90655374b55328..0c82d526ba5c8df2a1c9edf58e158f569d1f2024 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 ();
+}