re PR fortran/45304 (Functions/subroutines without arguments always treated like varargs)

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
This commit is contained in:
Jakub Jelinek 2010-08-17 20:06:18 +02:00 committed by Jakub Jelinek
parent 1c111d0a58
commit 35d3d688fc
4 changed files with 14 additions and 3 deletions

View 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

View 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. */

View 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);

View 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;