Thread overview |
---|
February 21, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |blocker -- |
February 21, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl Hardware|x86_64 |All OS|Linux |All Severity|blocker |enhancement --- Comment #1 from Dennis <dkorpel@live.nl> --- This is similar to issue 23726, where I mentioned: > This is a consequence of druntime hooks being translated to templates in the front end: https://github.com/dlang/projects/issues/25 dmd and druntime are tied together. If you run a custom runtime without a hook for appending arrays, then it isn't surprising you get "Error: `object._d_arrayappendT` not found. The current runtime does not support appending array to arrays, or the runtime is corrupt." -- |
February 21, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |WONTFIX -- |
February 21, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WONTFIX |--- --- Comment #2 from ryuukk_ <ryuukk.dev@gmail.com> --- That's shame.., dmd should use its runtime, not mine Specially when i compile with -betterC wich the compiled is supposed to deal with it without a runtime This should be treated as a bug -- |
February 21, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 --- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to ryuukk_ from comment #2) > That's shame.., dmd should use its runtime, not mine > > Specially when i compile with -betterC wich the compiled is supposed to deal with it without a runtime > > > This should be treated as a bug What version of the compiler are you using? I cannot reproduce this. -- |
February 21, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 --- Comment #4 from ryuukk_ <ryuukk.dev@gmail.com> --- DMD64 D Compiler v2.102.1 Installed using the installer script on Ubuntu The bug is only available on Linux, on Windows it compiles and runs fine -- |
February 23, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |INVALID --- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to ryuukk_ from comment #4) > DMD64 D Compiler v2.102.1 > > Installed using the installer script on Ubuntu > > The bug is only available on Linux, on Windows it compiles and runs fine So, if I understand the issue correctly, you are trying to build a program using your custom object.d integrated in the broader druntime? Or are you trying to compile your app.d with -betterC and then you want to link it with your own druntime? Please clarify. Also, the title is misleading, where is CTFE involved? You have provided a program that uses functions in core.atomic. This program is going to use the import paths that you are providing. If you are using a custom druntime, it will use that one. If the function is missing from your druntime, then obviously is going to fail. I don't see how we can fix this. You can compile with betterC and provide the import paths from the normal druntime and then when you link at runtime, you can link with your custom one. But again, this is not a bug in the compiler, it is a misconfiguration issue on the user side. -- |
February 23, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #6 from ryuukk_ <ryuukk.dev@gmail.com> --- All information is provided in my 1st comment Take this code: ``` // dmd -betterC import core.atomic; int count; extern(C) void main() { atomicStore(count, 0); count = (atomicFetchAdd(count, 1) + 1); count = (atomicFetchSub(count, 1) - 1); } ``` create a file main.d, copy/paste the content then create a object.d file next to main.d and copy/paste the content from [1] then compile: ``dmd -betterC main.d`` on linux you'll get an error (check bellow) dmd shouldn't use my object.d, it has nothing to do with COMPILING the program, therefore it is a bug ``` dmd -betterC app.d -- using custom runtime -- /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1107): Error: `object._d_arrayappendT` not found. The current runtime does not support appending array to arrays, or the runtime is corrupt. /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1112): Error: `object._d_arrayappendcTXImpl` not found. The current runtime does not support appending element to arrays, or the runtime is corrupt. /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1121): Error: `object._d_arrayappendT` not found. The current runtime does not support appending array to arrays, or the runtime is corrupt. /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1137): Error: `object._d_arrayappendT` not found. The current runtime does not support appending array to arrays, or the runtime is corrupt. /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(324): called from here: `simpleFormat("\n asm pure nothrow @nogc @trusted\n {\n naked;\n xchg [%0], %1;\n ?2 mov %2, %1;\n ret;\n }\n ", ((string[3] __arrayliteral_on_stack1 = ["RSI", "EDI", null];) , cast(string[])__arrayliteral_on_stack1))` /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(233): Error: template instance `core.internal.atomic.atomicExchange!(MemoryOrder.seq, false, int)` error instantiating /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/atomic.d(127): instantiated from here: `atomicStore!(MemoryOrder.seq, int)` app.d(6): instantiated from here: `atomicStore!(MemoryOrder.seq, int, int)` /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(271): Error: CTFE failed because of previous errors in `simpleFormat` /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/atomic.d(172): Error: template instance `core.internal.atomic.atomicFetchAdd!(MemoryOrder.seq, true, int)` error instantiating app.d(7): instantiated from here: `atomicFetchAdd!(MemoryOrder.seq, int)` /home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/atomic.d(201): Error: template instance `core.internal.atomic.atomicFetchSub!(MemoryOrder.seq, true, int)` error instantiating app.d(8): instantiated from here: `atomicFetchSub!(MemoryOrder.seq, int)` (dmd-2.102.1) ``` [1] - https://gist.github.com/ryuukk/ecd85032b536e431d1350afbf945c3ad -- |
February 23, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 --- Comment #7 from ryuukk_ <ryuukk.dev@gmail.com> --- The problem is CTFE because the atomics module call this function: https://github.com/dlang/dmd/blob/d344030e01688fbe99b82438f4dae8dfa3f6aee3/druntime/src/core/internal/atomic.d#L1097 Wich does ``string append`` wich is not available in -betterC So it is a bug in the compiler, because he don't understand that DMD should use its object.d, not mine, i use -betterC, i don't have string append -- |
February 23, 2023 [Issue 23729] ignore custom object.d for CTFE needs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23729 --- Comment #8 from ryuukk_ <ryuukk.dev@gmail.com> --- The format function is used in a mixin context, therefore it's compile time https://github.com/dlang/dmd/blob/d344030e01688fbe99b82438f4dae8dfa3f6aee3/druntime/src/core/internal/atomic.d#L90 -- |
Copyright © 1999-2021 by the D Language Foundation