Infinite recursion with memcpy and memset/memclr lowerings

Johan Engelen j at j.nl
Tue Dec 24 13:02:51 UTC 2019


On Thursday, 19 July 2018 at 18:49:07 UTC, Johan Engelen wrote:
> On Thursday, 19 July 2018 at 12:12:28 UTC, Mike Franklin wrote:
>>
>> LDC seems to recognize the body of the function and rewrites 
>> it as `__aeabi_memclr`, causing infinite recursion.  Is there 
>> some way I can instruct the compiler to stop doing that?
>
> You can use `-disable-simplify-libcalls`.
>
> Looks like we need to implement something equivalent to Clang's 
> `-fno-builtin` or `-ffreestanding` etc.  After some quick 
> research, I don't think it is currently possible to disable 
> these optimizations just for one function, can only disable it 
> for one compiler invoke.

LLVM now supports disabling these optimizations per function: 
https://reviews.llvm.org/rG878ab6df033

https://github.com/ldc-developers/ldc/issues/3263




More information about the digitalmars-d-ldc mailing list