re PR fortran/45304 (Functions/subroutines without arguments always treated like...
authorJakub Jelinek <jakub@redhat.com>
Tue, 17 Aug 2010 18:06:18 +0000 (20:06 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 17 Aug 2010 18:06:18 +0000 (20:06 +0200)
PR fortran/45304
* trans-decl.c (build_library_function_decl_1): Chain on
void_list_node instead of creating a new TREE_LIST.
* trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise.
* trans-types.c (gfc_get_function_type): Likewise.  Set
typelist to void_list_node for the main program.

From-SVN: r163311

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans-types.c

index 77560d10ae41f4388b46caa5311a03bee333637f..67bcf5ab80cc1ac6b13f1c300c484a47511f99b4 100644 (file)
@@ -1,3 +1,12 @@
+2010-08-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/45304
+       * trans-decl.c (build_library_function_decl_1): Chain on
+       void_list_node instead of creating a new TREE_LIST.
+       * trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise.
+       * trans-types.c (gfc_get_function_type): Likewise.  Set
+       typelist to void_list_node for the main program.
+
 2010-08-17  Daniel Kraft  <d@domob.eu>
 
        PR fortran/38936
index 4fb0251054d81c4587e807710da45e3825680aad..1abb0596e7e0165b79961bd7c4d8c197772e6756 100644 (file)
@@ -2353,7 +2353,7 @@ build_library_function_decl_1 (tree name, const char *spec,
   if (nargs >= 0)
     {
       /* Terminate the list.  */
-      arglist = gfc_chainon_list (arglist, void_type_node);
+      arglist = chainon (arglist, void_list_node);
     }
 
   /* Build the function type and decl.  */
index 589e9df7a1d6a1fb1c22f7f3a1d6defc40cf9e5a..aa0db6375e8f08aaf2b14968974c9dfaeeb33932 100644 (file)
@@ -684,7 +684,7 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr)
       type = gfc_typenode_for_spec (&actual->expr->ts);
       argtypes = gfc_chainon_list (argtypes, type);
     }
-  argtypes = gfc_chainon_list (argtypes, void_type_node);
+  argtypes = chainon (argtypes, void_list_node);
   type = build_function_type (gfc_typenode_for_spec (ts), argtypes);
   fndecl = build_decl (input_location,
                       FUNCTION_DECL, get_identifier (name), type);
index 892a73ebd804a96b0697515426dd5e42b7131a7c..a08a7ea357bc76f06463c8c61ca1289a241d392f 100644 (file)
@@ -2357,7 +2357,9 @@ gfc_get_function_type (gfc_symbol * sym)
     typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);
 
   if (typelist)
-    typelist = gfc_chainon_list (typelist, void_type_node);
+    typelist = chainon (typelist, void_list_node);
+  else if (sym->attr.is_main_program)
+    typelist = void_list_node;
 
   if (alternate_return)
     type = integer_type_node;