[Issue 23729] ignore custom object.d for CTFE needs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 23 14:16:29 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23729

ryuukk_ <ryuukk.dev at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #6 from ryuukk_ <ryuukk.dev at 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

--


More information about the Digitalmars-d-bugs mailing list