Bug 21836 – std.format: grouping may cause RangeError

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-17T08:48:37Z
Last change time
2021-04-24T08:15:15Z
Keywords
pull
Assigned to
No Owner
Creator
Berni44

Comments

Comment #0 by bugzilla — 2021-04-17T08:48:37Z
assert(format!"%-5,1g"(0.0) == "0 "); Instead it throws: core.exception.RangeError@/usr/include/dmd/phobos/std/format/internal/write.d(656): Range violation ---------------- ??:? _d_arrayboundsp [0x563fc0971eed] ??:? @safe void std.format.internal.write.formatValueImpl!(std.stdio.File.LockingTextWriter, double, char).formatValueImpl(ref std.stdio.File.LockingTextWriter, double, scope ref const(std.format.spec.FormatSpec!(char).FormatSpec)) [0x563fc09678a8] ??:? @safe void std.format.write.formatValue!(std.stdio.File.LockingTextWriter, double, char).formatValue(ref std.stdio.File.LockingTextWriter, ref double, scope ref const(std.format.spec.FormatSpec!(char).FormatSpec)) [0x563fc0967107] ??:? @safe uint std.format.write.formattedWrite!(std.stdio.File.LockingTextWriter, char, double).formattedWrite(ref std.stdio.File.LockingTextWriter, scope const(char[]), double) [0x563fc0966270] ??:? @safe void std.stdio.File.writefln!(char, double).writefln(in char[], double) [0x563fc0965ef2] ??:? @safe void std.stdio.writefln!(char, double).writefln(in char[], double) [0x563fc0965e7a] ??:? @safe void std.stdio.writefln!("%-5,1g", double).writefln(double) [0x563fc09523cf] ??:? _Dmain [0x563fc0951b8f]
Comment #1 by dlang-bot — 2021-04-23T08:05:11Z
@berni44 created dlang/phobos pull request #8000 "std.format: Make formatting 0.0 100% @nogc." fixing this issue: - Fix Issue 21836 - std.format: grouping may cause RangeError https://github.com/dlang/phobos/pull/8000
Comment #2 by dlang-bot — 2021-04-24T08:15:15Z
dlang/phobos pull request #8000 "std.format: Make formatting 0.0 100% @nogc." was merged into master: - fe6c6b369f76cac38c20ab25bc4f8fcb77259fba by berni44: Fix Issue 21836 - std.format: grouping may cause RangeError https://github.com/dlang/phobos/pull/8000