This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ tree inlining bug with dynamic arrays


>>>>> "Jim" == Jim Wilson <wilson@cygnus.com> writes:

    Jim> That is what it looks like to me.  The only code that seems
    Jim> to care about SAVE_EXPR context is expand_expr, and that code
    Jim> is not a problem if function inlining is done after trees are
    Jim> converted to RTL.

Right.  That's what I expected.

    Jim> I'll finish the patch I started, test it with a cygwin build,
    Jim> and send it to gcc-patches.

Thanks!

BTW, the C9x standard says that "it is unspecified whether
side-effects are produced when the size expression is evaluated".
That's a slightly odd statement, but I wonder if it wouldn't simplify
GCC's handling of VLAs to take advantage of this statement in some
way.

Jason and I talked about this once.  The right thing to do in C++ is
to change 

  T a[E];

(where `E' is an expression) into:

  int temp = E;
  T a[temp];

at the tree level, and skip the SAVE_EXPRs altogether.  There are
technical difficulties in the front-end that prevent doing this as
easily as one might hope, but that would tremendously simplify lots of
these issues.  In general, I've concluded that SAVE_EXPRs are
semi-evil.  I presume that they were invented because in
statement-at-a-time mode it's tough to introduce new temporaries on
the fly.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]