Thread overview
[Issue 3245] New: Easy bug fix available for disabled unit test code in std.encoding
August 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3245

           Summary: Easy bug fix available for disabled unit test code in
                    std.encoding
           Product: D
           Version: 2.031
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: y0uf00bar@gmail.com


Bug: unittest line 55 in std.encoding was disabled by version(none)

Rationale: Re-enabling unittest at line 55 results in failure.

Fix: At line 1059  inside template EncoderInstance(CharType : char).

Current version:

    dchar decodeReverseViaRead()()

    {

        auto c = read;
....


Fixed version:
    dchar decodeReverseViaRead()()
    {
        dchar c = read;
....

Its obvious after failure point is pinned, even if not knowing the exact specs, as decodeReverseViaRead must return a dchar, and variable c accumulates left shifted bits in the loop, same as the nearby safeDecodeViaRead method. In UTF-8,the auto c = read makes a char type only (thank you zerobugs debugger), so high bits put in c are thrown away, and function may return character 0. Re-enabled unittest code ran succesfully after above fix.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3245


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com




--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com>  2009-08-12 00:23:37 PDT ---
Terrific, thanks. I looked at that and couldn't figure the problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3245


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com>  2009-08-28 12:43:36 PDT ---
Thanks for the precise instructions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------