March 02, 2022 [Issue 22836] [Reg 2.070/2.093] foreach using ubyte index over static array of length 256 or ushort index over static array of length 65536 does not execute the foreach body | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22836 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl --- Comment #1 from Dennis <dkorpel@live.nl> --- The compiler lowers it to ``` ubyte[] __r3 = array[]; ubyte __key2 = cast(ubyte)0u; for (; cast(int)__key2 < cast(int)cast(ubyte)__r3.length; cast(int)__key2 += 1) { ref ubyte a = __r3[cast(ulong)__key2]; const const(ubyte) i = __key2; a = i; } ``` As you can see, the length is cast to a `ubyte`, so it overflows to a length of 0, which is why the loop body isn't entered. -- |
December 13 [Issue 22836] [Reg 2.070/2.093] foreach using ubyte index over static array of length 256 or ushort index over static array of length 65536 does not execute the foreach body | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22836 --- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18087 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation