This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Fortran,patch] PR 41850 - Wrong-code with optional allocatable arrays
- From: Tobias Burnus <burnus at net-b dot de>
- To: Dominique Dhumieres <dominiq at lps dot ens dot fr>
- Cc: fortran at gcc dot gnu dot org
- Date: Sat, 31 Oct 2009 11:06:47 +0100
- Subject: Re: [Fortran,patch] PR 41850 - Wrong-code with optional allocatable arrays
- References: <20091031090510.1A5CA3BE85@mailhost.lps.ens.fr>
Hello Dominique,
Dominique Dhumieres wrote:
> With your patch the executable for the following code gives a bus error:
>
> subroutine sub1c(a)
> integer, pointer,optional :: a
> call sub2(a) ! <<< VALID or NOT?
> end subroutine sub1c
> subroutine sub2(b)
> integer, optional :: b
>
NAG f95 -C=all and gfortran -fcheck=all agree that it is invalid:
Reference to OPTIONAL argument A which is not PRESENT
Program terminated by fatal error
In SUB1C, line 21 of aaa.f90
Called by $main$, line 7 of aaa.f90
At line 21 of file aaa.f90
Fortran runtime error: Pointer actual argument 'a' is not associated or
not present
And ifort runs silently until one uses "-check all" - then it crashes
with a segfault. While g95 crashes with default options.
I think it is invalid, though I have not (yet) checked the standard.
Tobias