Merge branches/gcc-4_9-branch rev 216979
authorclyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Nov 2014 15:16:44 +0000 (15:16 +0000)
committerclyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Nov 2014 15:16:44 +0000 (15:16 +0000)
git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@217045 138bc75d-0d04-0410-961f-82ee72b054a4

160 files changed:
ChangeLog
boehm-gc/ChangeLog
config/ChangeLog
contrib/ChangeLog
contrib/reghunt/ChangeLog
contrib/regression/ChangeLog
fixincludes/ChangeLog
gcc/BASE-VER
gcc/ChangeLog
gcc/DATESTAMP
gcc/Makefile.in
gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/ada/uintp.adb
gcc/ada/uintp.ads
gcc/asan.c
gcc/c-family/ChangeLog
gcc/c/ChangeLog
gcc/cfgcleanup.c
gcc/collect2.c
gcc/config/aarch64/aarch64-elf-raw.h
gcc/config/aarch64/aarch64-linux.h
gcc/config/aarch64/aarch64.c
gcc/config/avr/avr-dimode.md
gcc/config/avr/avr-fixed.md
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.c
gcc/config/avr/avr.md
gcc/config/rs6000/altivec.md
gcc/config/rs6000/rs6000-c.c
gcc/config/rs6000/rs6000.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/doc/cpp.texi
gcc/doc/invoke.texi
gcc/flag-types.h
gcc/fortran/ChangeLog
gcc/gcc.c
gcc/gimple.c
gcc/go/ChangeLog
gcc/internal-fn.c
gcc/internal-fn.def
gcc/internal-fn.h
gcc/java/ChangeLog
gcc/lra-assigns.c
gcc/lra-constraints.c
gcc/lra-int.h
gcc/lra.c
gcc/lto/ChangeLog
gcc/objc/ChangeLog
gcc/objcp/ChangeLog
gcc/opts.c
gcc/params.def
gcc/params.h
gcc/po/ChangeLog
gcc/sanitizer.def
gcc/stor-layout.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/asan/asan-interface-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/bitfield-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/bitfield-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/bitfield-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/bitfield-4.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/inc.c
gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/misalign-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/misalign-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c
gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/pr61530.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/pr62089.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/pr62140-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/pr62140-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/pr63638.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/altivec-2.C
gcc/testsuite/g++.dg/ext/stmtexpr16.C [new file with mode: 0644]
gcc/testsuite/g++.dg/torture/pr63632.C [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr63302.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr62031.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr63530.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vmx/3c-01a.c
gcc/testsuite/gcc.dg/vmx/ops-long-1.c
gcc/testsuite/gcc.dg/vmx/ops.c
gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr63448.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr63563.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/altivec-20.c
gcc/testsuite/gcc.target/powerpc/altivec-6.c
gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c
gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c
gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c [new file with mode: 0644]
gcc/testsuite/gnat.dg/entry_queues2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt41.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt41_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt41_pkg.ads [new file with mode: 0644]
gcc/testsuite/lib/asan-dg.exp
gcc/toplev.c
gcc/tree-data-ref.c
gcc/tree-data-ref.h
gcc/tree-ssa-reassoc.c
gcc/tree-vect-data-refs.c
gcc/tree-vrp.c
gcc/tree.c
gnattools/ChangeLog
include/ChangeLog
intl/ChangeLog
libada/ChangeLog
libatomic/ChangeLog
libbacktrace/ChangeLog
libcilkrts/ChangeLog
libcpp/ChangeLog
libcpp/lex.c
libcpp/po/ChangeLog
libdecnumber/ChangeLog
libffi/ChangeLog
libgcc/ChangeLog
libgcc/config/avr/lib1funcs.S
libgcc/config/libbid/ChangeLog
libgcc/config/pa/linux-unwind.h
libgfortran/ChangeLog
libgfortran/config.h.in
libgfortran/configure
libgfortran/configure.ac
libgfortran/runtime/main.c
libgomp/ChangeLog
libiberty/ChangeLog
libitm/ChangeLog
libjava/ChangeLog
libjava/classpath/ChangeLog
libjava/libltdl/ChangeLog
libobjc/ChangeLog
libquadmath/ChangeLog
libsanitizer/ChangeLog
libsanitizer/Makefile.am
libsanitizer/Makefile.in
libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
libssp/ChangeLog
libstdc++-v3/ChangeLog
libstdc++-v3/config/os/mingw32-w64/os_defines.h
libstdc++-v3/config/os/mingw32/os_defines.h
libstdc++-v3/configure.host
libstdc++-v3/include/debug/functions.h
libstdc++-v3/testsuite/23_containers/vector/63500.cc [new file with mode: 0644]
libvtv/ChangeLog
lto-plugin/ChangeLog
maintainer-scripts/ChangeLog
zlib/ChangeLog

index b526895..4a457e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/47230
index 2dbc61f..abf401c 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index cb6dcaa..e569d7a 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/47230
index c89d9d5..6254a17 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-09-18  Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * config-list.mk (LIST): Add v850-rtems.
index ccb88eb..6495664 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index de91385..602272d 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index cef5385..f1bb068 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index dad10c7..c01c413 100644 (file)
@@ -1 +1 @@
-4.9.2
+4.9.3
index 032bc6a..aa76d2b 100644 (file)
@@ -1,3 +1,333 @@
+2014-10-31  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * config/aarch64/aarch64-elf-raw.h (CA53_ERR_835769_SPEC): Define.
+       (LINK_SPEC): Include CA53_ERR_835769_SPEC.
+       * config/aarch64/aarch64-linux.h (CA53_ERR_835769_SPEC): Define.
+       (LINK_SPEC): Include CA53_ERR_835769_SPEC.
+
+2014-10-31  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/63697
+       * tree-vrp.c (simplify_internal_call_using_ranges): For subcode ==
+       MINUS_EXPR, check overflow on vr0.min - vr1.max and vr0.max - vr1.min
+       instead of vr0.min - vr1.min and vr0.max - vr1.max.
+
+2014-10-30  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR63633
+       * config/avr/avr-protos.h (regmask): New inline function.
+       (avr_fix_inputs, avr_emit3_fix_outputs): New protos.
+       * config/avr/avr.c (avr_fix_operands, avr_move_fixed_operands)
+       (avr_fix_inputs, avr_emit3_fix_outputs): New functions.
+       * config/avr/avr-fixed.md (mulqq3_nomul, muluqq3_nomul)
+       (mul<ALL2QA>3, mul<ALL4A>3, <usdiv><ALL1Q>3, <usdiv><ALL2QA>3)
+       (<usdiv><ALL4A>3, round<ALL124QA>3): Fix input operands.
+       * config/avr/avr-dimode.md (add<ALL8>3, sub<ALL8>3)
+       (<ss_addsub><ALL8S>3, <us_addsub><ALL8U>3, cbranch<ALL8>4)
+       (<di_shifts><ALL8>3, <any_extend>mulsidi3): Fix input operands.
+       * config/avr/avr.md (mulqi3_call, mulhi3_call, mulsi3, mulpsi3)
+       (mulu<QIHI>si3, muls<QIHI>si3, mulohisi3, <any_extend>mulhisi3)
+       (usmulhisi3, <any_extend>mulhi3_highpart, mulsqipsi3)
+       (fmul, fmuls, fmulsu): Fix operands.  Turn insn into expander as
+       needed.
+
+2014-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * BASE-VER: Set to 4.9.3.
+       * DEV-PHASE: Set to prerelease.
+
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * config/aarch64/aarch64.c (aarch64_madd_needs_nop): Restore
+       recog state after aarch64_prev_real_insn call.
+
+2014-10-27  Guozhi Wei  <carrot@google.com>
+
+       PR tree-optimization/63530
+       tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Set
+       pointer alignment according to DR_MISALIGNMENT.
+
+2014-10-25  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/63638
+       * asan.c (enum asan_check_flags): Fixed ASAN_CHECK_LAST.
+
+2014-10-24  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR bootstrap/63632
+       * collect2.c (main): Filter out -fno-lto.
+
+2014-10-22  Richard Biener  <rguenther@suse.de>
+           Tobias Burnus <burnus@net-b.de>
+
+       PR lto/63603
+       * gcc.c (LINK_COMMAND_SPEC): Add %{fno-lto}.
+
+2014-10-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/63563
+       * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Bail out
+       if either dra or drb stmts are not normal loads/stores.
+
+2014-10-17  Jakub Jelinek  <jakub@redhat.com>
+
+       * asan.c (instrument_derefs): Allow instrumentation of odd-sized
+       accesses even for -fsanitize=address.
+       (execute_sanopt): Only allow use_calls for -fsanitize=kernel-address.
+
+       PR tree-optimization/63302
+       * tree-ssa-reassoc.c (optimize_range_tests_xor,
+       optimize_range_tests_diff): Use !integer_pow2p () instead of
+       tree_log2 () < 0.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       * asan.c (instrument_derefs): Enable unaligned path for KASan.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-10-03  Yury Gribov  <y.gribov@samsung.com>
+
+       * asan.c (asan_finish_file): Disable __asan_init calls for KASan;
+       don't emit empty ctors.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-09-01  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61897
+       PR sanitizer/62140
+
+       * asan.c (asan_mem_ref_get_end): Handle non-ptroff_t lengths.
+       (build_check_stmt): Likewise.
+       (instrument_strlen_call): Likewise.
+       (asan_expand_check_ifn): Likewise and fix types.
+       (maybe_cast_to_ptrmode): New function.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-08-18  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/62089
+
+       * asan.c (instrument_derefs): Fix bitfield check.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-08-11  Yury Gribov  <y.gribov@samsung.com>
+
+       * asan.c (asan_check_flags): New enum.
+       (build_check_stmt_with_calls): Removed function.
+       (build_check_stmt): Split inlining logic to
+       asan_expand_check_ifn.
+       (instrument_derefs): Rename parameter.
+       (instrument_mem_region_access): Rename parameter.
+       (instrument_strlen_call): Likewise.
+       (asan_expand_check_ifn): New function.
+       (asan_instrument): Remove old code.
+       (pass_sanopt::execute): Change handling of
+       asan-instrumentation-with-call-threshold.
+       (asan_clear_shadow): Fix formatting.
+       (asan_function_start): Likewise.
+       (asan_emit_stack_protection): Likewise.
+       * doc/invoke.texi (asan-instrumentation-with-call-threshold):
+       Update description.
+       * internal-fn.c (expand_ASAN_CHECK): New function.
+       * internal-fn.def (ASAN_CHECK): New internal function.
+       * params.def (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD):
+       Update description.
+       (PARAM_ASAN_USE_AFTER_RETURN): Likewise.
+       * tree.c: Small comment fix.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-08-11  Yury Gribov  <y.gribov@samsung.com>
+
+       * gimple.c (gimple_call_fnspec): Support internal functions.
+       (gimple_call_return_flags): Use const.
+       * Makefile.in (GTFILES): Add internal-fn.h to list of GC files.
+       * internal-fn.def: Add fnspec information.
+       * internal-fn.h (internal_fn_fnspec): New function.
+       (init_internal_fns): Declare new function.
+       * internal-fn.c (internal_fn_fnspec_array): New global variable.
+       (init_internal_fns): New function.
+       * tree-core.h: Update macro call.
+       * tree.c (build_common_builtin_nodes): Initialize internal fns.
+
+       Backport from mainline
+       2014-08-12  Yury Gribov  <y.gribov@samsung.com>
+
+       * internal-fn.c (init_internal_fns): Fix off-by-one.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-07-31  Yury Gribov  <y.gribov@samsung.com>
+
+       * doc/cpp.texi (__SANITIZE_ADDRESS__): Updated description.
+       * doc/invoke.texi (-fsanitize=kernel-address): Describe new option.
+       * flag-types.h (SANITIZE_USER_ADDRESS, SANITIZE_KERNEL_ADDRESS):
+       New enums.
+       * gcc.c (sanitize_spec_function): Support new option.
+       (SANITIZER_SPEC): Remove now redundant check.
+       * opts.c (common_handle_option): Support new option.
+       (finish_options): Check for incompatibilities.
+       * toplev.c (process_options): Split userspace-specific checks.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-06-24  Max Ostapenko  <m.ostapenko@partner.samsung.com>
+
+       * asan.c (instrument_strlen_call): Do not instrument first byte in strlen
+       if already instrumented.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-06-16  Yury Gribov  <y.gribov@samsung.com>
+
+       * asan.c (check_func): New function.
+       (maybe_create_ssa_name): Likewise.
+       (build_check_stmt_with_calls): Likewise.
+       (use_calls_p): Likewise.
+       (report_error_func): Change interface.
+       (build_check_stmt): Allow non-integer lengths; add support
+       for new parameter.
+       (asan_instrument): Likewise.
+       (instrument_mem_region_access): Moved code to
+       build_check_stmt.
+       (instrument_derefs): Likewise.
+       (instrument_strlen_call): Likewise.
+       * cfgcleanup.c (old_insns_match_p): Add support for new
+       functions.
+       * doc/invoke.texi: Describe new parameter.
+       * params.def: Define new parameter.
+       * params.h: Likewise.
+       * sanitizer.def: Describe new builtins.
+
+       Backport from mainline
+       2014-06-16  Yury Gribov  <y.gribov@samsung.com>
+
+       * asan.c (build_check_stmt): Fix maybe-uninitialized warning.
+
+       Backport from mainline
+       2014-06-18  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61530
+
+       * asan.c (build_check_stmt): Add condition.
+
+       Backport from mainline
+       2014-06-18  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61547
+
+       * asan.c (instrument_strlen_call): Fixed instrumentation of
+       trailing byte.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-05-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * asan.c (report_error_func): Add SLOW_P argument, use
+       BUILT_IN_ASAN_*_N if set.
+       (build_check_stmt): Likewise.
+       (instrument_derefs): If T has insufficient alignment,
+       force same handling as for odd sizes.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-05-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * sanitizer.def (BUILT_IN_ASAN_REPORT_LOAD_N,
+       BUILT_IN_ASAN_REPORT_STORE_N): New.
+       * asan.c (struct asan_mem_ref): Change access_size type to
+       HOST_WIDE_INT.
+       (asan_mem_ref_init, asan_mem_ref_new, get_mem_refs_of_builtin_call,
+       update_mem_ref_hash_table): Likewise.
+       (asan_mem_ref_hasher::hash): Hash in a HWI.
+       (report_error_func): Change size_in_bytes argument to HWI.
+       Use *_N builtins if size_in_bytes is larger than 16 or not power of
+       two.
+       (build_shadow_mem_access): New function.
+       (build_check_stmt): Use it.  Change size_in_bytes argument to HWI.
+       Handle size_in_bytes not power of two or larger than 16.
+       (instrument_derefs): Don't give up if size_in_bytes is not
+       power of two or is larger than 16.
+
+2014-10-15  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/63448
+       * lra-int.h (LRA_MAX_CONSTRAINT_ITERATION_NUMBER): Remove.
+       (LRA_MAX_ASSIGNMENT_ITERATION_NUMBER): New.
+       (LRA_MAX_INHERITANCE_PASSES): Use it.
+       (lra_constraint_iter_after_spill): Remove.
+       (lra_assignment_iter): New.
+       (lra_assignment_iter_after_spill): New.
+       * lra-assigns.c (lra_assignment_iter): New.
+       (lra_assignment_iter_after_spill): New.
+       (former_reload_pseudo_spill_p): New.
+       (spill_for): Set up former_reload_pseudo_spill_p.
+       (setup_live_pseudos_and_spill_after_risky): Ditto.
+       (assign_by_spills): Ditto.
+       (lra_assign): Increment lra_assignment_iter.  Print the iteration
+       number.  Reset former_reload_pseudo_spill_p.  Check
+       lra_assignment_iter_after_spill.
+       * lra.c (lra): Remove lra_constraint_iter_after_spill.  Initialize
+       lra_assignment_iter and lra_assignment_iter_after_spill.
+       * lra-constraints.c (lra_constraint_iter_after_spill): Remove.
+       (lra_constraints): Remove code with
+       lra_assignment_iter_after_spill.
+
+2014-10-15  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * stor-layout.c (self_referential_size): Do not promote arguments.
+
+2014-10-15  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-08-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/62031
+       * tree-data-ref.c (dr_analyze_indices): Do not set
+       DR_UNCONSTRAINED_BASE.
+       (dr_may_alias_p): All indirect accesses have to go the
+       formerly DR_UNCONSTRAINED_BASE path.
+       * tree-data-ref.h (struct indices): Remove
+       unconstrained_base member.
+       (DR_UNCONSTRAINED_BASE): Remove.
+
+2014-10-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline r215880
+       2014-10-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
+       Issue a warning message when vec_lvsl or vec_lvsr is used with a
+       little endian target.
+
+       Backport from mainline r215882
+       2014-10-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * altivec.md (altivec_lvsl): New define_expand.
+       (altivec_lvsl_direct): Rename define_insn from altivec_lvsl.
+       (altivec_lvsr): New define_expand.
+       (altivec_lvsr_direct): Rename define_insn from altivec_lvsr.
+       * rs6000.c (rs6000_expand_builtin): Change to use
+       altivec_lvs[lr]_direct; remove commented-out code.
+
 2014-10-10  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/63379
        * omp-low.c (create_omp_child_function): Don't set DECL_NAMELESS
        on the FUNCTION_DECL.
 
-       * BASE-VER: Set to 4.9.1.
+       * BASE-VER: Set to 4.9.2.
        * DEV-PHASE: Set to prerelease.
 
 2014-07-16  Release Manager
index ac2dda7..a651986 100644 (file)
@@ -1 +1 @@
-20141013
+20141031
index 146b16c..7565c58 100644 (file)
@@ -2282,7 +2282,9 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
   $(srcdir)/vtable-verify.c \
   $(srcdir)/asan.c \
   $(srcdir)/ubsan.c \
-  $(srcdir)/tsan.c $(srcdir)/ipa-devirt.c \
+  $(srcdir)/tsan.c \
+  $(srcdir)/ipa-devirt.c \
+  $(srcdir)/internal-fn.h \
   @all_gtfiles@
 
 # Compute the list of GT header files from the corresponding C sources,
index c8c4d80..de30982 100644 (file)
@@ -1,3 +1,22 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-27  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Remove
+       superfluous computation for the max size.
+       <E_Array_Subtype>: Likewise.  Make sure that the max size calculation
+       does not overflow at compile time.
+
+2014-10-13  Eric Botcazou  <ebotcazou@adacore.com>
+            Alan Modra  <amodra@gmail.com>
+
+       PR ada/63225
+       * uintp.adb (Vector_To_Uint): Move from here to...
+       * uintp.ads (UI_Vector): Make public.
+       (Vector_To_Uint): ...here.
+
 2014-08-12  Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * socket.c: For RTEMS, use correct prototype of gethostbyname_r().
index 52452ce..95bc778 100644 (file)
@@ -2200,11 +2200,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
                tree gnu_max
                  = convert (sizetype, TYPE_MAX_VALUE (gnu_index_type));
                tree gnu_this_max
-                 = size_binop (MAX_EXPR,
-                               size_binop (PLUS_EXPR, size_one_node,
-                                           size_binop (MINUS_EXPR,
-                                                       gnu_max, gnu_min)),
-                               size_zero_node);
+                 = size_binop (PLUS_EXPR, size_one_node,
+                               size_binop (MINUS_EXPR, gnu_max, gnu_min));
 
                if (TREE_CODE (gnu_this_max) == INTEGER_CST
                    && TREE_OVERFLOW (gnu_this_max))
@@ -2525,20 +2522,26 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
                    gnu_max_size = NULL_TREE;
                  else
                    {
-                     tree gnu_this_max
-                       = size_binop (MAX_EXPR,
-                                     size_binop (PLUS_EXPR, size_one_node,
-                                                 size_binop (MINUS_EXPR,
+                     tree gnu_this_max;
+
+                     /* Use int_const_binop if the bounds are constant to
+                        avoid any unwanted overflow.  */
+                     if (TREE_CODE (gnu_base_min) == INTEGER_CST
+                         && TREE_CODE (gnu_base_max) == INTEGER_CST)
+                       gnu_this_max
+                         = int_const_binop (PLUS_EXPR, size_one_node,
+                                            int_const_binop (MINUS_EXPR,
                                                              gnu_base_max,
-                                                             gnu_base_min)),
-                                     size_zero_node);
-
-                     if (TREE_CODE (gnu_this_max) == INTEGER_CST
-                         && TREE_OVERFLOW (gnu_this_max))
-                       gnu_max_size = NULL_TREE;
+                                                             gnu_base_min));
                      else
-                       gnu_max_size
-                         = size_binop (MULT_EXPR, gnu_max_size, gnu_this_max);
+                       gnu_this_max
+                         = size_binop (PLUS_EXPR, size_one_node,
+                                       size_binop (MINUS_EXPR,
+                                                   gnu_base_max,
+                                                   gnu_base_min));
+
+                     gnu_max_size
+                       = size_binop (MULT_EXPR, gnu_max_size, gnu_this_max);
                    }
                }
 
index f418b56..226c187 100644 (file)
@@ -171,22 +171,6 @@ package body Uintp is
    --  If Discard_Quotient is True, Quotient is set to No_Uint
    --  If Discard_Remainder is True, Remainder is set to No_Uint
 
-   function Vector_To_Uint
-     (In_Vec   : UI_Vector;
-      Negative : Boolean) return Uint;
-   --  Functions that calculate values in UI_Vectors, call this function to
-   --  create and return the Uint value. In_Vec contains the multiple precision
-   --  (Base) representation of a non-negative value. Leading zeroes are
-   --  permitted. Negative is set if the desired result is the negative of the
-   --  given value. The result will be either the appropriate directly
-   --  represented value, or a table entry in the proper canonical format is
-   --  created and returned.
-   --
-   --  Note that Init_Operand puts a signed value in the result vector, but
-   --  Vector_To_Uint is always presented with a non-negative value. The
-   --  processing of signs is something that is done by the caller before
-   --  calling Vector_To_Uint.
-
    ------------
    -- Direct --
    ------------
index dcf85a0..d76d285 100644 (file)
@@ -90,6 +90,18 @@ package Uintp is
    Uint_Minus_80  : constant Uint;
    Uint_Minus_128 : constant Uint;
 
+   type UI_Vector is array (Pos range <>) of Int;
+   --  Vector containing the integer values of a Uint value
+
+   --  Note: An earlier version of this package used pointers of arrays of Ints
+   --  (dynamically allocated) for the Uint type. The change leads to a few
+   --  less natural idioms used throughout this code, but eliminates all uses
+   --  of the heap except for the table package itself. For example, Uint
+   --  parameters are often converted to UI_Vectors for internal manipulation.
+   --  This is done by creating the local UI_Vector using the function N_Digits
+   --  on the Uint to find the size needed for the vector, and then calling
+   --  Init_Operand to copy the values out of the table into the vector.
+
    -----------------
    -- Subprograms --
    -----------------
@@ -252,6 +264,22 @@ package Uintp is
    --  function is used for capacity checks, and it can be one bit off
    --  without affecting its usage.
 
+   function Vector_To_Uint
+     (In_Vec   : UI_Vector;
+      Negative : Boolean) return Uint;
+   --  Functions that calculate values in UI_Vectors, call this function to
+   --  create and return the Uint value. In_Vec contains the multiple precision
+   --  (Base) representation of a non-negative value. Leading zeroes are
+   --  permitted. Negative is set if the desired result is the negative of the
+   --  given value. The result will be either the appropriate directly
+   --  represented value, or a table entry in the proper canonical format is
+   --  created and returned.
+   --
+   --  Note that Init_Operand puts a signed value in the result vector, but
+   --  Vector_To_Uint is always presented with a non-negative value. The
+   --  processing of signs is something that is done by the caller before
+   --  calling Vector_To_Uint.
+
    ---------------------
    -- Output Routines --
    ---------------------
@@ -494,18 +522,6 @@ private
    --  UI_Vector is defined for this purpose and some internal subprograms
    --  used for converting from one to the other are defined.
 
-   type UI_Vector is array (Pos range <>) of Int;
-   --  Vector containing the integer values of a Uint value
-
-   --  Note: An earlier version of this package used pointers of arrays of Ints
-   --  (dynamically allocated) for the Uint type. The change leads to a few
-   --  less natural idioms used throughout this code, but eliminates all uses
-   --  of the heap except for the table package itself. For example, Uint
-   --  parameters are often converted to UI_Vectors for internal manipulation.
-   --  This is done by creating the local UI_Vector using the function N_Digits
-   --  on the Uint to find the size needed for the vector, and then calling
-   --  Init_Operand to copy the values out of the table into the vector.
-
    type Uint_Entry is record
       Length : Pos;
       --  Length of entry in Udigits table in digits (i.e. in words)
index 08cc2c0..f6c42a1 100644 (file)
@@ -242,6 +242,17 @@ static GTY(()) tree shadow_ptr_types[2];
 /* Decl for __asan_option_detect_stack_use_after_return.  */
 static GTY(()) tree asan_detect_stack_use_after_return;
 
+/* Various flags for Asan builtins.  */
+enum asan_check_flags
+{
+  ASAN_CHECK_STORE = 1 << 0,
+  ASAN_CHECK_SCALAR_ACCESS = 1 << 1,
+  ASAN_CHECK_NON_ZERO_LEN = 1 << 2,
+  ASAN_CHECK_START_INSTRUMENTED = 1 << 3,
+  ASAN_CHECK_END_INSTRUMENTED = 1 << 4,
+  ASAN_CHECK_LAST = 1 << 5
+};
+
 /* Hashtable support for memory references used by gimple
    statements.  */
 
