D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7997 - Optlink issues 'Index Range' error with static zero length array
Summary: Optlink issues 'Index Range' error with static zero length array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: Optlink, rejects-valid
: 16129 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-04-27 04:54 UTC by bearophile_hugs
Modified: 2017-12-18 22:55 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2012-04-27 04:54:06 UTC
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 Don 2012-04-29 00:07:44 UTC
Very similar to bug 5332, probably another symptom of the same bug.
Comment 2 Walter Bright 2017-10-25 03:35:28 UTC
*** Issue 16129 has been marked as a duplicate of this issue. ***
Comment 3 Walter Bright 2017-10-25 07:42:31 UTC
https://github.com/dlang/dmd/pull/7243
Comment 4 github-bugzilla 2017-10-26 12:03:40 UTC
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 github-bugzilla 2017-12-18 22:55:51 UTC
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