Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 10, 2011 [Issue 5725] New: ubyte/ushort infinite foreach loops | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5725 Summary: ubyte/ushort infinite foreach loops Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2011-03-10 05:19:30 PST --- Problem found by Magnus Lie Hetland. This program produces two infinite loops, DMD 2.052: void main() { alias ubyte T1; T1[T1.max + 1] array1; foreach (T1 i, _; array1) {} alias ushort T2; T2[T2.max + 1] array2; foreach (T2 i, _; array2) {} } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 26, 2011 [Issue 5725] ubyte/ushort infinite foreach loops | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5725 --- Comment #1 from bearophile_hugs@eml.cc 2011-06-26 01:54:29 PDT --- Related. This compiles with no errors, and maybe goes in infinite loop: import std.stdio; void main() { auto array = new int[270]; foreach (ubyte i, ref x; array) x = i; writeln(array); } If the range of the fixed-sized array is larger than the max number that the index can represent, then I suggest to raise a compile-time error, just like this program does: void main() { ubyte x = 270; } test.d(2): Error: cannot implicitly convert expression (270) of type int to ubyte -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 17, 2013 [Issue 5725] ubyte/ushort infinite foreach loops | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5725 --- Comment #2 from yebblies <yebblies@gmail.com> 2013-01-17 13:54:13 EST --- *** Issue 7034 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 17, 2013 [Issue 5725] ubyte/ushort infinite foreach loops | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5725 --- Comment #3 from yebblies <yebblies@gmail.com> 2013-01-17 14:02:25 EST --- *** Issue 8964 has been marked as a duplicate of this issue. *** -- 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