@@ -251,8 +262,8 @@ struct asan_mem_ref
   /* The expression of the beginning of the memory region.  */
   tree start;
 
-  /* The size of the access (can be 1, 2, 4, 8, 16 for now).  */
-  char access_size;
+  /* The size of the access.  */
+  HOST_WIDE_INT access_size;
 };
 
 static alloc_pool asan_mem_ref_alloc_pool;
@@ -274,7 +285,7 @@ asan_mem_ref_get_alloc_pool ()
 /* Initializes an instance of asan_mem_ref.  */
 
 static void
-asan_mem_ref_init (asan_mem_ref *ref, tree start, char access_size)
+asan_mem_ref_init (asan_mem_ref *ref, tree start, HOST_WIDE_INT access_size)
 {
   ref->start = start;
   ref->access_size = access_size;
@@ -287,7 +298,7 @@ asan_mem_ref_init (asan_mem_ref *ref, tree start, char access_size)
    access to the referenced memory.  */
 
 static asan_mem_ref*
-asan_mem_ref_new (tree start, char access_size)
+asan_mem_ref_new (tree start, HOST_WIDE_INT access_size)
 {
   asan_mem_ref *ref =
     (asan_mem_ref *) pool_alloc (asan_mem_ref_get_alloc_pool ());
@@ -305,6 +316,9 @@ asan_mem_ref_get_end (tree start, tree len)
   if (len == NULL_TREE || integer_zerop (len))
     return start;
 
+  if (!ptrofftype_p (len))
+    len = convert_to_ptrofftype (len);
+
   return fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (start), start, len);
 }
 
@@ -334,7 +348,7 @@ inline hashval_t
 asan_mem_ref_hasher::hash (const asan_mem_ref *mem_ref)
 {
   hashval_t h = iterative_hash_expr (mem_ref->start, 0);
-  h = iterative_hash_hashval_t (h, mem_ref->access_size);
+  h = iterative_hash_host_wide_int (mem_ref->access_size, h);
   return h;
 }
 
@@ -392,7 +406,7 @@ free_mem_ref_resources ()
 /* Return true iff the memory reference REF has been instrumented.  */
 
 static bool
-has_mem_ref_been_instrumented (tree ref, char access_size)
+has_mem_ref_been_instrumented (tree ref, HOST_WIDE_INT access_size)
 {
   asan_mem_ref r;
   asan_mem_ref_init (&r, ref, access_size);
@@ -480,7 +494,7 @@ get_mem_refs_of_builtin_call (const gimple call,
   tree source0 = NULL_TREE, source1 = NULL_TREE,
     dest = NULL_TREE, len = NULL_TREE;
   bool is_store = true, got_reference_p = false;
-  char access_size = 1;
+  HOST_WIDE_INT access_size = 1;
 
   switch (DECL_FUNCTION_CODE (callee))
     {
@@ -842,7 +856,7 @@ has_stmt_been_instrumented_p (gimple stmt)
 /*  Insert a memory reference into the hash table.  */
 
 static void
-update_mem_ref_hash_table (tree ref, char access_size)
+update_mem_ref_hash_table (tree ref, HOST_WIDE_INT access_size)
 {
   hash_table <asan_mem_ref_hasher> ht = get_mem_ref_hash_table ();
 
@@ -929,7 +943,7 @@ asan_clear_shadow (rtx shadow_mem, HOST_WIDE_INT len)
 
   emit_move_insn (shadow_mem, const0_rtx);
   tmp = expand_simple_binop (Pmode, PLUS, addr, gen_int_mode (4, Pmode), addr,
-                             true, OPTAB_LIB_WIDEN);
+                            true, OPTAB_LIB_WIDEN);
   if (tmp != addr)
     emit_move_insn (addr, tmp);
   emit_cmp_and_jump_insns (addr, end, LT, NULL_RTX, Pmode, true, top_label);
@@ -944,7 +958,7 @@ asan_function_start (void)
   section *fnsec = function_section (current_function_decl);
   switch_to_section (fnsec);
   ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LASANPC",
-                         current_function_funcdef_no);
+                        current_function_funcdef_no);
 }
 
 /* Insert code to protect stack vars.  The prologue sequence should be emitted
@@ -1009,7 +1023,7 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
     {
       use_after_return_class = floor_log2 (asan_frame_size - 1) - 5;
       /* __asan_stack_malloc_N guarantees alignment
-         N < 6 ? (64 << N) : 4096 bytes.  */
+        N < 6 ? (64 << N) : 4096 bytes.  */
       if (alignb > (use_after_return_class < 6
                    ? (64U << use_after_return_class) : 4096U))
        use_after_return_class = -1;
@@ -1082,7 +1096,7 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
   ASM_GENERATE_INTERNAL_LABEL (buf, "LASANPC", current_function_funcdef_no);
   id = get_identifier (buf);
   decl = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
-                    VAR_DECL, id, char_type_node);
+                   VAR_DECL, id, char_type_node);
   SET_DECL_ASSEMBLER_NAME (decl, id);
   TREE_ADDRESSABLE (decl) = 1;
   TREE_READONLY (decl) = 1;
@@ -1315,23 +1329,50 @@ asan_protect_global (tree decl)
   return true;
 }
 
-/* Construct a function tree for __asan_report_{load,store}{1,2,4,8,16}.
-   IS_STORE is either 1 (for a store) or 0 (for a load).
-   SIZE_IN_BYTES is one of 1, 2, 4, 8, 16.  */
+/* Construct a function tree for __asan_report_{load,store}{1,2,4,8,16,_n}.
+   IS_STORE is either 1 (for a store) or 0 (for a load).  */
 
 static tree
-report_error_func (bool is_store, int size_in_bytes)
+report_error_func (bool is_store, HOST_WIDE_INT size_in_bytes, int *nargs)
 {
-  static enum built_in_function report[2][5]
+  static enum built_in_function report[2][6]
     = { { BUILT_IN_ASAN_REPORT_LOAD1, BUILT_IN_ASAN_REPORT_LOAD2,
          BUILT_IN_ASAN_REPORT_LOAD4, BUILT_IN_ASAN_REPORT_LOAD8,
-         BUILT_IN_ASAN_REPORT_LOAD16 },
+         BUILT_IN_ASAN_REPORT_LOAD16, BUILT_IN_ASAN_REPORT_LOAD_N },
        { BUILT_IN_ASAN_REPORT_STORE1, BUILT_IN_ASAN_REPORT_STORE2,
          BUILT_IN_ASAN_REPORT_STORE4, BUILT_IN_ASAN_REPORT_STORE8,
-         BUILT_IN_ASAN_REPORT_STORE16 } };
+         BUILT_IN_ASAN_REPORT_STORE16, BUILT_IN_ASAN_REPORT_STORE_N } };
+  if (size_in_bytes == -1)
+    {
+      *nargs = 2;
+      return builtin_decl_implicit (report[is_store][5]);
+    }
+  *nargs = 1;
   return builtin_decl_implicit (report[is_store][exact_log2 (size_in_bytes)]);
 }
 
+/* Construct a function tree for __asan_{load,store}{1,2,4,8,16,_n}.
+   IS_STORE is either 1 (for a store) or 0 (for a load).  */
+
+static tree
+check_func (bool is_store, int size_in_bytes, int *nargs)
+{
+  static enum built_in_function check[2][6]
+    = { { BUILT_IN_ASAN_LOAD1, BUILT_IN_ASAN_LOAD2,
+      BUILT_IN_ASAN_LOAD4, BUILT_IN_ASAN_LOAD8,
+      BUILT_IN_ASAN_LOAD16, BUILT_IN_ASAN_LOADN },
+       { BUILT_IN_ASAN_STORE1, BUILT_IN_ASAN_STORE2,
+      BUILT_IN_ASAN_STORE4, BUILT_IN_ASAN_STORE8,
+      BUILT_IN_ASAN_STORE16, BUILT_IN_ASAN_STOREN } };
+  if (size_in_bytes == -1)
+    {
+      *nargs = 2;
+      return builtin_decl_implicit (check[is_store][5]);
+    }
+  *nargs = 1;
+  return builtin_decl_implicit (check[is_store][exact_log2 (size_in_bytes)]);
+}
+
 /* Split the current basic block and create a condition statement
    insertion point right before or after the statement pointed to by
    ITER.  Return an iterator to the point at which the caller might
@@ -1450,85 +1491,36 @@ insert_if_then_before_iter (gimple cond,
   gsi_insert_after (&cond_insert_point, cond, GSI_NEW_STMT);
 }
 
-/* Instrument the memory access instruction BASE.  Insert new
-   statements before or after ITER.
-
-   Note that the memory access represented by BASE can be either an
-   SSA_NAME, or a non-SSA expression.  LOCATION is the source code
-   location.  IS_STORE is TRUE for a store, FALSE for a load.
-   BEFORE_P is TRUE for inserting the instrumentation code before
-   ITER, FALSE for inserting it after ITER.  SIZE_IN_BYTES is one of
-   1, 2, 4, 8, 16.
-
-   If BEFORE_P is TRUE, *ITER is arranged to still point to the
-   statement it was pointing to prior to calling this function,
-   otherwise, it points to the statement logically following it.  */
+/* Build
+   (base_addr >> ASAN_SHADOW_SHIFT) + targetm.asan_shadow_offset ().  */
 
-static void
-build_check_stmt (location_t location, tree base, gimple_stmt_iterator *iter,
-                 bool before_p, bool is_store, int size_in_bytes)
+static tree
+build_shadow_mem_access (gimple_stmt_iterator *gsi, location_t location,
+                        tree base_addr, tree shadow_ptr_type)
 {
-  gimple_stmt_iterator gsi;
-  basic_block then_bb, else_bb;
-  tree t, base_addr, shadow;
-  gimple g;
-  tree shadow_ptr_type = shadow_ptr_types[size_in_bytes == 16 ? 1 : 0];
+  tree t, uintptr_type = TREE_TYPE (base_addr);
   tree shadow_type = TREE_TYPE (shadow_ptr_type);
-  tree uintptr_type
-    = build_nonstandard_integer_type (TYPE_PRECISION (TREE_TYPE (base)), 1);
-  tree base_ssa = base;
-
-  /* Get an iterator on the point where we can add the condition
-     statement for the instrumentation.  */
-  gsi = create_cond_insert_point (iter, before_p,
-                                 /*then_more_likely_p=*/false,
-                                 /*create_then_fallthru_edge=*/false,
-                                 &then_bb,
-                                 &else_bb);
-
-  base = unshare_expr (base);
-
-  /* BASE can already be an SSA_NAME; in that case, do not create a
-     new SSA_NAME for it.  */
-  if (TREE_CODE (base) != SSA_NAME)
-    {
-      g = gimple_build_assign_with_ops (TREE_CODE (base),
-                                       make_ssa_name (TREE_TYPE (base), NULL),
-                                       base, NULL_TREE);
-      gimple_set_location (g, location);
-      gsi_insert_after (&gsi, g, GSI_NEW_STMT);
-      base_ssa = gimple_assign_lhs (g);
-    }
-
-  g = gimple_build_assign_with_ops (NOP_EXPR,
-                                   make_ssa_name (uintptr_type, NULL),
-                                   base_ssa, NULL_TREE);
-  gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
-  base_addr = gimple_assign_lhs (g);
-
-  /* Build
-     (base_addr >> ASAN_SHADOW_SHIFT) + targetm.asan_shadow_offset ().  */
+  gimple g;
 
   t = build_int_cst (uintptr_type, ASAN_SHADOW_SHIFT);
   g = gimple_build_assign_with_ops (RSHIFT_EXPR,
                                    make_ssa_name (uintptr_type, NULL),
                                    base_addr, t);
   gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+  gsi_insert_after (gsi, g, GSI_NEW_STMT);
 
   t = build_int_cst (uintptr_type, targetm.asan_shadow_offset ());
   g = gimple_build_assign_with_ops (PLUS_EXPR,
                                    make_ssa_name (uintptr_type, NULL),
                                    gimple_assign_lhs (g), t);
   gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+  gsi_insert_after (gsi, g, GSI_NEW_STMT);
 
   g = gimple_build_assign_with_ops (NOP_EXPR,
                                    make_ssa_name (shadow_ptr_type, NULL),
                                    gimple_assign_lhs (g), NULL_TREE);
   gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+  gsi_insert_after (gsi, g, GSI_NEW_STMT);
 
   t = build2 (MEM_REF, shadow_type, gimple_assign_lhs (g),
              build_int_cst (shadow_ptr_type, 0));
@@ -1536,48 +1528,150 @@ build_check_stmt (location_t location, tree base, gimple_stmt_iterator *iter,
                                    make_ssa_name (shadow_type, NULL),
                                    t, NULL_TREE);
   gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
-  shadow = gimple_assign_lhs (g);
+  gsi_insert_after (gsi, g, GSI_NEW_STMT);
+  return gimple_assign_lhs (g);
+}
+
+/* BASE can already be an SSA_NAME; in that case, do not create a
+   new SSA_NAME for it.  */
+
+static tree
+maybe_create_ssa_name (location_t loc, tree base, gimple_stmt_iterator *iter,
+                      bool before_p)
+{
+  if (TREE_CODE (base) == SSA_NAME)
+    return base;
+  gimple g
+    = gimple_build_assign_with_ops (TREE_CODE (base),
+                                   make_ssa_name (TREE_TYPE (base), NULL),
+                                   base, NULL_TREE);
+  gimple_set_location (g, loc);
+  if (before_p)
+    gsi_insert_before (iter, g, GSI_SAME_STMT);
+  else
+    gsi_insert_after (iter, g, GSI_NEW_STMT);
+  return gimple_assign_lhs (g);
+}
+
+/* LEN can already have necessary size and precision;
+   in that case, do not create a new variable.  */
+
+tree
+maybe_cast_to_ptrmode (location_t loc, tree len, gimple_stmt_iterator *iter,
+                      bool before_p)
+{
+  if (ptrofftype_p (len))
+    return len;
+  gimple g
+    = gimple_build_assign_with_ops (NOP_EXPR,
+                                   make_ssa_name (pointer_sized_int_node, NULL),
+                                   len, NULL);
+  gimple_set_location (g, loc);
+  if (before_p)
+    gsi_insert_before (iter, g, GSI_SAME_STMT);
+  else
+    gsi_insert_after (iter, g, GSI_NEW_STMT);
+  return gimple_assign_lhs (g);
+}
+
+/* Instrument the memory access instruction BASE.  Insert new
+   statements before or after ITER.
 
-  if (size_in_bytes < 8)
+   Note that the memory access represented by BASE can be either an
+   SSA_NAME, or a non-SSA expression.  LOCATION is the source code
+   location.  IS_STORE is TRUE for a store, FALSE for a load.
+   BEFORE_P is TRUE for inserting the instrumentation code before
+   ITER, FALSE for inserting it after ITER.  IS_SCALAR_ACCESS is TRUE
+   for a scalar memory access and FALSE for memory region access.
+   NON_ZERO_P is TRUE if memory region is guaranteed to have non-zero
+   length.  ALIGN tells alignment of accessed memory object.
+
+   START_INSTRUMENTED and END_INSTRUMENTED are TRUE if start/end of
+   memory region have already been instrumented.
+
+   If BEFORE_P is TRUE, *ITER is arranged to still point to the
+   statement it was pointing to prior to calling this function,
+   otherwise, it points to the statement logically following it.  */
+
+static void
+build_check_stmt (location_t loc, tree base, tree len,
+                 HOST_WIDE_INT size_in_bytes, gimple_stmt_iterator *iter,
+                 bool is_non_zero_len, bool before_p, bool is_store,
+                 bool is_scalar_access, unsigned int align = 0,
+                 bool start_instrumented = false,
+                 bool end_instrumented = false)
+{
+  gimple_stmt_iterator gsi = *iter;
+  gimple g;
+
+  gcc_assert (!(size_in_bytes > 0 && !is_non_zero_len));
+
+  if (start_instrumented && end_instrumented)
     {
-      /* Slow path for 1, 2 and 4 byte accesses.
-        Test (shadow != 0)
-             & ((base_addr & 7) + (size_in_bytes - 1)) >= shadow).  */
-      gimple_seq seq = NULL;
-      gimple shadow_test = build_assign (NE_EXPR, shadow, 0);
-      gimple_seq_add_stmt (&seq, shadow_test);
-      gimple_seq_add_stmt (&seq, build_assign (BIT_AND_EXPR, base_addr, 7));
-      gimple_seq_add_stmt (&seq, build_type_cast (shadow_type,
-                                                  gimple_seq_last (seq)));
-      if (size_in_bytes > 1)
-        gimple_seq_add_stmt (&seq,
-                             build_assign (PLUS_EXPR, gimple_seq_last (seq),
-                                           size_in_bytes - 1));
-      gimple_seq_add_stmt (&seq, build_assign (GE_EXPR, gimple_seq_last (seq),
-                                               shadow));
-      gimple_seq_add_stmt (&seq, build_assign (BIT_AND_EXPR, shadow_test,
-                                               gimple_seq_last (seq)));
-      t = gimple_assign_lhs (gimple_seq_last (seq));
-      gimple_seq_set_location (seq, location);
-      gsi_insert_seq_after (&gsi, seq, GSI_CONTINUE_LINKING);
+      if (!before_p)
+       gsi_next (iter);
+      return;
     }
-  else
-    t = shadow;
 
-  g = gimple_build_cond (NE_EXPR, t, build_int_cst (TREE_TYPE (t), 0),
-                        NULL_TREE, NULL_TREE);
-  gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+  gsi = *iter;
 
-  /* Generate call to the run-time library (e.g. __asan_report_load8).  */
-  gsi = gsi_start_bb (then_bb);
-  g = gimple_build_call (report_error_func (is_store, size_in_bytes),
-                        1, base_addr);
-  gimple_set_location (g, location);
-  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+  base = unshare_expr (base);
+  base = maybe_create_ssa_name (loc, base, &gsi, before_p);
 
-  *iter = gsi_start_bb (else_bb);
+  if (len)
+    {
+      len = unshare_expr (len);
+      len = maybe_cast_to_ptrmode (loc, len, iter, before_p);
+    }
+  else
+    {
+      gcc_assert (size_in_bytes != -1);
+      len = build_int_cst (pointer_sized_int_node, size_in_bytes);
+    }
+
+  if (size_in_bytes > 1)
+    {
+      if ((size_in_bytes & (size_in_bytes - 1)) != 0
+         || size_in_bytes > 16)
+       is_scalar_access = false;
+      else if (align && align < size_in_bytes * BITS_PER_UNIT)
+       {
+         /* On non-strict alignment targets, if
+            16-byte access is just 8-byte aligned,
+            this will result in misaligned shadow
+            memory 2 byte load, but otherwise can
+            be handled using one read.  */
+         if (size_in_bytes != 16
+             || STRICT_ALIGNMENT
+             || align < 8 * BITS_PER_UNIT)
+           is_scalar_access = false;
+       }
+    }
+
+  HOST_WIDE_INT flags = 0;
+  if (is_store)
+    flags |= ASAN_CHECK_STORE;
+  if (is_non_zero_len)
+    flags |= ASAN_CHECK_NON_ZERO_LEN;
+  if (is_scalar_access)
+    flags |= ASAN_CHECK_SCALAR_ACCESS;
+  if (start_instrumented)
+    flags |= ASAN_CHECK_START_INSTRUMENTED;
+  if (end_instrumented)
+    flags |= ASAN_CHECK_END_INSTRUMENTED;
+
+  g = gimple_build_call_internal (IFN_ASAN_CHECK, 3,
+                                 build_int_cst (integer_type_node, flags),
+                                 base, len);
+  gimple_set_location (g, loc);
+  if (before_p)
+    gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+  else
+    {
+      gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+      gsi_next (&gsi);
+      *iter = gsi;
+    }
 }
 
 /* If T represents a memory access, add instrumentation code before ITER.
@@ -1611,8 +1705,7 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
     }
 
   size_in_bytes = int_size_in_bytes (type);
-  if ((size_in_bytes & (size_in_bytes - 1)) != 0
-      || (unsigned HOST_WIDE_INT) size_in_bytes - 1 >= 16)
+  if (size_in_bytes <= 0)
     return;
 
   HOST_WIDE_INT bitsize, bitpos;
@@ -1621,20 +1714,21 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
   int volatilep = 0, unsignedp = 0;
   tree inner = get_inner_reference (t, &bitsize, &bitpos, &offset,
                                    &mode, &unsignedp, &volatilep, false);
-  if (bitpos % (size_in_bytes * BITS_PER_UNIT)
-      || bitsize != size_in_bytes * BITS_PER_UNIT)
+
+  if (TREE_CODE (t) == COMPONENT_REF
+      && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1)) != NULL_TREE)
     {
-      if (TREE_CODE (t) == COMPONENT_REF
-         && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1)) != NULL_TREE)
-       {
-         tree repr = DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1));
-         instrument_derefs (iter, build3 (COMPONENT_REF, TREE_TYPE (repr),
-                                          TREE_OPERAND (t, 0), repr,
-                                          NULL_TREE), location, is_store);
-       }
+      tree repr = DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1));
+      instrument_derefs (iter, build3 (COMPONENT_REF, TREE_TYPE (repr),
+                                      TREE_OPERAND (t, 0), repr,
+                                      NULL_TREE), location, is_store);
       return;
     }
 
+  if (bitpos % BITS_PER_UNIT
+      || bitsize != size_in_bytes * BITS_PER_UNIT)
+    return;
+
   if (TREE_CODE (inner) == VAR_DECL
       && offset == NULL_TREE
       && bitpos >= 0
@@ -1666,8 +1760,10 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
   base = build_fold_addr_expr (t);
   if (!has_mem_ref_been_instrumented (base, size_in_bytes))
     {
-      build_check_stmt (location, base, iter, /*before_p=*/true,
-                       is_store, size_in_bytes);
+      unsigned int align = get_object_alignment (t);
+      build_check_stmt (location, base, NULL_TREE, size_in_bytes, iter,
+                       /*is_non_zero_len*/size_in_bytes > 0, /*before_p=*/true,
+                       is_store, /*is_scalar_access*/true, align);
       update_mem_ref_hash_table (base, size_in_bytes);
       update_mem_ref_hash_table (t, size_in_bytes);
     }
@@ -1692,142 +1788,24 @@ instrument_mem_region_access (tree base, tree len,
       || integer_zerop (len))
     return;
 
-  gimple_stmt_iterator gsi = *iter;
-
-  basic_block fallthrough_bb = NULL, then_bb = NULL;
-
   /* If the beginning of the memory region has already been
      instrumented, do not instrument it.  */
   bool start_instrumented = has_mem_ref_been_instrumented (base, 1);
 
   /* If the end of the memory region has already been instrumented, do
-     not instrument it. */
+     not instrument it.  */
   tree end = asan_mem_ref_get_end (base, len);
   bool end_instrumented = has_mem_ref_been_instrumented (end, 1);
 
-  if (start_instrumented && end_instrumented)
-    return;
-
-  if (!is_gimple_constant (len))
-    {
-      /* So, the length of the memory area to asan-protect is
-        non-constant.  Let's guard the generated instrumentation code
-        like:
-
-        if (len != 0)
-          {
-            //asan instrumentation code goes here.
-          }
-          // falltrough instructions, starting with *ITER.  */
+  HOST_WIDE_INT size_in_bytes = tree_fits_shwi_p (len) ? tree_to_shwi (len) : -1;
 
-      gimple g = gimple_build_cond (NE_EXPR,
-                                   len,
-                                   build_int_cst (TREE_TYPE (len), 0),
-                                   NULL_TREE, NULL_TREE);
-      gimple_set_location (g, location);
-      insert_if_then_before_iter (g, iter, /*then_more_likely_p=*/true,
-                                 &then_bb, &fallthrough_bb);
-      /* Note that fallthrough_bb starts with the statement that was
-        pointed to by ITER.  */
-
-      /* The 'then block' of the 'if (len != 0) condition is where
-        we'll generate the asan instrumentation code now.  */
-      gsi = gsi_last_bb (then_bb);
-    }
-
-  if (!start_instrumented)
-    {
-      /* Instrument the beginning of the memory region to be accessed,
-        and arrange for the rest of the intrumentation code to be
-        inserted in the then block *after* the current gsi.  */
-      build_check_stmt (location, base, &gsi, /*before_p=*/true, is_store, 1);
-
-      if (then_bb)
-       /* We are in the case where the length of the region is not
-          constant; so instrumentation code is being generated in the
-          'then block' of the 'if (len != 0) condition.  Let's arrange
-          for the subsequent instrumentation statements to go in the
-          'then block'.  */
-       gsi = gsi_last_bb (then_bb);
-      else
-        {
-          *iter = gsi;
-         /* Don't remember this access as instrumented, if length
-            is unknown.  It might be zero and not being actually
-            instrumented, so we can't rely on it being instrumented.  */
-          update_mem_ref_hash_table (base, 1);
-       }
-    }
-
-  if (end_instrumented)
-    return;
-
-  /* We want to instrument the access at the end of the memory region,
-     which is at (base + len - 1).  */
-
-  /* offset = len - 1;  */
-  len = unshare_expr (len);
-  tree offset;
-  gimple_seq seq = NULL;
-  if (TREE_CODE (len) == INTEGER_CST)
-    offset = fold_build2 (MINUS_EXPR, size_type_node,
-                         fold_convert (size_type_node, len),
-                         build_int_cst (size_type_node, 1));
-  else
-    {
-      gimple g;
-      tree t;
-
-      if (TREE_CODE (len) != SSA_NAME)
-       {
-         t = make_ssa_name (TREE_TYPE (len), NULL);
-         g = gimple_build_assign_with_ops (TREE_CODE (len), t, len, NULL);
-         gimple_set_location (g, location);
-         gimple_seq_add_stmt_without_update (&seq, g);
-         len = t;
-       }
-      if (!useless_type_conversion_p (size_type_node, TREE_TYPE (len)))
-       {
-         t = make_ssa_name (size_type_node, NULL);
-         g = gimple_build_assign_with_ops (NOP_EXPR, t, len, NULL);
-         gimple_set_location (g, location);
-         gimple_seq_add_stmt_without_update (&seq, g);
-         len = t;
-       }
-
-      t = make_ssa_name (size_type_node, NULL);
-      g = gimple_build_assign_with_ops (MINUS_EXPR, t, len,
-                                       build_int_cst (size_type_node, 1));
-      gimple_set_location (g, location);
-      gimple_seq_add_stmt_without_update (&seq, g);
-      offset = gimple_assign_lhs (g);
-    }
+  build_check_stmt (location, base, len, size_in_bytes, iter,
+                   /*is_non_zero_len*/size_in_bytes > 0, /*before_p*/true,
+                   is_store, /*is_scalar_access*/false, /*align*/0,
+                   start_instrumented, end_instrumented);
 
