From: pault Date: Tue, 22 Feb 2011 20:33:45 +0000 (+0000) Subject: 2011-02-22 Paul Thomas X-Git-Tag: upstream/4.9.2~22624 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04c32837608f6e6a9ad7f466689ef8753206f3ff;p=platform%2Fupstream%2Flinaro-gcc.git 2011-02-22 Paul Thomas 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 PR fortran/45743 * gfortran.dg/whole_file_32.f90 : New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170414 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a19ba0b..159b1be 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2011-02-22 Paul Thomas + + 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 PR fortran/41359 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 616cca8..08207e0 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1495,6 +1495,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym) tree name; tree mangled_name; gfc_gsymbol *gsym; + bool proc_formal_arg; if (sym->backend_decl) return sym->backend_decl; @@ -1511,10 +1512,27 @@ gfc_get_extern_function_decl (gfc_symbol * sym) return the backend_decl. */ 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 && (!sym->attr.use_assoc || sym->attr.if_source != IFSRC_DECL) && !sym->backend_decl && gsym && gsym->ns + && !proc_formal_arg && ((gsym->type == GSYM_SUBROUTINE) || (gsym->type == GSYM_FUNCTION)) && (gsym->ns->proc_name->backend_decl || !sym->attr.intrinsic)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 227f290..14df266 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-22 Paul Thomas + + PR fortran/45743 + * gfortran.dg/whole_file_32.f90 : New test. + 2011-02-22 Dodji Seketeli PR c++/47666 diff --git a/gcc/testsuite/gfortran.dg/whole_file_32.f90 b/gcc/testsuite/gfortran.dg/whole_file_32.f90 new file mode 100644 index 0000000..6626fbd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/whole_file_32.f90 @@ -0,0 +1,20 @@ +! { 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 +! + 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