Skip to content

Instantly share code, notes, and snippets.

@dhermes
Last active August 27, 2019 22:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhermes/f448415b9160b785f503a7361fe40d51 to your computer and use it in GitHub Desktop.
Save dhermes/f448415b9160b785f503a7361fe40d51 to your computer and use it in GitHub Desktop.
WSL failure on closures with gfortran

Ubuntu install, Fortran compiler and valgrind installed via apt install gfortran valgrind.

$ gfortran --version
GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

$ valgrind --version
valgrind-3.11.0

Running a very simple binary that contains a "closure" and a procedure pointer fails on WSL.

Standard Ubuntu (i.e. non-WSL)

$ gfortran -o main simple.f90 main.f90
$ ./main
DEBUG: apply() enter
DEBUG: cube() enter
DEBUG: cube() exit
DEBUG: apply() exit
b = a**3
27 = 3**3
=================================
DEBUG: bar() enter
DEBUG: closure() enter
DEBUG: closure() exit
DEBUG: bar() exit
z = x * (x + y)
10 = 2 * (2 + 3)
$ valgrind ./main
==28624== Memcheck, a memory error detector
==28624== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==28624== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==28624== Command: ./main
==28624==
DEBUG: apply() enter
DEBUG: cube() enter
DEBUG: cube() exit
DEBUG: apply() exit
b = a**3
27 = 3**3
=================================
DEBUG: bar() enter
DEBUG: closure() enter
DEBUG: closure() exit
DEBUG: bar() exit
z = x * (x + y)
10 = 2 * (2 + 3)
==28624==
==28624== HEAP SUMMARY:
==28624==     in use at exit: 0 bytes in 0 blocks
==28624==   total heap usage: 30 allocs, 30 frees, 23,936 bytes allocated
==28624==
==28624== All heap blocks were freed -- no leaks are possible
==28624==
==28624== For counts of detected and suppressed errors, rerun with: -v
==28624== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
$ rm -f main simple.mod

Windows Subsystem for Linux (WSL) Ubuntu

$ gfortran -o main simple.f90 main.f90
$ ./main
DEBUG: apply() enter
DEBUG: cube() enter
DEBUG: cube() exit
DEBUG: apply() exit
b = a**3
27 = 3**3
=================================
DEBUG: bar() enter

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

Backtrace for this error:
#0  0x7FAAE74EBE08
#1  0x7FAAE74EAF90
#2  0x7FAAE71354AF
#3  0x7FFFEF16E6C8
Segmentation fault (core dumped)
$ valgrind ./main
==6787== Memcheck, a memory error detector
==6787== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==6787== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==6787== Command: ./main
==6787==
DEBUG: apply() enter
DEBUG: cube() enter
DEBUG: cube() exit
DEBUG: apply() exit
b = a**3
27 = 3**3
=================================
DEBUG: bar() enter
DEBUG: closure() enter
DEBUG: closure() exit
DEBUG: bar() exit
z = x * (x + y)
10 = 2 * (2 + 3)
==6787==
==6787== HEAP SUMMARY:
==6787==     in use at exit: 0 bytes in 0 blocks
==6787==   total heap usage: 30 allocs, 30 frees, 25,759 bytes allocated
==6787==
==6787== All heap blocks were freed -- no leaks are possible
==6787==
==6787== For counts of detected and suppressed errors, rerun with: -v
==6787== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
$ rm -f main simple.mod

It's unclear if the issue is caused by the closure (that is my hunch) or the procedure pointer. The first example call apply(cube, ...) seems to indicate that a procedure pointer alone is not the issue, but somehow the nesting / closure is.

strace

I have done a strace of the failure and put it in a file checked into this gist:

$ strace ./main 2> strace_wsl.txt
DEBUG: apply() enter
DEBUG: cube() enter
DEBUG: cube() exit
DEBUG: apply() exit
b = a**3
27 = 3**3
=================================
DEBUG: bar() enter
Segmentation fault (core dumped)

And as a comparison also have strace_ubuntu.txt. Comparing the two, it seems that the failure isn't going to show through in the system calls. (Though I have very little experience in this domain.)

