Jump to page: 1 2
Thread overview
[Issue 15989] Win32 optimizer bug
May 07, 2016
Jack Stouffer
Sep 30, 2016
Vladimir Panteleev
Sep 30, 2016
Walter Bright
Sep 30, 2016
Walter Bright
Sep 30, 2016
Walter Bright
Sep 30, 2016
Walter Bright
Sep 30, 2016
Vladimir Panteleev
[Issue 15989] Initializing manifest constants with CTFE allocated data
Oct 01, 2016
Walter Bright
Oct 01, 2016
Walter Bright
Oct 01, 2016
Walter Bright
Oct 01, 2016
Walter Bright
May 07, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

Jack Stouffer <jack@jackstouffer.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jack@jackstouffer.com
           Severity|major                       |blocker

--- Comment #1 from Jack Stouffer <jack@jackstouffer.com> ---
Raising to blocker as this is blocking https://github.com/dlang/phobos/pull/4286

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

Vladimir Panteleev <thecybershadow@gmail.com> changed:

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

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
Simplified example:

interface Kickstart{
    bool foo( int );
}

class ShiftOr : Kickstart
{
    bool foo( int )
    {
        return false;
    }
}

struct Regex
{
    Kickstart kickstart;
}

Regex regex()
{
    return Regex(new ShiftOr());
}

void main()
{
    enum ctRegex = regex();
    Regex r = ctRegex;
    r.kickstart.foo(7);
}

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

uplink.coder@googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uplink.coder@googlemail.com

--- Comment #3 from uplink.coder@googlemail.com ---
This most likely happens as a consequence of not copying in optimize.d line 237-238.

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
The trouble appears to be the line:

    new ShiftOr();

which is evaluated at compile time (because of the enum) yet is expected to exist at runtime. Creating items on the GC heap with operator new does not transfer from compile time to runtime. I don't see how this can possibly work, and the compiler should issue an error message for it.

It has nothing to do with optimizer flags, as it doesn't work regardless, it just happens to fail in a way that doesn't seg fault when -O is not specified.

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
For example:

 void main()
 {
    enum pi = new int(3);
    *pi = 4;
 }

emits:

  foo4.d(4): Error: cannot use non-constant CTFE pointer in an initializer
'&[3][0]'

This error message should be printed for the bug case.

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

--- Comment #6 from uplink.coder@googlemail.com ---
Yes this code is invalid.
finding this condition will involve scanning the members of a struct for
classReferances and disallowing the creation of a manifest consntant if there
are those in there.

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |accepts-invalid

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

--- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Workaround: use "static const" instead of "enum"?

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=15989

--- Comment #8 from uplink.coder@googlemail.com ---
No. It has to be static immutable. Otherwise it will not be there at CT.

--
« First   ‹ Prev
1 2