This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA (omp): PATCH for c++/45437 (wrong sequence point handling with compound assignment)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Sat, 9 Jul 2011 00:18:49 +0200
- Subject: Re: RFA (omp): PATCH for c++/45437 (wrong sequence point handling with compound assignment)
- References: <4E177B70.5030806@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jul 08, 2011 at 05:49:36PM -0400, Jason Merrill wrote:
> The C++ sequence point rules for compound assignment (+= and such)
> are slightly different from those for C: the value of the LHS is not
> loaded until after the RHS value (and LHS location) are evaluated.
> Since we don't have tree codes for compound assignment, I need to
> handle this in C++ by preevaluating the RHS into a temporary. Doing
> this breaks various gomp tests because the logic for recognizing
> compound assignment gets confused by the COMPOUND_EXPR, so I've
> adjusted the appropriate omp code appropriately.
>
> Tested x86_64-pc-linux-gnu, OK for trunk?
Ok.
> commit cec1fed71c8cf44b26fbb80546b1c2dd3780ebe1
> Author: Jason Merrill <jason@redhat.com>
> Date: Fri Jul 8 14:07:23 2011 -0400
>
> PR c++/45437
> gcc/
> * gimplify.c (goa_stabilize_expr): Handle RHS preevaluation in
> compound assignment.
> gcc/c-family/
> * c-omp.c (check_omp_for_incr_expr): Handle preevaluation.
> gcc/cp/
> * typeck.c (cp_build_modify_expr): Preevaluate RHS.
Jakub