Bug 20366 – CTFE foreach_reverse on array with utf characters crashes compiler
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-11-07T21:11:02Z
Last change time
2019-11-08T00:27:08Z
Keywords
CTFE, ice, ice-on-valid-code, pull
Assigned to
No Owner
Creator
Suleyman Sahmi (سليمان السهمي)
Comments
Comment #0 by sahmi.soulaimane — 2019-11-07T21:11:02Z
Test case:
```
auto test()
{
const(char)[] s = ['h', 'e', 'l', '\xef', '\xbd', '\x8c', 'o'];
foreach_reverse (dchar c; s)
{
}
return true;
}
static assert(test());
```
Comment #1 by dlang-bot — 2019-11-07T21:21:08Z
@SSoulaimane created dlang/dmd pull request #10547 "Fix issue 20366 - fix a programming bug in ctfe foreach_rverse code" fixing this issue:
- Fix issue 20366 - programming bug in ctfe foreach_rverse code
Index is not decremented which causes bounds checking error.
https://github.com/dlang/dmd/pull/10547
Comment #2 by dlang-bot — 2019-11-08T00:27:08Z
dlang/dmd pull request #10547 "Fix issue 20366 - fix a programming bug in ctfe foreach_reverse code" was merged into stable:
- 450c957dc41fddb7b610ae8e492e8145a3235b85 by سليمان السهمي (Suleyman Sahmi):
Fix issue 20366 - programming bug in ctfe foreach_rverse code
Index is not decremented which causes bounds checking error.
https://github.com/dlang/dmd/pull/10547