Bug 14596 – Error: e2ir: cannot cast malloc(42u) of type void* to type char[]
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-17T10:41:00Z
Last change time
2015-06-17T21:05:17Z
Keywords
ice
Assigned to
nobody
Creator
rswhite4
Comments
Comment #0 by rswhite4 — 2015-05-17T10:41:21Z
I believe the error is an ICE and should be fixed, or, at least, the internal filename should not be shown.
dmd 2.067.1
Code:
----
void main() {
import core.stdc.stdlib : malloc;
auto ptr = cast(char[]) malloc(42);
}
----
Comment #1 by dlang-bugzilla — 2015-05-17T16:20:40Z
I believe this is a "soft ICE". Apart from "e2ir:" there is nothing wrong with the error message.
Comment #2 by schveiguy — 2015-05-18T12:46:59Z
Actually, its the presence of the e2ir filename which clues you in that it is an ICE. I've advocated for this to generate an actual ICE assert (see https://issues.dlang.org/show_bug.cgi?id=13810), but it seems this is not something the devs wish to incorporate, or it's too difficult for the benefit.
Essentially, the error is happening in the wrong part of the compiler (if it's supposed to be an error at all).
Comment #3 by github-bugzilla — 2015-05-19T18:07:29Z