Menu

#206 x09f segfaults when compiled with -fsanitize=address

open
nobody
None
5
2023-11-16
2023-11-16
No

[For context in this issue, please see these bug reports filed in Debian: 1055228 and 1055750.]

Example x09f in Fortran is generating a segmentation fault when compiled with gfortran option -fsanitize=address. The problem is reproducible on the architectures amd64 and armhf. Here is the reproducer on an amd64 Debian system:

sudo apt install libplplot-dev plplot-examples
cp -r /usr/share/doc/plplot-examples/examples/fortran/ .
cd fortran/
/usr/bin/gfortran x09f.f90 -g -o x09f  -I/usr/include/plplot -I/usr/lib/x86_64-linux-gnu/fortran/modules/plplot -lplplotfortran  -lplfortrandemolib -fsanitize=address
./x09f -dev ps -o /dev/null

The last command produces the following error:

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

Backtrace for this error:
#0  0x7f5f81821772 in ???
#1  0x7f5f81820905 in ???
#2  0x7f5f8157b50f in ???
    at ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
#3  0x7f5f7fb010ec in ???
Segmentation fault

Here is the backtrace in GDB:

$ gdb x09f
[snip]
(gdb) run -dev ps -o /dev/null
Starting program: /var/tmp/fortran/x09f -dev ps -o /dev/null
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff58010ec in ?? ()
(gdb) bt
#0  0x00007ffff58010ec in ?? ()
#1  0x00007ffff7f22ee0 in plplot_double_private_pltransformf2c_data () from /lib/x86_64-linux-gnu/libplplotfortran.so.0
#2  0x00007ffff71c46fc in ?? () from /lib/x86_64-linux-gnu/libplplot.so.17
#3  0x00007ffff71c5881 in plfcont () from /lib/x86_64-linux-gnu/libplplot.so.17
#4  0x00007ffff71c5c69 in c_plcont () from /lib/x86_64-linux-gnu/libplplot.so.17
#5  0x00007ffff7f38964 in __plplot_double_MOD_plcont_impl_data () from /lib/x86_64-linux-gnu/libplplotfortran.so.0
#6  0x000055555555cad4 in x09f () at x09f.f90:129
#7  0x0000555555564336 in main (argc=5, argv=0x7fffffffe2e7) at x09f.f90:35
#8  0x00007ffff72456ca in __libc_start_call_main (main=main@entry=0x5555555642fd <main>, argc=argc@entry=5, argv=argv@entry=0x7fffffffde38) at ../sysdeps/nptl/libc_start_call_main.h:58
#9  0x00007ffff7245785 in __libc_start_main_impl (main=0x5555555642fd <main>, argc=5, argv=0x7fffffffde38, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde28)
    at ../csu/libc-start.c:360
#10 0x0000555555556331 in _start ()

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.