[patch, fortran] PR20923 gfortran slow for large array constructors

Jerry DeLisle jvdelisle@verizon.net
Sat Dec 5 14:50:00 GMT 2009


Dominique Dhumieres wrote:
> Jerry,
> 
> Your patch seems to work as advertised. The only oddity is that the test
> 
> integer, parameter :: n=65536
> integer, parameter :: i(n)=(/(mod(k,2),k=1,n)/)
> integer, parameter :: m(n)=i(n:1:-1)
> print *, i(1), m(1), i(n), m(n)
> end
> 
> gives the error, but there is no error if you remove the print
> statement. Do you understand why?
> 
> Thanks for the work.
> 
> Dominique
> 

The parameters are never used.  The error is not generated until the translate 
phase and at that point, there is nothing to translate.  You can see this by 
looking at the -fdump-tree-original :

MAIN__ ()
{
   integer(kind=4) k;

   (void) 0;
}


main (integer(kind=4) argc, character(kind=1) * * argv)
{
   static integer(kind=4) options.0[8] = {68, 255, 0, 0, 0, 1, 0, 1};

   _gfortran_set_args (argc, argv);
   _gfortran_set_options (8, &options.0[0]);
   MAIN__ ();
   return 0;
}

Regards,

Jerry



More information about the Fortran mailing list