This is the mail archive of the
mailing list for the GCC project.
Re: Dealing with default recursive procedures in Fortran
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Thomas König <tk at tkoenig dot net>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Fri, 13 Apr 2018 12:08:18 +0100
- Subject: Re: Dealing with default recursive procedures in Fortran
- References: <firstname.lastname@example.org>
On Thu, Apr 12, 2018 at 10:50 PM, Thomas König <email@example.com> wrote:
> Hello world,
> with Fortran 2018, recursive is becoming the default. This will likely
> have a serious impact on many user codes, which often declare large
> arrays which could then overflow stacks, leading to segfaults without
> further explanation.
> What could we do? A few options, not all mutally exclusive.
> We could extend -fmax-stack-var-size so it allocates memory
> from the heap in recursive procedures, too, and set this to
> some default value. Of course, it would also have to free them
> afterwards, but we manage that for allocatable arrays already.
> We could warn when large arrays with sizes known at compile time
> are translated.
> We could use -fsplit-stack by default. How reliable is that
> option? Can it be used, for example, with -fopenmp?
> Is it available on all (relevant) platforms?
Not available on AArch64 (yet, though there are some patches) and Arm
(no current plans that I know of). Probably works best only on x86_64.
I don't think you can rely on that being available everywhere.
Additionally depending on the implementation IIRC that will have a
dependency on a newer glibc as well,so that would depend on a newer
glibc as well for split-stack to work reliably as platforms.