Thread overview | |||||
---|---|---|---|---|---|
|
May 31, 2011 [Issue 6079] New: [CTFE] Array index out of bound detection is off-by-one | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6079 Summary: [CTFE] Array index out of bound detection is off-by-one Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Keywords: accepts-invalid Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: kennytm@gmail.com --- Comment #0 from kennytm@gmail.com 2011-05-31 01:59:48 PDT --- Test case: ------------------------ static assert({ int[] x = [1,2,3,4]; x[4] = 1; return true; }()); ------------------------ In 2.052 this is correctly rejected, but in 2.053 this is wrongly accepted. Changing the [4] to [5] will make the code fail to compile. There should be some off-by-one error introduced between the two versions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 31, 2011 [Issue 6079] [CTFE] Array index out of bound detection is off-by-one | ||||
---|---|---|---|---|
| ||||
Posted in reply to kennytm@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=6079 --- Comment #1 from kennytm@gmail.com 2011-05-31 02:39:16 PDT --- The bug was introduced in commit 4120b86*, I believe this is because of if (indexToModify > destarraylen) // ^ should be >=. *: https://github.com/D-Programming-Language/dmd/commit/4120b86f67eace7a7b930a6ceca823d2088deefd#L0R2728 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 02, 2011 [Issue 6079] [CTFE] Array index out of bound detection is off-by-one | ||||
---|---|---|---|---|
| ||||
Posted in reply to kennytm@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=6079 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |FIXED --- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-06-01 22:49:53 PDT --- https://github.com/D-Programming-Language/dmd/commit/d96486ec09401bdd5cf64d037e024b8e687b8014 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation