This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fortran,patch] PR 41850 - Wrong-code with optional allocatable arrays


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]