[Issue 13381] One case of array literal that can be stack-allocated
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 31 04:10:39 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13381
--- Comment #9 from yebblies <yebblies at gmail.com> ---
(In reply to bearophile_hugs from comment #8)
> (In reply to yebblies from comment #7)
>
> > Like I said, once the literal is stack-allocated it's more likely to work.
>
> OK, another experiment:
>
>
> bool foo(in int[] a) {
> immutable static int[3] aux = [1, 2, 3];
> return a == aux;
> }
> void main() {}
>
>
> __D4test3fooFxAiZb:
> subl $20, %esp
> movl 28(%esp), %eax
> movl %eax, 4(%esp)
> movl 24(%esp), %eax
> movl %eax, (%esp)
> movl $__D12TypeInfo_Axi6__initZ, 16(%esp)
> movl $__D4test3fooFxAiZb3auxyG3i, 12(%esp)
> movl $3, 8(%esp)
> calll __adEq2
> testl %eax, %eax
> setne %al
> addl $20, %esp
> ret $8
Which compiler? I'd say it's worth filing an optimizer enhancement.
--
More information about the Digitalmars-d-bugs
mailing list