tree.c (build_function_type_list): Work correctly if there are no arguments.
authorIan Lance Taylor <ian@airs.com>
Fri, 11 Feb 2005 15:07:33 +0000 (15:07 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 11 Feb 2005 15:07:33 +0000 (15:07 +0000)
* tree.c (build_function_type_list): Work correctly if there are
no arguments.

From-SVN: r94878

gcc/ChangeLog
gcc/tree.c

index 851f8bbe10d600bcaf58400c48375aac9dbbff23..b5a284a50b76d895ddfc42b9cdf25cbb81d11301 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-11  Ian Lance Taylor  <ian@airs.com>
+
+       * tree.c (build_function_type_list): Work correctly if there are
+       no arguments.
+
 2005-02-11  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config/s390/s390.md ("*cmpdi_cct", "*cmpsi_cct", "*cmpdi_ccs",
index 186594375c791babc9953fedbe0e6a95bf11a664..3d41e114342cfef172dd74cfb06057ec543c3f16 100644 (file)
@@ -4538,9 +4538,14 @@ build_function_type_list (tree return_type, ...)
   for (args = NULL_TREE; t != NULL_TREE; t = va_arg (p, tree))
     args = tree_cons (NULL_TREE, t, args);
 
-  last = args;
-  args = nreverse (args);
-  TREE_CHAIN (last) = void_list_node;
+  if (args == NULL_TREE)
+    args = void_list_node;
+  else
+    {
+      last = args;
+      args = nreverse (args);
+      TREE_CHAIN (last) = void_list_node;
+    }
   args = build_function_type (return_type, args);
 
   va_end (p);