On Fri, Mar 27, 2015 at 12:50:09AM +0100, Marek Polacek wrote: > 2015-03-26 Marek Polacek <pola...@redhat.com> > > PR sanitizer/65583 > * ubsan.c (ubsan_create_edge): New function. > (instrument_bool_enum_load): Call it. > (instrument_nonnull_arg): Likewise. > (instrument_nonnull_return): Likewise. > (instrument_object_size): Likewise. > > * g++.dg/ubsan/pr65583.C: New test.
Ok. > @@ -1834,6 +1853,17 @@ instrument_object_size (gimple_stmt_iterator *gsi, > bool is_lhs) > integer_zero_node); > sizet = force_gimple_operand_gsi (gsi, sizet, false, NULL_TREE, true, > GSI_SAME_STMT); > + /* If the call above didn't end up being an integer constant, go one > + statement back and get the __builtin_object_size stmt. Save it, Though, perhaps for GCC 6 it would be better to avoid building tree __bos call and instead just call compute_builtin_object_size and build_int_cstu if it returns non--1, and otherwise just gimple_build_call. Jakub