-  /* _1 = base;  */
-  base = unshare_expr (base);
-  gimple region_end =
-    gimple_build_assign_with_ops (TREE_CODE (base),
-                                 make_ssa_name (TREE_TYPE (base), NULL),
-                                 base, NULL);
-  gimple_set_location (region_end, location);
-  gimple_seq_add_stmt_without_update (&seq, region_end);
-
-  /* _2 = _1 + offset;  */
-  region_end =
-    gimple_build_assign_with_ops (POINTER_PLUS_EXPR,
-                                 make_ssa_name (TREE_TYPE (base), NULL),
-                                 gimple_assign_lhs (region_end),
-                                 offset);
-  gimple_set_location (region_end, location);
-  gimple_seq_add_stmt_without_update (&seq, region_end);
-  gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
-
-  /* instrument access at _2;  */
-  gsi = gsi_for_stmt (region_end);
-  build_check_stmt (location, gimple_assign_lhs (region_end),
-                   &gsi, /*before_p=*/false, is_store, 1);
-
-  if (then_bb == NULL)
+  update_mem_ref_hash_table (base, 1);
+  if (size_in_bytes != -1)
     update_mem_ref_hash_table (end, 1);
 
   *iter = gsi_for_stmt (gsi_stmt (*iter));
@@ -1850,6 +1828,7 @@ instrument_mem_region_access (tree base, tree len,
 static bool
 instrument_strlen_call (gimple_stmt_iterator *iter)
 {
+  gimple g;
   gimple call = gsi_stmt (*iter);
   gcc_assert (is_gimple_call (call));
 
@@ -1858,6 +1837,8 @@ instrument_strlen_call (gimple_stmt_iterator *iter)
              && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
              && DECL_FUNCTION_CODE (callee) == BUILT_IN_STRLEN);
 
+  location_t loc = gimple_location (call);
+
   tree len = gimple_call_lhs (call);
   if (len == NULL)
     /* Some passes might clear the return value of the strlen call;
@@ -1866,50 +1847,35 @@ instrument_strlen_call (gimple_stmt_iterator *iter)
     return false;
   gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (len)));
 
-  location_t loc = gimple_location (call);
-  tree str_arg = gimple_call_arg (call, 0);
+  len = maybe_cast_to_ptrmode (loc, len, iter, /*before_p*/false);
 
-  /* Instrument the access to the first byte of str_arg.  i.e:
+  tree str_arg = gimple_call_arg (call, 0);
+  bool start_instrumented = has_mem_ref_been_instrumented (str_arg, 1);
 
-     _1 = str_arg; instrument (_1); */
   tree cptr_type = build_pointer_type (char_type_node);
-  gimple str_arg_ssa =
-    gimple_build_assign_with_ops (NOP_EXPR,
-                                 make_ssa_name (cptr_type, NULL),
-                                 str_arg, NULL);
-  gimple_set_location (str_arg_ssa, loc);
-  gimple_stmt_iterator gsi = *iter;
-  gsi_insert_before (&gsi, str_arg_ssa, GSI_NEW_STMT);
-  build_check_stmt (loc, gimple_assign_lhs (str_arg_ssa), &gsi,
-                   /*before_p=*/false, /*is_store=*/false, 1);
-
-  /* If we initially had an instruction like:
-
-        int n = strlen (str)
-
-     we now want to instrument the access to str[n], after the
-     instruction above.*/
-
-  /* So let's build the access to str[n] that is, access through the
-     pointer_plus expr: (_1 + len).  */
-  gimple stmt =
-    gimple_build_assign_with_ops (POINTER_PLUS_EXPR,
-                                 make_ssa_name (cptr_type, NULL),
-                                 gimple_assign_lhs (str_arg_ssa),
-                                 len);
-  gimple_set_location (stmt, loc);
-  gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
-
-  build_check_stmt (loc, gimple_assign_lhs (stmt), &gsi,
-                   /*before_p=*/false, /*is_store=*/false, 1);
-
-  /* Ensure that iter points to the statement logically following the
-     one it was initially pointing to.  */
-  *iter = gsi;
-  /* As *ITER has been advanced to point to the next statement, let's
-     return true to inform transform_statements that it shouldn't
-     advance *ITER anymore; otherwises it will skip that next
-     statement, which wouldn't be instrumented.  */
+  g = gimple_build_assign_with_ops (NOP_EXPR,
+                                   make_ssa_name (cptr_type, NULL),
+                                   str_arg, NULL);
+  gimple_set_location (g, loc);
+  gsi_insert_before (iter, g, GSI_SAME_STMT);
+  str_arg = gimple_assign_lhs (g);
+
+  build_check_stmt (loc, str_arg, NULL_TREE, 1, iter,
+                   /*is_non_zero_len*/true, /*before_p=*/true,
+                   /*is_store=*/false, /*is_scalar_access*/true, /*align*/0,
+                   start_instrumented, start_instrumented);
+
+  g = gimple_build_assign_with_ops (POINTER_PLUS_EXPR,
+                                   make_ssa_name (cptr_type, NULL),
+                                   str_arg,
+                                   len);
+  gimple_set_location (g, loc);
+  gsi_insert_after (iter, g, GSI_NEW_STMT);
+
+  build_check_stmt (loc, gimple_assign_lhs (g), NULL_TREE, 1, iter,
+                   /*is_non_zero_len*/true, /*before_p=*/false,
+                   /*is_store=*/false, /*is_scalar_access*/true, /*align*/0);
+
   return true;
 }
 
@@ -2417,8 +2383,11 @@ asan_finish_file (void)
      nor after .LASAN* array.  */
   flag_sanitize &= ~SANITIZE_ADDRESS;
 
-  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
-  append_to_statement_list (build_call_expr (fn, 0), &asan_ctor_statements);
+  if (flag_sanitize & SANITIZE_USER_ADDRESS)
+    {
+      tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
+      append_to_statement_list (build_call_expr (fn, 0), &asan_ctor_statements);
+    }
   FOR_EACH_DEFINED_VARIABLE (vnode)
     if (TREE_ASM_WRITTEN (vnode->decl)
        && asan_protect_global (vnode->decl))
@@ -2455,7 +2424,7 @@ asan_finish_file (void)
       DECL_INITIAL (var) = ctor;
       varpool_assemble_decl (varpool_node_for_decl (var));
 
-      fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
+      tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
       tree gcount_tree = build_int_cst (pointer_sized_int_node, gcount);
       append_to_statement_list (build_call_expr (fn, 2,
                                                 build_fold_addr_expr (var),
@@ -2470,11 +2439,218 @@ asan_finish_file (void)
       cgraph_build_static_cdtor ('D', dtor_statements,
                                 MAX_RESERVED_INIT_PRIORITY - 1);
     }
-  cgraph_build_static_cdtor ('I', asan_ctor_statements,
-                            MAX_RESERVED_INIT_PRIORITY - 1);
+  if (asan_ctor_statements)
+    cgraph_build_static_cdtor ('I', asan_ctor_statements,
+                              MAX_RESERVED_INIT_PRIORITY - 1);
   flag_sanitize |= SANITIZE_ADDRESS;
 }
 
+/* Expand the ASAN_{LOAD,STORE} builtins.  */
+
+static bool
+asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
+{
+  gimple g = gsi_stmt (*iter);
+  location_t loc = gimple_location (g);
+
+  HOST_WIDE_INT flags = tree_to_shwi (gimple_call_arg (g, 0));
+  gcc_assert (flags < ASAN_CHECK_LAST);
+  bool is_scalar_access = (flags & ASAN_CHECK_SCALAR_ACCESS) != 0;
+  bool is_store = (flags & ASAN_CHECK_STORE) != 0;
+  bool is_non_zero_len = (flags & ASAN_CHECK_NON_ZERO_LEN) != 0;
+  bool start_instrumented = (flags & ASAN_CHECK_START_INSTRUMENTED) != 0;
+  bool end_instrumented = (flags & ASAN_CHECK_END_INSTRUMENTED) != 0;
+
+  tree base = gimple_call_arg (g, 1);
+  tree len = gimple_call_arg (g, 2);
+
+  HOST_WIDE_INT size_in_bytes
+    = is_scalar_access && tree_fits_shwi_p (len) ? tree_to_shwi (len) : -1;
+
+  if (use_calls)
+    {
+      /* Instrument using callbacks.  */
+      gimple g
+       = gimple_build_assign_with_ops (NOP_EXPR,
+                                       make_ssa_name (pointer_sized_int_node,
+                                       NULL),
+                                       base, NULL_TREE);
+      gimple_set_location (g, loc);
+      gsi_insert_before (iter, g, GSI_SAME_STMT);
+      tree base_addr = gimple_assign_lhs (g);
+
+      int nargs;
+      tree fun = check_func (is_store, size_in_bytes, &nargs);
+      if (nargs == 1)
+       g = gimple_build_call (fun, 1, base_addr);
+      else
+       {
+         gcc_assert (nargs == 2);
+         g = gimple_build_assign_with_ops (NOP_EXPR,
+                                           make_ssa_name (pointer_sized_int_node,
+                                                          NULL),
+                                           len, NULL_TREE);
+         gimple_set_location (g, loc);
+         gsi_insert_before (iter, g, GSI_SAME_STMT);
+         tree sz_arg = gimple_assign_lhs (g);
+         g = gimple_build_call (fun, nargs, base_addr, sz_arg);
+       }
+      gimple_set_location (g, loc);
+      gsi_replace (iter, g, false);
+      return false;
+    }
+
+  HOST_WIDE_INT real_size_in_bytes = size_in_bytes == -1 ? 1 : size_in_bytes;
+
+  tree shadow_ptr_type = shadow_ptr_types[real_size_in_bytes == 16 ? 1 : 0];
+  tree shadow_type = TREE_TYPE (shadow_ptr_type);
+
+  gimple_stmt_iterator gsi = *iter;
+
+  if (!is_non_zero_len)
+    {
+      /* So, the length of the memory area to asan-protect is
+        non-constant.  Let's guard the generated instrumentation code
+        like:
+
+        if (len != 0)
+          {
+            //asan instrumentation code goes here.
+          }
+        // falltrough instructions, starting with *ITER.  */
+
+      g = gimple_build_cond (NE_EXPR,
+                           len,
+                           build_int_cst (TREE_TYPE (len), 0),
+                           NULL_TREE, NULL_TREE);
+      gimple_set_location (g, loc);
+
+      basic_block then_bb, fallthrough_bb;
+      insert_if_then_before_iter (g, iter, /*then_more_likely_p=*/true,
+                                &then_bb, &fallthrough_bb);
+      /* Note that fallthrough_bb starts with the statement that was
+       pointed to by ITER.  */
+
+      /* The 'then block' of the 'if (len != 0) condition is where
+       we'll generate the asan instrumentation code now.  */
+      gsi = gsi_last_bb (then_bb);
+    }
+
+  /* Get an iterator on the point where we can add the condition
+     statement for the instrumentation.  */
+  basic_block then_bb, else_bb;
+  gsi = create_cond_insert_point (&gsi, /*before_p*/false,
+                                 /*then_more_likely_p=*/false,
+                                 /*create_then_fallthru_edge=*/false,
+                                 &then_bb,
+                                 &else_bb);
+
+  g = gimple_build_assign_with_ops (NOP_EXPR,
+                                   make_ssa_name (pointer_sized_int_node,
+                                                  NULL),
+                                   base, NULL_TREE);
+  gimple_set_location (g, loc);
+  gsi_insert_before (&gsi, g, GSI_NEW_STMT);
+  tree base_addr = gimple_assign_lhs (g);
+
+  tree t = NULL_TREE;
+  if (real_size_in_bytes >= 8)
+    {
+      tree shadow = build_shadow_mem_access (&gsi, loc, base_addr,
+                                            shadow_ptr_type);
+      t = shadow;
+    }
+  else
+    {
+      /* Slow path for 1, 2 and 4 byte accesses.  */
+
+      if (!start_instrumented)
+       {
+         /* Test (shadow != 0)
+            & ((base_addr & 7) + (real_size_in_bytes - 1)) >= shadow).  */
+         tree shadow = build_shadow_mem_access (&gsi, loc, base_addr,
+                                                shadow_ptr_type);
+         gimple shadow_test = build_assign (NE_EXPR, shadow, 0);
+         gimple_seq seq = NULL;
+         gimple_seq_add_stmt (&seq, shadow_test);
+         gimple_seq_add_stmt (&seq, build_assign (BIT_AND_EXPR, base_addr, 7));
+         gimple_seq_add_stmt (&seq, build_type_cast (shadow_type,
+                                                     gimple_seq_last (seq)));
+         if (real_size_in_bytes > 1)
+           gimple_seq_add_stmt (&seq,
+                                build_assign (PLUS_EXPR, gimple_seq_last (seq),
+                                              real_size_in_bytes - 1));
+         gimple_seq_add_stmt (&seq, build_assign (GE_EXPR,
+                                                  gimple_seq_last (seq),
+                                                  shadow));
+         gimple_seq_add_stmt (&seq, build_assign (BIT_AND_EXPR, shadow_test,
+                                                  gimple_seq_last (seq)));
+         t = gimple_assign_lhs (gimple_seq_last (seq));
+         gimple_seq_set_location (seq, loc);
+         gsi_insert_seq_after (&gsi, seq, GSI_CONTINUE_LINKING);
+       }
+
+      /* For non-constant, misaligned or otherwise weird access sizes,
+        check first and last byte.  */
+      if (size_in_bytes == -1 && !end_instrumented)
+       {
+         g = gimple_build_assign_with_ops (MINUS_EXPR,
+                                           make_ssa_name (pointer_sized_int_node, NULL),
+                                           len,
+                                           build_int_cst (pointer_sized_int_node, 1));
+         gimple_set_location (g, loc);
+         gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+         tree last = gimple_assign_lhs (g);
+         g = gimple_build_assign_with_ops (PLUS_EXPR,
+                                           make_ssa_name (pointer_sized_int_node, NULL),
+                                           base_addr,
+                                           last);
+         gimple_set_location (g, loc);
+         gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+         tree base_end_addr = gimple_assign_lhs (g);
+
+         tree shadow = build_shadow_mem_access (&gsi, loc, base_end_addr,
+                                                shadow_ptr_type);
+         gimple shadow_test = build_assign (NE_EXPR, shadow, 0);
+         gimple_seq seq = NULL;
+         gimple_seq_add_stmt (&seq, shadow_test);
+         gimple_seq_add_stmt (&seq, build_assign (BIT_AND_EXPR,
+                                                  base_end_addr, 7));
+         gimple_seq_add_stmt (&seq, build_type_cast (shadow_type,
+                                                     gimple_seq_last (seq)));
+         gimple_seq_add_stmt (&seq, build_assign (GE_EXPR,
+                                                  gimple_seq_last (seq),
+                                                  shadow));
+         gimple_seq_add_stmt (&seq, build_assign (BIT_AND_EXPR, shadow_test,
+                                                  gimple_seq_last (seq)));
+         if (!start_instrumented)
+           gimple_seq_add_stmt (&seq, build_assign (BIT_IOR_EXPR, t,
+                                                    gimple_seq_last (seq)));
+         t = gimple_assign_lhs (gimple_seq_last (seq));
+         gimple_seq_set_location (seq, loc);
+         gsi_insert_seq_after (&gsi, seq, GSI_CONTINUE_LINKING);
+       }
+    }
+
+  g = gimple_build_cond (NE_EXPR, t, build_int_cst (TREE_TYPE (t), 0),
+                        NULL_TREE, NULL_TREE);
+  gimple_set_location (g, loc);
+  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+
+  /* Generate call to the run-time library (e.g. __asan_report_load8).  */
+  gsi = gsi_start_bb (then_bb);
+  int nargs;
+  tree fun = report_error_func (is_store, size_in_bytes, &nargs);
+  g = gimple_build_call (fun, nargs, base_addr, len);
+  gimple_set_location (g, loc);
+  gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+
+  gsi_remove (iter, true);
+  *iter = gsi_start_bb (else_bb);
+
+  return true;
+}
+
 /* Instrument the current function.  */
 
 static unsigned int
@@ -2586,25 +2762,55 @@ execute_sanopt (void)
 {
   basic_block bb;
 
+  int asan_num_accesses = 0;
+  if (flag_sanitize & SANITIZE_ADDRESS)
+    {
+      gimple_stmt_iterator gsi;
+      FOR_EACH_BB_FN (bb, cfun)
+       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+         {
+           gimple stmt = gsi_stmt (gsi);
+           if (is_gimple_call (stmt) && gimple_call_internal_p (stmt)
+               && gimple_call_internal_fn (stmt) == IFN_ASAN_CHECK)
+             ++asan_num_accesses;
+         }
+    }
+
+  bool use_calls = ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD < INT_MAX
+    && (flag_sanitize & SANITIZE_KERNEL_ADDRESS)
+    && asan_num_accesses >= ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD;
+
   FOR_EACH_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator gsi;
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
        {
          gimple stmt = gsi_stmt (gsi);
+         bool no_next = false;
 
          if (!is_gimple_call (stmt))
-           continue;
+           {
+             gsi_next (&gsi);
+             continue;
+           }
 
          if (gimple_call_internal_p (stmt))
-           switch (gimple_call_internal_fn (stmt))
-             {
-             case IFN_UBSAN_NULL:
-               ubsan_expand_null_ifn (gsi);
-               break;
-             default:
-               break;
-             }
+           {
+             enum internal_fn ifn = gimple_call_internal_fn (stmt);
+             switch (ifn)
+               {
+               case IFN_UBSAN_NULL:
+                 ubsan_expand_null_ifn (gsi);
+                 break;
+               case IFN_ASAN_CHECK:
+                 {
+                   no_next = asan_expand_check_ifn (&gsi, use_calls);
+                   break;
+                 }
+               default:
+                 break;
+               }
+           }
 
          if (dump_file && (dump_flags & TDF_DETAILS))
            {
@@ -2612,6 +2818,9 @@ execute_sanopt (void)
              print_gimple_stmt (dump_file, stmt, 0, dump_flags);
              fprintf (dump_file, "\n");
            }
+
+         if (!no_next)
+           gsi_next (&gsi);
        }
     }
   return 0;
index 159cd9d..c1f2fc0 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-10-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/63495
index 6cf964c..deb70eb 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-09-25  Thomas Schwinge  <thomas@codesourcery.com>
 
        PR c++/63249
index de307da..53ea300 100644 (file)
@@ -1174,7 +1174,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
                      && DECL_FUNCTION_CODE (SYMBOL_REF_DECL (symbol))
                         >= BUILT_IN_ASAN_REPORT_LOAD1
                      && DECL_FUNCTION_CODE (SYMBOL_REF_DECL (symbol))
-                        <= BUILT_IN_ASAN_REPORT_STORE16)
+                        <= BUILT_IN_ASAN_STOREN)
                    return dir_none;
                }
            }
index f0ab6b8..2c587a0 100644 (file)
@@ -1341,6 +1341,12 @@ main (int argc, char **argv)
                  ld1--;
                  ld2--;
                }
+             else if (strncmp (arg, "-fno-lto", 8) == 0)
+               {
+                 /* Do not pass -fno-lto to the linker. */
+                 ld1--;
+                 ld2--;
+               }
 #ifdef TARGET_AIX_VERSION
              else
                {
index b9d4e8d..16ad5c8 100644 (file)
   " crtend%O%s crtn%O%s " \
   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
+#ifdef TARGET_FIX_ERR_A53_835769_DEFAULT
+#define CA53_ERR_835769_SPEC \
+  " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#else
+#define CA53_ERR_835769_SPEC \
+  " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#endif
+
 #ifndef LINK_SPEC
 #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X \
-  -maarch64elf%{mabi=ilp32*:32}%{mbig-endian:b}"
+  -maarch64elf%{mabi=ilp32*:32}%{mbig-endian:b}" \
+  CA53_ERR_835769_SPEC
 #endif
 
 #endif /* GCC_AARCH64_ELF_RAW_H */
index 1731432..dce2f2d 100644 (file)
    %{mbig-endian:-EB} %{mlittle-endian:-EL}     \
    -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}"
 
-#define LINK_SPEC LINUX_TARGET_LINK_SPEC
+#ifdef TARGET_FIX_ERR_A53_835769_DEFAULT
+#define CA53_ERR_835769_SPEC \
+  " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#else
+#define CA53_ERR_835769_SPEC \
+  " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#endif
+
+#define LINK_SPEC LINUX_TARGET_LINK_SPEC \
+                  CA53_ERR_835769_SPEC
 
 #define GNU_USER_TARGET_MATHFILE_SPEC \
   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
index 7ed7faa..f3f2472 100644 (file)
@@ -7592,6 +7592,10 @@ aarch64_madd_needs_nop (rtx insn)
     return false;
 
   prev = aarch64_prev_real_insn (insn);
+  /* aarch64_prev_real_insn can call recog_memoized on insns other than INSN.
+     Restore recog state to INSN to avoid state corruption.  */
+  extract_constrain_insn_cached (insn);
+
   if (!prev)
     return false;
 
index 6398105..56cd304 100644 (file)
@@ -68,6 +68,7 @@
   {
     rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
 
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
     emit_move_insn (acc_a, operands[1]);
 
     if (DImode == <MODE>mode
   {
     rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
 
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
     emit_move_insn (acc_a, operands[1]);
 
     if (const_operand (operands[2], GET_MODE (operands[2])))
   {
     rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
 
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
     emit_move_insn (acc_a, operands[1]);
 
     if (const_operand (operands[2], GET_MODE (operands[2])))
   {
     rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
 
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
     emit_move_insn (acc_a, operands[1]);
 
     if (const_operand (operands[2], GET_MODE (operands[2])))
   {
     rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
 
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
     emit_move_insn (acc_a, operands[1]);
 
     if (s8_operand (operands[2], VOIDmode))
   {
     rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
 
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
     emit_move_insn (acc_a, operands[1]);
     emit_move_insn (gen_rtx_REG (QImode, 16), operands[2]);
     emit_insn (gen_<code_stdname><mode>3_insn ());
               (clobber (any_extend:SI (match_dup 1)))])]
   "avr_have_dimode"
   {
+    avr_fix_inputs (operands, 1 << 2, regmask (SImode, 22));
     emit_move_insn (gen_rtx_REG (SImode, 22), operands[1]);
     emit_move_insn (gen_rtx_REG (SImode, 18), operands[2]);
     emit_insn (gen_<extend_u>mulsidi3_insn());
index 9c8489e..6763f59 100644 (file)
               (clobber (reg:HI 24))])
    (set (match_operand:QQ 0 "register_operand" "")
         (reg:QQ 23))]
-  "!AVR_HAVE_MUL")
+  "!AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (QQmode, 24));
+  })
+
 
 (define_expand "muluqq3_nomul"
   [(set (reg:UQQ 22)
               (clobber (reg:HI 22))])
    (set (match_operand:UQQ 0 "register_operand" "")
         (reg:UQQ 25))]
-  "!AVR_HAVE_MUL")
+  "!AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (UQQmode, 22));
+  })
 
 (define_insn "*mulqq3.call"
   [(set (reg:QQ 23)
               (clobber (reg:HI 22))])
    (set (match_operand:ALL2QA 0 "register_operand" "")
         (reg:ALL2QA 24))]
-  "AVR_HAVE_MUL")
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, 18));
+  })
 
 ;; "*mulhq3.call"  "*muluhq3.call"
 ;; "*mulha3.call"  "*muluha3.call"
                     (reg:ALL4A 20)))
    (set (match_operand:ALL4A 0 "register_operand" "")
         (reg:ALL4A 24))]
-  "AVR_HAVE_MUL")
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, 16));
+  })
 
 ;; "*mulsa3.call" "*mulusa3.call"
 (define_insn "*mul<mode>3.call"
                                 (reg:ALL1Q 22)))
               (clobber (reg:QI 25))])
    (set (match_operand:ALL1Q 0 "register_operand" "")
-        (reg:ALL1Q 24))])
+        (reg:ALL1Q 24))]
+  ""
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, 25));
+  })
+
 
 ;; "*divqq3.call" "*udivuqq3.call"
 (define_insn "*<code><mode>3.call"
               (clobber (reg:HI 26))
               (clobber (reg:QI 21))])
    (set (match_operand:ALL2QA 0 "register_operand" "")
-        (reg:ALL2QA 24))])
+        (reg:ALL2QA 24))]
+  ""
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, 26));
+  })
 
 ;; "*divhq3.call" "*udivuhq3.call"
 ;; "*divha3.call" "*udivuha3.call"
               (clobber (reg:HI 26))
               (clobber (reg:HI 30))])
    (set (match_operand:ALL4A 0 "register_operand" "")
-        (reg:ALL4A 22))])
+        (reg:ALL4A 22))]
+  ""
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, 24));
+  })
 
 ;; "*divsa3.call" "*udivusa3.call"
 (define_insn "*<code><mode>3.call"
 
     operands[3] = gen_rtx_REG (<MODE>mode, regno_out[(size_t) GET_MODE_SIZE (<MODE>mode)]);
     operands[4] = gen_rtx_REG (<MODE>mode,  regno_in[(size_t) GET_MODE_SIZE (<MODE>mode)]);
+    avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, REGNO (operands[4])));
     operands[5] = simplify_gen_subreg (QImode, force_reg (HImode, operands[2]), HImode, 0);
     // $2 is no more needed, but is referenced for expand.
     operands[2] = const0_rtx;
index c5ce784..4a899a2 100644 (file)
@@ -124,6 +124,15 @@ extern bool avr_mem_memx_p (rtx);
 extern bool avr_load_libgcc_p (rtx);
 extern bool avr_xload_libgcc_p (enum machine_mode);
 
+static inline unsigned
+regmask (enum machine_mode mode, unsigned regno)
+{
+  return ((1u << GET_MODE_SIZE (mode)) - 1) << regno;
+}
+
+extern void avr_fix_inputs (rtx*, unsigned, unsigned);
+extern bool avr_emit3_fix_outputs (rtx (*)(rtx,rtx,rtx), rtx*, unsigned, unsigned);
+
 extern rtx lpm_reg_rtx;
 extern rtx lpm_addr_reg_rtx;
 extern rtx tmp_reg_rtx;
index fa979df..4c65f5e 100644 (file)
@@ -11118,6 +11118,115 @@ avr_convert_to_type (tree type, tree expr)
 }
 
 
+/* PR63633: The middle-end might come up with hard regs as input operands.
+
+   RMASK is a bit mask representing a subset of hard registers R0...R31:
+   Rn is an element of that set iff bit n of RMASK is set.
+   OPMASK describes a subset of OP[]:  If bit n of OPMASK is 1 then
+   OP[n] has to be fixed; otherwise OP[n] is left alone.
+
+   For each element of OPMASK which is a hard register overlapping RMASK,
+   replace OP[n] with a newly created pseudo register
+
+   HREG == 0:  Also emit a move insn that copies the contents of that
+               hard register into the new pseudo.
+
+   HREG != 0:  Also set HREG[n] to the hard register.  */
+
+static void
+avr_fix_operands (rtx *op, rtx *hreg, unsigned opmask, unsigned rmask)
+{
+  for (; opmask; opmask >>= 1, op++)
+    {
+      rtx reg = *op;
+
+      if (hreg)
+        *hreg = NULL_RTX;
+
+      if ((opmask & 1)
+          && REG_P (reg)
+          && REGNO (reg) < FIRST_PSEUDO_REGISTER
+          // This hard-reg overlaps other prohibited hard regs?
+          && (rmask & regmask (GET_MODE (reg), REGNO (reg))))
+        {
+          *op = gen_reg_rtx (GET_MODE (reg));
+          if (hreg == NULL)
+            emit_move_insn (*op, reg);
+          else
+            *hreg = reg;
+        }
+
+      if (hreg)
+        hreg++;
+    }
+}
+
+
+void
+avr_fix_inputs (rtx *op, unsigned opmask, unsigned rmask)
+{
+  avr_fix_operands (op, NULL, opmask, rmask);
+}
+
+
+/* Helper for the function below:  If bit n of MASK is set and
+   HREG[n] != NULL, then emit a move insn to copy OP[n] to HREG[n].
+   Otherwise do nothing for that n.  Return TRUE.  */
+
+static bool
+avr_move_fixed_operands (rtx *op, rtx *hreg, unsigned mask)
+{
+  for (; mask; mask >>= 1, op++, hreg++)
+    if ((mask & 1)
+        && *hreg)
+      emit_move_insn (*hreg, *op);
+
+  return true;
+}
+
+
+/* PR63633: The middle-end might come up with hard regs as output operands.
+
+   GEN is a sequence generating function like gen_mulsi3 with 3 operands OP[].
+   RMASK is a bit mask representing a subset of hard registers R0...R31:
+   Rn is an element of that set iff bit n of RMASK is set.
+   OPMASK describes a subset of OP[]:  If bit n of OPMASK is 1 then
+   OP[n] has to be fixed; otherwise OP[n] is left alone.
+
+   Emit the insn sequence as generated by GEN() with all elements of OPMASK
+   which are hard registers overlapping RMASK replaced by newly created
+   pseudo registers.  After the sequence has been emitted, emit insns that
+   move the contents of respective pseudos to their hard regs.  */
+
+bool
+avr_emit3_fix_outputs (rtx (*gen)(rtx,rtx,rtx), rtx *op,
+                       unsigned opmask, unsigned rmask)
+{
+  const int n = 3;
+  rtx hreg[n];
+
+  /* It is legitimate for GEN to call this function, and in order not to
+     get self-recursive we use the following static kludge.  This is the
+     only way not to duplicate all expanders and to avoid ugly and
+     hard-to-maintain C-code instead of the much more appreciated RTL
+     representation as supplied by define_expand.  */
+  static bool lock = false;
+
+  gcc_assert (opmask < (1u << n));
+
+  if (lock)
+    return false;
+
+  avr_fix_operands (op, hreg, opmask, rmask);
+
+  lock = true;
+  emit_insn (gen (op[0], op[1], op[2]));
+  lock = false;
+
+  return avr_move_fixed_operands (op, hreg, opmask);
+}
+
+
 /* Worker function for movmemhi expander.
    XOP[0]  Destination as MEM:BLK
    XOP[1]  Source      "     "
index 2d90b76..3f4181d 100644 (file)
    (set (reg:QI 22) (match_operand:QI 2 "register_operand" ""))
    (parallel [(set (reg:QI 24) (mult:QI (reg:QI 24) (reg:QI 22)))
               (clobber (reg:QI 22))])
-   (set (match_operand:QI 0 "register_operand" "") (reg:QI 24))])
+   (set (match_operand:QI 0 "register_operand" "") (reg:QI 24))]
+  ""
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
+  })
 
 (define_insn "*mulqi3_call"
   [(set (reg:QI 24) (mult:QI (reg:QI 24) (reg:QI 22)))
    (parallel [(set (reg:HI 24) (mult:HI (reg:HI 24) (reg:HI 22)))
               (clobber (reg:HI 22))
               (clobber (reg:QI 21))])
-   (set (match_operand:HI 0 "register_operand" "") (reg:HI 24))])
+   (set (match_operand:HI 0 "register_operand" "")
+        (reg:HI 24))]
+  ""
+  {
+    avr_fix_inputs (operands, (1 << 2), regmask (HImode, 24));
+  })
+
 
 (define_insn "*mulhi3_call"
   [(set (reg:HI 24) (mult:HI (reg:HI 24) (reg:HI 22)))
         emit_insn (gen_mulohisi3 (operands[0], operands[2], operands[1]));
         DONE;
       }
+
+    if (avr_emit3_fix_outputs (gen_mulsi3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
   })
 
 (define_insn_and_split "*mulsi3"
 
 ;; "muluqisi3"
 ;; "muluhisi3"
-(define_insn_and_split "mulu<mode>si3"
+(define_expand "mulu<mode>si3"
+  [(parallel [(set (match_operand:SI 0 "pseudo_register_operand" "")
+                   (mult:SI (zero_extend:SI (match_operand:QIHI 1 "pseudo_register_operand" ""))
+                            (match_operand:SI 2 "pseudo_register_or_const_int_operand" "")))
+              (clobber (reg:HI 26))
+              (clobber (reg:DI 18))])]
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, (1 << 1) | (1 << 2), -1u);
+    if (avr_emit3_fix_outputs (gen_mulu<mode>si3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
+  })
+
+;; "*muluqisi3"
+;; "*muluhisi3"
+(define_insn_and_split "*mulu<mode>si3"
   [(set (match_operand:SI 0 "pseudo_register_operand"                           "=r")
         (mult:SI (zero_extend:SI (match_operand:QIHI 1 "pseudo_register_operand" "r"))
                  (match_operand:SI 2 "pseudo_register_or_const_int_operand"      "rn")))
 
 ;; "mulsqisi3"
 ;; "mulshisi3"
-(define_insn_and_split "muls<mode>si3"
+(define_expand "muls<mode>si3"
+  [(parallel [(set (match_operand:SI 0 "pseudo_register_operand" "")
+                   (mult:SI (sign_extend:SI (match_operand:QIHI 1 "pseudo_register_operand" ""))
+                            (match_operand:SI 2 "pseudo_register_or_const_int_operand" "")))
+              (clobber (reg:HI 26))
+              (clobber (reg:DI 18))])]
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, (1 << 1) | (1 << 2), -1u);
+    if (avr_emit3_fix_outputs (gen_muls<mode>si3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
+  })
+
+;; "*mulsqisi3"
+;; "*mulshisi3"
+(define_insn_and_split "*muls<mode>si3"
   [(set (match_operand:SI 0 "pseudo_register_operand"                           "=r")
         (mult:SI (sign_extend:SI (match_operand:QIHI 1 "pseudo_register_operand" "r"))
                  (match_operand:SI 2 "pseudo_register_or_const_int_operand"      "rn")))
 
 ;; One-extend operand 1
 
-(define_insn_and_split "mulohisi3"
+(define_expand "mulohisi3"
+  [(parallel [(set (match_operand:SI 0 "pseudo_register_operand" "")
+                   (mult:SI (not:SI (zero_extend:SI
+                                     (not:HI (match_operand:HI 1 "pseudo_register_operand" ""))))
+                            (match_operand:SI 2 "pseudo_register_or_const_int_operand" "")))
+              (clobber (reg:HI 26))
+              (clobber (reg:DI 18))])]
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, (1 << 1) | (1 << 2), -1u);
+    if (avr_emit3_fix_outputs (gen_mulohisi3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
+  })
+
+(define_insn_and_split "*mulohisi3"
   [(set (match_operand:SI 0 "pseudo_register_operand"                          "=r")
         (mult:SI (not:SI (zero_extend:SI
                           (not:HI (match_operand:HI 1 "pseudo_register_operand" "r"))))
                             (any_extend:SI (match_operand:HI 2 "register_operand" ""))))
               (clobber (reg:HI 26))
               (clobber (reg:DI 18))])]
-  "AVR_HAVE_MUL")
+  "AVR_HAVE_MUL"
+  {
+    if (avr_emit3_fix_outputs (gen_<extend_u>mulhisi3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
+  })
 
 (define_expand "usmulhisi3"
   [(parallel [(set (match_operand:SI 0 "register_operand" "")
                             (sign_extend:SI (match_operand:HI 2 "register_operand" ""))))
               (clobber (reg:HI 26))
               (clobber (reg:DI 18))])]
-  "AVR_HAVE_MUL")
+  "AVR_HAVE_MUL"
+  {
+    if (avr_emit3_fix_outputs (gen_usmulhisi3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
+  })
 
 ;; "*uumulqihisi3" "*uumulhiqisi3" "*uumulhihisi3" "*uumulqiqisi3"
 ;; "*usmulqihisi3" "*usmulhiqisi3" "*usmulhihisi3" "*usmulqiqisi3"
               (clobber (reg:HI 22))])
    (set (match_operand:HI 0 "register_operand" "")
         (reg:HI 24))]
-  "AVR_HAVE_MUL")
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, 1 << 2, regmask (HImode, 18));
+  })
 
 
 (define_insn "*mulsi3_call"
         emit_insn (gen_mulsqipsi3 (operands[0], reg, operands[1]));
         DONE;
       }
+
+    if (avr_emit3_fix_outputs (gen_mulpsi3, operands, 1u << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
   })
 
 (define_insn "*umulqihipsi3"
   [(set_attr "length" "7")
    (set_attr "cc" "clobber")])
 
-(define_insn_and_split "mulsqipsi3"
+(define_expand "mulsqipsi3"
+  [(parallel [(set (match_operand:PSI 0 "pseudo_register_operand" "")
+                   (mult:PSI (sign_extend:PSI (match_operand:QI 1 "pseudo_register_operand" ""))
+                             (match_operand:PSI 2 "pseudo_register_or_const_int_operand""")))
+              (clobber (reg:HI 26))
+              (clobber (reg:DI 18))])]
+  "AVR_HAVE_MUL"
+  {
+    avr_fix_inputs (operands, (1 << 1) | (1 << 2), -1u);
+    if (avr_emit3_fix_outputs (gen_mulsqipsi3, operands, 1 << 0,
+                               regmask (DImode, 18) | regmask (HImode, 26)))
+      DONE;
+  })
+
+(define_insn_and_split "*mulsqipsi3"
   [(set (match_operand:PSI 0 "pseudo_register_operand"                          "=r")
         (mult:PSI (sign_extend:PSI (match_operand:QI 1 "pseudo_register_operand" "r"))
                   (match_operand:PSI 2 "pseudo_register_or_const_int_operand"    "rn")))
         emit_insn (gen_fmul_insn (operand0, operand1, operand2));
         DONE;
       }
+    avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
   })
 
 (define_insn "fmul_insn"
         emit_insn (gen_fmuls_insn (operand0, operand1, operand2));
         DONE;
       }
+    avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
   })
 
 (define_insn "fmuls_insn"
         emit_insn (gen_fmulsu_insn (operand0, operand1, operand2));
         DONE;
       }
+    avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
   })
 
 (define_insn "fmulsu_insn"
index a8cfcb7..682bdae 100644 (file)
   "dststt %0,%1,%2"
   [(set_attr "type" "vecsimple")])
 
-(define_insn "altivec_lvsl"
+(define_expand "altivec_lvsl"
+  [(use (match_operand:V16QI 0 "register_operand" ""))
+   (use (match_operand:V16QI 1 "memory_operand" ""))]
+  "TARGET_ALTIVEC"
+{
+  if (VECTOR_ELT_ORDER_BIG)
+    emit_insn (gen_altivec_lvsl_direct (operands[0], operands[1]));
+  else
+    {
+      int i;
+      rtx mask, perm[16], constv, vperm;
+      mask = gen_reg_rtx (V16QImode);
+      emit_insn (gen_altivec_lvsl_direct (mask, operands[1]));
+      for (i = 0; i < 16; ++i)
+        perm[i] = GEN_INT (i);
+      constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm));
+      constv = force_reg (V16QImode, constv);
+      vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv),
+                              UNSPEC_VPERM);
+      emit_insn (gen_rtx_SET (VOIDmode, operands[0], vperm));
+    }
+  DONE;
+})
+
+(define_insn "altivec_lvsl_direct"
   [(set (match_operand:V16QI 0 "register_operand" "=v")
        (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")]
                      UNSPEC_LVSL))]
   "lvsl %0,%y1"
   [(set_attr "type" "vecload")])
 
-(define_insn "altivec_lvsr"
+(define_expand "altivec_lvsr"
+  [(use (match_operand:V16QI 0 "register_operand" ""))
+   (use (match_operand:V16QI 1 "memory_operand" ""))]
+  "TARGET_ALTIVEC"
+{
+  if (VECTOR_ELT_ORDER_BIG)
+    emit_insn (gen_altivec_lvsr_direct (operands[0], operands[1]));
+  else
+    {
+      int i;
+      rtx mask, perm[16], constv, vperm;
+      mask = gen_reg_rtx (V16QImode);
+      emit_insn (gen_altivec_lvsr_direct (mask, operands[1]));
+      for (i = 0; i < 16; ++i)
+        perm[i] = GEN_INT (i);
+      constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm));
+      constv = force_reg (V16QImode, constv);
+      vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv),
+                              UNSPEC_VPERM);
+      emit_insn (gen_rtx_SET (VOIDmode, operands[0], vperm));
+    }
+  DONE;
+})
+
+(define_insn "altivec_lvsr_direct"
   [(set (match_operand:V16QI 0 "register_operand" "=v")
        (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")]
                      UNSPEC_LVSR))]
index 016be9e..5e8bfea 100644 (file)
@@ -4187,6 +4187,14 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "altivec_resolve_overloaded_builtin, code = %4d, %s\n",
             (int)fcode, IDENTIFIER_POINTER (DECL_NAME (fndecl)));
+  /* vec_lvsl and vec_lvsr are deprecated for use with LE element order.  */
+  if (fcode == ALTIVEC_BUILTIN_VEC_LVSL && !VECTOR_ELT_ORDER_BIG)
+    warning (OPT_Wdeprecated, "vec_lvsl is deprecated for little endian; use \
+assignment for unaligned loads and stores");
+  else if (fcode == ALTIVEC_BUILTIN_VEC_LVSR && !VECTOR_ELT_ORDER_BIG)
+    warning (OPT_Wdeprecated, "vec_lvsr is deprecated for little endian; use \
+assignment for unaligned loads and stores");
 
   /* For now treat vec_splats and vec_promote as the same.  */
   if (fcode == ALTIVEC_BUILTIN_VEC_SPLATS
index bad4a1b..e1a226c 100644 (file)
@@ -13842,8 +13842,8 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
     case ALTIVEC_BUILTIN_MASK_FOR_LOAD:
     case ALTIVEC_BUILTIN_MASK_FOR_STORE:
       {
-       int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr
-                    : (int) CODE_FOR_altivec_lvsl);
+       int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr_direct
+                    : (int) CODE_FOR_altivec_lvsl_direct);
        enum machine_mode tmode = insn_data[icode].operand[0].mode;
        enum machine_mode mode = insn_data[icode].operand[1].mode;
        tree arg;
@@ -13871,7 +13871,6 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
            || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
          target = gen_reg_rtx (tmode);
 
-       /*pat = gen_altivec_lvsr (target, op);*/
        pat = GEN_FCN (icode) (target, op);
        if (!pat)
          return 0;
index 2cd0f1a..d79d629 100644 (file)
@@ -1,3 +1,14 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-15  Jason Merrill  <jason@redhat.com>
+
+       PR c++/63455
+       Revert:
+       * parser.c (cp_parser_abort_tentative_parse): Make sure we haven't
+       committed to this tentative parse.
+
 2014-10-09  Jason Merrill  <jason@redhat.com>
 
        PR c++/63415
