Segmentation fault in DMD - how to debug?
Dennis
dkorpel at gmail.com
Tue Oct 4 10:10:35 UTC 2022
On Tuesday, 4 October 2022 at 02:13:16 UTC, Walter Bright wrote:
> grep reveals:
>
> https://github.com/dlang/dmd/pull/14517
I have a few more :)
The backend has 4 calls to `util_malloc`, 28 calls to
`mem_malloc`, 2 calls to `mem_malloc2`, 8 calls to `mem_fmalloc`
(why so many `malloc` wrappers?), and 16 calls to `mem_calloc`. I
don't see any checks on those.
Here's one with plain `malloc`:
dmd/backend/dcgcv.d:264
```
d = cast(debtyp_t *) malloc(debtyp_t.sizeof - (d.data).sizeof +
length);
d.length = cast(ushort)length;
```
This one checks, but after memcpy'ing to `null`!
dmd/common/file.d:148
```
name = cast(char*) memcpy(malloc(totalNameLength), filename,
totalNameLength);
name || assert(0, "FileMapping: Out of memory.");
```
More information about the Digitalmars-d
mailing list