Jump to page: 1 2
Thread overview
[Issue 14480] dmd 2.067 x64 release codegen
Apr 22, 2015
fengli@gmail.com
Apr 22, 2015
fengli@gmail.com
Apr 23, 2015
weaselcat
Apr 23, 2015
fengli@gmail.com
Apr 23, 2015
yebblies
Apr 24, 2015
fengli@gmail.com
Apr 27, 2015
Vladimir Panteleev
Apr 27, 2015
Vladimir Panteleev
Apr 27, 2015
fengli@gmail.com
Apr 27, 2015
Vladimir Panteleev
Apr 27, 2015
Vladimir Panteleev
Jun 24, 2015
ponce
Jun 24, 2015
ponce
Jun 26, 2015
Martin Nowak
Jun 26, 2015
fengli@gmail.com
Jun 26, 2015
ponce
Jun 27, 2015
Walter Bright
Jun 27, 2015
Kenji Hara
Jun 27, 2015
Walter Bright
April 22, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

--- Comment #1 from fengli@gmail.com ---
still broken in 2.067.1 b1

--
April 22, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

--- Comment #2 from fengli@gmail.com ---
On OSX with 2.067 this does not happen.

--
April 23, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

weaselcat <r9shackleford@gmail.com> changed:

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

--- Comment #3 from weaselcat <r9shackleford@gmail.com> ---
I'm unable to reproduce this on Linux, dmd 2.067.

Windows only issue?

--
April 23, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

--- Comment #4 from fengli@gmail.com ---
It's probably a windows only issue (in fact windows 64 bit release mode only).

--
April 23, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |yebblies@gmail.com

--- Comment #5 from yebblies <yebblies@gmail.com> ---
A reduced test case would be helpful

--
April 24, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

--- Comment #6 from fengli@gmail.com ---
Here's a reduced test case

// compile on windows with "dmd -m64 -O test.d" => BAD

import std.stdio;
import std.array;
import std.math;
import std.algorithm;
import std.range;

struct Vector(T, alias N)
{
    enum size = N;
    alias T ValueType;
    alias v this;

    this (T...) (T args)
    {
        static if(args.length == 1)
            v[] = args[0];
        else static if(args.length == N)
            v[] = [args];
        else
            static assert("wrong number of arguments");
    }
    Vector opUnary(string op)() const
        if( op =="-" )
    {
        mixin("return Vector(" ~ Unroll!("v[%] * (-1)", N, ",") ~ ");");
    }
    Vector opBinary(string op)(auto ref in T rhs) const
        if( op == "+" || op =="-" || op=="*" || op=="/" )
    {
        mixin("return Vector(" ~ Unroll!("v[%]"~op~"rhs", N, ",") ~ ");");
    }
    Vector opBinary(string op)(auto ref in Vector rhs) const
        if( op == "+" || op =="-" || op=="*" || op=="/" )
    {
        mixin("return Vector(" ~ Unroll!("v[%]"~op~"rhs.v[%]", N, ",") ~ ");");
    }
    ref Vector opOpAssign(string op)(auto ref in Vector rhs)
        if( op == "+" || op =="-" || op=="*" || op=="/" )
    {
        mixin("v[]"~op~"=rhs.v[];");
        return this;
    }

    static if (N >= 1)
    {
        T x() const { return v[0]; }
        ref T x()   { return v[0]; }
    }
    static if (N >= 2)
    {
        T y() const { return v[1]; }
        ref T y()   { return v[1]; }
    }
    static if (N >= 3)
    {
        T z() const { return v[2]; }
        ref T z()   { return v[2]; }
    }

    alias v this;

    T[N] v;
}
protected template Unroll(alias CODE, alias N, alias SEP="")
{
    import std.string;
    enum t = replace(CODE, "%", "%1$d");
    enum Unroll = iota(N).map!(i => format(t, i)).join(SEP);
}

V.ValueType dot(V, V2)(auto ref in V v1, auto ref in V2 v2)
    if( is(V.ValueType == V2.ValueType) )
{
    return mixin(Unroll!("v1[%]*v2[%]", V.size, "+"));
}

void bezier(T)(in T p1, in T p2, in T p3, in T p4, int indent)
{
    writefln("%s%s %s %s %s", replicate(" ", indent), p1, p2, p3, p4);

    auto p12   = (p1 + p2) / 2;
    auto p23   = (p2 + p3) / 2;
    auto p34   = (p3 + p4) / 2;
    auto p123  = (p12 + p23) / 2;
    auto p234  = (p23 + p34) / 2;
    auto p1234 = (p123 + p234) / 2;

    auto d = p4 - p1;
    auto d2 = fabs(((p2.x - p4.x) * d.y - (p2.y - p4.y) * d.x));
    auto d3 = fabs(((p3.x - p4.x) * d.y - (p3.y - p4.y) * d.x));

    if((d2 + d3)*(d2 + d3) < 0.25 * dot(d, d))
    {
        return;
    }

    bezier(p1, p12, p123, p1234, indent+2);
    bezier(p1234, p234, p34, p4, indent+2);
}

