[Issue 24070] New: Opaque struct with nested definition when taking pointer segfaults

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 5 08:18:46 UTC 2023


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

          Issue ID: 24070
           Summary: Opaque struct with nested definition when taking
                    pointer segfaults
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: alphaglosined at gmail.com

>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.

--


More information about the Digitalmars-d-bugs mailing list