index e6f9430..7893235 100644 (file)
@@ -24982,8 +24982,6 @@ cp_parser_commit_to_topmost_tentative_parse (cp_parser* parser)
 static void
 cp_parser_abort_tentative_parse (cp_parser* parser)
 {
-  gcc_assert (parser->context->status != CP_PARSER_STATUS_KIND_COMMITTED
-             || errorcount > 0);
   cp_parser_simulate_error (parser);
   /* Now, pretend that we want to see if the construct was
      successfully parsed.  */
index aaed739..0a6e50c 100644 (file)
@@ -2354,8 +2354,8 @@ This macro is defined, with value 3, when @option{-fstack-protector-strong} is
 in use.
 
 @item __SANITIZE_ADDRESS__
-This macro is defined, with value 1, when @option{-fsanitize=address} is
-in use.
+This macro is defined, with value 1, when @option{-fsanitize=address}
+or @option{-fsanitize=kernel-address} are in use.
 
 @item __TIMESTAMP__
 This macro expands to a string constant that describes the date and time
index a152472..bea8be2 100644 (file)
@@ -5286,6 +5286,11 @@ more details.  The run-time behavior can be influenced using the
 @url{https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags} for
 a list of supported options.
 
+@item -fsanitize=kernel-address
+@opindex fsanitize=kernel-address
+Enable AddressSanitizer for Linux kernel.
+See @uref{http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel} for more details.
+
 @item -fsanitize=thread
 @opindex fsanitize=thread
 Enable ThreadSanitizer, a fast data race detector.
@@ -10134,6 +10139,12 @@ is enabled by default when using @option{-fsanitize=address} option.
 To disable use-after-return detection use 
 @option{--param asan-use-after-return=0}.
 
+@item asan-instrumentation-with-call-threshold
+If number of memory accesses in function being instrumented
+is greater or equal to this number, use callbacks instead of inline checks.
+E.g. to disable inline code use
+@option{--param asan-instrumentation-with-call-threshold=0}.
+
 @end table
 @end table
 
index ec16faa..1dd1b3e 100644 (file)
@@ -204,20 +204,22 @@ enum vect_cost_model {
 enum sanitize_code {
   /* AddressSanitizer.  */
   SANITIZE_ADDRESS = 1 << 0,
+  SANITIZE_USER_ADDRESS = 1 << 1,
+  SANITIZE_KERNEL_ADDRESS = 1 << 2,
   /* ThreadSanitizer.  */
-  SANITIZE_THREAD = 1 << 1,
+  SANITIZE_THREAD = 1 << 3,
   /* LeakSanitizer.  */
-  SANITIZE_LEAK = 1 << 2,
+  SANITIZE_LEAK = 1 << 4,
   /* UndefinedBehaviorSanitizer.  */
-  SANITIZE_SHIFT = 1 << 3,
-  SANITIZE_DIVIDE = 1 << 4,
-  SANITIZE_UNREACHABLE = 1 << 5,
-  SANITIZE_VLA = 1 << 6,
-  SANITIZE_NULL = 1 << 7,
-  SANITIZE_RETURN = 1 << 8,
-  SANITIZE_SI_OVERFLOW = 1 << 9,
-  SANITIZE_BOOL = 1 << 10,
-  SANITIZE_ENUM = 1 << 11,
+  SANITIZE_SHIFT = 1 << 5,
+  SANITIZE_DIVIDE = 1 << 6,
+  SANITIZE_UNREACHABLE = 1 << 7,
+  SANITIZE_VLA = 1 << 8,
+  SANITIZE_NULL = 1 << 9,
+  SANITIZE_RETURN = 1 << 10,
+  SANITIZE_SI_OVERFLOW = 1 << 11,
+  SANITIZE_BOOL = 1 << 12,
+  SANITIZE_ENUM = 1 << 13,
   SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE
                       | SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN
                       | SANITIZE_SI_OVERFLOW | SANITIZE_BOOL | SANITIZE_ENUM
index 18f360d..648621c 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-10-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/59488
index 9c4c40c..c7ce64d 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -734,8 +734,7 @@ proper position among the other output files.  */
 #ifndef SANITIZER_SPEC
 #define SANITIZER_SPEC "\
 %{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\
-    %{static:%ecannot specify -static with -fsanitize=address}\
-    %{%:sanitize(thread):%e-fsanitize=address is incompatible with -fsanitize=thread}}\
+    %{static:%ecannot specify -static with -fsanitize=address}}\
     %{%:sanitize(thread):" LIBTSAN_SPEC "\
     %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}\
     %{%:sanitize(undefined):" LIBUBSAN_SPEC "}\
@@ -767,7 +766,7 @@ proper position among the other output files.  */
     %(linker) " \
     LINK_PLUGIN_SPEC \
    "%{flto|flto=*:%<fcompare-debug*} \
-    %{flto} %{flto=*} %l " LINK_PIE_SPEC \
+    %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
    "%{fuse-ld=*:-fuse-ld=%*}\
     %X %{o*} %{e*} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
@@ -8173,7 +8172,9 @@ sanitize_spec_function (int argc, const char **argv)
     return NULL;
 
   if (strcmp (argv[0], "address") == 0)
-    return (flag_sanitize & SANITIZE_ADDRESS) ? "" : NULL;
+    return (flag_sanitize & SANITIZE_USER_ADDRESS) ? "" : NULL;
+  if (strcmp (argv[0], "kernel-address") == 0)
+    return (flag_sanitize & SANITIZE_KERNEL_ADDRESS) ? "" : NULL;
   if (strcmp (argv[0], "thread") == 0)
     return (flag_sanitize & SANITIZE_THREAD) ? "" : NULL;
   if (strcmp (argv[0], "undefined") == 0)
index 2a278e4..30d1653 100644 (file)
@@ -1329,11 +1329,14 @@ gimple_call_flags (const_gimple stmt)
 
 /* Return the "fn spec" string for call STMT.  */
 
-static tree
+static const_tree
 gimple_call_fnspec (const_gimple stmt)
 {
   tree type, attr;
 
+  if (gimple_call_internal_p (stmt))
+    return internal_fn_fnspec (gimple_call_internal_fn (stmt));
+
   type = gimple_call_fntype (stmt);
   if (!type)
     return NULL_TREE;
@@ -1350,7 +1353,7 @@ gimple_call_fnspec (const_gimple stmt)
 int
 gimple_call_arg_flags (const_gimple stmt, unsigned arg)
 {
-  tree attr = gimple_call_fnspec (stmt);
+  const_tree attr = gimple_call_fnspec (stmt);
 
   if (!attr || 1 + arg >= (unsigned) TREE_STRING_LENGTH (attr))
     return 0;
@@ -1384,7 +1387,7 @@ gimple_call_arg_flags (const_gimple stmt, unsigned arg)
 int
 gimple_call_return_flags (const_gimple stmt)
 {
-  tree attr;
+  const_tree attr;
 
   if (gimple_call_flags (stmt) & ECF_MALLOC)
     return ERF_NOALIAS;
index 1af11e4..cb51027 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 1062ea8..d64e20d 100644 (file)
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* The names of each internal function, indexed by function number.  */
 const char *const internal_fn_name_array[] = {
-#define DEF_INTERNAL_FN(CODE, FLAGS) #CODE,
+#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) #CODE,
 #include "internal-fn.def"
 #undef DEF_INTERNAL_FN
   "<invalid-fn>"
@@ -48,12 +48,26 @@ const char *const internal_fn_name_array[] = {
 
 /* The ECF_* flags of each internal function, indexed by function number.  */
 const int internal_fn_flags_array[] = {
-#define DEF_INTERNAL_FN(CODE, FLAGS) FLAGS,
+#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) FLAGS,
 #include "internal-fn.def"
 #undef DEF_INTERNAL_FN
   0
 };
 
+/* Fnspec of each internal function, indexed by function number.  */
+const_tree internal_fn_fnspec_array[IFN_LAST + 1];
+
+void
+init_internal_fns ()
+{
+#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) \
+  if (FNSPEC) internal_fn_fnspec_array[IFN_##CODE] = \
+    build_string ((int) sizeof (FNSPEC), FNSPEC ? FNSPEC : "");
+#include "internal-fn.def"
+#undef DEF_INTERNAL_FN
+  internal_fn_fnspec_array[IFN_LAST] = 0;
+}
+
 /* ARRAY_TYPE is an array of vector modes.  Return the associated insn
    for load-lanes-style optab OPTAB.  The insn must exist.  */
 
@@ -159,6 +173,14 @@ expand_UBSAN_NULL (gimple stmt ATTRIBUTE_UNUSED)
   gcc_unreachable ();
 }
 
+/* This should get expanded in the sanopt pass.  */
+
+static void
+expand_ASAN_CHECK (gimple stmt ATTRIBUTE_UNUSED)
+{
+  gcc_unreachable ();
+}
+
 /* Add sub/add overflow checking to the statement STMT.
    CODE says whether the operation is +, or -.  */
 
@@ -891,7 +913,7 @@ expand_BUILTIN_EXPECT (gimple stmt)
 
    where STMT is the statement that performs the call. */
 static void (*const internal_fn_expanders[]) (gimple) = {
-#define DEF_INTERNAL_FN(CODE, FLAGS) expand_##CODE,
+#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) expand_##CODE,
 #include "internal-fn.def"
 #undef DEF_INTERNAL_FN
   0
index 31dc4c9..2156e24 100644 (file)
@@ -28,28 +28,30 @@ along with GCC; see the file COPYING3.  If not see
 
    Each entry in this file has the form:
 
-     DEF_INTERNAL_FN (NAME, FLAGS)
+     DEF_INTERNAL_FN (NAME, FLAGS, FNSPEC)
 
-   where NAME is the name of the function and FLAGS is a set of
-   ECF_* flags.  Each entry must have a corresponding expander
-   of the form:
+   where NAME is the name of the function, FLAGS is a set of
+   ECF_* flags and FNSPEC is a string describing functions fnspec.
+   
+   Each entry must have a corresponding expander of the form:
 
      void expand_NAME (gimple stmt)
 
    where STMT is the statement that performs the call.  */
 
-DEF_INTERNAL_FN (LOAD_LANES, ECF_CONST | ECF_LEAF)
-DEF_INTERNAL_FN (STORE_LANES, ECF_CONST | ECF_LEAF)
-DEF_INTERNAL_FN (GOMP_SIMD_LANE, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (GOMP_SIMD_VF, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (GOMP_SIMD_LAST_LANE, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (LOOP_VECTORIZED, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (MASK_LOAD, ECF_PURE | ECF_LEAF)
-DEF_INTERNAL_FN (MASK_STORE, ECF_LEAF)
-DEF_INTERNAL_FN (ANNOTATE,  ECF_CONST | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
-DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN)
-DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
+DEF_INTERNAL_FN (LOAD_LANES, ECF_CONST | ECF_LEAF, NULL)
+DEF_INTERNAL_FN (STORE_LANES, ECF_CONST | ECF_LEAF, NULL)
+DEF_INTERNAL_FN (GOMP_SIMD_LANE, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (GOMP_SIMD_VF, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (GOMP_SIMD_LAST_LANE, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (LOOP_VECTORIZED, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (MASK_LOAD, ECF_PURE | ECF_LEAF, NULL)
+DEF_INTERNAL_FN (MASK_STORE, ECF_LEAF, NULL)
+DEF_INTERNAL_FN (ANNOTATE,  ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ".W.")
+DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
+DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, ".W..")
index 9c3215f..af93e15 100644 (file)
@@ -21,12 +21,16 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_INTERNAL_FN_H
 
 enum internal_fn {
-#define DEF_INTERNAL_FN(CODE, FLAGS) IFN_##CODE,
+#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) IFN_##CODE,
 #include "internal-fn.def"
 #undef DEF_INTERNAL_FN
   IFN_LAST
 };
 
+/* Initialize internal function tables.  */
+
+extern void init_internal_fns ();
+
 /* Return the name of internal function FN.  The name is only meaningful
    for dumps; it has no linkage.  */
 
@@ -48,6 +52,16 @@ internal_fn_flags (enum internal_fn fn)
   return internal_fn_flags_array[(int) fn];
 }
 
+/* Return fnspec for function FN.  */
+
+extern GTY(()) const_tree internal_fn_fnspec_array[IFN_LAST + 1];
+
+static inline const_tree
+internal_fn_fnspec (enum internal_fn fn)
+{
+  return internal_fn_fnspec_array[(int) fn];
+}
+
 extern void expand_internal_call (gimple);
 
 #endif
index b9185f1..8dba8fa 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index f7bb86b..ac5ffd4 100644 (file)
@@ -97,6 +97,15 @@ along with GCC; see the file COPYING3.       If not see
 #include "params.h"
 #include "lra-int.h"
 
+/* Current iteration number of the pass and current iteration number
+   of the pass after the latest spill pass when any former reload
+   pseudo was spilled.  */
+int lra_assignment_iter;
+int lra_assignment_iter_after_spill;
+
+/* Flag of spilling former reload pseudos on this pass.  */
+static bool former_reload_pseudo_spill_p;
+
 /* Array containing corresponding values of function
    lra_get_allocno_class.  It is used to speed up the code.  */
 static enum reg_class *regno_allocno_class_array;
@@ -992,6 +1001,8 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p)
   /* Spill: */
   EXECUTE_IF_SET_IN_BITMAP (&best_spill_pseudos_bitmap, 0, spill_regno, bi)
     {
+      if ((int) spill_regno >= lra_constraint_new_regno_start)
+       former_reload_pseudo_spill_p = true;
       if (lra_dump_file != NULL)
        fprintf (lra_dump_file, "      Spill %sr%d(hr=%d, freq=%d) for r%d\n",
                 pseudo_prefix_title (spill_regno),
@@ -1101,6 +1112,8 @@ setup_live_pseudos_and_spill_after_risky_transforms (bitmap
           j++)
        lra_hard_reg_usage[hard_regno + j] -= lra_reg_info[regno].freq;
       reg_renumber[regno] = -1;
+      if (regno >= lra_constraint_new_regno_start)
+       former_reload_pseudo_spill_p = true;
       if (lra_dump_file != NULL)
        fprintf (lra_dump_file, "    Spill r%d after risky transformations\n",
                 regno);
@@ -1361,7 +1374,10 @@ assign_by_spills (void)
       EXECUTE_IF_SET_IN_SPARSESET (live_range_hard_reg_pseudos, conflict_regno)
        {
          if ((int) conflict_regno >= lra_constraint_new_regno_start)
-           sorted_pseudos[nfails++] = conflict_regno;
+           {
+             sorted_pseudos[nfails++] = conflict_regno;
+             former_reload_pseudo_spill_p = true;
+           }
          if (lra_dump_file != NULL)
            fprintf (lra_dump_file, "     Spill %s r%d(hr=%d, freq=%d)\n",
                     pseudo_prefix_title (conflict_regno), conflict_regno,
@@ -1449,12 +1465,17 @@ lra_assign (void)
   int max_regno = max_reg_num ();
 
   timevar_push (TV_LRA_ASSIGN);
+  lra_assignment_iter++;
+  if (lra_dump_file != NULL)
+    fprintf (lra_dump_file, "\n********** Assignment #%d: **********\n\n",
+            lra_assignment_iter);
   init_lives ();
   sorted_pseudos = XNEWVEC (int, max_regno);
   sorted_reload_pseudos = XNEWVEC (int, max_regno);
   regno_allocno_class_array = XNEWVEC (enum reg_class, max_regno);
   for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
     regno_allocno_class_array[i] = lra_get_allocno_class (i);
+  former_reload_pseudo_spill_p = false;
   init_regno_assign_info ();
   bitmap_initialize (&all_spilled_pseudos, &reg_obstack);
   create_live_range_start_chains ();
@@ -1501,5 +1522,11 @@ lra_assign (void)
   free (sorted_reload_pseudos);
   finish_lives ();
   timevar_pop (TV_LRA_ASSIGN);
+  if (former_reload_pseudo_spill_p)
+    lra_assignment_iter_after_spill++;
+  if (lra_assignment_iter_after_spill > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER)
+    internal_error
+      ("Maximum number of LRA assignment passes is achieved (%d)\n",
+       LRA_MAX_ASSIGNMENT_ITERATION_NUMBER);
   return no_spills_p;
 }
index 3691ab8..8746968 100644 (file)
@@ -3920,10 +3920,6 @@ loc_equivalence_callback (rtx loc, const_rtx, void *data)
 /* The current iteration number of this LRA pass.  */
 int lra_constraint_iter;
 
-/* The current iteration number of this LRA pass after the last spill
-   pass.  */
-int lra_constraint_iter_after_spill;
-
 /* True if we substituted equiv which needs checking register
    allocation correctness because the equivalent value contains
    allocatable hard registers or when we restore multi-register
@@ -4069,11 +4065,6 @@ lra_constraints (bool first_p)
   if (lra_dump_file != NULL)
     fprintf (lra_dump_file, "\n********** Local #%d: **********\n\n",
             lra_constraint_iter);
-  lra_constraint_iter_after_spill++;
-  if (lra_constraint_iter_after_spill > LRA_MAX_CONSTRAINT_ITERATION_NUMBER)
-    internal_error
-      ("Maximum number of LRA constraint passes is achieved (%d)\n",
-       LRA_MAX_CONSTRAINT_ITERATION_NUMBER);
   changed_p = false;
   lra_risky_transformations_p = false;
   new_insn_uid_start = get_max_uid ();
index b2f5cf7..7262087 100644 (file)
@@ -244,9 +244,10 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
 #define LRA_LOSER_COST_FACTOR 6
 #define LRA_MAX_REJECT 600
 
-/* Maximum allowed number of constraint pass iterations after the last
-   spill pass. It is for preventing LRA cycling in a bug case.  */
-#define LRA_MAX_CONSTRAINT_ITERATION_NUMBER 30
+/* Maximum allowed number of assignment pass iterations after the
+   latest spill pass when any former reload pseudo was spilled.  It is
+   for preventing LRA cycling in a bug case.  */
+#define LRA_MAX_ASSIGNMENT_ITERATION_NUMBER 30
 
 /* The maximal number of inheritance/split passes in LRA.  It should
    be more 1 in order to perform caller saves transformations and much
@@ -259,7 +260,7 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
 #define LRA_MAX_INHERITANCE_PASSES 2
 
 #if LRA_MAX_INHERITANCE_PASSES <= 0 \
-    || LRA_MAX_INHERITANCE_PASSES >= LRA_MAX_CONSTRAINT_ITERATION_NUMBER - 8
+    || LRA_MAX_INHERITANCE_PASSES >= LRA_MAX_ASSIGNMENT_ITERATION_NUMBER - 8
 #error wrong LRA_MAX_INHERITANCE_PASSES value
 #endif
 
@@ -323,7 +324,6 @@ extern void lra_init_equiv (void);
 extern int lra_constraint_offset (int, enum machine_mode);
 
 extern int lra_constraint_iter;
-extern int lra_constraint_iter_after_spill;
 extern bool lra_risky_transformations_p;
 extern int lra_inheritance_iter;
 extern int lra_undo_inheritance_iter;
@@ -360,6 +360,8 @@ extern void lra_setup_reload_pseudo_preferenced_hard_reg (int, int, int);
 
 /* lra-assigns.c: */
 
+extern int lra_assignment_iter;
+extern int lra_assignment_iter_after_spill;
 extern void lra_setup_reg_renumber (int, int, bool);
 extern bool lra_assign (void);
 
index c1b92d8..69b08dc 100644 (file)
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2295,8 +2295,8 @@ lra (FILE *f)
 
   lra_in_progress = 1;
 
-  lra_live_range_iter = lra_coalesce_iter = 0;
-  lra_constraint_iter = lra_constraint_iter_after_spill = 0;
+  lra_live_range_iter = lra_coalesce_iter = lra_constraint_iter = 0;
+  lra_assignment_iter = lra_assignment_iter_after_spill = 0;
   lra_inheritance_iter = lra_undo_inheritance_iter = 0;
 
   setup_reg_spill_flag ();
@@ -2419,7 +2419,7 @@ lra (FILE *f)
       lra_eliminate (false, false);
       lra_constraint_new_regno_start = max_reg_num ();
       lra_constraint_new_insn_uid_start = get_max_uid ();
-      lra_constraint_iter_after_spill = 0;
+      lra_assignment_iter_after_spill = 0;
     }
   restore_scratches ();
   lra_eliminate (true, false);
index 6c6ea2b..8aed890 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-08-15  Bin Cheng  <bin.cheng@arm.com>
 
        Backport from mainline
index 2443c61..507e32b 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index cba09a4..307fcaa 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index bbd6b9c..fbdebd7 100644 (file)
@@ -868,6 +868,20 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
   /* The -gsplit-dwarf option requires -gpubnames.  */
   if (opts->x_dwarf_split_debug_info)
     opts->x_debug_generate_pub_sections = 1;
+
+  /* Userspace and kernel ASan conflict with each other and with TSan.  */
+
+  if ((flag_sanitize & SANITIZE_USER_ADDRESS)
+      && (flag_sanitize & SANITIZE_KERNEL_ADDRESS))
+    error_at (loc,
+              "-fsanitize=address is incompatible with "
+              "-fsanitize=kernel-address");
+
+  if ((flag_sanitize & SANITIZE_ADDRESS)
+      && (flag_sanitize & SANITIZE_THREAD))
+    error_at (loc,
+              "-fsanitize=address and -fsanitize=kernel-address "
+              "are incompatible with -fsanitize=thread");
 }
 
 #define LEFT_COLUMN    27
@@ -1453,7 +1467,10 @@ common_handle_option (struct gcc_options *opts,
              size_t len;
            } spec[] =
            {
-             { "address", SANITIZE_ADDRESS, sizeof "address" - 1 },
+             { "address", SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS,
+               sizeof "address" - 1 },
+             { "kernel-address", SANITIZE_ADDRESS | SANITIZE_KERNEL_ADDRESS,
+               sizeof "kernel-address" - 1 },
              { "thread", SANITIZE_THREAD, sizeof "thread" - 1 },
              { "leak", SANITIZE_LEAK, sizeof "leak" - 1 },
              { "shift", SANITIZE_SHIFT, sizeof "shift" - 1 },
@@ -1514,6 +1531,25 @@ common_handle_option (struct gcc_options *opts,
           the null pointer checks.  */
        if (flag_sanitize & SANITIZE_NULL)
          opts->x_flag_delete_null_pointer_checks = 0;
+
+       /* Kernel ASan implies normal ASan but does not yet support
+          all features.  */
+       if (flag_sanitize & SANITIZE_KERNEL_ADDRESS)
+         {
+           maybe_set_param_value (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+           maybe_set_param_value (PARAM_ASAN_GLOBALS, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+           maybe_set_param_value (PARAM_ASAN_STACK, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+           maybe_set_param_value (PARAM_ASAN_USE_AFTER_RETURN, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+         }
+
        break;
       }
 
index dd2e2cd..c656eaf 100644 (file)
@@ -1081,9 +1081,15 @@ DEFPARAM (PARAM_ASAN_MEMINTRIN,
 
 DEFPARAM (PARAM_ASAN_USE_AFTER_RETURN,
          "asan-use-after-return",
-         "Enable asan builtin functions protection",
+         "Enable asan detection of use-after-return bugs",
          1, 0, 1)
 
+DEFPARAM (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD,
+         "asan-instrumentation-with-call-threshold",
+         "Use callbacks instead of inline code if number of accesses "
+         "in function becomes greater or equal to this number",
+         INT_MAX, 0, INT_MAX)
+
 DEFPARAM (PARAM_UNINIT_CONTROL_DEP_ATTEMPTS,
          "uninit-control-dep-attempts",
          "Maximum number of nested calls to search for control dependencies "
index 0d6daa2..d488e32 100644 (file)
@@ -232,5 +232,7 @@ extern void init_param_values (int *params);
   PARAM_VALUE (PARAM_ASAN_MEMINTRIN)
 #define ASAN_USE_AFTER_RETURN \
   PARAM_VALUE (PARAM_ASAN_USE_AFTER_RETURN)
+#define ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD \
+  PARAM_VALUE (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD)
 
 #endif /* ! GCC_PARAMS_H */
index 399d6b5..23a4a9c 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 015b1d8..b1e6f04 100644 (file)
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Address Sanitizer */
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_INIT, "__asan_init_v3",
                      BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
-/* Do not reorder the BUILT_IN_ASAN_REPORT* builtins, e.g. cfgcleanup.c
+/* Do not reorder the BUILT_IN_ASAN_{REPORT,CHECK}* builtins, e.g. cfgcleanup.c
    relies on this order.  */
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD1, "__asan_report_load1",
                      BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
@@ -41,6 +41,9 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD8, "__asan_report_load8",
                      BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD16, "__asan_report_load16",
                      BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD_N, "__asan_report_load_n",
+                     BT_FN_VOID_PTR_PTRMODE,
+                     ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE1, "__asan_report_store1",
                      BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE2, "__asan_report_store2",
@@ -51,6 +54,33 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE8, "__asan_report_store8",
                      BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE16, "__asan_report_store16",
                      BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE_N, "__asan_report_store_n",
+                     BT_FN_VOID_PTR_PTRMODE,
+                     ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD1, "__asan_load1",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD2, "__asan_load2",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD4, "__asan_load4",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD8, "__asan_load8",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD16, "__asan_load16",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOADN, "__asan_loadN",
+                     BT_FN_VOID_PTR_PTRMODE, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE1, "__asan_store1",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE2, "__asan_store2",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE4, "__asan_store4",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE8, "__asan_store8",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE16, "__asan_store16",
+                     BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STOREN, "__asan_storeN",
+                     BT_FN_VOID_PTR_PTRMODE, ATTR_TMPURE_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REGISTER_GLOBALS,
                      "__asan_register_globals",
                      BT_FN_VOID_PTR_PTRMODE, ATTR_NOTHROW_LEAF_LIST)
index 084d195..9dc10d4 100644 (file)
@@ -211,12 +211,7 @@ self_referential_size (tree size)
       param_type = TREE_TYPE (ref);
       param_decl
        = build_decl (input_location, PARM_DECL, param_name, param_type);
-      if (targetm.calls.promote_prototypes (NULL_TREE)
-         && INTEGRAL_TYPE_P (param_type)
-         && TYPE_PRECISION (param_type) < TYPE_PRECISION (integer_type_node))
-       DECL_ARG_TYPE (param_decl) = integer_type_node;
-      else
-       DECL_ARG_TYPE (param_decl) = param_type;
+      DECL_ARG_TYPE (param_decl) = param_type;
       DECL_ARTIFICIAL (param_decl) = 1;
       TREE_READONLY (param_decl) = 1;
 
index 0e7553e..be16d9c 100644 (file)
@@ -1,3 +1,209 @@
+2014-10-31  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/63697
+       * c-c++-common/ubsan/overflow-sub-3.c: New test.
+
+2014-10-30  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR63633
+       * gcc.target/avr/torture/pr63633-ice-mult.c: New test.
+
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * gcc.target/aarch64/madd_after_asm_1.c: New test.
+
+2014-10-27  Guozhi Wei  <carrot@google.com>
+
+       PR tree-optimization/63530
+       gcc.dg/vect/pr63530.c: New test.
+
+2014-10-27  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/entry_queues2.adb: New test.
+
+2014-10-25  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/63638
+       * c-c++-common/asan/pr63638.c: New test.
+
+2014-10-24  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR bootstrap/63632
+       * g++.dg/torture/pr63632.C: New test.
+
+2014-10-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/63563
+       * gcc.target/i386/pr63563.c: New test.
+
+2014-10-20  Yury Gribov  <y.gribov@samsung.com>
+
+       Backported from mainline
+       2014-05-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-c++-common/asan/misalign-1.c: New test.
+       * c-c++-common/asan/misalign-2.c: New test.
+
+2014-10-17  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-c++-common/asan/instrument-with-calls-1.c: Add
+       -fno-sanitize=address -fsanitize=kernel-address to dg-options.
+       * c-c++-common/asan/instrument-with-calls-2.c: Likewise.
+
+       PR tree-optimization/63302
+       * gcc.c-torture/execute/pr63302.c: New test.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-09-01  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61897
+       PR sanitizer/62140
+
+       * c-c++-common/asan/pr62140-1.c: New test.
+       * c-c++-common/asan/pr62140-2.c: New test.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-08-18  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/62089
+
+       * c-c++-common/asan/pr62089.c: New test.
+       * c-c++-common/asan/bitfield-1.c: New test.
+       * c-c++-common/asan/bitfield-2.c: New test.
+       * c-c++-common/asan/bitfield-3.c: New test.
+       * c-c++-common/asan/bitfield-4.c: New test.
+
+       Backport from mainline
+       2014-08-28  Yury Gribov  <y.gribov@samsung.com>
+
+       * c-c++-common/asan/pr62089.c: Fix test on 32-bit platforms.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-08-11  Yury Gribov  <y.gribov@samsung.com>
+
+       * c-c++-common/asan/inc.c: Update test.
+       * c-c++-common/asan/instrument-with-calls-2.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-1.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-2.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-3.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-4.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-5.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-6.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-7.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-8.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-9.c: Likewise.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-06-24  Max Ostapenko  <m.ostapenko@partner.samsung.com>
+
+       * c-c++-common/asan/no-redundant-instrumentation-9.c: New test.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-06-16  Yury Gribov  <y.gribov@samsung.com>
+
+       * c-c++-common/asan/instrument-with-calls-1.c: New test.
+       * c-c++-common/asan/instrument-with-calls-2.c: Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-1.c: Update
+       test patterns.
+       * c-c++-common/asan/no-redundant-instrumentation-2.c:
+       Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-4.c:
+       Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-5.c:
+       Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-6.c:
+       Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-7.c:
+       Likewise.
+       * c-c++-common/asan/no-redundant-instrumentation-8.c:
+       Likewise.
+
+       Backport from mainline
+       2014-06-18  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61530
+
+       * c-c++-common/asan/pr61530.c: New test.
+
+       Backport from mainline
+       2014-06-18  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61547
+
+       * c-c++-common/asan/strlen-overflow-1.c: New test.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-05-14  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61100
+
+       * c-c++-common/asan/asan-interface-1.c: New test.
+       * lib/asan-dg.exp (asan_include_flags): New function.
+       (asan_init): Call asan_include_flags to obtain path
+       to sanitizer headers.
+
+2014-10-15  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/63448
+       * gcc.target/i386/pr63448.c: New test.
+
+2014-10-15  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/opt41.adb: New test.
+       * gnat.dg/opt41_pkg.ad[sb]: New helper.
+
+2014-10-15  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-08-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/62031
+       * gcc.dg/torture/pr62031.c: New testcase.
+
+2014-10-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline r215880
+       2014-10-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * g++.dg/ext/altivec-2.C: Compile with -Wno-deprecated to avoid
+       failing with the new warning message.
+       * gcc.dg/vmx/3c-01a.c: Likewise.
+       * gcc.dg/vmx/ops-long-1.c: Likewise.
+       * gcc.dg/vmx/ops.c: Likewise.
+       * gcc.target/powerpc/altivec-20.c: Likewise.
+       * gcc.target/powerpc/altivec-6.c: Likewise.
+       * gcc.target/powerpc/altivec-vec-merge.c: Likewise.
+       * gcc.target/powerpc/vsx-builtin-8.c: Likewise.
+       * gcc.target/powerpc/warn-lvsl-lvsr.c: New test.
+
+       Backport from mainline r215882
+       2014-10-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * gcc.target/powerpc/lvsl-lvsr.c: New test.
+
+       Backport from mainline r216017
+       2014-10-08  Pat Haugen  <pthaugen@us.ibm.com>
+
+       * gcc.dg/vmx/3c-01a.c: Add default options from vmx.exp.
+       * gcc.dg/vmx/ops.c: Likewise.
+       * gcc.dg/vmx/ops-long-1.c: Likewise.
+
 2014-10-11  Christophe Lyon  <christophe.lyon@linaro.org>
 
        Backport from mainline r216117.
diff --git a/gcc/testsuite/c-c++-common/asan/asan-interface-1.c b/gcc/testsuite/c-c++-common/asan/asan-interface-1.c
new file mode 100644 (file)
index 0000000..8cd80ca
--- /dev/null
@@ -0,0 +1,14 @@
+/* Check that interface headers work. */
+
+/* { dg-do run { target { *-*-linux* } } } */
+
+#include <stdbool.h>
+#include <sanitizer/asan_interface.h>
+
+int main() {
+  char tmp;
+  if (__asan_address_is_poisoned((volatile char *)&tmp + 1))
+    return 0;
+  return 1;
+}
+
diff --git a/gcc/testsuite/c-c++-common/asan/bitfield-1.c b/gcc/testsuite/c-c++-common/asan/bitfield-1.c
new file mode 100644 (file)
index 0000000..b3f300c
--- /dev/null
@@ -0,0 +1,25 @@
+/* Check that Asan correctly instruments bitfields with non-round size.  */
+
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+struct A
+{
+  char base;
+  int : 4;
+  long x : 7;
+};
+
+int __attribute__ ((noinline, noclone))
+f (void *p) {
+  return ((struct A *)p)->x;
+}
+
+int
+main ()
+{
+  char a = 0;
+  return f (&a);
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */
diff --git a/gcc/testsuite/c-c++-common/asan/bitfield-2.c b/gcc/testsuite/c-c++-common/asan/bitfield-2.c
new file mode 100644 (file)
index 0000000..8ab0f80
--- /dev/null
@@ -0,0 +1,25 @@
+/* Check that Asan correctly instruments bitfields with non-round offset.  */
+
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+struct A
+{
+  char base;
+  int : 7;
+  int x : 8;
+};
+
+int __attribute__ ((noinline, noclone))
+f (void *p) {
+  return ((struct A *)p)->x;
+}
+
+int
+main ()
+{
+  char a = 0;
+  return f (&a);
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */
diff --git a/gcc/testsuite/c-c++-common/asan/bitfield-3.c b/gcc/testsuite/c-c++-common/asan/bitfield-3.c
new file mode 100644 (file)
index 0000000..c590778
--- /dev/null
@@ -0,0 +1,25 @@
+/* Check that Asan correctly instruments bitfields with round offset.  */
+
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+struct A
+{
+  char base;
+  int : 8;
+  int x : 8;
+};
+
+int __attribute__ ((noinline, noclone))
+f (void *p) {
+  return ((struct A *)p)->x;
+}
+
+int
+main ()
+{
+  char a = 0;
+  return f (&a);
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */
diff --git a/gcc/testsuite/c-c++-common/asan/bitfield-4.c b/gcc/testsuite/c-c++-common/asan/bitfield-4.c
new file mode 100644 (file)
index 0000000..94de9a4
--- /dev/null
@@ -0,0 +1,25 @@
+/* Check that Asan correctly instruments bitfields with round offset.  */
+
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+struct A
+{
+  char base;
+  int : 0;
+  int x : 8;
+};
+
+int __attribute__ ((noinline, noclone))
+f (void *p) {
+  return ((struct A *)p)->x;
+}
+
+int
+main ()
+{
+  char a = 0;
+  return f (&a);
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */
index b9c6734..36cc3d8 100644 (file)
@@ -16,6 +16,6 @@ main ()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 1 "asan0" } }  */
-/* { dg-final { scan-tree-dump "__builtin___asan_report_load4" "asan0" } }  */
+/* { dg-final { scan-tree-dump-times "ASAN_" 1 "asan0" } }  */
+/* { dg-final { scan-tree-dump "ASAN_CHECK \\(.*, 4\\);" "asan0" } }  */
 /* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c b/gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c
new file mode 100644 (file)
index 0000000..32e32a6
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do assemble } */
+/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=0 -save-temps" } */
+
+void f(char *a, int *b) {
+  *b = *a;
+}
+
+/* { dg-final { scan-assembler "__asan_load1" } } */
+/* { dg-final { scan-assembler "__asan_store4" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c b/gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c
new file mode 100644 (file)
index 0000000..1b361e6
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do assemble } */
+/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=1 -save-temps" } */
+
+int x;
+
+void f(int *a, int *b) {
+  *a = 0;
+  asm volatile ("" ::: "memory");
+  x = *b;
+}
+
+/* { dg-final { scan-assembler "__asan_store4" } } */
+/* { dg-final { scan-assembler-not "__asan_report_store4" } } */
+/* { dg-final { scan-assembler "__asan_load4" } } */
+/* { dg-final { scan-assembler-not "__asan_report_load4" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/c-c++-common/asan/misalign-1.c b/gcc/testsuite/c-c++-common/asan/misalign-1.c
new file mode 100644 (file)
index 0000000..0c5b6e0
--- /dev/null
@@ -0,0 +1,42 @@
+/* { dg-do run { target { ilp32 || lp64 } } } */
+/* { dg-options "-O2" } */
+/* { dg-shouldfail "asan" } */
+
+struct S { int i; } __attribute__ ((packed));
+
+__attribute__((noinline, noclone)) int
+foo (struct S *s)
+{
+  return s->i;
+}
+
+__attribute__((noinline, noclone)) int
+bar (int *s)
+{
+  return *s;
+}
+
+__attribute__((noinline, noclone)) struct S
+baz (struct S *s)
+{
+  return *s;
+}
+
+int
+main ()
+{
+  struct T { char a[3]; struct S b[3]; char c; } t;
+  int v = 5;
+  struct S *p = t.b;
+  asm volatile ("" : "+rm" (p));
+  p += 3;
+  if (bar (&v) != 5) __builtin_abort ();
+  volatile int w = foo (p);
+  return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
+/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #0 0x\[0-9a-f\]+ (in _*foo(\[^\n\r]*misalign-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*misalign-1.c:34|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/asan/misalign-2.c b/gcc/testsuite/c-c++-common/asan/misalign-2.c
new file mode 100644 (file)
index 0000000..7fbe299
--- /dev/null
@@ -0,0 +1,42 @@
+/* { dg-do run { target { ilp32 || lp64 } } } */
+/* { dg-options "-O2" } */
+/* { dg-shouldfail "asan" } */
+
+struct S { int i; } __attribute__ ((packed));
+
+__attribute__((noinline, noclone)) int
+foo (struct S *s)
+{
+  return s->i;
+}
+
+__attribute__((noinline, noclone)) int
+bar (int *s)
+{
+  return *s;
+}
+
+__attribute__((noinline, noclone)) struct S
+baz (struct S *s)
+{
+  return *s;
+}
+
+int
+main ()
+{
+  struct T { char a[3]; struct S b[3]; char c; } t;
+  int v = 5;
+  struct S *p = t.b;
+  asm volatile ("" : "+rm" (p));
+  p += 3;
+  if (bar (&v) != 5) __builtin_abort ();
+  volatile struct S w = baz (p);
+  return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
+/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #0 0x\[0-9a-f\]+ (in _*baz(\[^\n\r]*misalign-2.c:22|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*misalign-2.c:34|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
index fa52e0c..028f8d7 100644 (file)
@@ -2,7 +2,7 @@
    location in the same basic block, the second reference should not
    be instrumented by the Address Sanitizer.  */
 
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
@@ -16,12 +16,11 @@ test0 ()
   tab[0] = 1;
   tab[1] = 2;
 
-  /* __builtin___asan_report_load1 called 1 time for the store
-     below.  */
-  char t0 = tab[1];
-
   /* This load should not be instrumented because it is to the same
      memory location as above.  */
+  char t0 = tab[1];
+
+  /* Likewise.  */
   char t1 = tab[1];
 
   return t0 + t1;
@@ -36,7 +35,7 @@ test1 (int i)
     the initialization.  */
   foo[i] = 1;
 
-  /*__builtin___asan_report_store1 called 2 times here to instrument
+  /*__builtin___asan_report_store_n called once here to instrument
     the store to the memory region of tab.  */
   __builtin_memset (tab, 3, sizeof (tab));
 
@@ -44,8 +43,8 @@ test1 (int i)
   __builtin_memset (tab, 4, sizeof (tab));
   __builtin_memset (tab, 5, sizeof (tab));
 
-  /* There are 2 calls to __builtin___asan_report_store1 and 2 calls
-     to __builtin___asan_report_load1 to instrument the store to
+  /* There is a call to __builtin___asan_report_store_n and a call
+     to __builtin___asan_report_load_n to instrument the store to
      (subset of) the memory region of tab.  */
   __builtin_memcpy (&tab[1], foo + i, 3);
 
@@ -53,7 +52,7 @@ test1 (int i)
      the reference to tab[1] has been already instrumented above.  */
   return tab[1];
 
-  /* So for these function, there should be 7 calls to
+  /* So for these functions, there should be 3 calls to
      __builtin___asan_report_store1.  */
 }
 
@@ -63,6 +62,7 @@ main ()
   return test0 () && test1 (0);
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 7 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 2 "asan0" }  } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 3 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 1 "sanopt" }  } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index 28525e0..a58411c 100644 (file)
@@ -3,7 +3,7 @@
    be instrumented by the Address Sanitizer.  But in case of access to
    overlapping regions we must be precise.  */
 
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
@@ -20,6 +20,7 @@ main ()
   __builtin_memset (tab, 1, 3);
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 3 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 3 "asan0" }  } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "& 7" 3 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "sanopt" }  } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index 420a263..5193ae0 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
@@ -12,7 +12,7 @@ foo (__INT32_TYPE__ *p)
   return ret; 
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store" 1 "asan0" } } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store" 1 "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index b2e7284..c3632aa 100644 (file)
@@ -1,13 +1,17 @@
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
 void
 foo  (int *a, char *b, char *c)
 {
+  /* One check for c[0], one check for a[], one check for c, two checks for b.  */
   __builtin_memmove (c, b, a[c[0]]);
+  /* For a total of 5 checks.  */
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 3 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 1 "asan0" } } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "& 7" 5 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 1 "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index ead3f58..077ea34 100644 (file)
@@ -1,13 +1,18 @@
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
 void
 foo  (int *a, char *b, char *c)
 {
+  /* One check for b[0], one check for a[], 2 checks for c and one checks for b.  */
   __builtin_memmove (c, b, a[b[0]]);
+  /* For a total of 5 checks.  */
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 2 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "& 7" 5 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 1 "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index e4691bc..6d87104 100644 (file)
@@ -1,14 +1,20 @@
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
 void
 foo  (int *a, char *b, char *c)
 {
+  /* One check for c[0], one check for a[], one check for c and 2 checks for b.  */
   __builtin_memmove (c, b, a[c[0]]);
+  /* One check for a[], one check for c and one check for b.  */
   __builtin_memmove (c, b, a[b[0]]);
+  /* For a total of 8 checks.  */
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 5 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "& 7" 8 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 2 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 2 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index bf40a03..5baa10d 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
@@ -13,11 +13,15 @@ struct S
 int
 foo  (int *a, char *b, char *c)
 {
+  /* 2 checks for s.a, 2 checks for e.  */
   int d = __builtin_memcmp (s.a, e, 100);
+  /* One check for s.a and one check for e.  */
   d += __builtin_memcmp (s.a, e, 200);
+  /* For a total of 6 checks.  */
   return d;
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 6 "asan0" } } */
-/* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "asan0" } } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "& 7" 6 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 4 "sanopt" } } */
+/* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
index 38ea7a2..2a4c081 100644 (file)
@@ -1,14 +1,20 @@
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-sanopt" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
 char
 foo  (int *a, char *b, char *c)
 {
+  /* One check for b[0], one check for a[], two checks for c and one check for b.  */
   __builtin_memmove (c, b, a[b[0]]);
+  /* No checks here.  */
   return c[0] + b[0];
+  /* For a total of 5 checks.  */
 }
 
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 3 "asan0" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "& 7" 5 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 1 "sanopt" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 1 "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c
new file mode 100644 (file)
index 0000000..9449de5
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-options "-fdump-tree-sanopt" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+__SIZE_TYPE__
+f (char *a)
+{
+  a[0] = '1';
+  return  __builtin_strlen (a);
+}
+
+/* { dg-final { scan-tree-dump-times "__asan_report_load1" 1 "sanopt" } } */
+/* { dg-final { cleanup-tree-dump "sanopt" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/pr61530.c b/gcc/testsuite/c-c++-common/asan/pr61530.c
new file mode 100644 (file)
index 0000000..e306a71
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+__attribute__((noinline,noclone)) void
+foo (char *a, char *b) {
+  a[0] = b[0] = 0;
+  __builtin_memcpy(a, b, 4);
+}
+
+int
+main () {
+  char a, b;
+  foo (&a, &b);
+  return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */
diff --git a/gcc/testsuite/c-c++-common/asan/pr62089.c b/gcc/testsuite/c-c++-common/asan/pr62089.c
new file mode 100644 (file)
index 0000000..9b92e9b
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdbool.h>
+#include <sanitizer/asan_interface.h>
+
+struct vfsmount {};
+struct dentry {};
+
+struct path {
+  struct vfsmount *mnt;
+  struct dentry *dentry;
+};
+
+struct fs_struct {
+  int users;
+  int lock;
+  int seq;
+  int umask;
+  int in_exec;
+  struct path root, pwd;
+};
+
+void __attribute__((noinline, noclone))
+copy_fs_struct(struct fs_struct *a, struct fs_struct *b) {
+  a->root = b->root;
+}
+
+struct fs_struct a, b;
+
+int
+main () {
+  __asan_poison_memory_region (&a.root, sizeof (a.root));
+  copy_fs_struct (&a, &b);
+  return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
diff --git a/gcc/testsuite/c-c++-common/asan/pr62140-1.c b/gcc/testsuite/c-c++-common/asan/pr62140-1.c
new file mode 100644 (file)
index 0000000..f0b026d
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-w -fpermissive" } */
+
+int memcmp (const void *p, const void *q, int len);
+
+int f (int *p, int *q, int len)
+{
+    return memcmp (p, q, len);
+}
+
diff --git a/gcc/testsuite/c-c++-common/asan/pr62140-2.c b/gcc/testsuite/c-c++-common/asan/pr62140-2.c
new file mode 100644 (file)
index 0000000..0bb2563
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-w -fpermissive" } */
+
+int strlen (const char *p);
+
+int f (char *p)
+{
+    int x = strlen (p);
+    return x;
+}
+
diff --git a/gcc/testsuite/c-c++-common/asan/pr63638.c b/gcc/testsuite/c-c++-common/asan/pr63638.c
new file mode 100644 (file)
index 0000000..a8bafc5
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memcpy (void *, const void *, __SIZE_TYPE__);
+
+struct S{
+  long d0, d1, d2, d3, d4, d5, d6;
+};
+
+struct S s[6];
+
+int f(struct S *p)
+{
+  memcpy(p, &s[2], sizeof(*p));
+  memcpy(p, &s[1], sizeof(*p));
+}
+
diff --git a/gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c b/gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c
new file mode 100644 (file)
index 0000000..4833dc7
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdbool.h>
+#include <sanitizer/asan_interface.h>
+
+char a[2] = "0";
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+__attribute__((no_sanitize_address, noinline)) __SIZE_TYPE__
+strlen (const char *p) {
+
+  __SIZE_TYPE__ n = 0;
+  for (; *p; ++n, ++p);
+  return n;
+}
+
+int main () {
+  char *p = &a[0];
+  asm ("" : "+r"(p));
+  __asan_poison_memory_region ((char *)&a[1], 1);
+  return __builtin_strlen (a);
+}
+
+/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
+/* { dg-output "    #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strlen-overflow-1.c:26|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c b/gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c
new file mode 100644 (file)
index 0000000..deec5c4
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+__attribute__((noinline, noclone)) int
+foo1 (int x, int y)
+{
+  return x - y;
+}
+
+__attribute__((noinline, noclone)) int
+foo2 (int x, int y)
+{
+  unsigned int xa = (unsigned int) x - (__INT_MAX__ - 3);
+  xa &= 3;
+  x = __INT_MAX__ - 3 + xa;
+  unsigned int ya = y + 1U;
+  ya &= 1;
+  y = ya - 1;
+  return x - y;
+}
+
+int
+main ()
+{
+  int xm1, y;
+  for (xm1 = __INT_MAX__ - 4; xm1 < __INT_MAX__; xm1++)
+    for (y = -1; y <= 0; y++)
+      if (foo1 (xm1 + 1, y) != (int) (xm1 + 1U - y)
+         || foo2 (xm1 + 1, y) != (int) (xm1 + 1U - y))
+       __builtin_abort ();
+  return 0;
+}
+/* { dg-output ":7:\[0-9]\[^\n\r]*signed integer overflow: 2147483647 - -1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*:19:\[0-9]\[^\n\r]*signed integer overflow: 2147483647 - -1 cannot be represented in type 'int'" } */
index eb8a929..e14e6f8 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do compile { target powerpc*-*-* } } */
 /* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable" } */
+/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable -Wno-deprecated" } */
 
 /* This test checks if AltiVec builtins accept const-qualified
    arguments.  */
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr16.C b/gcc/testsuite/g++.dg/ext/stmtexpr16.C
new file mode 100644 (file)
index 0000000..ddce40c
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/63455
+// { dg-options "-std=gnu++11" }
+
+int main()
+{
+    int x = 0;
+
+    // without '+0', gcc 4.6 gives a different error (no ICE though)
+    decltype(({ int y = x; y; })+0) v1 = 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr63632.C b/gcc/testsuite/g++.dg/torture/pr63632.C
new file mode 100644 (file)
index 0000000..48cd869
--- /dev/null
@@ -0,0 +1,5 @@
+// PR bootstrap/63632
+// { dg-do link }
+// { dg-options "-fno-lto" }
+
+int main () {}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr63302.c b/gcc/testsuite/gcc.c-torture/execute/pr63302.c
new file mode 100644 (file)
index 0000000..9967024
--- /dev/null
@@ -0,0 +1,60 @@
+/* PR tree-optimization/63302 */
+
+#ifdef __SIZEOF_INT128__
+#if __SIZEOF_INT128__ * __CHAR_BIT__ == 128
+#define USE_INT128
+#endif
+#endif
+#if __SIZEOF_LONG_LONG__ * __CHAR_BIT__ == 64
+#define USE_LLONG
+#endif
+
+#ifdef USE_INT128
+__attribute__((noinline, noclone)) int
+foo (__int128 x)
+{
+  __int128 v = x & (((__int128) -1 << 63) | 0x7ff);
+  return v == 0 || v == ((__int128) -1 << 63);
+}
+#endif
+
+#ifdef USE_LLONG
+__attribute__((noinline, noclone)) int
+bar (long long x)
+{
+  long long v = x & (((long long) -1 << 31) | 0x7ff);
+  return v == 0 || v == ((long long) -1 << 31);
+}
+#endif
+
+int
+main ()
+{
+#ifdef USE_INT128
+  if (foo (0) != 1
+      || foo (1) != 0
+      || foo (0x800) != 1
+      || foo (0x801) != 0
+      || foo ((__int128) 1 << 63) != 0
+      || foo ((__int128) -1 << 63) != 1
+      || foo (((__int128) -1 << 63) | 1) != 0
+      || foo (((__int128) -1 << 63) | 0x800) != 1
+      || foo (((__int128) -1 << 63) | 0x801) != 0)
+    __builtin_abort ();
+#endif
+#ifdef USE_LLONG
+  if (bar (0) != 1
+      || bar (1) != 0
+      || bar (0x800) != 1
+      || bar (0x801) != 0
+      || bar (1LL << 31) != 0
+      || bar (-1LL << 31) != 1
+      || bar ((-1LL << 31) | 1) != 0
+      || bar ((-1LL << 31) | 0x800) != 1
+      || bar ((-1LL << 31) | 0x801) != 0)
+    __builtin_abort ();
+#endif
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr62031.c b/gcc/testsuite/gcc.dg/torture/pr62031.c
new file mode 100644 (file)
index 0000000..f0dcef4
--- /dev/null
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define NUM_OF_STATES 4
+typedef unsigned int entry_t[2];
+typedef struct entries_item { entry_t metricEntries_[0]; } entries_item_t;
+
+void __attribute__((noinline,noclone))
+test_00(size_t numOfStates, entries_item_t* p_bm,
+       const unsigned int* polyArray,
+       size_t polyArraySize)
+{
+  size_t idx;
+  unsigned int hlp0, hlp1;
+  for (idx = 0; idx < numOfStates; ++idx)
+    {
+      size_t idy;
+
+      hlp0 = (idx << 1) | 0x00;
+      hlp1 = (idx << 1) | 0x01;
+      p_bm->metricEntries_[idx][0] = 0;
+      p_bm->metricEntries_[idx][1] = 0;
+      for (idy = 0; idy < polyArraySize; ++idy)
+       {
+         p_bm->metricEntries_[idx][0]
+             |= __builtin_parity(hlp0 & polyArray[idy]) << idy;
+         p_bm->metricEntries_[idx][1]
+             |= __builtin_parity(hlp1 & polyArray[idy]) << idy;
+       }
+    }
+}
+
+int main()
+{
+  unsigned int polyArray[] = { 0x07, 0x05 };
+  entries_item_t* pBranchMetrics;
+  pBranchMetrics = malloc(sizeof(entry_t) * NUM_OF_STATES);
+  test_00(NUM_OF_STATES, pBranchMetrics, polyArray,
+         sizeof(polyArray) / sizeof(polyArray[0]));
+  if (pBranchMetrics->metricEntries_[0][0] != 0
+      || pBranchMetrics->metricEntries_[0][1] != 3
+      || pBranchMetrics->metricEntries_[1][0] != 1
+      || pBranchMetrics->metricEntries_[1][1] != 2
+      || pBranchMetrics->metricEntries_[2][0] != 3
+      || pBranchMetrics->metricEntries_[2][1] != 0
+      || pBranchMetrics->metricEntries_[3][0] != 2
+      || pBranchMetrics->metricEntries_[3][1] != 1)
+    abort ();
+  free(pBranchMetrics);
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr63530.c b/gcc/testsuite/gcc.dg/vect/pr63530.c
new file mode 100644 (file)
index 0000000..b583b9b
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-options "-O2 -ftree-vectorize -funroll-loops --param \"max-completely-peeled-insns=400\"" } */
+
+/* PR tree-optimization/63530 */
+/* On armv7 hardware, following options cause run time failure  */
+/*   -march=armv7-a -mfloat-abi=hard -mfpu=neon -marm -O2 -ftree-vectorize  */
+/*   -funroll-loops --param "max-completely-peeled-insns=400"  */
+
+#include <stdlib.h>
+
+typedef struct {
+  unsigned char map[256];
+  int i;
+} A, *AP;
+
+AP __attribute__ ((noinline))
+foo (int n)
+{
+  AP b = (AP)calloc (1, sizeof (A));
+  int i;
+  for (i = n; i < 256; i++)
+    b->map[i] = i;
+  return b;
+}
+
+int
+main()
+{
+  AP p = foo(3);
+  return p->map[30] - p->map[20] - p->map[10];
+}
index 2499ca6..56f3c87 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */
 #include <altivec.h>
 typedef const volatile unsigned int _1;
 typedef const  unsigned int _2;
index 5471706..bceb4fc 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */
 
 /* Checks from the original ops.c that pass pointers to long or
    unsigned long for operations that support that in released versions
index b39ad1d..21801ca 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */
 #include <altivec.h>
 #include <stdlib.h>
 extern char * *var_char_ptr;
diff --git a/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c b/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c
new file mode 100644 (file)
index 0000000..523941d
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do assemble } */
+/* { dg-options "-O2 -mfix-cortex-a53-835769" } */
+
+int
+test (int a, double b, int c, int d, int e)
+{
+  double result;
+  __asm__ __volatile ("// %0, %1"
+                      : "=w" (result)
+                      : "0" (b)
+                      :    /* No clobbers */
+                      );
+  return c * d + e;
+}
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c b/gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c
new file mode 100644 (file)
index 0000000..a523424
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+
+void ice_mult32 (int x)
+{
+  register long reg __asm ("22");
+  __asm volatile (" " :: "r" (reg = 0x12345 * x));
+}
+
+void ice_mult24 (int x)
+{
+  register __int24 reg __asm ("20");
+  __asm volatile (" " :: "r" (reg = 0x12345 * x));
+}
+
+void ice_sh24 (__int24 x)
+{
+  register __int24 reg __asm ("20");
+  __asm volatile (" " :: "r" (reg = x << 3));
+}
+
+void ice_sh24b (__int24 x)
+{
+  register __int24 reg __asm ("20");
+  __asm volatile (" " :: "r" (reg = x << 22));
+}
+
+void ice_s16s16 (int x)
+{
+  register long reg __asm ("20");
+  __asm volatile (" " :: "r" (reg = (long) x*x));
+}
+
+void ice_u16s16 (int x)
+{
+  register long reg __asm ("20");
+  __asm volatile (" " :: "r" (reg = (long) x*0x1234u));
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr63448.c b/gcc/testsuite/gcc.target/i386/pr63448.c
new file mode 100644 (file)
index 0000000..3f8262e
--- /dev/null
@@ -0,0 +1,120 @@
+/* PR rtl-optimization/63448 */
+/* { dg-do compile } */
+/* { dg-options "-O -std=c99" } */
+
+int a, d, e, g, h, j;
+float b, c, k, l, m, n;
+int *__restrict i;
+void
+foo (void)
+{
+  int o = e;
+  int *p;
+  float *q, *r = (float *) 0x1234000;
+  float s, t, u, v, w, x;
+  do
+    {
+      for (a = o; a; a--)
+       {
+         s += m;
+         t += n;
+         u += m;
+         v += n;
+         w += d;
+         x += d;
+         n = l;
+         s += r[1];
+         t += n;
+         v += r[1];
+         m = k * r[4];
+         n = q[0] * r[4];
+         s += m;
+         m = q[1] * r[4];
+         t += n;
+         q += g;
+         k = *q;
+         n = q[1] * r[4];
+         s += m;
+         t += n;
+         u += r[4];
+         m = q[8] * r[4];
+         q += 1;
+         n = q[1] * r[4];
+         s += m;
+         m = q[4];
+         t += n;
+         q += g;
+         w += m;
+         m = k * r[4];
+         s += m;
+         t += q[0];
+         m = q[1] * r[4];
+         v += q[0];
+         n = q[10] * r[4];
+         s += m;
+         t += n;
+         u += b;
+         m = q[8] * r[4];
+         n = q[2] * r[4];
+         s += m;
+         m = q[4] * r[4];
+         t += n;
+         q++;
+         n = q[2] * r[16];
+         s += m;
+         m = q[4];
+         t += n;
+         s += m;
+         t += r[6];
+         q += g;
+         k = *q;
+         w += m;
+         m = k * r[20];
+         x += r[16];
+         n = q[1] * r[20];
+         s += m;
+         t += n;
+         q += g;
+         k = *q;
+         w += m;
+         m = k * r[2];
+         n = q[1] * r[22];
+         s += m;
+         m = q[4];
+         t += n;
+         q += g;
+         s += m;
+         t += q[0];
+         s += m;
+         u += m;
+         n = q[1] * r[22];
+         s += m;
+         m = q[4] * r[22];
+         t += n;
+         q += g;
+         k = 1;
+         w += m;
+         c = q[10];
+         x += r[22];
+         s += m;
+         t += r[22];
+         u += m;
+         v += r[22];
+         n = q[10] * r[30];
+         d = r[32];
+         l = q[1];
+         b = 0;
+         w += m;
+         m = r[32];
+         x += n;
+         r = 0;
+       }
+      *i = s;
+      p[0] = t;
+      p[1] = u;
+      p[6] = v;
+      p[8] = w;
+      p[10] = x;
+    }
+  while (j);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr63563.c b/gcc/testsuite/gcc.target/i386/pr63563.c
new file mode 100644 (file)
index 0000000..ce3e465
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR tree-optimization/63563 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2" } */
+
+struct A { unsigned long a, b, c, d; } a[1024] = { { 0, 1, 2, 3 } }, b;
+
+void
+foo (void)
+{
+  int i;
+  for (i = 0; i < 1024; i++)
+    {
+      a[i].a = a[i].b = a[i].c = b.c;
+      if (a[i].d)
+       a[i].d = b.d;
+    }
+}
index b2c29a9..1af8ed7 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile { target powerpc_altivec_ok } } */
-/* { dg-options "-maltivec -mcpu=G5 -O2" } */
+/* { dg-options "-maltivec -mcpu=G5 -O2 -Wno-deprecated" } */
 
 #include <altivec.h>
 
index 51d4116..29856fd 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do compile { target powerpc*-*-* } } */
 /* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -O0 -Wall" } */
+/* { dg-options "-maltivec -O0 -Wall -Wno-deprecated" } */
 
 #include <altivec.h>
 
index 3689f97..b1ed8b8 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
 /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
 /* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -O2" } */
+/* { dg-options "-maltivec -O2 -Wno-deprecated" } */
 
 #include <altivec.h>
 
diff --git a/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c b/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
new file mode 100644 (file)
index 0000000..71dd0a2
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test expected code generation for lvsl and lvsr on little endian.
+   Note that lvsl and lvsr are each produced once, but the filename
+   causes them to appear twice in the file.  */
+
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-options "-O0 -Wno-deprecated" } */
+/* { dg-final { scan-assembler-times "lvsl" 2 } } */
+/* { dg-final { scan-assembler-times "lvsr" 2 } } */
+/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
+/* { dg-final { scan-assembler-times "vperm" 2 } } */
+
+
+#include <altivec.h>
+
+float f[20];
+
+void foo ()
+{
+  vector unsigned char a = vec_lvsl (4, f);
+  vector unsigned char b = vec_lvsr (8, f);
+}
index 836b385..934cdad 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O3 -mcpu=power7" } */
+/* { dg-options "-O3 -mcpu=power7 -Wno-deprecated" } */
 
 /* Test the various load/store varients.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c b/gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c
new file mode 100644 (file)
index 0000000..bf889aa
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test for deprecation messages on use of lvsl and lvsr for little endian.  */
+
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-options "-O0 -Wdeprecated" } */
+
+#include <altivec.h>
+
+float f[20];
+
+void foo ()
+{
+  vector unsigned char a = vec_lvsl (4, f); /* { dg-warning "vec_lvsl is deprecated for little endian; use assignment for unaligned loads and stores" } */
+  vector unsigned char b = vec_lvsr (8, f); /* { dg-warning "vec_lvsr is deprecated for little endian; use assignment for unaligned loads and stores" } */
+}
diff --git a/gcc/testsuite/gnat.dg/entry_queues2.adb b/gcc/testsuite/gnat.dg/entry_queues2.adb
new file mode 100644 (file)
index 0000000..a1445ce
--- /dev/null
@@ -0,0 +1,45 @@
+-- { dg-do compile }
+
+procedure Entry_Queues2 is
+
+    F1 : Integer := 17;
+
+    generic
+        type T is limited private;
+    procedure Check;
+
+    procedure Check is
+    begin
+        declare
+            type Poe is new T;
+        begin
+            declare
+                type Arr is array (1 .. 2) of Poe;
+                X : Arr;
+                pragma Unreferenced (X);
+            begin
+                null;
+            end;
+        end;
+    end;
+
+begin
+
+    declare
+        protected type Poe (D3 : Integer := F1) is
+            entry E (D3 .. F1);    -- F1 evaluated
+        end Poe;
+        protected body Poe is
+            entry E (for I in D3 .. F1) when True is
+            begin
+                null;
+            end E;
+        end Poe;
+
+        procedure Chk is new Check (Poe);
+
+    begin
+        Chk;
+    end;
+
+end;
diff --git a/gcc/testsuite/gnat.dg/opt41.adb b/gcc/testsuite/gnat.dg/opt41.adb
new file mode 100644 (file)
index 0000000..2166043
--- /dev/null
@@ -0,0 +1,15 @@
+-- { dg-do run }
+-- { dg-options "-Os" }
+
+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+with Opt41_Pkg;             use Opt41_Pkg;
+
+procedure Opt41 is
+   R  : Rec := (Five, To_Unbounded_String ("CONFIG"));
+   SP : String_Access := new String'(To_String (Rec_Write (R)));
+   RP : Rec_Ptr := new Rec'(Rec_Read (SP));
+begin
+   if RP.D /= R.D then
+      raise Program_Error;
+   end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/opt41_pkg.adb b/gcc/testsuite/gnat.dg/opt41_pkg.adb
new file mode 100644 (file)
index 0000000..c43c1bf
--- /dev/null
@@ -0,0 +1,53 @@
+with Ada.Streams; use Ada.Streams;\r
+\r
+package body Opt41_Pkg is\r
+\r
+   type Wstream is new Root_Stream_Type with record\r
+      S : Unbounded_String;\r
+   end record;\r
+\r
+   procedure Read (Stream : in out Wstream;\r
+                   Item   : out Stream_Element_Array;\r
+                   Last   : out Stream_Element_Offset) is null;\r
+\r
+   procedure Write (Stream : in out Wstream; Item : Stream_Element_Array) is\r
+   begin\r
+      for J in Item'Range loop\r
+         Append (Stream.S, Character'Val (Item (J)));\r
+      end loop;\r
+   end Write;\r
+\r
+   function Rec_Write (R : Rec) return Unbounded_String is\r
+      S : aliased Wstream;\r
+   begin\r
+      Rec'Output (S'Access, R);\r
+      return S.S;\r
+   end Rec_Write;\r
+\r
+   type Rstream is new Root_Stream_Type with record\r
+      S   : String_Access;\r
+      Idx : Integer := 1;\r
+   end record;\r
+\r
+   procedure Write (Stream : in out Rstream; Item : Stream_Element_Array) is null;\r
+\r
+   procedure Read (Stream : in out Rstream;\r
+                   Item   : out Stream_Element_Array;\r
+                   Last   : out Stream_Element_Offset) is\r
+   begin\r
+      Last := Stream_Element_Offset'Min\r
+         (Item'Last, Item'First + Stream_Element_Offset (Stream.S'Last - Stream.Idx));\r
+      for I in Item'First .. Last loop\r
+         Item (I) := Stream_Element (Character'Pos (Stream.S (Stream.Idx)));\r
+         Stream.Idx := Stream.Idx + 1;\r
+      end loop;\r
+   end Read;\r
+\r
+   function Rec_Read (Str : String_Access) return Rec is\r
+      S : aliased Rstream;\r
+   begin\r
+      S.S := Str;\r
+      return Rec'Input (S'Access);\r
+   end Rec_Read;\r
+\r
+end Opt41_Pkg;\r
diff --git a/gcc/testsuite/gnat.dg/opt41_pkg.ads b/gcc/testsuite/gnat.dg/opt41_pkg.ads
new file mode 100644 (file)
index 0000000..e73bc93
--- /dev/null
@@ -0,0 +1,28 @@
+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;\r
+\r
+package Opt41_Pkg is\r
+\r
+   type Enum is (One, Two, Three, Four, Five, Six);\r
+\r
+   type Rec (D : Enum) is record\r
+      case D is\r
+         when One => \r
+            I : Integer;\r
+         when Two | Five | Six =>\r
+            S : Unbounded_String;\r
+            case D is\r
+               when Two => B : Boolean;\r
+               when others => null;\r
+            end case;\r
+         when others =>\r
+            null;\r
+      end case;\r
+   end record;\r
+\r
+   type Rec_Ptr is access all Rec;\r
+\r
+   function Rec_Write (R : Rec) return Unbounded_String;\r
+\r
+   function Rec_Read (Str : String_Access) return Rec;\r
+\r
+end Opt41_Pkg;\r
index 9ba39db..7a12160 100644 (file)
@@ -23,6 +23,21 @@ proc check_effective_target_faddress_sanitizer {} {
     } "-fsanitize=address"]
 }
 
+proc asan_include_flags {} {
+    global srcdir
+    global TESTING_IN_BUILD_TREE
+
+    set flags ""
+
+    if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
+      return "${flags}"
+    }
+
+    set flags "-I$srcdir/../../libsanitizer/include"
+
+    return "$flags"
+}
+
 #
 # asan_link_flags -- compute library path and flags to find libasan.
 # (originally from g++.exp)
@@ -80,17 +95,19 @@ proc asan_init { args } {
        }
     }
 
+    set include_flags "[asan_include_flags]"
+
     if [info exists TEST_ALWAYS_FLAGS] {
        set asan_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
     }
     if [info exists ALWAYS_CXXFLAGS] {
        set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS]
-       set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -g}" $ALWAYS_CXXFLAGS]
+       set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -g $include_flags}" $ALWAYS_CXXFLAGS]
     } else {
        if [info exists TEST_ALWAYS_FLAGS] {
-           set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g $TEST_ALWAYS_FLAGS"
+           set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g $include_flags $TEST_ALWAYS_FLAGS"
        } else {
-           set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g"
+           set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g $include_flags"
        }
     }
     if { $link_flags != "" } {
index d646faf..588fa2b 100644 (file)
@@ -1555,9 +1555,18 @@ process_options (void)
     warn_stack_protect = 0;
 
   /* Address Sanitizer needs porting to each target architecture.  */
+
   if ((flag_sanitize & SANITIZE_ADDRESS)
-      && (targetm.asan_shadow_offset == NULL
-         || !FRAME_GROWS_DOWNWARD))
+      && !FRAME_GROWS_DOWNWARD)
+    {
+      warning (0,
+              "-fsanitize=address and -fsanitize=kernel-address "
+              "are not supported for this target");
+      flag_sanitize &= ~SANITIZE_ADDRESS;
+    }
+
+  if ((flag_sanitize & SANITIZE_USER_ADDRESS)
+      && targetm.asan_shadow_offset == NULL)
     {
       warning (0, "-fsanitize=address not supported for this target");
       flag_sanitize &= ~SANITIZE_ADDRESS;
index 01d0a7a..a15494a 100644 (file)
@@ -982,7 +982,6 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
          ref = fold_build2_loc (EXPR_LOCATION (ref),
                                 MEM_REF, TREE_TYPE (ref),
                                 base, memoff);
-         DR_UNCONSTRAINED_BASE (dr) = true;
          access_fns.safe_push (access_fn);
        }
     }
@@ -1389,14 +1388,20 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b,
        return false;
     }
 
-  /* If we had an evolution in a MEM_REF BASE_OBJECT we do not know
-     the size of the base-object.  So we cannot do any offset/overlap
-     based analysis but have to rely on points-to information only.  */
+  /* If we had an evolution in a pointer-based MEM_REF BASE_OBJECT we
+     do not know the size of the base-object.  So we cannot do any
+     offset/overlap based analysis but have to rely on points-to
+     information only.  */
   if (TREE_CODE (addr_a) == MEM_REF
-      && DR_UNCONSTRAINED_BASE (a))
+      && TREE_CODE (TREE_OPERAND (addr_a, 0)) == SSA_NAME)
     {
-      if (TREE_CODE (addr_b) == MEM_REF
-         && DR_UNCONSTRAINED_BASE (b))
+      /* For true dependences we can apply TBAA.  */
+      if (flag_strict_aliasing
+         && DR_IS_WRITE (a) && DR_IS_READ (b)
+         && !alias_sets_conflict_p (get_alias_set (DR_REF (a)),
+                                    get_alias_set (DR_REF (b))))
+       return false;
+      if (TREE_CODE (addr_b) == MEM_REF)
        return ptr_derefs_may_alias_p (TREE_OPERAND (addr_a, 0),
                                       TREE_OPERAND (addr_b, 0));
       else
@@ -1404,9 +1409,21 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b,
                                       build_fold_addr_expr (addr_b));
     }
   else if (TREE_CODE (addr_b) == MEM_REF
-          && DR_UNCONSTRAINED_BASE (b))
-    return ptr_derefs_may_alias_p (build_fold_addr_expr (addr_a),
-                                  TREE_OPERAND (addr_b, 0));
+          && TREE_CODE (TREE_OPERAND (addr_b, 0)) == SSA_NAME)
+    {
+      /* For true dependences we can apply TBAA.  */
+      if (flag_strict_aliasing
+         && DR_IS_WRITE (a) && DR_IS_READ (b)
+         && !alias_sets_conflict_p (get_alias_set (DR_REF (a)),
+                                    get_alias_set (DR_REF (b))))
+       return false;
+      if (TREE_CODE (addr_a) == MEM_REF)
+       return ptr_derefs_may_alias_p (TREE_OPERAND (addr_a, 0),
+                                      TREE_OPERAND (addr_b, 0));
+      else
+       return ptr_derefs_may_alias_p (build_fold_addr_expr (addr_a),
+                                      TREE_OPERAND (addr_b, 0));
+    }
 
   /* Otherwise DR_BASE_OBJECT is an access that covers the whole object
      that is being subsetted in the loop nest.  */
index 9d819e4..f4f6832 100644 (file)
@@ -81,10 +81,6 @@ struct indices
 
   /* A list of chrecs.  Access functions of the indices.  */
   vec<tree> access_fns;
-
-  /* Whether BASE_OBJECT is an access representing the whole object
-     or whether the access could not be constrained.  */
-  bool unconstrained_base;
 };
 
 struct dr_alias
@@ -195,7 +191,6 @@ struct data_reference
 #define DR_STMT(DR)                (DR)->stmt
 #define DR_REF(DR)                 (DR)->ref
 #define DR_BASE_OBJECT(DR)         (DR)->indices.base_object
-#define DR_UNCONSTRAINED_BASE(DR)  (DR)->indices.unconstrained_base
 #define DR_ACCESS_FNS(DR)         (DR)->indices.access_fns
 #define DR_ACCESS_FN(DR, I)        DR_ACCESS_FNS (DR)[I]
 #define DR_NUM_DIMENSIONS(DR)      DR_ACCESS_FNS (DR).length ()
index fce2a6e..b5b1d90 100644 (file)
@@ -2198,7 +2198,7 @@ optimize_range_tests_xor (enum tree_code opcode, tree type,
   lowxor = fold_binary (BIT_XOR_EXPR, type, lowi, lowj);
   if (lowxor == NULL_TREE || TREE_CODE (lowxor) != INTEGER_CST)
     return false;
-  if (tree_log2 (lowxor) < 0)
+  if (!integer_pow2p (lowxor))
     return false;
   highxor = fold_binary (BIT_XOR_EXPR, type, highi, highj);
   if (!tree_int_cst_equal (lowxor, highxor))
@@ -2245,7 +2245,7 @@ optimize_range_tests_diff (enum tree_code opcode, tree type,
   tem1 = fold_binary (MINUS_EXPR, type, lowj, lowi);
   if (tem1 == NULL_TREE || TREE_CODE (tem1) != INTEGER_CST)
     return false;
-  if (tree_log2 (tem1) < 0)
+  if (!integer_pow2p (tem1))
     return false;
 
   mask = fold_build1 (BIT_NOT_EXPR, type, tem1);
index a1096fd..49303b1 100644 (file)
@@ -2530,11 +2530,14 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
             over them.  The we can just skip ahead to the next DR here.  */
 
          /* Check that the data-refs have same first location (except init)
-            and they are both either store or load (not load and store).  */
+            and they are both either store or load (not load and store,
+            not masked loads or stores).  */
          if (DR_IS_READ (dra) != DR_IS_READ (drb)
              || !operand_equal_p (DR_BASE_ADDRESS (dra),
                                   DR_BASE_ADDRESS (drb), 0)
-             || !dr_equal_offsets_p (dra, drb))
+             || !dr_equal_offsets_p (dra, drb)
+             || !gimple_assign_single_p (DR_STMT (dra))
+             || !gimple_assign_single_p (DR_STMT (drb)))
            break;
 
          /* Check that the data-refs have the same constant size and step.  */
@@ -3938,8 +3941,12 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
       && TREE_CODE (addr_base) == SSA_NAME)
     {
       duplicate_ssa_name_ptr_info (addr_base, DR_PTR_INFO (dr));
-      if (offset)
+      unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info));
+      int misalign = DR_MISALIGNMENT (dr);
+      if (offset || byte_offset || (misalign == -1))
        mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base));
