August 31, 2014
https://issues.dlang.org/show_bug.cgi?id=13381

--- Comment #11 from yebblies <yebblies@gmail.com> ---
(In reply to bearophile_hugs from comment #10)
> 
> dmd is not doing better.

Haha no surprise there.

> 
> > I'd say it's worth filing an optimizer enhancement.
> 
> I don't know.

Actually this is the same thing as general inlining and expanding of array ops, which I think you've already filed.

--
September 16, 2014
https://issues.dlang.org/show_bug.cgi?id=13381

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|One case of array literal   |Two cases of array literal
                   |that can be stack-allocated |that can be stack-allocated

--- Comment #12 from bearophile_hugs@eml.cc ---
Another case worth optimizing:


void main() @nogc {
    import std.traits: EnumMembers;
    enum Foo { A, B, C, D }
    size_t i = 2;
    Foo[4] foos = [EnumMembers!Foo]; // OK
    auto r1 = foos[i];
    auto r2 = [EnumMembers!Foo][i]; // Error: array literal in @nogc
}

--
October 06, 2014
https://issues.dlang.org/show_bug.cgi?id=13381

--- Comment #13 from bearophile_hugs@eml.cc ---
A case (from Issue 13576 ):


immutable int[] a;
static this() @nogc {
    a = [1];
}
void main() {}


dmd 2.067alpha gives:

temp.d(3,9): Error: array literal in @nogc function _staticCtor1 may cause GC
allocation

--
October 06, 2014
https://issues.dlang.org/show_bug.cgi?id=13381

--- Comment #14 from bearophile_hugs@eml.cc ---
*** Issue 13576 has been marked as a duplicate of this issue. ***

--
October 31, 2014
https://issues.dlang.org/show_bug.cgi?id=13381

--- Comment #15 from bearophile_hugs@eml.cc ---
Another common case where I'd like the compiler to avoid GC-allocations:

void main() @nogc {
    immutable int[4] a1 = [1, 2, 4, 5];
    size_t i = 2;
    immutable int[5] a2 = a1[0 .. i] ~ 3 ~ a1[i .. $];
}


Currently you have to write this more bug-prone code and the 'a2' variable can't be immutable:

void main() @nogc {
    immutable int[4] a1 = [1, 2, 4, 5];
    size_t i = 2;
    int[5] a2 = void;
    a2[0 .. i] = a1[0 .. i];
    a2[2] = 3;
    a2[i + 1 .. $] = a1[i .. $];
}

--
September 14, 2021
https://issues.dlang.org/show_bug.cgi?id=13381

Dennis <dkorpel@live.nl> changed:

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

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=13381

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
1 2
Next ›   Last »