https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87838

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to menospaamthereaper from comment #2)
> Thank you Dominique for testing this on a Mac. So perhaps the problem is
> specific to Linux.

I just compiled the test case on Ubuntu 18.04 with gfortran versions 5, 6, 7, 8
and trunk. I don't see a segfault with any of these. Also gdb and valgrind
don't show any kind of problem.


> Additional information that might help with debugging the segmentation fault:
> 
> 1) Compiling this code with
> 
> gfortran -ffree-form -std=f2003 test.f 
> 
> gives the error
> 
> test.f:12:13:
> 
>      f_ptr => f1
>              1
> Error: Fortran 2008: Internal procedure ‘f1’ is invalid in procedure pointer
> assignment at (1)

This error is correct. That's just not allowed in Fortran 2003. All fine.


> 2) However,  
> 
> gfortran -ffree-form -std=f2008 test.f
> 
> compiles successfully but gives a segmentation fault.
> 
> ./a.out 
> 
> Program received signal SIGSEGV: Segmentation fault - invalid memory
> reference.
> 
> Backtrace for this error:
> #0  0x7fe7aae3b31a
> #1  0x7fe7aae3a503
> #2  0x7fe7aaa5ef1f
> #3  0x7fffed8fe6c0
> Segmentation fault (core dumped)

Could you please compile with the -g flag, in order to get a more meaningful
backtrace? Alternatively try running the executable via gdb or valgrind for
further debugging.

Reply via email to