This patch makes sure that there is no vararg if the procedure interface is known. Before, for functions and subroutines without arguments, no void_list_node.

(Related, separate and unfixed issue: For procedures without explicit interface, the interface should be deduced from the usage.)

Build and regtested on x86-64-linux.
OK for the trunk?

Tobias
2011-03-22  Tobias Burnus  <bur...@net-b.de>

	PR fortran/48174
	PR fortran/45304
	* trans-types.c (gfc_get_function_type): Don't use varargs if the
	procedure is known to have no arguments.

2011-03-22  Tobias Burnus  <bur...@net-b.de>

	PR fortran/48174
	PR fortran/45304
	* gfortran.dg/ishft_4.f90: Adapt scan-tree-dump-times.
	* gfortran.dg/leadz_trailz_3.f90: Ditto

diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 258685e..8ecceea 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2618,7 +2618,7 @@ gfc_get_function_type (gfc_symbol * sym)
 
   if (typelist)
     typelist = chainon (typelist, void_list_node);
-  else if (sym->attr.is_main_program)
+  else if (sym->attr.is_main_program || sym->attr.if_source != IFSRC_UNKNOWN)
     typelist = void_list_node;
 
   if (alternate_return)
diff --git a/gcc/testsuite/gfortran.dg/ishft_4.f90 b/gcc/testsuite/gfortran.dg/ishft_4.f90
index 0315c7f..4e2ad2b 100644
--- a/gcc/testsuite/gfortran.dg/ishft_4.f90
+++ b/gcc/testsuite/gfortran.dg/ishft_4.f90
@@ -35,6 +35,6 @@ end program
 !   -- once in the function definition itself
 !   -- plus as many times as the function is called
 !
-! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 6 "original" } }
-! { dg-final { scan-tree-dump-times "bar *\\\(\\\)" 6 "original" } }
+! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 5 "original" } }
+! { dg-final { scan-tree-dump-times "bar *\\\(\\\)" 5 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90 b/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90
index f8466ff..b54a11f 100644
--- a/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90
+++ b/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90
@@ -26,5 +26,5 @@ end program
 !   -- once in the function definition itself
 !   -- plus as many times as the function is called
 !
-! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 8 "original" } }
+! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 7 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }

Reply via email to