This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch,Fortran] PR40949 - Fix gfc_get_function_type to fix -flto failure
- From: Tobias Burnus <burnus at net-b dot de>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Aug 2009 18:34:48 +0200
- Subject: [Patch,Fortran] PR40949 - Fix gfc_get_function_type to fix -flto failure
Hello,
the test case gfortran.dg/proc_ptr_7.f90 fails on the LTO branch with "-flto -O3"
without the attached patch as the function prototype is wrong.
The problem is that if one does not add a trailing void node, the middle end
assumes that one is allowed to pass more arguments (cf. C's "..."). The void
node was added - except for the case of no arguments.
The fix is rather trivial.
Bootstrapped and regtested on x86-64-linux & build and tested with
gfortran.dg/proc_ptr_7.f90 on the LTO branch.
OK for the trunk?
Tobias
PS: Note: -flto implies -fwhole-file.
2009-08-04 Tobias Burnus <burnus@net-b.de>
PR fortran/40949
* trans-types.c (gfc_get_function_type): Fix typelist of
functions without argument.
Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c (revision 150455)
+++ gcc/fortran/trans-types.c (working copy)
@@ -2324,8 +2324,7 @@ gfc_get_function_type (gfc_symbol * sym)
while (nstr--)
typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);
- if (typelist)
- typelist = gfc_chainon_list (typelist, void_type_node);
+ typelist = gfc_chainon_list (typelist, void_type_node);
if (alternate_return)
type = integer_type_node;