From 29a514fa887ecd77bdba4c1a0424b9cd10aeb5a8 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 17 Mar 2016 23:00:04 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234312 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 8 ++++++++ gcc/c/c-typeck.c | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index fa657e588c0..3d57c76cd58 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2016-03-17 Jakub Jelinek + + 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 PR c/70093 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index de9d4657799..fb274d5f3c9 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -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. -- cgit v1.2.1