[Issue 19937] object._d_assert_fail linker error if compiling with -checkaction=context
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 3 20:08:59 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19937
Seb <greeenify at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |greeenify at gmail.com
--- Comment #2 from Seb <greeenify at gmail.com> ---
Demangled:
---
checkaction.o:checkaction.d:function const pure nothrow @nogc @trusted bool
std.uni.Trie!(std.uni.BitPacked!(bool, 1uL).BitPacked, dchar, 1114112uL,
std.uni.sliceBits!(13uL, 21uL).sliceBits, std.uni.sliceBits!(8uL,
13uL).sliceBits, std.uni.sliceBits!(0uL,
8uL).sliceBits).Trie.opIndex!().opIndex(dchar): error: undefined reference to
'pure nothrow @nogc @safe immutable(char)[] object._d_assert_fail!("<", ulong,
ulong)._d_assert_fail(ulong, ulong)'
---
Code generated from DMD looks like this:
```
inout pure nothrow @nogc @system BitPacked!(bool, 1LU) opIndex(ulong idx)
in
{
assert(idx < this.limit, _d_assert_fail(idx,
this.limit));
}
do
{
{
{
assert(idx < this.limit,
_d_assert_fail(idx, this.limit));
}
}
return this.ptr.opIndex(this.ofs + idx);
}
```
...
```
_d_assert_fail!("<", ulong, ulong)
{
pure nothrow @nogc @safe string _d_assert_fail(ulong a, ulong b)
{
import core.internal.dassert : invertCompToken,
miniFormatFakeAttributes, pureAlloc;
string valA = miniFormatFakeAttributes(a);
string valB = miniFormatFakeAttributes(b);
enum string token = ">=";
const const(ulong) totalLen = valA.length + 2LU + valB.length +
2LU;
char[] buffer = cast(char[])pureAlloc(totalLen)[0..totalLen];
ulong n = valA.length;
buffer[0..n] = cast(const(char[]))valA;
buffer[n++] = ' ';
buffer[n..n + 2LU] = ">=";
n += 2LU;
buffer[n++] = ' ';
buffer[n..n + valB.length] = cast(const(char[]))valB;
return delegate () => cast(string)buffer();
}
}
```
but it doesn't appear in the object file:
```
$ nm bar.o | grep assert_fail | ddemangle
0000000000000000 W pure nothrow @nogc @trusted immutable(char)[]
object._d_assert_fail!("<", uint, uint)._d_assert_fail(uint, uint).__lambda3()
0000000000000000 W pure nothrow @nogc @safe immutable(char)[]
object._d_assert_fail!("<", uint, uint)._d_assert_fail(uint, uint)
U pure nothrow @nogc @safe immutable(char)[]
object._d_assert_fail!("<", ulong, ulong)._d_assert_fail(ulong, ulong)
0000000000000000 W pure nothrow @nogc @trusted immutable(char)[]
object._d_assert_fail!(">=", uint, uint)._d_assert_fail(uint, uint).__lambda3()
0000000000000000 W pure nothrow @nogc @safe immutable(char)[]
object._d_assert_fail!(">=", uint, uint)._d_assert_fail(uint, uint)
```
DMD probably thinks that this assertion was already instantiated in Phobos (and
thus should be part of the object file), but it is not as Phobos was build
without -checkaction=context.
--
More information about the Digitalmars-d-bugs
mailing list