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
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2bcf5dc2111fea1b99cb03841b93ef4d55d49107 fix Issue 14596 - Error: e2ir: cannot cast malloc(42u) of type void* to type char[] https://github.com/D-Programming-Language/dmd/commit/d872b5a308f1580c6a92a19fe90625e837188fe3 Merge pull request #4667 from Kozzi11/14596 fix Issue 14596 - Error: e2ir: cannot cast malloc(42u) of type void* …
Comment #4 by dlang-bugzilla — 2015-06-10T23:22:52Z
*** Issue 14677 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2015-06-17T21:05:17Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2bcf5dc2111fea1b99cb03841b93ef4d55d49107 fix Issue 14596 - Error: e2ir: cannot cast malloc(42u) of type void* to type char[] https://github.com/D-Programming-Language/dmd/commit/d872b5a308f1580c6a92a19fe90625e837188fe3 Merge pull request #4667 from Kozzi11/14596