program main
use simple, only: foo, cube, apply
implicit none
integer :: a, b
integer :: x, y, z
a = 3
call apply(cube, a, b)
write (*, '(A)') 'b = a**3'
write (*, '(I0, A, I0, A, I0)') b, ' = ', a, '**', 3
write (*, '(A)') '================================='
x = 2
y = 3
call foo(x, y, z)
write (*, '(A)') 'z = x * (x + y)'
write (*, '(I0, A, I0, A, I0, A, I0, A)') &
z, ' = ', x, ' * (', x, ' + ', y, ')'
end program main
module simple
implicit none
private bar
public foo, cube, apply
abstract interface
! f: integer --> integer
integer function scalar_func(x)
implicit none
integer, intent(in) :: x
end function scalar_func
end interface
contains
subroutine bar(f, a, result_)
procedure(scalar_func) :: f
integer, intent(in) :: a
integer, intent(out) :: result_
write (*, '(A)') 'DEBUG: bar() enter'
result_ = a * f(a)
write (*, '(A)') 'DEBUG: bar() exit'
end subroutine bar
subroutine foo(x, y, z)
integer, intent(in) :: x, y
integer, intent(out) :: z
call bar(closure, x, z)
contains
integer function closure(a) result(sum_)
integer, intent(in) :: a
write (*, '(A)') 'DEBUG: closure() enter'
! NOTE: `y` is enclosed in the scope.
sum_ = a + y
write (*, '(A)') 'DEBUG: closure() exit'
end function closure
end subroutine foo
integer function cube(a) result(b)
integer, intent(in) :: a
write (*, '(A)') 'DEBUG: cube() enter'
b = a * a * a
write (*, '(A)') 'DEBUG: cube() exit'
end function cube
subroutine apply(f, a, b)
procedure(scalar_func) :: f
integer, intent(in) :: a
integer, intent(out) :: b
write (*, '(A)') 'DEBUG: apply() enter'
b = f(a)
write (*, '(A)') 'DEBUG: apply() exit'
end subroutine apply
end module simple
execve("./main", ["./main"], [/* 74 vars */]) = 0
brk(NULL) = 0xffb000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5918e32000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=122934, ...}) = 0
mmap(NULL, 122934, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5918e13000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libgfortran.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\250\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1223128, ...}) = 0
mmap(NULL, 3318712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f59188e4000
mprotect(0x7f5918a0d000, 2093056, PROT_NONE) = 0
mmap(0x7f5918c0c000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x128000) = 0x7f5918c0c000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f591851a000
mprotect(0x7f59186da000, 2097152, PROT_NONE) = 0
mmap(0x7f59188da000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f59188da000
mmap(0x7f59188e0000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f59188e0000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libquadmath.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`$\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=257208, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5918e12000
mmap(NULL, 2352304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f59182db000
mprotect(0x7f5918319000, 2093056, PROT_NONE) = 0
mmap(0x7f5918518000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3d000) = 0x7f5918518000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0V\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1088952, ...}) = 0
mmap(NULL, 3178744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5917fd2000
mprotect(0x7f59180da000, 2093056, PROT_NONE) = 0
mmap(0x7f59182d9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x107000) = 0x7f59182d9000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=89696, ...}) = 0
mmap(NULL, 2185488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5917dbc000
mprotect(0x7f5917dd2000, 2093056, PROT_NONE) = 0
mmap(0x7f5917fd1000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f5917fd1000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5918e11000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5918e10000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5918e0f000
arch_prctl(ARCH_SET_FS, 0x7f5918e10700) = 0
mprotect(0x7f59188da000, 16384, PROT_READ) = 0
mprotect(0x7f59182d9000, 4096, PROT_READ) = 0
mprotect(0x7f5918518000, 4096, PROT_READ) = 0
mprotect(0x7f5918c0c000, 4096, PROT_READ) = 0
mprotect(0x601000, 4096, PROT_READ) = 0
mprotect(0x7f5918e34000, 4096, PROT_READ) = 0
munmap(0x7f5918e13000, 122934) = 0
brk(NULL) = 0xffb000
brk(0x101c000) = 0x101c000
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 23), ...}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 23), ...}) = 0
fstat(2, {st_mode=S_IFREG|0664, st_size=4625, ...}) = 0
readlink("/proc/self/exe", "${GIST_ROOT}/f44"..., 256) = 66
rt_sigaction(SIGQUIT, {0x7f59188fef30, [QUIT], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGILL, {0x7f59188fef30, [ILL], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGABRT, {0x7f59188fef30, [ABRT], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGFPE, {0x7f59188fef30, [FPE], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSEGV, {0x7f59188fef30, [SEGV], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGBUS, {0x7f59188fef30, [BUS], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSYS, {0x7f59188fef30, [SYS], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTRAP, {0x7f59188fef30, [TRAP], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGXCPU, {0x7f59188fef30, [XCPU], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGXFSZ, {0x7f59188fef30, [XFSZ], SA_RESTORER|SA_RESTART, 0x7f591854f4b0}, {SIG_DFL, [], 0}, 8) = 0
access("/usr/local/sbin/addr2line", R_OK|X_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/bin/addr2line", R_OK|X_OK) = -1 ENOENT (No such file or directory)
access("/usr/sbin/addr2line", R_OK|X_OK) = -1 ENOENT (No such file or directory)
access("/usr/bin/addr2line", R_OK|X_OK) = 0
write(1, "DEBUG: apply() enter\n", 21) = 21
write(1, "DEBUG: cube() enter\n", 20) = 20
write(1, "DEBUG: cube() exit\n", 19) = 19
write(1, "DEBUG: apply() exit\n", 20) = 20
write(1, "b = a**3\n", 9) = 9
write(1, "27 = 3**3\n", 10) = 10
write(1, "================================"..., 34) = 34
write(1, "DEBUG: bar() enter\n", 19) = 19
write(1, "DEBUG: closure() enter\n", 23) = 23
write(1, "DEBUG: closure() exit\n", 22) = 22
write(1, "DEBUG: bar() exit\n", 18) = 18
write(1, "z = x * (x + y)\n", 16) = 16
write(1, "10 = 2 * (2 + 3)\n", 17) = 17
exit_group(0) = ?
+++ exited with 0 +++
execve("./main", ["./main"], [/* 22 vars */]) = 0
brk(NULL) = 0x1390000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b37830000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=41357, ...}) = 0
mmap(NULL, 41357, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3b37834000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libgfortran.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\250\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1223128, ...}) = 0
mmap(NULL, 3318712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b372d0000
mprotect(0x7f3b373f9000, 2093056, PROT_NONE) = 0
mmap(0x7f3b375f8000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x128000) = 0x7f3b375f8000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b36f00000
mprotect(0x7f3b370c0000, 2097152, PROT_NONE) = 0
mmap(0x7f3b372c0000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f3b372c0000
mmap(0x7f3b372c6000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3b372c6000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libquadmath.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`$\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=257208, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b37820000
mmap(NULL, 2352304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b36cc0000
mprotect(0x7f3b36cfe000, 2093056, PROT_NONE) = 0
mmap(0x7f3b36efd000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3d000) = 0x7f3b36efd000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0V\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1088952, ...}) = 0
mmap(NULL, 3178744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b369b0000
mprotect(0x7f3b36ab8000, 2093056, PROT_NONE) = 0
mmap(0x7f3b36cb7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x107000) = 0x7f3b36cb7000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=89696, ...}) = 0
mmap(NULL, 2185488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b36790000
mprotect(0x7f3b367a6000, 2093056, PROT_NONE) = 0
mmap(0x7f3b369a5000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f3b369a5000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b37810000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b37800000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b377f0000
arch_prctl(ARCH_SET_FS, 0x7f3b37800700) = 0
mprotect(0x7f3b372c0000, 16384, PROT_READ) = 0
mprotect(0x7f3b36cb7000, 4096, PROT_READ) = 0
mprotect(0x7f3b36efd000, 4096, PROT_READ) = 0
mprotect(0x7f3b375f8000, 4096, PROT_READ) = 0
mprotect(0x601000, 4096, PROT_READ) = 0
mprotect(0x7f3b37825000, 4096, PROT_READ) = 0
munmap(0x7f3b37834000, 41357) = 0
brk(NULL) = 0x1390000
brk(0x13b1000) = 0x13b1000
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
fstat(2, {st_mode=S_IFREG|0666, st_size=4623, ...}) = 0
readlink("/proc/self/exe", "${GIST_ROOT}/f448"..., 256) = 65
rt_sigaction(SIGQUIT, {0x7f3b372eaf30, [QUIT], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGILL, {0x7f3b372eaf30, [ILL], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGABRT, {0x7f3b372eaf30, [ABRT], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGFPE, {0x7f3b372eaf30, [FPE], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGSEGV, {0x7f3b372eaf30, [SEGV], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGBUS, {0x7f3b372eaf30, [BUS], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGSYS, {0x7f3b372eaf30, [SYS], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGTRAP, {0x7f3b372eaf30, [TRAP], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGXCPU, {0x7f3b372eaf30, [XCPU], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
rt_sigaction(SIGXFSZ, {0x7f3b372eaf30, [XFSZ], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {SIG_DFL, [], SA_RESTORER, 0x7f8103a254b0}, 8) = 0
access("/usr/local/sbin/addr2line", R_OK|X_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/bin/addr2line", R_OK|X_OK) = -1 ENOENT (No such file or directory)
access("/usr/sbin/addr2line", R_OK|X_OK) = -1 ENOENT (No such file or directory)
access("/usr/bin/addr2line", R_OK|X_OK) = 0
write(1, "DEBUG: apply() enter\n", 21) = 21
write(1, "DEBUG: cube() enter\n", 20) = 20
write(1, "DEBUG: cube() exit\n", 19) = 19
write(1, "DEBUG: apply() exit\n", 20) = 20
write(1, "b = a**3\n", 9) = 9
write(1, "27 = 3**3\n", 10) = 10
write(1, "================================"..., 34) = 34
write(1, "DEBUG: bar() enter\n", 19) = 19
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x7ffff8279928} ---
write(2, "\nProgram received signal SIGSEGV"..., 81
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
) = 81
write(2, "\nBacktrace for this error:\n", 27
Backtrace for this error:
) = 27
pipe([3, 4]) = 0
pipe([5, 6]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f3b378009d0) = 7923
close(4) = 0
close(5) = 0
write(6, "7F3B372EBE08", 12) = 12
write(6, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, ":", 1) = 1
read(3, "0", 1) = 1
read(3, "\n", 1) = 1
write(2, "#0 ", 4#0 ) = 4
write(2, "0x", 20x) = 2
write(2, "7F3B372EBE08", 127F3B372EBE08) = 12
write(2, "\n", 1
) = 1
write(6, "7F3B372EAF90", 12) = 12
write(6, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, ":", 1) = 1
read(3, "0", 1) = 1
read(3, "\n", 1) = 1
write(2, "#1 ", 4#1 ) = 4
write(2, "0x", 20x) = 2
write(2, "7F3B372EAF90", 127F3B372EAF90) = 12
write(2, "\n", 1
) = 1
write(6, "7F3B36F354AF", 12) = 12
write(6, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, ":", 1) = 1
read(3, "0", 1) = 1
read(3, "\n", 1) = 1
write(2, "#2 ", 4#2 ) = 4
write(2, "0x", 20x) = 2
write(2, "7F3B36F354AF", 127F3B36F354AF) = 12
write(2, "\n", 1
) = 1
write(6, "7FFFF8279928", 12) = 12
write(6, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, "\n", 1) = 1
read(3, "?", 1) = 1
read(3, "?", 1) = 1
read(3, ":", 1) = 1
read(3, "0", 1) = 1
read(3, "\n", 1) = 1
write(2, "#3 ", 4#3 ) = 4
write(2, "0x", 20x) = 2
write(2, "7FFFF8279928", 127FFFF8279928) = 12
write(2, "\n", 1
) = 1
close(6) = 0
close(3) = 0
wait4(-1, NULL, 0, NULL) = 7923
rt_sigaction(SIGSEGV, {SIG_DFL, [SEGV], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, {0x7f3b372eaf30, [SEGV], SA_RESTORER|SA_RESTART, 0x7f3b36f354b0}, 8) = 0
gettid() = 7922
tgkill(7922, 7922, SIGSEGV) = 0
rt_sigreturn({mask=[]} <unfinished ...>
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_TKILL, si_pid=7922, si_uid=1000} ---
+++ killed by SIGSEGV (core dumped) +++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment