This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Request to merge Undefined Behavior Sanitizer in (take 3)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 30 Aug 2013 14:29:22 +0200
- Subject: Re: Request to merge Undefined Behavior Sanitizer in (take 3)
- Authentication-results: sourceware.org; auth=none
- References: <20130815150848 dot GZ17022 at redhat dot com> <20130822175107 dot GC4968 at redhat dot com> <20130822190157 dot GD4968 at redhat dot com> <20130827143040 dot GC574 at redhat dot com> <20130830081306 dot GD23899 at redhat dot com> <20130830081544 dot GG21876 at tucnak dot zalov dot cz> <20130830083850 dot GE23899 at redhat dot com> <20130830084257 dot GH21876 at tucnak dot zalov dot cz> <20130830122344 dot GF23899 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Aug 30, 2013 at 02:23:44PM +0200, Marek Polacek wrote:
> I see. For the record, here are the new ChangeLog entries I'm going
> to use when doing the merge.
Ok for trunk, thanks.
> config/ChangeLog
> 2013-08-30 Marek Polacek <polacek@redhat.com>
>
> * bootstrap-ubsan.mk: New.
>
> gcc/c-family/ChangeLog
> 2013-08-30 Marek Polacek <polacek@redhat.com>
>
> * c-ubsan.c: New file.
> * c-ubsan.h: New file.
>
> gcc/ChangeLog
> 2013-08-30 Marek Polacek <polacek@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 <polacek@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 <polacek@redhat.com>
>
> * c-typeck.c (build_binary_op): Add division by zero and shift
> instrumentation.
>
> gcc/testsuite/ChangeLog
> 2013-08-30 Marek Polacek <polacek@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.
Jakub