www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23006] New: importC: dmd segfaults on static initializer for

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

          Issue ID: 23006
           Summary: importC: dmd segfaults on static initializer for
                    multi-dimensional array inside struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice-on-valid-code, ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

//int x[1][1] = {{1}}; // works
struct { int x[1][1]; } y = { {{1}} };

---
Program received signal SIGSEGV, Segmentation fault.
0x0000555555822310 in structs (this=0x7fffffffcf10, ts=0x7ffff6d5a900) at
src/dmd/initsem.d:699
699                     if (ex.op == EXP.error)
(gdb) i lo
vd = 0x7ffff757f8f0
ex = 0x0
iz = 0x7ffff757fb60
tm = 0x7ffff757f7d0
di = {designatorList = 0x0, initializer = 0x7ffff757fb60}
fieldi = 0
ie = 0x7fffffffce60
sle = 0x555555ab02c5 <OutBuffer::~OutBuffer()+24>
tx = 0x7ffff6d5a900
elems = {0x0}
elements = 0x7ffff6d5b040
nfields = 1
sd = 0x7ffff6d5a6f0
(gdb) bt

src/dmd/initsem.d:699

src/dmd/initsem.d:722

NeedInterpret) (init=0x7ffff757fbc0, sc=0x7ffff6d5a5a0, tx= 0x7ffff757fc80:
0x7ffff6d5a900, needInterpret=dmd.init.NeedInterpret.INITinterpret) at
src/dmd/initsem.d:926

(this=0x7fffffffd3b0, dsym=0x7ffff757fc20) at src/dmd/dsymbolsem.d:1143

(this=0x7ffff757fc20, v=0x7fffffffd3b0) at src/dmd/declaration.d:1653

(dsym=0x7ffff757fc20, sc=0x7ffff6d5a350) at src/dmd/dsymbolsem.d:105

DsymbolSemanticVisitor::attribSemantic(AttribDeclaration*)
(this=0x7fffffffd4a0, ad=0x7ffff757fd50) at src/dmd/dsymbolsem.d:1432

(this=0x7fffffffd4a0, atd=0x7ffff757fd50) at src/dmd/dsymbolsem.d:1444

(this=0x7fffffffd4a0, s=0x7ffff757fd50) at src/dmd/parsetimevisitor.d:71

(this=0x7ffff757fd50, v=0x7fffffffd4a0) at src/dmd/attrib.d:434

(dsym=0x7ffff757fd50, sc=0x7ffff757ffb0) at src/dmd/dsymbolsem.d:105

(this=0x7fffffffd550, s=0x7ffff757fd50) at src/dmd/dsymbolsem.d:1995

dmd.dsymbol.foreachDsymbol(dmd.root.array.Array!(dmd.dsymbol.Dsymbol).Array*,
scope void(dmd.dsymbol.Dsymbol) delegate) (symbols=0x7ffff757fd30, dg=...) at
src/dmd/dsymbol.d:105

(this=0x7fffffffd5d0, m=0x7ffff757f4e0) at src/dmd/dsymbolsem.d:1992

v=0x7fffffffd5d0) at src/dmd/dmodule.d:1450

(dsym=0x7ffff757f4e0, sc=0x0) at src/dmd/dsymbolsem.d:105

dmd.globals.Param) (argc=3, argv=0x7fffffffdd28, params=...) at
src/dmd/mars.d:439

---

line at current commit:
https://github.com/dlang/dmd/blob/863fec775e2dd8b8f4788849d7b8923b70dcf279/src/dmd/initsem.d#L699

--
Apr 10 2022