Bug 21004 – dmd segmentation fault with 'void' struct member array initializer

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-07-01T21:16:28Z
Last change time
2024-12-13T19:09:51Z
Keywords
backend, ice
Assigned to
No Owner
Creator
Ali Cehreli
Moved to GitHub: dmd#19738 →

Comments

Comment #0 by acehreli — 2020-07-01T21:16:28Z
Compiling the following code segfaults dmd 2.092.0: struct S { ubyte[1024 * 1024] a = void; } void main() { version (works) { S s; } else { auto s = S(); // Fails } } Compile it with `-version=works' and now it compiles fine. Array size does matter. You may have to use a different size to duplicate. Perhaps related to https://issues.dlang.org/show_bug.cgi?id=17874 Ali
Comment #1 by b2.temp — 2023-01-08T19:53:10Z
that's a stack overflow in outelem(elem*, bool&) (e=0x7216de0, addressOfParam=@0x7fffffffc8a0: false) at src/dmd/backend/out.d:812
Comment #2 by b2.temp — 2023-01-08T20:05:40Z
one thing is that void init of members is not a thing, I've been told recently (*). DMD should process the initializer as a default one instead of processing all the elements. (*): https://github.com/ldc-developers/ldc/issues/4285#issuecomment-1337471489
Comment #3 by robert.schadek — 2024-12-13T19:09:51Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19738 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB