www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5556] New: [64-bit] Wrong Implicit Conversion to Double

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5556

           Summary: [64-bit] Wrong Implicit Conversion to Double
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



The following weird result happens only with -m64 enabled.  To reproduce the
bug from this test case, -inline must be disabled to prevent the two functions
from being inlined, though in the more complex cases that I reduced it from
inlining could be enabled.

import std.stdio;

float fun(float[] data, sizediff_t k) {
    stderr.writeln("Returning ", data[k]);  // Prints "Returning 2"
    return data[k];
}

double gun(float[] data) {
    return  fun(data, data.length / 2);
}

void main() {
    float[] test = [1,4,2,3,5];
    stderr.writeln(gun(test));  // Prints 5.30499e-215
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5556


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



22:50:47 PST ---
https://github.com/D-Programming-Language/dmd/commit/e5b63251d2c0fb4d2aa7929d3560e0f4d42be458

https://github.com/D-Programming-Language/dmd/commit/bc29f3797e695fe7ff3ad5da5f3c5bc6e43a84da

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