Thread overview
[Issue 9034] New: errors of conversions in format.d
Nov 16, 2012
Gilles Cloup
Nov 16, 2012
yebblies
Nov 27, 2012
js.mdnq@gmail.com
November 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9034

           Summary: errors of conversions in format.d
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: gcloup@gmx.fr


--- Comment #0 from Gilles Cloup <gcloup@gmx.fr> 2012-11-16 04:30:00 PST ---
dmd2\src\phobos\std\format.d(4573): Error: cannot implicitly convert expression
(fbuf.length) of type ulong to uint
dmd2\src\phobos\std\format.d(4575): Error: cannot implicitly convert expression
(& sl) of type uint* to ulong*
dmd2\src\phobos\std\format.d(4578): Error: cannot implicitly convert expression
(fbuf.length * 2LU) of type ulong to uint

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9034


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #1 from yebblies <yebblies@gmail.com> 2012-11-17 00:59:29 EST ---
A minimal test case to go with those errors would be helpful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9034



--- Comment #2 from js.mdnq@gmail.com 2012-11-27 03:25:25 PST ---
(In reply to comment #1)
> A minimal test case to go with those errors would be helpful.

Use a rather bare bones d example and trying to compile for x64 in windows by adding the -m64 switch gave the same results. Seems like it is a conversion issue due the fact that length depends on the architecture.

Changing the line in format.d "uint sl;" to "size_t sl;" solves the errors but then gives

------ Build started: Project: CTest1, Configuration: Release Win64 ------
Building Release\CTest1.exe...
Internal error: ..\ztc\cgobj.c 1479
Building Release\CTest1.exe failed!

Using casts instead of size_t also gives the same error.


The code is

"   else                                // 16 bit segment
    {
#if MARS
        assert(0);  // line 1479
#else
        if (size & ~0xFFFFL)
        {   if (size == 0x10000)        // if exactly 64Kb
                sd[0] |= 2;             // set "B" bit
            else
                synerr(EM_seg_gt_64k,size);     // segment exceeds 64Kb
        }
//printf("attr = %x\n", attr);
#endif
    }"


Which seems to be how the compiler is dealing with object files and the 64-bit object segments are treated as 16-bit. (A guess as I'm new to D but jives with what was said about the 64-bit issues DMD had)

In any case the uint seems to be a bug as much of the code surrounding it uses size_t's.

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