This is the mail archive of the
mailing list for the GCC project.
Re: Infamous PR fortran/19925
- From: "Paul Richard Thomas" <paul dot richard dot thomas at gmail dot com>
- To: "Steve Kargl" <sgk at troutmask dot apl dot washington dot edu>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 14 Sep 2008 11:20:57 +0200
- Subject: Re: Infamous PR fortran/19925
- References: <20080914051717.GA19461@troutmask.apl.washington.edu>
On Sun, Sep 14, 2008 at 7:17 AM, Steve Kargl
> Well, I spent some time last week thinking about PR
> fortran/19925 and have decided that the best option
> may be to punt. Consider the somewhat far fetched
> but legal Fortran,
I concur with you completely on this. I have visited this PR on one
or two occasions and have failed to come up with any better
alternative. Maybe a warning like that at the head of module files
should be emitted? :-)
OK for trunk
> program test
> implicit none
> integer j
> integer, parameter :: n = 1000000
> integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)
> real :: x(i(5))
> do j = 1, i(5)
> x(j) = sin(i(j) * 1.23)
> end do
> print *, x
> end program test
> Most possible solutions that I could fathom would inhibit
> the optimizer from possibly optimizing the above loop.
> So, I've come up with the following patch. It does not
> fix the compile time problem, the memory consumption
> problem during compilation, nor the size of an object file.
> It simply gives a user a method (or more appropriately a
> gun) to shoot their feet if they do something like the above.
> The above code will not compile with gfortran. With my
> patch, one can do
> gfortran -fmax-array-construct=1000000 test.f90
> If the gfortran maintainers prefer a better solution, then I'll
> certainly won't be offended.
> 2008-09-13 Steven G. Kargl <firstname.lastname@example.org>
> PR fortran/19925
> * trans-array.c (gfc_trans_array_constructor_value): Replace an
> internal_error with gfc_error_now.
> * array.c: Remove GFC_MAX_AC_EXPAND
> (gfc_expand_constructor): Use gfc_option.flag_max_array_constructor.
> * gfortran.h: Add flag_max_array_constructor
> * lang.opt: Add -fmax-array-constructor option.
> * invoke.texi: Document option.
> * options.c (gfc_init_options): Set
> (gfc_handle_option): Process option.
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy