dlang bug - accessing module variable from method segfaults only when using module reference directly

Chris Katko ckatko at gmail.com
Fri Jul 1 12:59:55 UTC 2022


To add, I cannot even access g.world from inside elf's 
constructor.

... which is the function that called it.

````D
Thread 1 "main" received signal SIGSEGV, Segmentation fault.
objects.elf.this(g.pair, objects.atlasHandler) (this=, atlas=, 
_pos=...) at ./src/objects.d:320

(gdb) bt
#0  objects.elf.this(g.pair, objects.atlasHandler) (this=, 
atlas=, _pos=...) at ./src/objects.d:320
#1  worldmod.world_t.this() (this=) at ./src/worldmod.d:60
#2  main.initialize() () at ./src/main.d:110
#3  main.main(immutable(char)[][]).__lambda6() (__capture=) at 
./src/main.d:462
#4  allegro5.system.al_run_allegro(scope int() 
delegate).main_runner(int, char**) ()
#5  allegro5.system.al_run_allegro(scope int() delegate) ()
#6  D main (args=...) at ./src/main.d:461

(gdb) x g.world
0x0:	Cannot access memory at address 0x0

````




More information about the Digitalmars-d-learn mailing list