int main(string[] args)
{
    alias Vector!(double, 2) VEC;
    auto p1 = VEC(563.022, 319.849);
    auto p2 = VEC(534.772, 266.534);
    auto p3 = VEC(551.44, 365.862);
    auto p4 = VEC(551.44, 365.862);
    bezier(p1,p2,p3,p4,0);
    return 0;
}

--
April 27, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com
           Severity|normal                      |regression

--
April 27, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

--- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to fengli from comment #6)
> Here's a reduced test case
> 
> // compile on windows with "dmd -m64 -O test.d" => BAD

This program will give different output every time it's run, regardless of the compiler I tested.

--
April 27, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

--- Comment #8 from fengli@gmail.com ---
Hi Vladimir,

Are you saying the program producing different output even without -O -m64?

In my tests this function produces identical and correct output on windows without -O -m64 and on OSX with any arguments.  The expected output is

[563.022, 319.849] [534.772, 266.534] [551.44, 365.862] [551.44, 365.862]
  [563.022, 319.849] [548.897, 293.192] [546.002, 304.695] [546.637, 322.862]
    [563.022, 319.849] [555.96, 306.52] [551.704, 302.732] [549.294, 304.546]
      [563.022, 319.849] [559.491, 313.185] [556.661, 308.905] [554.413,
306.519]
        [563.022, 319.849] [561.256, 316.517] [559.666, 313.781] [558.236,
311.58]
        [558.236, 311.58] [556.807, 309.379] [555.537, 307.712] [554.413,
306.519]
      [554.413, 306.519] [552.166, 304.132] [550.499, 303.639] [549.294,
304.546]
        [554.413, 306.519] [553.29, 305.326] [552.311, 304.606] [551.463,
304.297]
          [554.413, 306.519] [553.852, 305.922] [553.326, 305.444] [552.835,
305.076]
          [552.835, 305.076] [552.344, 304.709] [551.887, 304.452] [551.463,
304.297]
        [551.463, 304.297] [550.615, 303.989] [549.897, 304.093] [549.294,
304.546]
          [551.463, 304.297] [551.039, 304.143] [550.647, 304.092] [550.286,
304.136]
          [550.286, 304.136] [549.926, 304.18] [549.596, 304.319] [549.294,
304.546]
    [549.294, 304.546] [546.884, 306.361] [546.319, 313.779] [546.637, 322.862]
      [549.294, 304.546] [548.089, 305.454] [547.346, 307.762] [546.943,
310.978]
        [549.294, 304.546] [548.692, 305] [548.205, 305.804] [547.818, 306.896]
          [549.294, 304.546] [548.993, 304.773] [548.721, 305.087] [548.475,
305.482]
          [548.475, 305.482] [548.23, 305.876] [548.011, 306.35] [547.818,
306.896]
        [547.818, 306.896] [547.431, 307.989] [547.144, 309.37] [546.943,
310.978]
      [546.943, 310.978] [546.54, 314.195] [546.478, 318.32] [546.637, 322.862]
        [546.943, 310.978] [546.741, 312.587] [546.625, 314.422] [546.579,
316.423]
        [546.579, 316.423] [546.533, 318.425] [546.558, 320.591] [546.637,
322.862]
  [546.637, 322.862] [547.273, 341.03] [551.44, 365.862] [551.44, 365.862]
    [546.637, 322.862] [546.955, 331.946] [548.156, 342.696] [549.277, 351.175]
      [546.637, 322.862] [546.796, 327.404] [547.176, 332.363] [547.656,
337.246]
      [547.656, 337.246] [548.136, 342.128] [548.716, 346.936] [549.277,
351.175]
    [549.277, 351.175] [550.398, 359.654] [551.44, 365.862] [551.44, 365.862]

--
April 27, 2015
https://issues.dlang.org/show_bug.cgi?id=14480

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=14510

--- Comment #9 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Vladimir Panteleev from comment #7)
> This program will give different output every time it's run, regardless of the compiler I tested.

I reduced this behavior, but did not find this to be a regression, so I filed it as a new bug:

https://issues.dlang.org/show_bug.cgi?id=14510

--
« First   ‹ Prev
1 2