free(): double free detected in tcache 2

workman workman at gmail.com
Wed Aug 25 06:55:40 UTC 2021


On Tuesday, 24 August 2021 at 11:10:47 UTC, Johan wrote:
>
> 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

I use ld.ldd to do the link, try -flto=full and -flto=thin, has 
same problem:  `free(): double free detected in tcache 2`





More information about the digitalmars-d-ldc mailing list