re PR middle-end/70280 (-fcompare-debug failure (length) with --param=integer-share...
authorJakub Jelinek <jakub@redhat.com>
Thu, 17 Mar 2016 23:00:04 +0000 (00:00 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 17 Mar 2016 23:00:04 +0000 (00:00 +0100)
PR c/70280
* c-typeck.c (composite_type): Don't count void_list_node
into len, if the list is terminated by void_list_node, start
with void_list_node instead of NULL for newargs.  Stop
at void_list_node.

From-SVN: r234312

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

index fa657e588c082cad2fcde7a1b5898aa9f6f25e64..3d57c76cd5817fe717ae9819280e172bdd2dc069 100644 (file)
@@ -1,3 +1,11 @@
+2016-03-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/70280
+       * c-typeck.c (composite_type): Don't count void_list_node
+       into len, if the list is terminated by void_list_node, start
+       with void_list_node instead of NULL for newargs.  Stop
+       at void_list_node.
+
 2016-03-16  Marek Polacek  <polacek@redhat.com>
 
        PR c/70093
index de9d4657799906a0b28ad8c48e106107584d4af5..fb274d5f3c90bc236ca5ed54b4eaba8ea58ad13b 100644 (file)
@@ -518,15 +518,17 @@ composite_type (tree t1, tree t2)
        /* If both args specify argument types, we must merge the two
           lists, argument by argument.  */
 
-       len = list_length (p1);
-       newargs = 0;
+       for (len = 0, newargs = p1;
+            newargs && newargs != void_list_node;
+            len++, newargs = TREE_CHAIN (newargs))
+         ;
 
        for (i = 0; i < len; i++)
          newargs = tree_cons (NULL_TREE, NULL_TREE, newargs);
 
        n = newargs;
 
-       for (; p1;
+       for (; p1 && p1 != void_list_node;
             p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n))
          {
            /* A null type means arg type is not specified.