www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 140] New: Inlining certain trivial function fails

Date: Sat, 12 Jul 2014 16:39:54 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"


            Bug ID: 140
           Summary: Inlining certain trivial function fails
           Product: GDC
           Version: 4.9.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw gdcproject.org
          Reporter: art.08.09 gmail.com

GDC fails to inline some trivial functions (like array.empty) in certain cases.
The simplest testcase (that i can think of) that still exhibits the problem:

   import std.array, std.algorithm;
   immutable a = [1];
   int main() {
      return a.filter!"true"().empty;

This gets compiled to:

   sub    $0x18,%rsp
   mov    $0x1,%edi
   mov    $0x65d968,%esi
   callq  <pure nothrow  property  safe bool
   add    $0x18,%rsp
   movzbl %al,%eax

Originally reported on ML  
http://forum.dlang.org/post/mailman.75.1396605155.19942.d.gnu puremagic.com ;
some more info in that thread.

Could be related to http://bugzilla.gdcproject.org/show_bug.cgi?id=120 ,
which I thought was the same bug, but it turns out that the testcase in #120
does *not* fail here.

You are receiving this mail because:
You are watching all bug changes.
Jul 12 2014