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

            Bug ID: 79446
           Summary: Passing internal procedure as argument causes segfault
                    at runtime
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: townsend at astro dot wisc.edu
  Target Milestone: ---

Created attachment 40709
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40709&action=edit
Example program

Attached program demonstrates my problem. Compiling with:

gfortran -std=f2008 -g -o test_mem test_mem.f90

Running on RHEL (2.6.32-642.13.1.el6.x86_64), I get the following segfault:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x14E10ED8FBB7
#1  0x14E10ED8EDB0
#2  0x354523269F
#3  0x7FFC67EF9B00
Segmentation fault (core dumped)

In gdb:

(gdb) where
#0  0x00007ffe250e7390 in ?? ()
#1  0x0000000000400865 in test_mem_m::do (a=3, theirproc=0x7ffe250e7390) at
test_mem.f90:17
#2  0x0000000000400928 in test_mem () at test_mem.f90:29
#3  0x000000000040095f in main (argc=1, argv=0x7ffe250e9110) at test_mem.f90:25
#4  0x000000354521ed5d in __libc_start_main () from /lib64/libc.so.6
#5  0x0000000000400709 in _start ()

If I change the internal procedure to a non-internal one, the segfault goes
away. Also, I don't experience the segfault on other Linux distros (e.g.,
Gentoo/3.16.5) or Mac OS.

cheers,

Rich

Reply via email to