Bug 10742 – CTFE of std.digest.digest.digest() crashes DMD.

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-01T13:39:00Z
Last change time
2013-11-20T08:28:00Z
Assigned to
nobody
Creator
blm768

Comments

Comment #0 by blm768 — 2013-08-01T13:39:19Z
Trying to execute std.digest.digest.digest() in a CTFE context causes DMD (compiled from Git) to crash (at least on win32). import std.digest.md; import std.stdio; template hash(string text) { enum hash = digest!MD5(text); } int main(string[] args) { writeln(hash!"test"); return 0; } Just before crashing, it prints an assertion error message: assert ctfeexpr.c(1816) ae->type->ty == Tsarray || ae->type->ty == Tarray This seems to happen with all available hash types. If the line "copy(range, &hash);" is removed from std.digest.digest.digest(), DMD gives an error message instead of crashing: C:\D\dmd2\windows\bin\..\..\src\phobos\std\bitmanip.d(1885): Error: Unions with overlapping fields are not yet supported in CTFE C:\D\dmd2\windows\bin\..\..\src\phobos\std\bitmanip.d(1862): called from here: nativeToLittleEndianImpl(val) C:\D\dmd2\windows\bin\..\..\src\phobos\std\digest\md.d(443): called from here: nativeToLittleEndian(this._count) test.d(9): called from here: hash.finish() test.d(13): called from here: doHash("test") test.d(17): Error: template instance main.hash!"test" error instantiating However, a little more testing suggests that this error message isn't related to the crash, so it's probably crashing in copy().
Comment #1 by yebblies — 2013-11-20T08:28:00Z
*** This issue has been marked as a duplicate of issue 11535 ***