free(): double free detected in tcache 2
Johan
j at j.nl
Tue Aug 24 11:10:47 UTC 2021
On Tuesday, 24 August 2021 at 06:04:12 UTC, workman wrote:
> On Monday, 23 August 2021 at 23:25:19 UTC, max haughton wrote:
>>
>> You need to break, then set the ignore count, then `info
>> breakpoints` (something like you that) will still give you the
>> hit count for that breakpoint
>
>
> Thanks for the tips,
>
>
> ```sh
> Num Type Disp Enb Address What
> 1 breakpoint keep y 0x00000000004b0f90
> <_d_dso_registry>
> breakpoint already hit 3 times
> ```
>
> without lto
>
> ```sh
> Num Type Disp Enb Address What
> 1 breakpoint keep y 0x000000000052ece0
> <_d_dso_registry>
> breakpoint already hit 2 times
>
> ```
OK, so indeed it is what I thought: with LTO _d_dso_registry is
called too often.
The function does initialization or deinit (it is a 'toggle'
operation).
1st call: initialization
2nd call: deinitialization
3rd call: initialization, but here the struct passed probably
contains something that triggers a second free call on a pointer
that was not nulled maybe? Regardless, this third call should
not happen.
Which linker is used in the LTO case? ld.bfd, ld.gold, ld.lld ?
(`ldc2 -v ...` one of the last lines is the C compiler invocation
for linking; check for "-fuse-ld="; if it is not there then just
`ld` is used, check `ld --version`)
Probably the same as this bug:
https://github.com/ldc-developers/ldc/issues/3786
-Johan
More information about the digitalmars-d-ldc
mailing list