C++ PATCH for c++/43555 (wrong code with VLA and conditional branches)

Olivier Hainque hainque@adacore.com
Fri May 28 10:28:00 GMT 2010


Jason Merrill wrote:
> Back in 2006 (r117493) Olivier fixed the C front end to avoid a problem 
> with the SAVE_EXPR for a VLA type size being evaluated on one side of a 
> condition but not the other,

 Oula, old memories ... thanks for cc'ing me.

> but the fix never made it into the C++ front end.  This patch adapts
> that fix a bit: we don't really need to introduce an artificial
> TYPE_DECL just to force the evaluation of the SAVE_EXPR at the point
> where we see the abstract declarator, we can just introduce it as a
> dummy expression statement.

 Nice. I remember we discussed different possible approaches and that
 avoiding the introduction of dummy TYPE_DECL was of interest if possible.
 (thread at http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00009.html
  then http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00239.html),

 I eventually introduced one on the grounds of 

  << A key aspect is the call to finish_decl, which builds the DECL_EXPR
     node required to push the gimplifier into gimplify_type_sizes.
  >>

 This was my first dive in the C front-end, so could maybe be avoided
 there as well today.

 Olivier
 









More information about the Gcc-patches mailing list