www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 228] New: Creation of temporaries internally needs to be taken

http://bugzilla.gdcproject.org/show_bug.cgi?id=228

            Bug ID: 228
           Summary: Creation of temporaries internally needs to be taken
                    back under control.
           Product: GDC
           Version: development
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw gdcproject.org
          Reporter: ibuclaw gdcproject.org

See, for instance: https://github.com/D-Programming-GDC/GDC/pull/217

Though the use of COMPOUND_EXPR  seems to make the matter look worse, it should
be investigated why we create so many temporaries (SAVE_EXPRs).

Having a single pass after generating the code is not ideal.  If it is indeed
simply COMPOUND_EXPRs with side effects, then we should make all codegen
helpers COMPOUND_EXPR-aware.

e.g:

  build_deref(build_nop(type, build_address(expr)));

Should not result in:

  *((TYPE *)&(foo(), bar));

Instead always apply the action to the right-most result.

  (foo(), *(TYPE *)&bar);

This should simplify inspecting expressions in order-sensitive parts, where the
question "Do we need a temporary?" in maybe_make_temp could three possible
answers - Yes; No; and No, but the left hand side (normally construction) needs
to be executed first.

Creating temporaries at every step also blocks bug42.

-- 
You are receiving this mail because:
You are watching all bug changes.
Jun 06 2016