www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20562] New: [dmd] Memory allocation failed (ERROR: This is a

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

          Issue ID: 20562
           Summary: [dmd] Memory allocation failed (ERROR: This is a
                    compiler bug)
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

After updating to 2.088.1 from 2.087.1, my project no longer compiles with dmd
under Windows and just throws an OutOfMemoryError.

I bisected it to https://github.com/dlang/dmd/pull/10446, which adds a stack
size linker parameter to dmd's compilation, and thus breaks mine.

 diff --git a/src/build.d b/src/build.d
 index 8b5d59373..592ceb8a8 100755
 --- a/src/build.d
 +++ b/src/build.d
    -361,13 +361,16    alias dmdExe = memoize!(function(string targetSuffix,
string[] extraFlags...)
          target = env["DMD_PATH"] ~ targetSuffix;
          msg = "(DC) DMD%s %-(%s, %)".format(targetSuffix, dmdSources.map!(e
=> e.baseName).array);
          deps = [versionFile, sysconfDirFile, lexer, backend];
 +        string[] platformArgs;
 +        version (Windows)
 +            platformArgs = ["-L/STACK:8388608"];
          command = [
              env["HOST_DMD_RUN"],
              "-of" ~ target,
              "-vtls",
              "-J"~env["G"],
              "-J../res",
 -        ].chain(extraFlags).chain(flags["DFLAGS"], sources).array;
 +        ].chain(extraFlags, platformArgs, flags["DFLAGS"], sources).array;
      }
      return new DependencyRef(dep);
  });
I don't know enough. Assuming it's there for a reason and can't be reverted, can we at least increase the size? Or is there some other way for me to be able to keep using dmd? To test (assuming Windows):
 git clone https://github.com/zorael/kameloso
 cd kameloso

C:\Temp\kameloso>dub build -c vanilla Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. lu:core 0.1.2: target for configuration "library" is up to date. lu:meld 0.1.2: target for configuration "library" is up to date. dialect 0.3.2: target for configuration "library" is up to date. lu 0.1.2: target for configuration "library" is up to date. kameloso 1.5.0+commit.15.g588f6e55: building configuration "vanilla"... --- ERROR: This is a compiler bug. Please report it via https://issues.dlang.org/enter_bug.cgi with, preferably, a reduced, reproducible example and the information below. DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction. --- DMD v2.090.0-dirty predefs WithAdminPlugin WithAutomodePlugin WithBashQuotesPlugin WithChanQueriesService WithChatbotPlugin WithConnectService WithCTCPService WithHelpPlugin WithNotesPlugin WithOnelinersPlugin WithPersistenceService WithPipelinePlugin WithPrinterPlugin WithQuotesPlugin WithSedReplacePlugin WithSeenPlugin WithWebtitlesPlugin WithPlugins Have_kameloso Have_dialect Have_lu FlagAsUpdated Have_lu_core Have_lu_meld DigitalMars Windows CRuntime_Microsoft CppRuntime_Microsoft LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 Win64 D_LP64 assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binary C:\D\dmd2\windows\bin\dmd.exe version v2.090.0-dirty config C:\D\dmd2\windows\bin\sc.ini DFLAGS -IC:\D\dmd2\windows\bin\..\..\src\phobos -IC:\D\dmd2\windows\bin\..\..\src\druntime\import -L/OPT:NOICF --- core.exception.OutOfMemoryError src\core\exception.d(647): Memory allocation failed
 dub remove dialect --version=*
 dub remove lu --version=*
Bisection results: digger: Finding shortest path between 77f556acec92e295ac04e96f800f6d81a8b53ec0 and 2ca17849f4ce2585cb288026241337425385a590... digger: 0 commits (about 0 tests) remaining. digger: 2ca17849f4ce2585cb288026241337425385a590 is the first bad commit commit 2ca17849f4ce2585cb288026241337425385a590 Author: The Dlang Bot <code+dlang-bot dawg.eu> Date: Fri Oct 4 01:17:22 2019 +0200 https://github.com/dlang/dmd/pull/10446 Compile dmd exe in build.d merged-on-behalf-of: Nicholas Wilson <thewilsonator users.noreply.github.com> --
Feb 05 2020