]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/17297 (ICE with FP vector constructor containing qnan calculation)
authorJakub Jelinek <jakub@redhat.com>
Wed, 19 Jan 2005 09:44:48 +0000 (10:44 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 19 Jan 2005 09:44:48 +0000 (10:44 +0100)
PR c/17297
* c-typeck.c (digest_init): Only call build_vector if all constructor
elements are *_CST nodes.

* gcc.c-torture/compile/20050113-1.c: New testcase.

PR middle-end/19164
* c-typeck.c (digest_init): Only call build_vector if inside_init
is a CONSTRUCTOR.

* gcc.dg/20050113-1.c: New testcase.

From-SVN: r93894

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog

index 6eaafd01c7beb5e5ced2068b73778b1cb25590f5..85510bf8657ae57aeaf786346b22a5a3223c74f8 100644 (file)
@@ -1,3 +1,13 @@
+2005-01-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/17297
+       * c-typeck.c (digest_init): Only call build_vector if all constructor
+       elements are *_CST nodes.
+
+       PR middle-end/19164
+       * c-typeck.c (digest_init): Only call build_vector if inside_init
+       is a CONSTRUCTOR.
+
 2005-01-18  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR debug/16261
index 563ab7d49e088d8e3fe005ddb650b6ee434b0822..c9479f08d12744fdd34574c1e2205f22d5d11a24 100644 (file)
@@ -4097,18 +4097,32 @@ digest_init (tree type, tree init, int require_constant)
   /* Build a VECTOR_CST from a *constant* vector constructor.  If the
      vector constructor is not constant (e.g. {1,2,3,foo()}) then punt
      below and handle as a constructor.  */
-    if (code == VECTOR_TYPE
-        && comptypes (TREE_TYPE (inside_init), type, COMPARE_STRICT)
-        && TREE_CONSTANT (inside_init))
-      {
-       if (TREE_CODE (inside_init) == VECTOR_CST
-           && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
-                         TYPE_MAIN_VARIANT (type),
-                         COMPARE_STRICT))
-         return inside_init;
-       else
-         return build_vector (type, CONSTRUCTOR_ELTS (inside_init));
-      }
+  if (code == VECTOR_TYPE
+      && comptypes (TREE_TYPE (inside_init), type, COMPARE_STRICT)
+      && TREE_CONSTANT (inside_init))
+    {
+      if (TREE_CODE (inside_init) == VECTOR_CST
+         && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
+                       TYPE_MAIN_VARIANT (type),
+                       COMPARE_STRICT))
+       return inside_init;
+
+      if (TREE_CODE (inside_init) == CONSTRUCTOR)
+       {
+         tree link;
+         /* Iterate through elements and check if all constructor
+            elements are *_CSTs.  */
+         for (link = CONSTRUCTOR_ELTS (inside_init);
+              link;
+              link = TREE_CHAIN (link))
+           if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (link))) != 'c')
+             break;
+         if (link == NULL)
+           return build_vector (type, CONSTRUCTOR_ELTS (inside_init));
+       }
+    }
 
   /* Any type can be initialized
      from an expression of the same type, optionally with braces.  */
index 9df14f7c95c0fbea972595477315d3d195332cc6..5261abad4945cac198a0b05c120faa092c7087aa 100644 (file)
@@ -1,3 +1,11 @@
+2005-01-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/17297
+       * gcc.c-torture/compile/20050113-1.c: New testcase.
+
+       PR middle-end/19164
+       * gcc.dg/20050113-1.c: New testcase.
+
 2005-01-18  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * g++.dg/debug/typedef3.C: New test.