Segfault for type bound procedure

Environment: NVHPC 20.7 and NVHPC 20.9 on a Manjaro Linux:

nvfortran 20.9-0 LLVM 64-bit target on x86-64 Linux -tp sandybridge 
NVIDIA Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.

Minimal working example: mwe.zip (1.1 KB)
Reference: Tests fail with PGI · Issue #27 · toml-f/toml-f · GitHub

I tried to make one of my Fortran projects compatible with NVHPC/PGI and encountered a strange segfault for a recursive invocation of type bound procedure, involving abstract derived types. I created a hopefully minimal example of the issue (still 200 lines).

The program in mwe.f90 compiles with both NVHPC 20.7 and NVHPC 20.9 using

nvfortran mwe.f90 -g -O0 -traceback && ./a.out

but the resulting binary always segfaults for the invocation of a type bound procedure. I wasn’t able to get more information on this issue by running in gdb so far.

The same example works with GCC, Intel and NAG compilers without issues.

Any help with this issue is appreciated.

Thanks for the report and the great example!

I was able to reproduce the issue here and do agree that it’s compiler issue. As such, I’ve created a problem report (TPR #29300) and sent it to engineering for further evaluation.

Best Regards,
Mat

1 Like

Is there an update on this issue? I’m still hitting this issue with NVHPC 21.3.

Looking at the issue report, it doesn’t appear to be any recent activity on this one. Though I pinged engineering to see if there’s any update.

1 Like

Any update on this? Seems to be still broken in 21.11

❯ nvfortran --version

nvfortran 21.11-0 64-bit target on x86-64 Linux -tp haswell 
NVIDIA Compilers and Tools
Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.
❯ nvfortran mwe.f90
❯ ./a.out
enter: self%list%destroy
zsh: segmentation fault (core dumped)  ./a.out
❯ gdb ./a.out
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...
(gdb) run
Starting program: /home/awvwgk/projects/src/bugs/nv/a.out 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
enter: self%list%destroy

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000000000402321 in a_impl::destroy () at mwe.f90:185
#2  0x0000000000402660 in mwe () at mwe.f90:200
quit)