[Issue 16192] New: std.conv.toChars() opSlice wrong for radix other than 10

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 22 00:15:47 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16192

          Issue ID: 16192
           Summary: std.conv.toChars() opSlice wrong for radix other than
                    10
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: gorox at comcast.net

Off by one error in std.conv.toChars() opSlice() where radix != 10.  The "- 1"
here is wrong and fix is removing it.

  result.value = value >>> ((len - upr - 1) * SHIFT);

https://github.com/dlang/phobos/blob/master/std/conv.d#L5736

unittest does not try enough cases and accidentally passes on Intel.  Not so on
ARM.

Reference: https://forum.dlang.org/thread/lmwdwkcnrbcrbmkxacej@forum.dlang.org

--


More information about the Digitalmars-d-bugs mailing list