D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 22929 - importC: extern array with unknown length gives bounds errors
Summary: importC: extern array with unknown length gives bounds errors
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: ImportC, pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2022-03-25 12:12 UTC by duser
Modified: 2022-03-29 08:10 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 duser 2022-03-25 12:12:52 UTC
two cases:

// 1
extern int xs[];
void fn() { void *xp = &(xs[0]); }

// 2
struct S { char text[4]; };
extern struct S ops[];
char *args[] = { ops[0].text };

Error: array index 0 is out of bounds `[0..0]`
Comment 1 Dlang Bot 2022-03-28 08:39:25 UTC
@WalterBright created dlang/dmd pull request #13902 "fix Issue 22929 - importC: extern array with unknown length gives bou…" fixing this issue:

- fix Issue 22929 - importC: extern array with unknown length gives bounds errors

https://github.com/dlang/dmd/pull/13902
Comment 2 Dlang Bot 2022-03-29 08:10:13 UTC
dlang/dmd pull request #13902 "fix Issue 22929 - importC: extern array with unknown length gives bou…" was merged into master:

- 9cc80f73952cc486c0689032ae62cb92b93ca249 by Walter Bright:
  fix Issue 22929 - importC: extern array with unknown length gives bounds errors

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