Error: Incompatible declaration of runtime function `_d_arraybounds`

kinke noone at nowhere.com
Sun Aug 23 13:41:18 UTC 2020


On Sunday, 23 August 2020 at 13:25:30 UTC, Adam D. Ruppe wrote:
> A little known fact is dmd actually provides index and length 
> for RangeError in e2ir.d, but druntime doesn't do anything with 
> it.
>
> I just tried defining an object.d in ldc with this:
>
> extern(C) void _d_arraybounds(string file, size_t line, size_t 
> lwr, size_t upr, size_t length) {}
>
>
> to take advantage of this data and ldc outright rejected it. I 
> don't really know my way around the ldc source... what can I do 
> about this?

Such hacks don't work with LDC and its strongly typed IR, so we 
don't pass these unused extra args. You can grep the src for 
`_d_arraybounds`, adjusting the signature of this runtime hook 
and the call site in DtoBoundsCheckFailCall(), but will have to 
adapt more code to forward the extra args to the latter function.


More information about the digitalmars-d-ldc mailing list