+      else
+       set_ptr_info_alignment (SSA_NAME_PTR_INFO (addr_base), align, misalign);
     }
 
   if (dump_enabled_p ())
index 2c80135..57a58b1 100644 (file)
@@ -9377,8 +9377,10 @@ simplify_internal_call_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
     }
   else
     {
-      tree r1 = int_const_binop (subcode, vr0.min, vr1.min);
-      tree r2 = int_const_binop (subcode, vr0.max, vr1.max);
+      tree r1 = int_const_binop (subcode, vr0.min,
+                                subcode == MINUS_EXPR ? vr1.max : vr1.min);
+      tree r2 = int_const_binop (subcode, vr0.max,
+                                subcode == MINUS_EXPR ? vr1.min : vr1.max);
       if (r1 == NULL_TREE || TREE_OVERFLOW (r1)
          || r2 == NULL_TREE || TREE_OVERFLOW (r2))
        return false;
index 069abb7..b9f3d60 100644 (file)
@@ -9875,8 +9875,9 @@ local_define_builtin (const char *name, tree type, enum built_in_function code,
 }
 
 /* Call this function after instantiating all builtins that the language
-   front end cares about.  This will build the rest of the builtins that
-   are relied upon by the tree optimizers and the middle-end.  */
+   front end cares about.  This will build the rest of the builtins
+   and internal functions that are relied upon by the tree optimizers and
+   the middle-end.  */
 
 void
 build_common_builtin_nodes (void)
@@ -10109,6 +10110,8 @@ build_common_builtin_nodes (void)
                              ECF_CONST | ECF_NOTHROW | ECF_LEAF);
       }
   }
