[Issue 22616] New: Infinity loop instead of InvalidMemoryOperationError during GC routine

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 21 12:01:33 UTC 2021


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

          Issue ID: 22616
           Summary: Infinity loop instead of InvalidMemoryOperationError
                    during GC routine
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: feklushkin.denis at gmail.com

Issue was introduced in v2.097.0

/+ dub.json:
{
  "name": "test"
}
+/

class C
{
    int i;

    ~this ()
    {
        // It is wrong to allocate during GC collection,
        // but this failed assert allocates and must throw
        // InvalidMemoryOperationError.
        assert(i == 123);
    }
}

void main()
{
    auto c = new C;
}
```

DMD64 D Compiler v2.096.1 - OK

$ dub -f --compiler=dmd --single test.d
Performing "debug" build using dmd for x86_64.
test ~master: building configuration "application"...
Linking...
Running test 
core.exception.InvalidMemoryOperationError at src/core/exception.d(647): Invalid
memory operation
----------------
Program exited with code 1
(as expected)

DMD64 D Compiler v2.097.0 - Infinity wait

$ dub -f --compiler=dmd --single test.d
Performing "debug" build using dmd for x86_64.
test ~master: building configuration "application"...
Linking...
Running test 
(stalled)

Stack after ctrl+c:
#0  0x00007ffff7d05176 in __GI___wait4 (pid=289204, stat_loc=0x7fffffffc68c,
options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00005555557babb3 in std.process.Pid.performWait(bool) ()
#2  0x0000555555700686 in
dub.generators.build.BuildGenerator.runTarget(dub.internal.vibecompat.inet.path.NativePath,
in dub.compilers.buildsettings.BuildSettings, immutable(char)[][],
dub.generators.generator.GeneratorSettings) ()
#3  0x000055555570031b in
dub.generators.build.BuildGenerator.performPostGenerateActions(dub.generators.generator.GeneratorSettings,
in dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]]) ()
#4  0x00005555556e8806 in
dub.generators.generator.ProjectGenerator.generate(dub.generators.generator.GeneratorSettings)
()
#5  0x000055555577e429 in dub.commandline.GenerateCommand.execute(dub.dub.Dub,
immutable(char)[][], immutable(char)[][]) ()
#6  0x000055555577f4ee in dub.commandline.RunCommand.execute(dub.dub.Dub,
immutable(char)[][], immutable(char)[][]) ()
#7  0x000055555571964f in
dub.commandline.runDubCommandLine(immutable(char)[][]) ()
#8  0x00005555557e7258 in rt.dmain2._d_run_main2(char[][], ulong, extern(C)
int(char[][]) function).runAll() ()
#9  0x00005555557e7155 in _d_run_main2 ()
#10 0x00005555557e6fae in _d_run_main ()
#11 0x00007ffff7c627ed in __libc_start_main (main=0x555555788050 <main>,
argc=5, argv=0x7fffffffe7d8, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffe7c8) at ../csu/libc-start.c:332
#12 0x000055555559b2da in _start ()

--


More information about the Digitalmars-d-bugs mailing list