Bug 7997 – Optlink issues 'Index Range' error with static zero length array

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
tools
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-04-27T04:54:06Z
Last change time
2017-12-18T22:55:51Z
Keywords
Optlink, rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
See also
https://issues.dlang.org/show_bug.cgi?id=5332

Comments

Comment #0 by bearophile_hugs — 2012-04-27T04:54:06Z
This program compiles with no errors: void main() { int[0] foos; foreach (f; foos) {} } But the following 3 ones: int[0] foos; void main() { foreach (f; foos) {} } void main() { static int[0] foos; foreach (f; foos) {} } void main() { __gshared int[0] foos; foreach (f; foos) {} } Crash Optlink with error (DMD 2.060alpha): OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html bug3.obj(bug3) Offset 002C3H Record Type 009D Error 16: Index Range
Comment #1 by clugdbug — 2012-04-29T00:07:44Z
Very similar to bug 5332, probably another symptom of the same bug.
Comment #2 by bugzilla — 2017-10-25T03:35:28Z
*** Issue 16129 has been marked as a duplicate of this issue. ***
Comment #3 by bugzilla — 2017-10-25T07:42:31Z
Comment #4 by github-bugzilla — 2017-10-26T12:03:40Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/d4883f2a95a3e7ffe9feb09c688b7a1ef38e45f2 fix Issue 7997 - Optlink issues 'Index Range' error with static zero length array https://github.com/dlang/dmd/commit/4a62e8479c64b371878f23f0e77c154893613aea Merge pull request #7243 from WalterBright/fix7997 fix Issue 7997 - Optlink issues 'Index Range' error with static zero …
Comment #5 by github-bugzilla — 2017-12-18T22:55:51Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/d4883f2a95a3e7ffe9feb09c688b7a1ef38e45f2 fix Issue 7997 - Optlink issues 'Index Range' error with static zero length array https://github.com/dlang/dmd/commit/4a62e8479c64b371878f23f0e77c154893613aea Merge pull request #7243 from WalterBright/fix7997