[Issue 20471] TypeInfo_Array incorrectly initialized
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 23 13:13:52 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20471
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
Summary|DMD Crash |TypeInfo_Array incorrectly
| |initialized
--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
The leaf node in the stack trace is object.TypeInfo_Array.toString(), and
looking at that code
(https://github.com/dlang/druntime/blob/2cc13ead1e7e535ef8ebd1f600d4ffb508a93f98/src/object.d#L532):
override string toString() const { return value.toString() ~ "[]"; }
This will fail if value is null. Is it null though?
unittest {
auto a = typeid("");
import std.stdio;
writeln(a.toString());
}
> immutable(char)[]
Doesn't look like it.
unittest {
auto a = typeid("");
assert(a.value !is null, "a.value is null!");
}
> [unittest] a.value is null!
Uhm...
It seems something is special cased when handling TypeInfo, so that the code in
toString() doesn't run at that point. For whatever reason, this
short-circuiting doesn't happen inside DMD, and so it crashes.
--
More information about the Digitalmars-d-bugs
mailing list