www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19489] New: Null function call results in no stack trace

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

          Issue ID: 19489
           Summary: Null function call results in no stack trace
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: nightmarex1337 hotmail.com

void function() f = null;
f();

Calling a null function pointer results gives:
object.Error (0): Access Violation
----------------
Program exited with code 1


void function() f = cast(void function())1;
f();

Calling a non-null function pointer gives:
object.Error (0): Access Violation
----------------
0x00000001
0x00423FDB in _Dmain at D:\NX 1337\Projects\BlendUI\src\blendui\main.d(23)
0x00436353 in void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll().__lambda1()
0x004362D5 in void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll()
0x0043616F in _d_run_main
0x00424038 in main at D:\NX 1337\Projects\BlendUI\src\blendui\math\size.d(7)
0x00454FE9 in mainCRTStartup
0x76C28484 in BaseThreadInitThunk
0x771C302C in RtlValidSecurityDescriptor
0x771C2FFA in RtlValidSecurityDescriptor
Program exited with code 1


My quick glance at the trace handler source it seems like null is being used
for determining length of a fixed size stack buffer. (sigh..) This is a rather
frustrating bug and trivial to fix. I had to boot up linux and use gdb to just
debug this nonsense.

--
Dec 14 2018