This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: fix for the multiple-decl problem - please test




Sent from my iPhone

On Dec 27, 2008, at 1:23 PM, Daniel Franke <franke.daniel@gmail.com> wrote:


Hi all.


This is the first version of a patch for the multiple-decl problem as
discussed before. It enables middle-end optimizations as inlining, but does
not mark intent(in) arguments as TREE_CONSTANT yet (PR23169), nor does it
enables -fwhole-program. The final patch shall do both.


For now, I'd like to ask you to give it a spin on real-life sources and
benchmarks. I'd like to know if it works for you and if there is a measurable
gain from it, because ... although the results are quite promising, there is
one last test in the testsuite that still fails. It seems to be a
miscompilation of some sort. Here I'd need some help:


$> cat function_module_1.f90
module M1
INTEGER p
CONTAINS
 subroutine AA ()
   implicit NONE
   p = BB ()
 CONTAINS
   function BB()
      integer :: BB
      BB = 1
   end function
 end subroutine
end module

program P1
 USE M1
 implicit none
 p = 0
 call AA ()
 if (p /= 1) call abort
end

$> gfortran-svn -O1 -fdump-tree-optimized function_module_1.f90 && ./ a.out
$> gfortran-svn -O2 -fdump-tree-optimized function_module_1.f90 && ./ a.out
Aborted


The difference between -O1 and -O2 seems to be, that the CALL to AA is
inlined.

$> cat function_module_1.f90.123t.optimized
[...]
p1 ()
{
 static integer(kind=4) bb (void);
 static integer(kind=4) options.1[8] = {68, 255, 0, 0, 0, 1, 0, 1};

<bb 2>:
 _gfortran_set_options (8, &options.1);
 p = 0;
 p = 1;
 _gfortran_abort ();

}
Invalid sum of incoming frequencies 0, should be 9996

With -O1, there is no note about an "invalid sum of incoming frequencies".
Does this ring a bell anywhere? Richard?

Yes the p var_decl was not merged so the middle-end thinks they are two different variables and just props the first value.


Thanks,
Andrew Pinski


Thanks

Daniel

<multiple-decl.diff>


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