On Wed, Jun 12, 2013 at 03:48:24PM +0200, Marek Polacek wrote: > On Tue, Jun 11, 2013 at 10:44:12PM +0200, Jakub Jelinek wrote: > > There is another thing to solve BTW, op0 and/or op1 might have side-effects, > > if you are going to evaluate them more than once, they need to be surrounded > > into cp_save_expr resp. c_save_expr. > > There's that unpleasant thing that cp_save_expr is declared in > cp/cp-tree.h, but we don't want to include cp/*.h or c/*.h files > in c-family/c-ubsan.c. Should I use save_expr from tree.c instead? > I seem to recall that that isn't the best thing to do...
No, you really need to use the cp_save_expr/c_save_expr, especially for C it e.g. fully folds etc. You want to call that in cp_build_binary_op etc., also because you want both the instrument_expr itself, but also the original binary expression to use the SAVE_EXPRs if they are created. Jakub