Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 23, 2020 LDC crash when compiling custom barebones runtime | ||||
---|---|---|---|---|
| ||||
Hi, I'm working on a barebones runtime targeting the ARM Cortex M CPU lineup. I've got classes, structs, invariants, asserts and contract compilation working - but whenever I use an interface, despite providing a stub TypeInfo_Interface for it, LDC 1.23.0 and 1.21.0 crashes. I am building on Windows 10 x64. The following is my ldc2 1.23.0 command: > ldc2 app.d object.d rtoslink.d util.d memory.d -defaultlib= -mtriple=arm-none-eabi -mcpu=cortex-m4 -d-debug -gc -float-abi=hard This is the output: > 0x00007FF6B3749649 (0x0000000000000000 0x0000000000000000 0x000000E24E1FDD30 0x0000003F00000002) > 0x00007FF6B57B4FB0 (0x00000233A388C1E0 0x000000E200000000 0x00000233A391F388 0x00007FF6B578DC03) > 0x00007FF6B5742018 (0x00000233A388C678 0x0000000000000040 0x000000E24E1FDC90 0x00000233A388F980) > 0x00007FF6B57558E8 (0x0000000000000050 0x0000000000000168 0x00000233A1850E40 0x0000000000000001) > 0x00007FF6B5773A05 (0x00007FF6B65EBF5B 0x0000000002000002 0x00007FF6B65C2E69 0x0000000000000004) > 0x00007FF6B5703159 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000) > 0x00007FF6B5771510 (0x000000000000000F 0x000000000000000C 0x0032006308000008 0x00000233A1851140) > 0x00007FF6B5887659 (0x0000000000000000 0x000000E24E1FFA08 0x0000000300000001 0x0000000000000000) > 0x00007FF6B5887337 (0x00000233A192B8B8 0x000000E24E1FFCD8 0x000000E24E1FFB10 0x0000000000000000) > 0x00007FF6B58875E3 (0x0000000000000010 0x00007FF600000000 0x00000233A192B9DE 0x0000000000000010) > 0x00007FF6B576BEEC (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000) > 0x00007FF6B58C60C8 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000) > 0x00007FFCA2C17BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s) > 0x00007FFCA2D6CE51 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s) My user code is: > interface I {} > class A : I {} That causes a crash. This is my object.d: https://github.com/0dyl/LWDR/blob/master/source/object.d Not really sure what is failing. Thanks in advance for the help. |
September 23, 2020 Re: LDC crash when compiling custom barebones runtime | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dylan Graham | On Wednesday, 23 September 2020 at 16:48:25 UTC, Dylan Graham wrote:
> [...]
The crash also occurs if I build the runtime and user code as an x86 target.
|
September 23, 2020 Re: LDC crash when compiling custom barebones runtime | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dylan Graham | On Wednesday, 23 September 2020 at 16:50:35 UTC, Dylan Graham wrote:
> The crash also occurs if I build the runtime and user code as an x86 target.
You need to fix the type of the 4th TypeInfo_Class field to `Interface[]` (not `void*[]`; `Interface` is a struct and the instances are generated by the compiler). Then compiling
interface I { void foo(); }
class C : I { void foo() {} }
works fine here for i686.
Using a CI build of LDC (enabled assertions) can help tracking such stuff down.
|
September 23, 2020 Re: LDC crash when compiling custom barebones runtime | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Wednesday, 23 September 2020 at 20:01:16 UTC, kinke wrote:
> On Wednesday, 23 September 2020 at 16:50:35 UTC, Dylan Graham wrote:
>> The crash also occurs if I build the runtime and user code as an x86 target.
>
> You need to fix the type of the 4th TypeInfo_Class field to `Interface[]` (not `void*[]`; `Interface` is a struct and the instances are generated by the compiler). Then compiling
>
> interface I { void foo(); }
> class C : I { void foo() {} }
>
> works fine here for i686.
>
> Using a CI build of LDC (enabled assertions) can help tracking such stuff down.
Oh bugger! I mistyped that declaration. Thanks for the quick help. It works now =)
|
Copyright © 1999-2021 by the D Language Foundation