D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3352 - RangeError in std.conv
Summary: RangeError in std.conv
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-30 03:58 UTC by anonymous4
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description anonymous4 2009-09-30 03:58:10 UTC
---
wtext(int.max);
---
core.exception.RangeError@std.conv(2526): Range violation

Unittests in std.conv don't test wstring and big numbers.
Comment 1 anonymous4 2009-10-01 07:43:35 UTC
Also I think, it's an overkill to fine tune allocation as it's done in to!string(uint)
Comment 2 Andrei Alexandrescu 2009-10-01 11:05:40 UTC
(In reply to comment #1)
> Also I think, it's an overkill to fine tune allocation as it's done in
> to!string(uint)

BTW I just improved optimization by adding preallocated strings for numbers between -1 and -9.
Comment 3 anonymous4 2009-10-05 06:59:13 UTC
The bug is in line 2526 where Char.sizeof * maxlength is allocated but only maxlength is sliced for the buffer.
Comment 4 Andrei Alexandrescu 2009-10-05 18:39:56 UTC
(In reply to comment #3)
> The bug is in line 2526 where Char.sizeof * maxlength is allocated but only
> maxlength is sliced for the buffer.

Thanks! I just fixed the bug and checked in.