+
+  init_internal_fns ();
 }
 
 /* HACK.  GROSS.  This is absolutely disgusting.  I wish there was a
index ca1c728..4074b08 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index cc3b59c..9ff64a0 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 4a30e7b..c1a4f25 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 38ba63c..27e7258 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-08-12  Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * Makefile.in: Add CFLAGS_FOR_TARGET to GNATLIBCFLAGS_FOR_C.
index f78862f..6be97ea 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 8acd472..f73ab03 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 5f36983..2b7bc43 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index b85cb67..05dbcc6 100644 (file)
@@ -1,4 +1,17 @@
-libcpp/
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline r215873
+       2014-10-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * lex.c (search_line_fast): Add new version to be used for Power8
+       and later targets when Altivec is enabled.  Restrict the existing
+       Altivec version to big-endian systems so that lvsr is not used on
+       little endian, where it is deprecated.  Remove LE-specific code
+       from the now-BE-only version.
 
 2014-10-08  Edward Smith-Rowland  <3dw4rd@verizon.net>
 
index 6d69b59..ec07c6e 100644 (file)
@@ -515,9 +515,111 @@ init_vectorized_lexer (void)
   search_line_fast = impl;
 }
 
-#elif (GCC_VERSION >= 4005) && defined(__ALTIVEC__)
+#elif defined(_ARCH_PWR8) && defined(__ALTIVEC__)
 
-/* A vection of the fast scanner using AltiVec vectorized byte compares.  */
+/* A vection of the fast scanner using AltiVec vectorized byte compares
+   and VSX unaligned loads (when VSX is available).  This is otherwise
+   the same as the pre-GCC 5 version.  */
+
+static const uchar *
+search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
+{
+  typedef __attribute__((altivec(vector))) unsigned char vc;
+
+  const vc repl_nl = {
+    '\n', '\n', '\n', '\n', '\n', '\n', '\n', '\n', 
+    '\n', '\n', '\n', '\n', '\n', '\n', '\n', '\n'
+  };
+  const vc repl_cr = {
+    '\r', '\r', '\r', '\r', '\r', '\r', '\r', '\r', 
+    '\r', '\r', '\r', '\r', '\r', '\r', '\r', '\r'
+  };
+  const vc repl_bs = {
+    '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', 
+    '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\'
+  };
+  const vc repl_qm = {
+    '?', '?', '?', '?', '?', '?', '?', '?', 
+    '?', '?', '?', '?', '?', '?', '?', '?', 
+  };
+  const vc zero = { 0 };
+
+  vc data, t;
+
+  /* Main loop processing 16 bytes at a time.  */
+  do
+    {
+      vc m_nl, m_cr, m_bs, m_qm;
+
+      data = *((const vc *)s);
+      s += 16;
+
+      m_nl = (vc) __builtin_vec_cmpeq(data, repl_nl);
+      m_cr = (vc) __builtin_vec_cmpeq(data, repl_cr);
+      m_bs = (vc) __builtin_vec_cmpeq(data, repl_bs);
+      m_qm = (vc) __builtin_vec_cmpeq(data, repl_qm);
+      t = (m_nl | m_cr) | (m_bs | m_qm);
+
+      /* T now contains 0xff in bytes for which we matched one of the relevant
+        characters.  We want to exit the loop if any byte in T is non-zero.
+        Below is the expansion of vec_any_ne(t, zero).  */
+    }
+  while (!__builtin_vec_vcmpeq_p(/*__CR6_LT_REV*/3, t, zero));
+
+  /* Restore s to to point to the 16 bytes we just processed.  */
+  s -= 16;
+
+  {
+#define N  (sizeof(vc) / sizeof(long))
+
+    union {
+      vc v;
+      /* Statically assert that N is 2 or 4.  */
+      unsigned long l[(N == 2 || N == 4) ? N : -1];
+    } u;
+    unsigned long l, i = 0;
+
+    u.v = t;
+
+    /* Find the first word of T that is non-zero.  */
+    switch (N)
+      {
+      case 4:
+       l = u.l[i++];
+       if (l != 0)
+         break;
+       s += sizeof(unsigned long);
+       l = u.l[i++];
+       if (l != 0)
+         break;
+       s += sizeof(unsigned long);
+      case 2:
+       l = u.l[i++];
+       if (l != 0)
+         break;
+       s += sizeof(unsigned long);
+       l = u.l[i];
+      }
+
+    /* L now contains 0xff in bytes for which we matched one of the
+       relevant characters.  We can find the byte index by finding
+       its bit index and dividing by 8.  */
+#ifdef __BIG_ENDIAN__
+    l = __builtin_clzl(l) >> 3;
+#else
+    l = __builtin_ctzl(l) >> 3;
+#endif
+    return s + l;
+
+#undef N
+  }
+}
+
+#elif (GCC_VERSION >= 4005) && defined(__ALTIVEC__) && defined (__BIG_ENDIAN__)
+
+/* A vection of the fast scanner using AltiVec vectorized byte compares.
+   This cannot be used for little endian because vec_lvsl/lvsr are
+   deprecated for little endian and the code won't work properly.  */
 /* ??? Unfortunately, attribute(target("altivec")) is not yet supported,
    so we can't compile this function without -maltivec on the command line
    (or implied by some other switch).  */
@@ -559,13 +661,8 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
      beginning with all ones and shifting in zeros according to the
      mis-alignment.  The LVSR instruction pulls the exact shift we
      want from the address.  */
-#ifdef __BIG_ENDIAN__
   mask = __builtin_vec_lvsr(0, s);
   mask = __builtin_vec_perm(zero, ones, mask);
-#else
-  mask = __builtin_vec_lvsl(0, s);
-  mask = __builtin_vec_perm(ones, zero, mask);
-#endif
   data &= mask;
 
   /* While altivec loads mask addresses, we still need to align S so
@@ -629,11 +726,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
     /* L now contains 0xff in bytes for which we matched one of the
        relevant characters.  We can find the byte index by finding
        its bit index and dividing by 8.  */
-#ifdef __BIG_ENDIAN__
     l = __builtin_clzl(l) >> 3;
-#else
-    l = __builtin_ctzl(l) >> 3;
-#endif
     return s + l;
 
 #undef N
index b9f6038..fc2c861 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index c3215a6..9942f9b 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 91908bb..4d33646 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-09-11  Jakub Jelinek  <jakub@redhat.com>
 
        * src/powerpc/linux64.S: Emit .note.GNU-stack even when
