Bug 13864 – [REG2.066] tuple expand causes range violation

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-15T12:55:00Z
Last change time
2015-02-18T03:41:22Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
vlevenfeld

Comments

Comment #0 by vlevenfeld — 2014-12-15T12:55:52Z
import std.typecons; void main (string[] args) {/*...}*/ int[] x = [2,3,4]; writeln (x[0]); writeln (x[0.tuple.expand]); // BUG range violation }
Comment #1 by hsteoh — 2014-12-16T15:47:58Z
Seems to work in git HEAD, tested on Linux/64. Maybe this has already been fixed?
Comment #2 by vlevenfeld — 2014-12-16T16:11:10Z
I'm using git HEAD, I still get the range violation. Not only that but this: auto y = x[0]; auto z = x[0.tuple.expand]; // ok runs fine. (got rid of writeln) but also this: auto y = x[0]; writeln (x[0.tuple.expand]); // ok and this: writeln (x[0]); auto z = x[0.tuple.expand]; // ok not sure whats going on, I just recompiled dmd from the latest
Comment #3 by vlevenfeld — 2014-12-16T16:13:16Z
this works as well: writeln (x[0]); auto y = x[0.tuple.expand]; writeln (x[0.tuple.expand]); // ok again??
Comment #4 by vlevenfeld — 2014-12-16T16:15:43Z
its not writeln, this works as well: auto f (T...)(T) { } void main (string[] args) { int[] x = [2,3,4]; f (x[0]); auto a = x[0.tuple.expand]; // range violation if commented out f (x[0.tuple.expand]); }
Comment #5 by vlevenfeld — 2014-12-16T16:20:24Z
It only seems to happen with T[] types, struct with opIndex to catch and print args confirms that the tuple expand call just resolves to a 0 int. Np luck catching it with gdb so far, the violation goes off as soon as that line is reached.
Comment #6 by k.hara.pg — 2014-12-17T15:58:58Z
Comment #7 by github-bugzilla — 2014-12-17T21:40:44Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/872a1b649c3a13f3a6b1bcfdec8e6961671411eb fix Issue 13864 - tuple expand causes range violation https://github.com/D-Programming-Language/dmd/commit/626d64259c0d6d8ebbe6bb54da816558d6137306 Merge pull request #4216 from 9rnsr/fix13864 [REG2.066] Issue 13864 - tuple expand causes range violation
Comment #8 by github-bugzilla — 2015-02-18T03:41:22Z