Infamous PR fortran/19925
Dominique Dhumieres
dominiq@lps.ens.fr
Sun Sep 14 19:57:00 GMT 2008
Steve,
Thanks for the patch which a step in the right direction.
It worked as expected on my tests replacing an unneeded ICE
by an error. I have the following comments:
(1) Why restrict max-array-constructor to values above 65535?
Some users may want to set it to a lower value to abort the
compilation sooner. BTW it seems that values lower than 65535
are silently set to it.
(2) Could the error message be more user friendly?
(a) is the locus of the error lost when it is emitted?
if not it would be nice to have the location of the offending
constructor (or any other info about it).
(b) I think the maximum size should be given in the error message.
(c) "Array constructor expansion" may be difficult to understand
for lay users. Why not something such as "The number of elements
in a constructor is greater than the maximum value 65535 ..."
(or whatever you like to fix my Frenglish).
(3) The following code:
INTEGER, PARAMETER :: N=100000
INTEGER, PARAMETER :: I(N)=(/(MOD(K,2),K=1,N)/)
INTEGER, PARAMETER :: M(N)=I(N:1:-1)
END
(comment #10) still gives:
[ibook-dhum] f90/bug% time gfc pr19925_1.f90
pr19925_1.f90:3.36:
INTEGER, PARAMETER :: M(N)=I(N:1:-1)
1
Error: Initialization expression didn't reduce (1)
307.380u 0.810s 5:08.50 99.8% 0+0k 0+5io 0pf+0w
According the bottom line of one of my favorite jokes, gfortran
is still a mathematician:
The answer takes a long time to come, it is absolutely correct,
but totally useless (not knowing the problem, I would have been
unable to trace it from the error message).
Now for the roots of the problem, it seems it occurs from certain uses of
long constructors. For instance the code in pr34554 has certainly constructors
of length greater tha 655535, however size() is still able to manage them.
Does anyone understand why?
Last point, in some future version 4.5(?), the algorithm to build the
constructors could be improved (I have seen something in the gcc wiki
about replacing unnecessary quadratic algorithms by linear ones).
Thanks again for the patch which is already a progress.
Dominique
More information about the Fortran
mailing list