This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran, committed] small fix for whole-file checking


The patch below was committed as obvious after regression
testing on i686-pc-linux-gnu (r145953).

gcc/fortran/:
2009-04-11  Daniel Franke  <frake.daniel@gmail.com>

        * resolve.c (resolve_global_procedure): Enable whole-file checking for
        procedures that are declared later in the file.


gcc/testsuite:
2009-04-11  Daniel Franke  <franke.daniel@gmail.com>

        * gfortran.dg/whole_file_5.f90: New.
        * gfortran.dg/whole_file_6.f90: New.


Cheers

	Daniel


Index: resolve.c
===================================================================
--- resolve.c   (revision 145538)
+++ resolve.c   (working copy)
@@ -1610,8 +1610,7 @@ resolve_global_procedure (gfc_symbol *sy
   if (gfc_option.flag_whole_file
        && gsym->type != GSYM_UNKNOWN
        && gsym->ns
-       && gsym->ns->proc_name
-       && gsym->ns->proc_name->formal)
+       && gsym->ns->proc_name)
     {
       /* Make sure that translation for the gsymbol occurs before
         the procedure currently being resolved.  */

! { dg-do "compile" }
! { dg-options "-O3 -fwhole-file -fdump-tree-optimized" }
!
! Check that inlining of functions declared BEFORE usage works.
! If yes, then the dump does not contain a call to F().
!

INTEGER FUNCTION f()
  f = 42
END FUNCTION

PROGRAM main
  INTEGER :: a
  a = f()
  print *, a
END PROGRAM

! { dg-final { scan-tree-dump-times "= f\(\)" 0 "optimized" } }
! { dg-do "compile" }
! { dg-options "-O3 -fwhole-file -fdump-tree-optimized" }
!
! Check that inlining of functions declared AFTER usage works.
! If yes, then the dump does not contain a call to F().
!

PROGRAM main
  INTEGER :: a(3)
  a = f()
  print *, a
END PROGRAM

INTEGER FUNCTION f()
  f = 42.0
END FUNCTION

! { dg-final { scan-tree-dump-times "= f\(\)" 0 "optimized" } }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]