Commit 0b3b617e by Paul Thomas

re PR fortran/45743 (gfortran.dg/whole_file_3.f90 ICE: verify_stmts failed:…

re PR fortran/45743 (gfortran.dg/whole_file_3.f90 ICE: verify_stmts failed: invalid conversion in gimple call with -finline-small-functions)

2011-02-22  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/45743
	* trans-decl.c (gfc_get_extern_function_decl): Don't use the
	gsymbol backend_decl if the procedure has a formal argument
	that is a procedure.

2011-02-22  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/45743
	* gfortran.dg/whole_file_32.f90 : New test.

From-SVN: r170414
parent ca2409f9
2011-02-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/45743
* trans-decl.c (gfc_get_extern_function_decl): Don't use the
gsymbol backend_decl if the procedure has a formal argument
that is a procedure.
2011-02-22 Tobias Burnus <burnus@net-b.de> 2011-02-22 Tobias Burnus <burnus@net-b.de>
PR fortran/41359 PR fortran/41359
......
...@@ -1495,6 +1495,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym) ...@@ -1495,6 +1495,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym)
tree name; tree name;
tree mangled_name; tree mangled_name;
gfc_gsymbol *gsym; gfc_gsymbol *gsym;
bool proc_formal_arg;
if (sym->backend_decl) if (sym->backend_decl)
return sym->backend_decl; return sym->backend_decl;
...@@ -1511,10 +1512,27 @@ gfc_get_extern_function_decl (gfc_symbol * sym) ...@@ -1511,10 +1512,27 @@ gfc_get_extern_function_decl (gfc_symbol * sym)
return the backend_decl. */ return the backend_decl. */
gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name); gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name);
/* Do not use procedures that have a procedure argument because this
can result in problems of multiple decls during inlining. */
proc_formal_arg = false;
if (gsym && gsym->ns && gsym->ns->proc_name)
{
gfc_formal_arglist *formal = gsym->ns->proc_name->formal;
for (; formal; formal = formal->next)
{
if (formal->sym && formal->sym->attr.flavor == FL_PROCEDURE)
{
proc_formal_arg = true;
break;
}
}
}
if (gfc_option.flag_whole_file if (gfc_option.flag_whole_file
&& (!sym->attr.use_assoc || sym->attr.if_source != IFSRC_DECL) && (!sym->attr.use_assoc || sym->attr.if_source != IFSRC_DECL)
&& !sym->backend_decl && !sym->backend_decl
&& gsym && gsym->ns && gsym && gsym->ns
&& !proc_formal_arg
&& ((gsym->type == GSYM_SUBROUTINE) || (gsym->type == GSYM_FUNCTION)) && ((gsym->type == GSYM_SUBROUTINE) || (gsym->type == GSYM_FUNCTION))
&& (gsym->ns->proc_name->backend_decl || !sym->attr.intrinsic)) && (gsym->ns->proc_name->backend_decl || !sym->attr.intrinsic))
{ {
......
2011-02-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/45743
* gfortran.dg/whole_file_32.f90 : New test.
2011-02-22 Dodji Seketeli <dodji@redhat.com> 2011-02-22 Dodji Seketeli <dodji@redhat.com>
PR c++/47666 PR c++/47666
......
! { dg-do compile }
! { dg-options "-O -finline-small-functions" }
! Tests the fix for PR45743 in which the compilation failed with an ICE
! internal compiler error: verify_stmts failed. The source is the essential
! part of whole_file_3.f90.
!
! Contributed by Zdenek Sojka <zsojka@seznam.cz>
!
SUBROUTINE PHLOAD (READER,*)
IMPLICIT NONE
EXTERNAL READER
CALL READER (*1)
1 RETURN 1
END SUBROUTINE
program test
EXTERNAL R
CALL PHLOAD (R, *999) ! This one is OK
999 continue
END program test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment