Bug 21794 – Internal compiler assertion

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-03T21:38:32Z
Last change time
2021-10-21T21:39:23Z
Keywords
pull
Assigned to
No Owner
Creator
Eyal

Comments

Comment #0 by eyal — 2021-04-03T21:38:32Z
This program triggers an internal compiler assertion (when assertions are enabled in dmd itself): void f(void* p) { const x = cast(ulong)p; } pragma(msg, f(null)); Specifically, the assignment goes thru: private void setValue(VarDeclaration vd, Expression newval) { ... assert((vd.storage_class & (STC.out_ | STC.ref_)) ? isCtfeReferenceValid(newval) : isCtfeValueValid(newval)); ... } and isCtfeValueValid has: case TOK.null_: return tb.ty == Tnull || tb.ty == Tpointer || tb.ty == Tarray || tb.ty == Taarray || tb.ty == Tclass || tb.ty == Tdelegate; which returns false, because tb.ty is Tuns64.
Comment #1 by boris2.9 — 2021-10-15T12:49:41Z
*** Issue 21818 has been marked as a duplicate of this issue. ***
Comment #2 by dlang-bot — 2021-10-15T13:12:51Z
@BorisCarvajal created dlang/dmd pull request #13172 "Fix Issue 21794 - ICE: Assertion hit in dinterpret.d" fixing this issue: - Fix Issue 21794 - ICE: Assertion hit in dinterpret.d https://github.com/dlang/dmd/pull/13172
Comment #3 by dlang-bot — 2021-10-16T09:45:57Z
dlang/dmd pull request #13172 "Fix Issue 21794 - ICE: Assertion hit in dinterpret.d" was merged into stable: - cdfccb118f51348930c6b48f022b044c9e9fc4e5 by Boris Carvajal: Fix Issue 21794 - ICE: Type painted NullExp hits assertion in dinterpret.d https://github.com/dlang/dmd/pull/13172
Comment #4 by dlang-bot — 2021-10-21T21:39:23Z
dlang/dmd pull request #13209 "Merge stable into master" was merged into master: - 712632c647c86bcfb5f68f505905874893c4b23f by Boris Carvajal: Fix Issue 21794 - ICE: Type painted NullExp hits assertion in dinterpret.d https://github.com/dlang/dmd/pull/13209