www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20132] New: segfault on fiber.call() in release mode

https://issues.dlang.org/show_bug.cgi?id=20132

          Issue ID: 20132
           Summary: segfault on fiber.call() in release mode
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

dmd 2.078.1, Manjaro/Arch x86_64. dub 1.16.0, ldc 1.16.0.

When calling a specific Fiber in dub's release mode, the program segfaults. It
works in debug mode, and binaries compiled with ldc are not affected in either
mode. It does not happen on Windows, dmd 2.078.0.

 git clone https://github.com/zorael/tests -b fibersegfault
 cd tests
 dub build -b release-debug
 gdb --ex 'run' --ex 'bt' ./fibersegfault
I reduced it as much as I could, and the resulting source is a brittle mess. Literally changing anything more in it, like removing or reordering function calls, makes the segfault go away. It's only good for reproducing the segfault and debugging, not for reasoning about.
 Program received signal SIGSEGV, Segmentation fault.
 0x00005555555a355b in
_D8kameloso7plugins4help13onCommandHelpFCQBnQBhQBc10HelpPluginSQCj3irc4d
fs8IRCEventZ2dgMFZv (__capture=0x0) at source/kameloso/plugins/help.d:15
 15          void dg()

_D8kameloso7plugins4help13onCommandHelpFCQBnQBhQBc10HelpPluginSQCj3irc4d
fs8IRCEventZ2dgMFZv (__capture=0x0) at source/kameloso/plugins/help.d:15

/usr/lib/libphobos2.so.0.87


 Backtrace stopped: Cannot access memory at address 0x7ffff7fce000
__capture=0x0? --
Aug 15 2019