[PATCH] Fix up passing long long in ubsan with -m32 (PR sanitizer/59333)
Jakub Jelinek
jakub@redhat.com
Thu Dec 5 15:44:00 GMT 2013
On Thu, Dec 05, 2013 at 04:31:20PM +0100, Marek Polacek wrote:
> > > + }
> > > + t = build_fold_addr_expr (var);
> > > + return build2 (COMPOUND_EXPR, TREE_TYPE (t), tem, t);
> >
> > I would expect you want to use this too even if in_expand_p...
>
> Unfortunately, this won't be sufficient -- in expand_expr_real_1 we
> have
> case COMPOUND_EXPR:
> /* Lowered by gimplify.c. */
> gcc_unreachable ();
> and with the code above we hit that.
Ah, ok, then perhaps you need to do expand_assignment (var, t, false);
there and then just build_fold_addr_expr. The ugly thing is that those
assignments will be expanded there right away, so you want to move
the
fn = ubsan_build_overflow_builtin (code, gimple_location (stmt),
TREE_TYPE (arg0), arg0, arg1);
lines down right above expand_normal (fn);
Also, you want push_temp_slots (); and pop_temp_slots (); around it.
So
push_temp_slots ();
fn = ubsan_build_overflow_builtin (code, gimple_location (stmt),
TREE_TYPE (arg0), arg0, arg1);
expand_normal (fn);
pop_temp_slots ();
That way if you have say multiple assign_stack_temp_for_type slots
in one spot for one diagnostics, those slots can be reused again
in another call.
Jakub
More information about the Gcc-patches
mailing list