Bug 24070 – Opaque struct with nested definition when taking pointer segfaults

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-08-05T08:18:46Z
Last change time
2023-08-15T22:23:18Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Richard Cattermole

Comments

Comment #0 by alphaglosined — 2023-08-05T08:18:46Z
From QBE parse.c + all.h: ```c typedef struct Typ Typ; typedef struct Field Field; struct Typ { struct Field { } (*fields)[1]; }; static void parse() { Typ* ty; void* fields = &ty->fields; } ``` Remove either the fields variable declaration (the expression is the problem) in parse or the Field typedef and it'll compile ok otherwise it'll crash.
Comment #1 by dlang-bot — 2023-08-08T11:34:17Z
@dkorpel created dlang/dmd pull request #15518 "Fix 24070 - Opaque struct with nested definition when taking pointer …" fixing this issue: - Fix 24070 - Opaque struct with nested definition when taking pointer segfaults https://github.com/dlang/dmd/pull/15518
Comment #2 by dlang-bot — 2023-08-09T09:54:01Z
dlang/dmd pull request #15518 "Fix 24070 - Opaque struct with nested definition when taking pointer …" was merged into stable: - de542d0fe6e63476a0e8131c7e7bc7b861772b95 by Dennis Korpel: Fix 24070 - Opaque struct with nested definition when taking pointer segfaults https://github.com/dlang/dmd/pull/15518
Comment #3 by dlang-bot — 2023-08-15T22:23:18Z
dlang/dmd pull request #15540 "merge stable" was merged into master: - f1a660553685345514026564f96e2accc1ff142a by Dennis Korpel: Fix 24070 - Opaque struct with nested definition when taking pointer segfaults https://github.com/dlang/dmd/pull/15540