Bug 22881 – ICE Index of array outside of bounds at CTFE

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-16T07:18:33Z
Last change time
2022-03-17T02:33:07Z
Keywords
pull
Assigned to
No Owner
Creator
Richard Cattermole

Comments

Comment #0 by alphaglosined — 2022-03-16T07:18:33Z
This appears to have been introduced in 2.080.0/2.080.1. Code: static bar = "hello".ptr[0 .. 6]; Output: Error: unknown, please file report on issues.dlang.org
Comment #1 by dkorpel — 2022-03-16T10:55:20Z
Looks like the function `resolveSlice` from `ctfeexpr.d` is called on `"hello".ptr[0 .. 6];` and returns a `CantExpression` without printing an error, so it ends up printing the generic error.
Comment #2 by dkorpel — 2022-03-16T11:09:13Z
Comment #3 by ibuclaw — 2022-03-16T11:32:59Z
(In reply to Richard Cattermole from comment #0) > This appears to have been introduced in 2.080.0/2.080.1. Before 2.080.0, the error was: string slice `[0 .. 6]` is out of bounds. Since then it was accepted as the null terminator was considered implicitly there. I think you meant that the internal error first appeared between [email protected] and [email protected]. [email protected] compiles this just fine.
Comment #4 by ibuclaw — 2022-03-16T11:35:27Z
(In reply to Dennis from comment #2) > Probably caused by https://github.com/dlang/dmd/pull/8259 Unfortunately, we'd have to do a special kind of bisect to be sure. https://github.com/dlang/dmd/pull/9425
Comment #5 by ibuclaw — 2022-03-16T11:55:23Z
Another likely candidate. https://github.com/dlang/dmd/pull/8261
Comment #6 by dlang-bot — 2022-03-16T16:59:12Z
@ibuclaw created dlang/dmd pull request #13826 "fix Issue 22881 - ICE Index of array outside of bounds at CTFE" fixing this issue: - fix Issue 22881 - ICE Index of array outside of bounds at CTFE https://github.com/dlang/dmd/pull/13826
Comment #7 by dlang-bot — 2022-03-17T02:33:07Z
dlang/dmd pull request #13826 "fix Issue 22881 - ICE Index of array outside of bounds at CTFE" was merged into master: - eef489775b295a64cf4120d53f1b1c0c475854f7 by Iain Buclaw: fix Issue 22881 - ICE Index of array outside of bounds at CTFE https://github.com/dlang/dmd/pull/13826