www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22397] New: Out of memory during compilation

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

          Issue ID: 22397
           Summary: Out of memory during compilation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kulhanek.5 wright.edu


---
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
predefs   DigitalMars Posix linux ELFv1 CRuntime_Glibc CppRuntime_Gcc
LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC
assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary    dmd
version   v2.090.0
config    /etc/dmd.conf
DFLAGS    -I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import
-L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic -fPIC
---
core.exception.OutOfMemoryError src/core/exception.d(647): Memory allocation
failed
----------------Segmentation fault


The same error appears in the Windows build (on Windows 10).

predefs DigitalMars Windows CRuntime_DigitalMars CppRuntime_DigitalMars
LittleEndian D_Version2 all D_InlineAsm D_InlineAsm_X86 X86 Win32 assert
D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
version v2.089.1-dirty



import std.file, std.stdio, std.algorithm, std.array, std.path;

void print(R)(R entries, uint depth) {
        entries
                .map!(a => a[depth..$])
                .filter!(a => a.length > 1)
                .map!(a => a[1..$])
                .print(depth + 1);
}

void main() {
        dirEntries(".", SpanMode.depth)
                .map!(a => a.name.pathSplitter.array)
                .print(0);
}

--
Oct 16 2021