index ec29554..df187b1 100644 (file)
@@ -1,3 +1,19 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-26  John David Anglin  <danglin@gcc.gnu.org>
+
+       * config/pa/linux-unwind.h (pa32_read_access_ok): New function.
+       (pa32_fallback_frame_state): Use pa32_read_access_ok to check if
+       memory read accesses are ok.
+
+2014-10-22  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/63223
+       * config/avr/lib1funcs.S (__do_global_dtors): Reverse execution
+       order to first...last.
+
 2014-09-18  Joseph Myers  <joseph@codesourcery.com>
 
        * config/i386/sfp-machine.h (FP_TRAPPING_EXCEPTIONS): Treat clear
index 080e250..5ad1e93 100644 (file)
@@ -2390,27 +2390,29 @@ ENDF __do_global_ctors
 #ifdef L_dtors
        .section .fini6,"ax",@progbits
 DEFUN __do_global_dtors
-    ldi     r17, pm_hi8(__dtors_start)
-    ldi     r28, pm_lo8(__dtors_end)
-    ldi     r29, pm_hi8(__dtors_end)
+    ldi     r17, pm_hi8(__dtors_end)
+    ldi     r28, pm_lo8(__dtors_start)
+    ldi     r29, pm_hi8(__dtors_start)
 #ifdef __AVR_HAVE_EIJMP_EICALL__
-    ldi     r16, pm_hh8(__dtors_end)
+    ldi     r16, pm_hh8(__dtors_start)
 #endif /* HAVE_EIJMP */
     rjmp    .L__do_global_dtors_start
 .L__do_global_dtors_loop:
-    sbiw    r28, 1
 #ifdef __AVR_HAVE_EIJMP_EICALL__
-    sbc     r16, __zero_reg__
     mov     r24, r16
 #endif /* HAVE_EIJMP */
     mov_h   r31, r29
     mov_l   r30, r28
     XCALL   __tablejump2__
+    adiw    r28, 1
+#ifdef __AVR_HAVE_EIJMP_EICALL__
+    adc     r16, __zero_reg__
+#endif /* HAVE_EIJMP */
 .L__do_global_dtors_start:
-    cpi     r28, pm_lo8(__dtors_start)
+    cpi     r28, pm_lo8(__dtors_end)
     cpc     r29, r17
 #ifdef __AVR_HAVE_EIJMP_EICALL__
-    ldi     r24, pm_hh8(__dtors_start)
+    ldi     r24, pm_hh8(__dtors_end)
     cpc     r16, r24
 #endif /* HAVE_EIJMP */
     brne    .L__do_global_dtors_loop
index c3f8386..68d46d2 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 485f2d9..4a3cfff 100644 (file)
@@ -32,6 +32,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <signal.h>
 #include <sys/ucontext.h>
 
+/* Return TRUE if read access to *P is allowed.  */
+
+static inline long
+pa32_read_access_ok (void *p)
+{
+  long ret;
+
+  __asm__ ("proberi (%1),3,%0" : "=r" (ret) : "r" (p) :);
+  return ret;
+}
+
 /* Unfortunately, because of various bugs and changes to the kernel,
    we have several cases to deal with.
 
@@ -48,7 +59,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    tell us how to locate the sigcontext structure.
 
    Note that with a 2.4 64-bit kernel, the signal context is not properly
-   passed back to userspace so the unwind will not work correctly.  */
+   passed back to userspace so the unwind will not work correctly.
+
+   There is also a bug in various glibc versions.  The (CONTEXT)->ra
+   for the outermost frame is not marked as undefined, so we need to
+   check whether read access is allowed for all the accesses used in
+   searching for the signal trampoline.  */
 
 #define MD_FALLBACK_FRAME_STATE_FOR pa32_fallback_frame_state
 
@@ -73,14 +89,17 @@ pa32_fallback_frame_state (struct _Unwind_Context *context,
      e4008200 be,l 0x100(%sr2, %r0), %sr0, %r31
      08000240 nop  */
 
-  if (pc[0] == 0x34190000 || pc[0] == 0x34190002)
+  if (pa32_read_access_ok (pc)
+      && (pc[0] == 0x34190000 || pc[0] == 0x34190002))
     off = 4*4;
-  else if (pc[4] == 0x34190000 || pc[4] == 0x34190002)
+  else if (pa32_read_access_ok (&pc[4])
+          && (pc[4] == 0x34190000 || pc[4] == 0x34190002))
     {
       pc += 4;
       off = 10 * 4;
     }
-  else if (pc[5] == 0x34190000 || pc[5] == 0x34190002)
+  else if (pa32_read_access_ok (&pc[5])
+          && (pc[5] == 0x34190000 || pc[5] == 0x34190002))
     {
       pc += 5;
       off = 10 * 4;
@@ -96,13 +115,16 @@ pa32_fallback_frame_state (struct _Unwind_Context *context,
         word boundary and we can then determine the frame offset.  */
       sp = (unsigned long)context->ra;
       pc = (unsigned int *)sp;
-      if ((pc[0] == 0x34190000 || pc[0] == 0x34190002) && (sp & 4))
+      if ((sp & 4)
+         && pa32_read_access_ok (pc)
+         && (pc[0] == 0x34190000 || pc[0] == 0x34190002))
        off = 5 * 4;
       else
        return _URC_END_OF_STACK;
     }
 
-  if (pc[1] != 0x3414015a
+  if (!pa32_read_access_ok (&pc[3])
+      || pc[1] != 0x3414015a
       || pc[2] != 0xe4008200
       || pc[3] != 0x08000240)
     return _URC_END_OF_STACK;
index 1fa1f78..6b99549 100644 (file)
@@ -1,3 +1,17 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-20  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       PR libfortran/63589
+       * configure.ac: Check for strtok_r.
+       * runtime/main.c (gfstrtok_r): Fallback implementation of
+       strtok_r.
+       (find_addr2line): Use strtok_r to split PATH.
+       * config.h.in: Regenerated.
+       * configure: Regenerated.
+
 2014-10-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/63460
index 8298f8d..5c9de02 100644 (file)
 /* Define to 1 if you have the `strtof' function. */
 #undef HAVE_STRTOF
 
+/* Define to 1 if you have the `strtok_r' function. */
+#undef HAVE_STRTOK_R
+
 /* Define to 1 if you have the `strtold' function. */
 #undef HAVE_STRTOLD
 
index d3ced74..830337c 100755 (executable)
@@ -2599,6 +2599,7 @@ as_fn_append ac_func_list " getegid"
 as_fn_append ac_func_list " secure_getenv"
 as_fn_append ac_func_list " __secure_getenv"
 as_fn_append ac_func_list " mkostemp"
+as_fn_append ac_func_list " strtok_r"
 as_fn_append ac_header_list " math.h"
 # Check that the precious variables saved in the cache have kept the same
 # value.
@@ -12343,7 +12344,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12346 "configure"
+#line 12347 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12449,7 +12450,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12452 "configure"
+#line 12453 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16473,6 +16474,9 @@ $as_echo "#define HAVE_LOCALTIME_R 1" >>confdefs.h
 $as_echo "#define HAVE_GMTIME_R 1" >>confdefs.h
 
 
+$as_echo "#define HAVE_STRTOK_R 1" >>confdefs.h
+
+
    # At some point, we should differentiate between architectures
    # like x86, which have long double versions, and alpha/powerpc/etc.,
    # which don't. For the time being, punt.
@@ -16605,6 +16609,8 @@ done
 
 
 
+
+
 fi
 
 # Check strerror_r, cannot be above as versions with two and three arguments exist
index 24dbf2b..922239f 100644 (file)
@@ -272,6 +272,7 @@ if test "x${with_newlib}" = "xyes"; then
    AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.])
    AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.])
    AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.])
+   AC_DEFINE(HAVE_STRTOK_R, 1, [Define if you have strtok_r.])
 
    # At some point, we should differentiate between architectures
    # like x86, which have long double versions, and alpha/powerpc/etc.,
@@ -286,7 +287,7 @@ else
    strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
    getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
    readlink getgid getpid getppid getuid geteuid umask getegid \
-   secure_getenv __secure_getenv mkostemp)
+   secure_getenv __secure_getenv mkostemp strtok_r)
 fi
 
 # Check strerror_r, cannot be above as versions with two and three arguments exist
index 58ec6cc..a103c55 100644 (file)
@@ -153,6 +153,16 @@ full_exe_path (void)
 }
 
 
+#ifndef HAVE_STRTOK_R
+static char*
+gfstrtok_r (char *str, const char *delim, 
+           char **saveptr __attribute__ ((unused)))
+{
+  return strtok (str, delim);
+}
+#define strtok_r gfstrtok_r
+#endif
+
 char *addr2line_path;
 
 /* Find addr2line and store the path.  */
@@ -161,30 +171,32 @@ void
 find_addr2line (void)
 {
 #ifdef HAVE_ACCESS
-#define A2L_LEN 10
+#define A2L_LEN 11
   char *path = secure_getenv ("PATH");
   if (!path)
     return;
+  char *tp = strdup (path);
+  if (!tp)
+    return;
   size_t n = strlen (path);
-  char ap[n + 1 + A2L_LEN];
-  size_t ai = 0;
-  for (size_t i = 0; i < n; i++)
+  char *ap = xmalloc (n + A2L_LEN);
+  char *saveptr;
+  for (char *str = tp;; str = NULL)
     {
-      if (path[i] != ':')
-       ap[ai++] = path[i];
-      else
+      char *token = strtok_r (str, ":", &saveptr);
+      if (!token)
+       break;
+      size_t toklen = strlen (token);
+      memcpy (ap, token, toklen);
+      memcpy (ap + toklen, "/addr2line", A2L_LEN);
+      if (access (ap, R_OK|X_OK) == 0)
        {
-         ap[ai++] = '/';
-         memcpy (ap + ai, "addr2line", A2L_LEN);
-         if (access (ap, R_OK|X_OK) == 0)
-           {
-             addr2line_path = strdup (ap);
-             return;
-           }
-         else
-           ai = 0;
+         addr2line_path = strdup (ap);
+         break;
        }
     }
+  free (tp);
+  free (ap);
 #endif
 }
 
index 58f83f5..29d9297 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-10-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR libgomp/61200
index 44e79a0..2c84de1 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 02afa89..0cac303 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-24  Richard Henderson  <rth@redhat.com>
 
        * config/aarch64/sjlj.S: New file.
index aeef0af..5463094 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 961745f..0204306 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 45db6e1..8bb04bc 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 9d7969b..62f7cda 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-28  Ulrich Weigand  <uweigand@de.ibm.com>
 
        PR libobjc/61920
index 3c50d51..2722ed3 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 840bca8..23bcabe 100644 (file)
@@ -1,3 +1,31 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-16  Yury Gribov  <y.gribov@samsung.com>
+
+       Backport from mainline
+       2014-05-14  Yury Gribov  <y.gribov@samsung.com>
+
+       PR sanitizer/61100
+
+       * Makefile.am (nodist_saninclude_HEADERS): Install
+       public headers.
+       * Makefile.in: Regenerate.
+
+2014-10-14  David S. Miller  <davem@davemloft.net>
+
+       * sanitizer_common/sanitizer_platform_limits_linux.cc (time_t):
+       Define at __kernel_time_t, as needed for sparc.
+       (struct __old_kernel_stat): Don't check if __sparc__ is defined.
+       * libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+       (__sanitizer): Define struct___old_kernel_stat_sz,
+       struct_kernel_stat_sz, and struct_kernel_stat64_sz for sparc.
+       (__sanitizer_ipc_perm): Adjust for sparc targets.
+       (__sanitizer_shmid_ds): Likewsie.
+       (__sanitizer_sigaction): Likewsie.
+       (IOC_SIZE): Likewsie.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index b0dc582..6b0c571 100644 (file)
@@ -1,7 +1,13 @@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 
+sanincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include/sanitizer
+
+nodist_saninclude_HEADERS =
+
 if SANITIZER_SUPPORTED
 SUBDIRS = sanitizer_common
+nodist_saninclude_HEADERS += \
+  include/sanitizer/common_interface_defs.h
 if !USING_MAC_INTERPOSE
 SUBDIRS += interception
 endif
@@ -9,6 +15,9 @@ if LIBBACKTRACE_SUPPORTED
 SUBDIRS += libbacktrace
 endif
 SUBDIRS += lsan asan ubsan
+nodist_saninclude_HEADERS += \
+  include/sanitizer/lsan_interface.h \
+  include/sanitizer/asan_interface.h
 if TSAN_SUPPORTED
 SUBDIRS += tsan
 endif
index 60cbe2e..0b89245 100644 (file)
@@ -35,9 +35,12 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-@SANITIZER_SUPPORTED_TRUE@@USING_MAC_INTERPOSE_FALSE@am__append_1 = interception
-@LIBBACKTRACE_SUPPORTED_TRUE@@SANITIZER_SUPPORTED_TRUE@am__append_2 = libbacktrace
-@SANITIZER_SUPPORTED_TRUE@@TSAN_SUPPORTED_TRUE@am__append_3 = tsan
+@SANITIZER_SUPPORTED_TRUE@am__append_1 = include/sanitizer/common_interface_defs.h \
+@SANITIZER_SUPPORTED_TRUE@     include/sanitizer/lsan_interface.h \
+@SANITIZER_SUPPORTED_TRUE@     include/sanitizer/asan_interface.h
+@SANITIZER_SUPPORTED_TRUE@@USING_MAC_INTERPOSE_FALSE@am__append_2 = interception
+@LIBBACKTRACE_SUPPORTED_TRUE@@SANITIZER_SUPPORTED_TRUE@am__append_3 = libbacktrace
+@SANITIZER_SUPPORTED_TRUE@@TSAN_SUPPORTED_TRUE@am__append_4 = tsan
 subdir = .
 DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
        $(top_srcdir)/configure $(am__configure_deps) \
@@ -98,8 +101,9 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
-HEADERS = $(nodist_toolexeclib_HEADERS)
+am__installdirs = "$(DESTDIR)$(sanincludedir)" \
+       "$(DESTDIR)$(toolexeclibdir)"
+HEADERS = $(nodist_saninclude_HEADERS) $(nodist_toolexeclib_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -250,9 +254,11 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
-@SANITIZER_SUPPORTED_TRUE@SUBDIRS = sanitizer_common $(am__append_1) \
-@SANITIZER_SUPPORTED_TRUE@     $(am__append_2) lsan asan ubsan \
-@SANITIZER_SUPPORTED_TRUE@     $(am__append_3)
+sanincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include/sanitizer
+nodist_saninclude_HEADERS = $(am__append_1)
+@SANITIZER_SUPPORTED_TRUE@SUBDIRS = sanitizer_common $(am__append_2) \
+@SANITIZER_SUPPORTED_TRUE@     $(am__append_3) lsan asan ubsan \
+@SANITIZER_SUPPORTED_TRUE@     $(am__append_4)
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
@@ -378,6 +384,26 @@ distclean-multi:
        $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
 maintainer-clean-multi:
        $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+install-nodist_sanincludeHEADERS: $(nodist_saninclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(sanincludedir)" || $(MKDIR_P) "$(DESTDIR)$(sanincludedir)"
+       @list='$(nodist_saninclude_HEADERS)'; test -n "$(sanincludedir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sanincludedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(sanincludedir)" || exit $$?; \
+       done
+
+uninstall-nodist_sanincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nodist_saninclude_HEADERS)'; test -n "$(sanincludedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       test -n "$$files" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(sanincludedir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(sanincludedir)" && rm -f $$files
 install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
        @$(NORMAL_INSTALL)
        test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@@ -538,7 +564,7 @@ check: check-recursive
 all-am: Makefile all-multi $(HEADERS) config.h
 installdirs: installdirs-recursive
 installdirs-am:
-       for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+       for dir in "$(DESTDIR)$(sanincludedir)" "$(DESTDIR)$(toolexeclibdir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-recursive
@@ -588,7 +614,7 @@ info: info-recursive
 
 info-am:
 
-install-data-am:
+install-data-am: install-nodist_sanincludeHEADERS
 
 install-dvi: install-dvi-recursive
 
@@ -634,7 +660,8 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-nodist_toolexeclibHEADERS
+uninstall-am: uninstall-nodist_sanincludeHEADERS \
+       uninstall-nodist_toolexeclibHEADERS
 
 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all all-multi \
        clean-multi ctags-recursive distclean-multi install-am \
@@ -649,13 +676,14 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS
        info-am install install-am install-data install-data-am \
        install-dvi install-dvi-am install-exec install-exec-am \
        install-html install-html-am install-info install-info-am \
-       install-man install-multi install-nodist_toolexeclibHEADERS \
-       install-pdf install-pdf-am install-ps install-ps-am \
-       install-strip installcheck installcheck-am installdirs \
-       installdirs-am maintainer-clean maintainer-clean-generic \
-       maintainer-clean-multi mostlyclean mostlyclean-generic \
-       mostlyclean-libtool mostlyclean-multi pdf pdf-am ps ps-am tags \
-       tags-recursive uninstall uninstall-am \
+       install-man install-multi install-nodist_sanincludeHEADERS \
+       install-nodist_toolexeclibHEADERS install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic maintainer-clean-multi mostlyclean \
+       mostlyclean-generic mostlyclean-libtool mostlyclean-multi pdf \
+       pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+       uninstall-nodist_sanincludeHEADERS \
        uninstall-nodist_toolexeclibHEADERS
 
 
index bc37df0..ac56f33 100644 (file)
@@ -36,6 +36,7 @@
 #define uid_t __kernel_uid_t
 #define gid_t __kernel_gid_t
 #define off_t __kernel_off_t
+#define time_t __kernel_time_t
 // This header seems to contain the definitions of _kernel_ stat* structs.
 #include <asm/stat.h>
 #undef ino_t
@@ -62,7 +63,7 @@ namespace __sanitizer {
   unsigned struct_statfs64_sz = sizeof(struct statfs64);
 }  // namespace __sanitizer
 
-#if !defined(__powerpc64__) && !defined(__x86_64__)
+#if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__sparc__)
 COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
 #endif
 
index be6e6cf..aec9504 100644 (file)
@@ -67,6 +67,14 @@ namespace __sanitizer {
   const unsigned struct___old_kernel_stat_sz = 0;
   const unsigned struct_kernel_stat_sz = 144;
   const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__sparc__) && defined(__arch64__)
+  const unsigned struct___old_kernel_stat_sz = 0;
+  const unsigned struct_kernel_stat_sz = 104;
+  const unsigned struct_kernel_stat64_sz = 144;
+#elif defined(__sparc__) && !defined(__arch64__)
+  const unsigned struct___old_kernel_stat_sz = 0;
+  const unsigned struct_kernel_stat_sz = 64;
+  const unsigned struct_kernel_stat64_sz = 104;
 #endif
   struct __sanitizer_perf_event_attr {
     unsigned type;
@@ -145,6 +153,18 @@ namespace __sanitizer {
     unsigned __seq;
     u64 __unused1;
     u64 __unused2;
+#elif defined(__sparc__)
+# if defined(__arch64__)
+    unsigned mode;
+    unsigned short __pad1;
+# else
+    unsigned short __pad1;
+    unsigned short mode;
+    unsigned short __pad2;
+# endif
+    unsigned short __seq;
+    unsigned long long __unused1;
+    unsigned long long __unused2;
 #else
     unsigned short mode;
     unsigned short __pad1;
@@ -162,6 +182,26 @@ namespace __sanitizer {
 
   struct __sanitizer_shmid_ds {
     __sanitizer_ipc_perm shm_perm;
+  #if defined(__sparc__)
+  # if !defined(__arch64__)
+    u32 __pad1;
+  # endif
+    long shm_atime;
+  # if !defined(__arch64__)
+    u32 __pad2;
+  # endif
+    long shm_dtime;
+  # if !defined(__arch64__)
+    u32 __pad3;
+  # endif
+    long shm_ctime;
+    uptr shm_segsz;
+    int shm_cpid;
+    int shm_lpid;
+    unsigned long shm_nattch;
+    unsigned long __glibc_reserved1;
+    unsigned long __glibc_reserved2;
+  #else    
   #ifndef __powerpc__
     uptr shm_segsz;
   #elif !defined(__powerpc64__)
@@ -199,6 +239,7 @@ namespace __sanitizer {
     uptr __unused4;
     uptr __unused5;
   #endif
+#endif
   };
   #endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
 
@@ -365,7 +406,11 @@ namespace __sanitizer {
       void (*sa_sigaction)(int sig, void *siginfo, void *uctx);
     };
     __sanitizer_sigset_t sa_mask;
+#if defined(__sparc__)
+    unsigned long sa_flags;
+#else
     int sa_flags;
+#endif
 #if SANITIZER_LINUX
     void (*sa_restorer)();
 #endif
@@ -511,7 +556,16 @@ namespace __sanitizer {
   };
 #endif
 
-#define IOC_SIZE(nr) (((nr) >> 16) & 0x3fff)
+#if defined(__sparc__)
+// In sparc the 14 bits SIZE field overlaps with the
+// least significant bit of DIR, so either IOC_READ or
+// IOC_WRITE shall be 1 in order to get a non-zero SIZE.
+# define IOC_SIZE(nr)                       \
+  ((((((nr) >> 29) & 0x7) & (4U|2U)) == 0)? \
+   0 : (((nr) >> 16) & 0x3fff))
+#else
+# define IOC_SIZE(nr) (((nr) >> 16) & 0x3fff)
+#endif
 
   extern unsigned struct_arpreq_sz;
   extern unsigned struct_ifreq_sz;
index a445537..dbf3753 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index af08f41..3eca6af 100644 (file)
@@ -1,3 +1,29 @@
+2014-10-30  David Edelsohn
+
+       Backported from mainline.
+       2014-10-30  David Edelsohn  <dje.gcc@gmail.com>
+
+       * configure.host (aix4.3+, 5+): Do not use -G in link command.
+
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
+2014-10-18  François Dumont  <fdumont@gcc.gnu.org>
+           Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/63500
+       * include/debug/functions.h (__foreign_iterator_aux2): Do not check for
+       foreign iterators if input iterators returns rvalue reference.
+       * testsuite/23_containers/vector/63500.cc: New.
+
+2014-10-14  Kai Tietz  <ktietz@redhat.com>
+
+       PR libstdc++/57440
+       * config/os/mingw32/os_defines.h (_GTHREAD_USE_MUTEX_INIT_FUNC):
+       Define to avoid leak.
+       * config/os/mingw32-w64/os_defines.h: Likewise.
+
 2014-10-08  Edward Smith-Rowland  <3dw4rd@verizon.net>
 
        Implement SD-6: SG10 Feature Test Recommendations
index c736f6c..fd5ad9e 100644 (file)
@@ -78,4 +78,7 @@
 #define _GLIBCXX_LLP64 1
 #endif
 
+// See libstdc++/59807
+#define _GTHREAD_USE_MUTEX_INIT_FUNC 1
+
 #endif
index a48c976..8e1fd51 100644 (file)
@@ -75,4 +75,7 @@
 #define _GLIBCXX_LLP64 1
 #endif
 
+// See libstdc++/59807
+#define _GTHREAD_USE_MUTEX_INIT_FUNC 1
+
 #endif
index c168454..a5c038c 100644 (file)
@@ -219,7 +219,6 @@ case "${host_os}" in
     os_include_dir="os/aix"
     atomicity_dir="os/aix"
     atomic_word_dir="os/aix"
-    OPT_LDFLAGS="-Wl,-G"
     ;;
   aix4.*)
     os_include_dir="os/generic"
index b48c36d..0e7f1b7 100644 (file)
@@ -34,7 +34,7 @@
                                          // _Iter_base
 #include <bits/cpp_type_traits.h>        // for __is_integer
 #include <bits/move.h>                    // for __addressof and addressof
-# include <bits/stl_function.h>                  // for less
+#include <bits/stl_function.h>           // for less
 #if __cplusplus >= 201103L
 # include <type_traits>                          // for is_lvalue_reference and __and_
 #endif
@@ -252,8 +252,16 @@ namespace __gnu_debug
                            const _InputIterator& __other,
                            const _InputIterator& __other_end)
     {
-      return __foreign_iterator_aux3(__it, __other, __other_end,
-                                    _Is_contiguous_sequence<_Sequence>());
+#if __cplusplus < 201103L
+      typedef _Is_contiguous_sequence<_Sequence> __tag;
+#else
+      using __lvalref = std::is_lvalue_reference<
+       typename std::iterator_traits<_InputIterator>::reference>;
+      using __contiguous = _Is_contiguous_sequence<_Sequence>;
+      using __tag = typename std::conditional<__lvalref::value, __contiguous,
+                                             std::__false_type>::type;
+#endif
+      return __foreign_iterator_aux3(__it, __other, __other_end, __tag());
     }
 
   /* Handle the case where we aren't really inserting a range after all */
diff --git a/libstdc++-v3/testsuite/23_containers/vector/63500.cc b/libstdc++-v3/testsuite/23_containers/vector/63500.cc
new file mode 100644 (file)
index 0000000..99fc9f4
--- /dev/null
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+#include <memory>
+#include <iterator>
+#include <debug/vector>
+
+class Foo
+{};
+
+void
+test01()
+{
+  __gnu_debug::vector<std::unique_ptr<Foo>> v;
+  __gnu_debug::vector<std::unique_ptr<Foo>> w;
+
+  v.insert(end(v),
+          make_move_iterator(begin(w)),
+          make_move_iterator(end(w)));
+}
index bf84e4b..56bab50 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index b58ed26..c316c97 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index b598869..c25c092 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index c7c8fa4..6b6068b 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-30  Release Manager
+
+       * GCC 4.9.2 released.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.