On Fri, Aug 30, 2013 at 10:42:57AM +0200, Jakub Jelinek wrote: > On Fri, Aug 30, 2013 at 10:38:51AM +0200, Marek Polacek wrote: > > On Fri, Aug 30, 2013 at 10:15:44AM +0200, Jakub Jelinek wrote: > > > So, can you please post a new final patch for the merge (with the new > > > directories > > > or files in libsanitizer/ just listed in the ChangeLog entries, but not > > > actually included in the patch, that would make it too large and anyone > > > can > > > look at libsanitizer/ubsan/ on the branch)? > > > > Yep. This is diff between trunk and the ubsan branch without new > > files. > > > > BTW, when merging the ChangeLog.ubsan into normal ChangeLog, should I > > change the CL entry dates to the day of the merge into the trunk, or > > can I keep them as they are? > > Usually you write a new ChangeLog entry (per changed directory) that > summarizes all the changes, using the current date. So, e.g. for the new > files you just mention * ubsan.c: New file. etc. and don't list all the > follow-up changes.
I see. For the record, here are the new ChangeLog entries I'm going to use when doing the merge. config/ChangeLog 2013-08-30 Marek Polacek <pola...@redhat.com> * bootstrap-ubsan.mk: New. gcc/c-family/ChangeLog 2013-08-30 Marek Polacek <pola...@redhat.com> * c-ubsan.c: New file. * c-ubsan.h: New file. gcc/ChangeLog 2013-08-30 Marek Polacek <pola...@redhat.com> * Makefile.in (ubsan.o): Add. (c-family/c-ubsan.o): Add. (builtins.o): Add ubsan.h dependency. * ubsan.h: New file. * ubsan.c: New file. * common.opt: Add -fsanitize=undefined option. (flag_sanitize): Add variable. (fsanitize=): Add option. Add Driver. (fsanitize=thread): Remove option. (fsanitize=address): Likewise. (static-libubsan): New option. * doc/invoke.texi: Document the new flag and -static-libubsan. * sanitizer.def (DEF_SANITIZER_BUILTIN): Define. (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE): Define. * builtin-attrs.def (ATTR_COLD): Define. (ATTR_COLD_NOTHROW_LEAF_LIST): Define. * builtins.def (BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW, BUILT_IN_UBSAN_HANDLE_SHIFT_OUT_OF_BOUNDS): Define. * flag-types.h (sanitize_code): New enum. * opts.c (common_handle_option): Parse command line arguments of -fsanitize=. Add -fsanitize=unreachable option. * varasm.c (get_variable_section): Adjust. (assemble_noswitch_variable): Likewise. (assemble_variable): Likewise. (output_constant_def_contents): Likewise. (categorize_decl_for_section): Likewise. (place_block_symbol): Likewise. (output_object_block): Likewise. * builtins.def: Likewise. * toplev.c (compile_file): Likewise. (process_options): Likewise. * cppbuiltin.c: Likewise. * tsan.c (tsan_pass): Likewise. (tsan_gate): Likewise. (tsan_gate_O0): Likewise. * cfgexpand.c (partition_stack_vars): Likewise. (expand_stack_vars): Likewise. (defer_stack_allocation): Likewise. (expand_used_vars): Likewise. * cfgcleanup.c (old_insns_match_p): Likewise. * asan.c (asan_finish_file): Likewise. (asan_instrument): Likewise. (gate_asan): Likewise. (initialize_sanitizer_builtins): Build BT_FN_VOID_PTR_PTR_PTR. (ATTR_COLD_NOTHROW_LEAF_LIST): Define. (asan_global_struct): Use pointer_sized_int_node instead calling build_nonstandard_integer_type. (initialize_sanitizer_builtins): Likewise. (asan_finish_file): Likewise. * gcc.c: Document %{%:function(args):X}. (static_spec_functions): Add sanitize. (handle_spec_function): Add retval_nonnull argument and if non-NULL, store funcval != NULL there. (do_spec_1): Adjust handle_spec_function caller. (handle_braces): Allow %:function(args) as condition. (sanitize_spec_function): New function. (ADD_STATIC_LIBUBSAN_LIBS): Define. (LIBUBSAN_SPEC): Likewise. (LIBUBSAN_EARLY_SPEC): Likewise. (SANITIZER_SPEC): Handle libubsan. (SANITIZER_EARLY_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Use %:sanitize(address) instead of fsanitize=address. * config/arm/linux-eabi.h (ASAN_CC1_SPEC): Use %:sanitize(address) instead of fsanitize=address*. * builtins.c: Include ubsan.h. (fold_builtin_0): Instrument __builtin_unreachable. * config/rs6000/rs6000.h (FRAME_GROWS_DOWNWARD): Use flag_sanitize instead of flag_asan. * tree.h (enum tree_index): Add TI_POINTER_SIZED_TYPE. (pointer_sized_int_node): Define. * tree.c (build_common_tree_nodes): Initialize pointer_sized_int_node. gcc/cp/ChangeLog 2013-08-30 Marek Polacek <pola...@redhat.com> * typeck.c (cp_build_binary_op): Add division by zero and shift instrumentation. * error.c (dump_expr): Special-case ubsan builtins. gcc/c/ChangeLog 2013-08-30 Marek Polacek <pola...@redhat.com> * c-typeck.c (build_binary_op): Add division by zero and shift instrumentation. gcc/testsuite/ChangeLog 2013-08-30 Marek Polacek <pola...@redhat.com> * g++.dg/ubsan/div-by-zero-1.C: New test. * c-c++-common/ubsan/save-expr-1.c: New test. * c-c++-common/ubsan/save-expr-2.c: New test. * c-c++-common/ubsan/save-expr-3.c: New test. * c-c++-common/ubsan/save-expr-4.c: New test. * c-c++-common/ubsan/typedef-1.c: New test. * c-c++-common/ubsan/const-char-1.c: New test. * c-c++-common/ubsan/const-expr.c: New test. * c-c++-common/ubsan/div-by-zero-1.c: Likewise. * c-c++-common/ubsan/shift-1.c: Likewise. * c-c++-common/ubsan/shift-2.c: Likewise. * c-c++-common/ubsan/div-by-zero-2.c: Likewise. * lib/ubsan-dg.exp: New file. * g++.dg/dg.exp: Add ubsan tests. * g++.dg/ubsan/ubsan.exp: New file. * gcc.dg/ubsan/ubsan.exp: New file. * g++.dg/ubsan/cxx11-shift-1.C: New test. * g++.dg/ubsan/cxx11-shift-2.C: New test. * c-c++-common/ubsan/div-by-zero-3.c: New test. * c-c++-common/ubsan/div-by-zero-1.c: New test. * c-c++-common/ubsan/div-by-zero-4.c: New test. * c-c++-common/ubsan/shift-3.c: New test. * c-c++-common/ubsan/unreachable-1.c: New test. * c-c++-common/ubsan/shift-1.c: New test. * c-c++-common/ubsan/shift-2.c: New test. * c-c++-common/ubsan/div-by-zero-2.c: New test. * gcc.dg/ubsan/c99-shift-2.c: New test. * gcc.dg/ubsan/c99-shift-1.c: New test. Marek