D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19890 - ICE: Segmentation fault with negative array size
Summary: ICE: Segmentation fault with negative array size
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 critical
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-05-21 18:31 UTC by Iain Buclaw
Modified: 2019-06-09 14:09 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2019-05-21 18:31:26 UTC
void[] f = cast(void[-1]) "a";
Comment 1 Iain Buclaw 2019-05-21 19:31:01 UTC
And adjusting the size of the static array instead causes a memory allocation failed ICE.  Meaning that the first test triggers an integer overflow.

void[] f = cast(void[-2]) "a";
Comment 2 Iain Buclaw 2019-05-21 19:38:50 UTC
Casting to void[uint.max] causes a segmentation fault in another part of the compiler.

void[] f = cast(void[uint.max]) "a";
Comment 3 Iain Buclaw 2019-05-21 19:42:11 UTC
Casting to void[int.max] causes the backend to run out of memory.

void[] f = cast(void[int.max]) "a";
Comment 4 Dlang Bot 2019-05-22 20:31:38 UTC
@ibuclaw created dlang/dmd pull request #9840 "fix Issue 19890 - ICE: Segmentation fault with negative array size" fixing this issue:

- fix Issue 19890 - ICE: Segmentation fault with negative array size

https://github.com/dlang/dmd/pull/9840
Comment 5 Dlang Bot 2019-05-24 00:14:52 UTC
dlang/dmd pull request #9840 "fix Issue 19890 - ICE: Segmentation fault with negative array size" was merged into master:

- fb7814cc95e504503f6d6f94f3fc4ed2b73715b7 by Iain Buclaw:
  fix Issue 19890 - ICE: Segmentation fault with negative array size

https://github.com/dlang/dmd/pull/9840
Comment 6 Dlang Bot 2019-06-09 14:09:30 UTC
dlang/dmd pull request #10007 "[dmd-cxx] fix Issue 19890 - ICE: Segmentation fault with negative array size" was merged into dmd-cxx:

- 789cf579d506e3b021d9beb47bf43b36bdb629d8 by Iain Buclaw:
  fix Issue 19890 - ICE: Segmentation fault with negative array size

https://github.com/dlang/dmd/pull/10007