aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-03 15:16:44 +0000
committerclyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-03 15:16:44 +0000
commitd95516cb64f48cd8f2aa9b5a921cf26e32dc4e0f (patch)
tree7df4b82e2168b0c95b14d3bac03e18cc981085a2
parentef7a8e4e21b2c1c5b148bc52263520e6f63a40f3 (diff)
Merge branches/gcc-4_9-branch rev 216979
git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@217045 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog4
-rw-r--r--boehm-gc/ChangeLog4
-rw-r--r--config/ChangeLog4
-rw-r--r--contrib/ChangeLog4
-rw-r--r--contrib/reghunt/ChangeLog4
-rw-r--r--contrib/regression/ChangeLog4
-rw-r--r--fixincludes/ChangeLog4
-rw-r--r--gcc/BASE-VER2
-rw-r--r--gcc/ChangeLog332
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in4
-rw-r--r--gcc/ada/ChangeLog19
-rw-r--r--gcc/ada/gcc-interface/decl.c37
-rw-r--r--gcc/ada/uintp.adb16
-rw-r--r--gcc/ada/uintp.ads40
-rw-r--r--gcc/asan.c829
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/cfgcleanup.c2
-rw-r--r--gcc/collect2.c6
-rw-r--r--gcc/config/aarch64/aarch64-elf-raw.h11
-rw-r--r--gcc/config/aarch64/aarch64-linux.h11
-rw-r--r--gcc/config/aarch64/aarch64.c4
-rw-r--r--gcc/config/avr/avr-dimode.md7
-rw-r--r--gcc/config/avr/avr-fixed.md41
-rw-r--r--gcc/config/avr/avr-protos.h9
-rw-r--r--gcc/config/avr/avr.c109
-rw-r--r--gcc/config/avr/avr.md113
-rw-r--r--gcc/config/rs6000/altivec.md52
-rw-r--r--gcc/config/rs6000/rs6000-c.c8
-rw-r--r--gcc/config/rs6000/rs6000.c5
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/doc/cpp.texi4
-rw-r--r--gcc/doc/invoke.texi11
-rw-r--r--gcc/flag-types.h24
-rw-r--r--gcc/fortran/ChangeLog4
-rw-r--r--gcc/gcc.c9
-rw-r--r--gcc/gimple.c9
-rw-r--r--gcc/go/ChangeLog4
-rw-r--r--gcc/internal-fn.c28
-rw-r--r--gcc/internal-fn.def40
-rw-r--r--gcc/internal-fn.h16
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/lra-assigns.c29
-rw-r--r--gcc/lra-constraints.c9
-rw-r--r--gcc/lra-int.h12
-rw-r--r--gcc/lra.c6
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/objc/ChangeLog4
-rw-r--r--gcc/objcp/ChangeLog4
-rw-r--r--gcc/opts.c38
-rw-r--r--gcc/params.def8
-rw-r--r--gcc/params.h2
-rw-r--r--gcc/po/ChangeLog4
-rw-r--r--gcc/sanitizer.def32
-rw-r--r--gcc/stor-layout.c7
-rw-r--r--gcc/testsuite/ChangeLog206
-rw-r--r--gcc/testsuite/c-c++-common/asan/asan-interface-1.c14
-rw-r--r--gcc/testsuite/c-c++-common/asan/bitfield-1.c25
-rw-r--r--gcc/testsuite/c-c++-common/asan/bitfield-2.c25
-rw-r--r--gcc/testsuite/c-c++-common/asan/bitfield-3.c25
-rw-r--r--gcc/testsuite/c-c++-common/asan/bitfield-4.c25
-rw-r--r--gcc/testsuite/c-c++-common/asan/inc.c4
-rw-r--r--gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c10
-rw-r--r--gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c16
-rw-r--r--gcc/testsuite/c-c++-common/asan/misalign-1.c42
-rw-r--r--gcc/testsuite/c-c++-common/asan/misalign-2.c42
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c24
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c9
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c10
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c12
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c13
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c14
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c12
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c14
-rw-r--r--gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c13
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr61530.c17
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr62089.c38
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr62140-1.c10
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr62140-2.c11
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr63638.c20
-rw-r--r--gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c30
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c34
-rw-r--r--gcc/testsuite/g++.dg/ext/altivec-2.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/stmtexpr16.C10
-rw-r--r--gcc/testsuite/g++.dg/torture/pr63632.C5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr63302.c60
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr62031.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr63530.c30
-rw-r--r--gcc/testsuite/gcc.dg/vmx/3c-01a.c1
-rw-r--r--gcc/testsuite/gcc.dg/vmx/ops-long-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/vmx/ops.c1
-rw-r--r--gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c14
-rw-r--r--gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c37
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63448.c120
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63563.c17
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-20.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-6.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c21
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c14
-rw-r--r--gcc/testsuite/gnat.dg/entry_queues2.adb45
-rw-r--r--gcc/testsuite/gnat.dg/opt41.adb15
-rw-r--r--gcc/testsuite/gnat.dg/opt41_pkg.adb53
-rw-r--r--gcc/testsuite/gnat.dg/opt41_pkg.ads28
-rw-r--r--gcc/testsuite/lib/asan-dg.exp23
-rw-r--r--gcc/toplev.c13
-rw-r--r--gcc/tree-data-ref.c37
-rw-r--r--gcc/tree-data-ref.h5
-rw-r--r--gcc/tree-ssa-reassoc.c4
-rw-r--r--gcc/tree-vect-data-refs.c13
-rw-r--r--gcc/tree-vrp.c6
-rw-r--r--gcc/tree.c7
-rw-r--r--gnattools/ChangeLog4
-rw-r--r--include/ChangeLog4
-rw-r--r--intl/ChangeLog4
-rw-r--r--libada/ChangeLog4
-rw-r--r--libatomic/ChangeLog4
-rw-r--r--libbacktrace/ChangeLog4
-rw-r--r--libcilkrts/ChangeLog4
-rw-r--r--libcpp/ChangeLog15
-rw-r--r--libcpp/lex.c115
-rw-r--r--libcpp/po/ChangeLog4
-rw-r--r--libdecnumber/ChangeLog4
-rw-r--r--libffi/ChangeLog4
-rw-r--r--libgcc/ChangeLog16
-rw-r--r--libgcc/config/avr/lib1funcs.S18
-rw-r--r--libgcc/config/libbid/ChangeLog4
-rw-r--r--libgcc/config/pa/linux-unwind.h34
-rw-r--r--libgfortran/ChangeLog14
-rw-r--r--libgfortran/config.h.in3
-rwxr-xr-xlibgfortran/configure10
-rw-r--r--libgfortran/configure.ac3
-rw-r--r--libgfortran/runtime/main.c44
-rw-r--r--libgomp/ChangeLog4
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libitm/ChangeLog4
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/classpath/ChangeLog4
-rw-r--r--libjava/libltdl/ChangeLog4
-rw-r--r--libobjc/ChangeLog4
-rw-r--r--libquadmath/ChangeLog4
-rw-r--r--libsanitizer/ChangeLog28
-rw-r--r--libsanitizer/Makefile.am9
-rw-r--r--libsanitizer/Makefile.in64
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h56
-rw-r--r--libssp/ChangeLog4
-rw-r--r--libstdc++-v3/ChangeLog26
-rw-r--r--libstdc++-v3/config/os/mingw32-w64/os_defines.h3
-rw-r--r--libstdc++-v3/config/os/mingw32/os_defines.h3
-rw-r--r--libstdc++-v3/configure.host1
-rw-r--r--libstdc++-v3/include/debug/functions.h14
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/63500.cc39
-rw-r--r--libvtv/ChangeLog4
-rw-r--r--lto-plugin/ChangeLog4
-rw-r--r--maintainer-scripts/ChangeLog4
-rw-r--r--zlib/ChangeLog4
160 files changed, 3390 insertions, 601 deletions
diff --git a/ChangeLog b/ChangeLog
index b52689522d3..4a457e42f65 100644
--- 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
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 2dbc61fa93c..abf401c1ea9 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/config/ChangeLog b/config/ChangeLog
index cb6dcaafccb..e569d7aed4b 100644
--- a/config/ChangeLog
+++ b/config/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
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index c89d9d5c29d..6254a17c3e1 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -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.
diff --git a/contrib/reghunt/ChangeLog b/contrib/reghunt/ChangeLog
index ccb88eb1d9a..64956647e37 100644
--- a/contrib/reghunt/ChangeLog
+++ b/contrib/reghunt/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog
index de91385ff41..602272d7097 100644
--- a/contrib/regression/ChangeLog
+++ b/contrib/regression/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index cef5385deb9..f1bb068a71a 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc/BASE-VER b/gcc/BASE-VER
index dad10c76dbf..c01c413359f 100644
--- a/gcc/BASE-VER
+++ b/gcc/BASE-VER
@@ -1 +1 @@
-4.9.2
+4.9.3
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 032bc6a1c6d..aa76d2bdaf4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
@@ -1212,7 +1542,7 @@
* 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
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index ac2dda7fb1b..a6519861c41 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20141013
+20141031
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 146b16c5a33..7565c58967b 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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,
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c8c4d807b94..de30982006c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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().
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 52452ce7920..95bc778b4bd 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -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);
}
}
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb
index f418b56ce9e..226c1877fca 100644
--- a/gcc/ada/uintp.adb
+++ b/gcc/ada/uintp.adb
@@ -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 --
------------
diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads
index dcf85a07f37..d76d2852704 100644
--- a/gcc/ada/uintp.ads
+++ b/gcc/ada/uintp.ads
@@ -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)
diff --git a/gcc/asan.c b/gcc/asan.c
index 08cc2c022ee..f6c42a1d0b0 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -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;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 159cd9d2b2a..c1f2fc0dc24 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -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
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 6cf964c1c4a..deb70eb7251 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -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
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index de307da542c..53ea300288c 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -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;
}
}
diff --git a/gcc/collect2.c b/gcc/collect2.c
index f0ab6b8c8f1..2c587a03488 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -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
{
diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h
index b9d4e8db8f0..16ad5c89450 100644
--- a/gcc/config/aarch64/aarch64-elf-raw.h
+++ b/gcc/config/aarch64/aarch64-elf-raw.h
@@ -27,9 +27,18 @@
" 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 */
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 1731432a4d1..dce2f2da10d 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,7 +35,16 @@
%{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}"
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 7ed7faaabe5..f3f24720809 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -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;
diff --git a/gcc/config/avr/avr-dimode.md b/gcc/config/avr/avr-dimode.md
index 639810518c9..56cd304582a 100644
--- a/gcc/config/avr/avr-dimode.md
+++ b/gcc/config/avr/avr-dimode.md
@@ -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
@@ -145,6 +146,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 (const_operand (operands[2], GET_MODE (operands[2])))
@@ -201,6 +203,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 (const_operand (operands[2], GET_MODE (operands[2])))
@@ -249,6 +252,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 (const_operand (operands[2], GET_MODE (operands[2])))
@@ -338,6 +342,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 (s8_operand (operands[2], VOIDmode))
@@ -424,6 +429,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]);
emit_move_insn (gen_rtx_REG (QImode, 16), operands[2]);
emit_insn (gen_<code_stdname><mode>3_insn ());
@@ -457,6 +463,7 @@
(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());
diff --git a/gcc/config/avr/avr-fixed.md b/gcc/config/avr/avr-fixed.md
index 9c8489edd8e..6763f596e5f 100644
--- a/gcc/config/avr/avr-fixed.md
+++ b/gcc/config/avr/avr-fixed.md
@@ -231,7 +231,11 @@
(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)
@@ -246,7 +250,10 @@
(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)
@@ -274,7 +281,10 @@
(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"
@@ -302,7 +312,10 @@
(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"
@@ -330,7 +343,12 @@
(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"
@@ -356,7 +374,11 @@
(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"
@@ -385,7 +407,11 @@
(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"
@@ -435,6 +461,7 @@
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;
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index c5ce784294e..4a899a27cdf 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -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;
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index fa979df4660..4c65f5efaba 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -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 " "
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 2d90b7684d8..3f4181dabff 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1482,7 +1482,11 @@
(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)))
@@ -2210,7 +2214,13 @@
(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)))
@@ -2248,6 +2258,10 @@
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"
@@ -2287,7 +2301,23 @@
;; "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")))
@@ -2323,7 +2353,23 @@
;; "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")))
@@ -2366,7 +2412,22 @@
;; 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"))))
@@ -2394,7 +2455,12 @@
(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" "")
@@ -2402,7 +2468,12 @@
(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"
@@ -2474,7 +2545,10 @@
(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"
@@ -2697,6 +2771,10 @@
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"
@@ -2729,7 +2807,21 @@
[(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")))
@@ -6064,6 +6156,7 @@
emit_insn (gen_fmul_insn (operand0, operand1, operand2));
DONE;
}
+ avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
})
(define_insn "fmul_insn"
@@ -6107,6 +6200,7 @@
emit_insn (gen_fmuls_insn (operand0, operand1, operand2));
DONE;
}
+ avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
})
(define_insn "fmuls_insn"
@@ -6150,6 +6244,7 @@
emit_insn (gen_fmulsu_insn (operand0, operand1, operand2));
DONE;
}
+ avr_fix_inputs (operands, 1 << 2, regmask (QImode, 24));
})
(define_insn "fmulsu_insn"
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index a8cfcb739ea..682bdae4eab 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -2297,7 +2297,31 @@
"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))]
@@ -2305,7 +2329,31 @@
"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))]
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 016be9e10bd..5e8bfea1713 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -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
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index bad4a1b2217..e1a226c5ecd 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -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;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2cd0f1a2f77..d79d629bdf2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index e6f94308acf..7893235afba 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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. */
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index aaed739fb35..0a6e50caac9 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -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
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a152472f0d0..bea8be20aff 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -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
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index ec16faa18a3..1dd1b3ea575 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -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
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 18f360da9b5..648621cfb68 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 9c4c40c7118..c7ce64d8fc8 100644
--- 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)
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 2a278e41e9d..30d16530e39 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -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;
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 1af11e48607..cb51027f3f1 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 1062ea84705..d64e20da6fd 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -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
diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
index 31dc4c9cacd..2156e24ec83 100644
--- a/gcc/internal-fn.def
+++ b/gcc/internal-fn.def
@@ -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..")
diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h
index 9c3215f3d5e..af93e154ab1 100644
--- a/gcc/internal-fn.h
+++ b/gcc/internal-fn.h
@@ -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
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index b9185f1190b..8dba8fa8031 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index f7bb86b2160..ac5ffd48733 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -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;
}
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 3691ab8c6e9..874696865b3 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -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 ();
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index b2f5cf7d05e..72620874798 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -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);
diff --git a/gcc/lra.c b/gcc/lra.c
index c1b92d8eee4..69b08dc244a 100644
--- 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);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 6c6ea2bdd2b..8aed89086c4 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -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
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 2443c61978b..507e32b169b 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index cba09a4be04..307fcaa6c70 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc/opts.c b/gcc/opts.c
index bbd6b9c806e..fbdebd79b1e 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -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;
}
diff --git a/gcc/params.def b/gcc/params.def
index dd2e2cd1a99..c656eaff0cf 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -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 "
diff --git a/gcc/params.h b/gcc/params.h
index 0d6daa205c0..d488e32ebfe 100644
--- a/gcc/params.h
+++ b/gcc/params.h
@@ -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 */
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 399d6b5fa97..23a4a9cb2c1 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc/sanitizer.def b/gcc/sanitizer.def
index 015b1d85f5f..b1e6f0497d9 100644
--- a/gcc/sanitizer.def
+++ b/gcc/sanitizer.def
@@ -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)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 084d195cd48..9dc10d454fd 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0e7553e97fb..be16d9c81af 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..8cd80caaa38
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/asan-interface-1.c
@@ -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
index 00000000000..b3f300c6484
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/bitfield-1.c
@@ -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
index 00000000000..8ab0f8069f3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/bitfield-2.c
@@ -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
index 00000000000..c5907786f76
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/bitfield-3.c
@@ -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
index 00000000000..94de9a4376c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/bitfield-4.c
@@ -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" } */
diff --git a/gcc/testsuite/c-c++-common/asan/inc.c b/gcc/testsuite/c-c++-common/asan/inc.c
index b9c6734eae0..36cc3d8d817 100644
--- a/gcc/testsuite/c-c++-common/asan/inc.c
+++ b/gcc/testsuite/c-c++-common/asan/inc.c
@@ -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
index 00000000000..32e32a600cb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c
@@ -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
index 00000000000..1b361e6270d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c
@@ -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
index 00000000000..0c5b6e0c754
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/misalign-1.c
@@ -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
index 00000000000..7fbe299cc54
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/misalign-2.c
@@ -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)" } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
index fa52e0ca85d..028f8d7152d 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c
index 28525e0ff0d..a58411c3af3 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c
index 420a2630902..5193ae06f46 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c
index b2e72841b35..c3632aa3d2d 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c
index ead3f582330..077ea34d028 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c
index e4691bc4734..6d87104aac2 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c
index bf40a037679..5baa10dcd7d 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c
@@ -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" } } */
diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c
index 38ea7a21d1e..2a4c0812f39 100644
--- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c
@@ -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
index 00000000000..9449de57884
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c
@@ -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
index 00000000000..e306a71be93
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr61530.c
@@ -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
index 00000000000..9b92e9bbf17
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr62089.c
@@ -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
index 00000000000..f0b026de2a3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr62140-1.c
@@ -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
index 00000000000..0bb2563abac
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr62140-2.c
@@ -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
index 00000000000..a8bafc5aad7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr63638.c
@@ -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
index 00000000000..4833dc77891
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c
@@ -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
index 00000000000..deec5c411ba
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c
@@ -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'" } */
diff --git a/gcc/testsuite/g++.dg/ext/altivec-2.C b/gcc/testsuite/g++.dg/ext/altivec-2.C
index eb8a92942bc..e14e6f800f7 100644
--- a/gcc/testsuite/g++.dg/ext/altivec-2.C
+++ b/gcc/testsuite/g++.dg/ext/altivec-2.C
@@ -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
index 00000000000..ddce40c050d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr16.C
@@ -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
index 00000000000..48cd8692412
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr63632.C
@@ -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
index 00000000000..99670241bb3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr63302.c
@@ -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
index 00000000000..f0dcef44b1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr62031.c
@@ -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
index 00000000000..b583b9b3550
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr63530.c
@@ -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];
+}
diff --git a/gcc/testsuite/gcc.dg/vmx/3c-01a.c b/gcc/testsuite/gcc.dg/vmx/3c-01a.c
index 2499ca66598..56f3c8708b8 100644
--- a/gcc/testsuite/gcc.dg/vmx/3c-01a.c
+++ b/gcc/testsuite/gcc.dg/vmx/3c-01a.c
@@ -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;
diff --git a/gcc/testsuite/gcc.dg/vmx/ops-long-1.c b/gcc/testsuite/gcc.dg/vmx/ops-long-1.c
index 5471706790a..bceb4fc8dae 100644
--- a/gcc/testsuite/gcc.dg/vmx/ops-long-1.c
+++ b/gcc/testsuite/gcc.dg/vmx/ops-long-1.c
@@ -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
diff --git a/gcc/testsuite/gcc.dg/vmx/ops.c b/gcc/testsuite/gcc.dg/vmx/ops.c
index b39ad1d6569..21801ca237a 100644
--- a/gcc/testsuite/gcc.dg/vmx/ops.c
+++ b/gcc/testsuite/gcc.dg/vmx/ops.c
@@ -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
index 00000000000..523941d4792
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c
@@ -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
index 00000000000..a523424c325
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c
@@ -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
index 00000000000..3f8262e87e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63448.c
@@ -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
index 00000000000..ce3e4658e75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63563.c
@@ -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;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-20.c b/gcc/testsuite/gcc.target/powerpc/altivec-20.c
index b2c29a979d9..1af8ed7dc54 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-20.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-20.c
@@ -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>
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-6.c b/gcc/testsuite/gcc.target/powerpc/altivec-6.c
index 51d411688fb..29856fd0794 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-6.c
@@ -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>
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c b/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c
index 3689f97490c..b1ed8b86491 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c
@@ -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
index 00000000000..71dd0a24ae1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
@@ -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);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c
index 836b3851cad..934cdad250c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c
@@ -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
index 00000000000..bf889aaa22b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c
@@ -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
index 00000000000..a1445cebdcb
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/entry_queues2.adb
@@ -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
index 00000000000..21660431c50
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt41.adb
@@ -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
index 00000000000..c43c1bfdf04
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt41_pkg.adb
@@ -0,0 +1,53 @@
+with Ada.Streams; use Ada.Streams;
+
+package body Opt41_Pkg is
+
+ type Wstream is new Root_Stream_Type with record
+ S : Unbounded_String;
+ end record;
+
+ procedure Read (Stream : in out Wstream;
+ Item : out Stream_Element_Array;
+ Last : out Stream_Element_Offset) is null;
+
+ procedure Write (Stream : in out Wstream; Item : Stream_Element_Array) is
+ begin
+ for J in Item'Range loop
+ Append (Stream.S, Character'Val (Item (J)));
+ end loop;
+ end Write;
+
+ function Rec_Write (R : Rec) return Unbounded_String is
+ S : aliased Wstream;
+ begin
+ Rec'Output (S'Access, R);
+ return S.S;
+ end Rec_Write;
+
+ type Rstream is new Root_Stream_Type with record
+ S : String_Access;
+ Idx : Integer := 1;
+ end record;
+
+ procedure Write (Stream : in out Rstream; Item : Stream_Element_Array) is null;
+
+ procedure Read (Stream : in out Rstream;
+ Item : out Stream_Element_Array;
+ Last : out Stream_Element_Offset) is
+ begin
+ Last := Stream_Element_Offset'Min
+ (Item'Last, Item'First + Stream_Element_Offset (Stream.S'Last - Stream.Idx));
+ for I in Item'First .. Last loop
+ Item (I) := Stream_Element (Character'Pos (Stream.S (Stream.Idx)));
+ Stream.Idx := Stream.Idx + 1;
+ end loop;
+ end Read;
+
+ function Rec_Read (Str : String_Access) return Rec is
+ S : aliased Rstream;
+ begin
+ S.S := Str;
+ return Rec'Input (S'Access);
+ end Rec_Read;
+
+end Opt41_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt41_pkg.ads b/gcc/testsuite/gnat.dg/opt41_pkg.ads
new file mode 100644
index 00000000000..e73bc931927
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt41_pkg.ads
@@ -0,0 +1,28 @@
+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+
+package Opt41_Pkg is
+
+ type Enum is (One, Two, Three, Four, Five, Six);
+
+ type Rec (D : Enum) is record
+ case D is
+ when One =>
+ I : Integer;
+ when Two | Five | Six =>
+ S : Unbounded_String;
+ case D is
+ when Two => B : Boolean;
+ when others => null;
+ end case;
+ when others =>
+ null;
+ end case;
+ end record;
+
+ type Rec_Ptr is access all Rec;
+
+ function Rec_Write (R : Rec) return Unbounded_String;
+
+ function Rec_Read (Str : String_Access) return Rec;
+
+end Opt41_Pkg;
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 9ba39db15e4..7a12160bb19 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -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 != "" } {
diff --git a/gcc/toplev.c b/gcc/toplev.c
index d646faf6836..588fa2bd4fa 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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;
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 01d0a7a79d8..a15494a89bf 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -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. */
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index 9d819e4a0ff..f4f6832af11 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -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 ()
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index fce2a6e20f6..b5b1d908707 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -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);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index a1096fdfcc1..49303b1b58a 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -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 ())
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 2c80135f96b..57a58b152db 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -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;
diff --git a/gcc/tree.c b/gcc/tree.c
index 069abb77590..b9f3d60ea09 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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
diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog
index ca1c728af72..4074b08fab2 100644
--- a/gnattools/ChangeLog
+++ b/gnattools/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/include/ChangeLog b/include/ChangeLog
index cc3b59cbe22..9ff64a0ed8a 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/intl/ChangeLog b/intl/ChangeLog
index 4a30e7b0fe4..c1a4f253faa 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libada/ChangeLog b/libada/ChangeLog
index 38ba63c2db6..27e72582659 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -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.
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index f78862ff968..6be97eaa556 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 8acd47243f8..f73ab03b73d 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index 5f369830d56..2b7bc436797 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index b85cb67aecb..05dbcc6bedd 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -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>
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 6d69b591fec..ec07c6e653f 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -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
diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog
index b9f60389e86..fc2c8612047 100644
--- a/libcpp/po/ChangeLog
+++ b/libcpp/po/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
index c3215a6e84b..9942f9b50eb 100644
--- a/libdecnumber/ChangeLog
+++ b/libdecnumber/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 91908bbc661..4d336469e77 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -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
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index ec295541630..df187b199cf 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -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
diff --git a/libgcc/config/avr/lib1funcs.S b/libgcc/config/avr/lib1funcs.S
index 080e250cd61..5ad1e93f13d 100644
--- a/libgcc/config/avr/lib1funcs.S
+++ b/libgcc/config/avr/lib1funcs.S
@@ -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
diff --git a/libgcc/config/libbid/ChangeLog b/libgcc/config/libbid/ChangeLog
index c3f83862abd..68d46d29f13 100644
--- a/libgcc/config/libbid/ChangeLog
+++ b/libgcc/config/libbid/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libgcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h
index 485f2d98e76..4a3cfffd19f 100644
--- a/libgcc/config/pa/linux-unwind.h
+++ b/libgcc/config/pa/linux-unwind.h
@@ -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;
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 1fa1f788e33..6b995493057 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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
diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in
index 8298f8d7812..5c9de02ac1a 100644
--- a/libgfortran/config.h.in
+++ b/libgfortran/config.h.in
@@ -732,6 +732,9 @@
/* 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
diff --git a/libgfortran/configure b/libgfortran/configure
index d3ced74e950..830337c4229 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -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
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 24dbf2b4fa5..922239f4153 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -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
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c
index 58ec6cc4961..a103c554be5 100644
--- a/libgfortran/runtime/main.c
+++ b/libgfortran/runtime/main.c
@@ -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
}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 58f83f52b50..29d929745b9 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -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
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 44e79a0f933..2c84de15ded 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 02afa89b504..0cac303757b 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -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.
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index aeef0afe58f..54630947404 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index 961745fe20e..020430631e0 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog
index 45db6e1246d..8bb04bc65c2 100644
--- a/libjava/libltdl/ChangeLog
+++ b/libjava/libltdl/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 9d7969bc450..62f7cdadd3e 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -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
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index 3c50d5191d4..2722ed3fc34 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 840bca87890..23bcabede45 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -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.
diff --git a/libsanitizer/Makefile.am b/libsanitizer/Makefile.am
index b0dc582ccfb..6b0c571c46e 100644
--- a/libsanitizer/Makefile.am
+++ b/libsanitizer/Makefile.am
@@ -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
diff --git a/libsanitizer/Makefile.in b/libsanitizer/Makefile.in
index 60cbe2ee554..0b8924554dc 100644
--- a/libsanitizer/Makefile.in
+++ b/libsanitizer/Makefile.in
@@ -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
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
index bc37df0df49..ac56f33c843 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
@@ -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
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index be6e6cf1c3f..aec950454b3 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -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;
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index a4455377adf..dbf37536da6 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index af08f41a450..3eca6af45d2 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/config/os/mingw32-w64/os_defines.h b/libstdc++-v3/config/os/mingw32-w64/os_defines.h
index c736f6c04bf..fd5ad9ed384 100644
--- a/libstdc++-v3/config/os/mingw32-w64/os_defines.h
+++ b/libstdc++-v3/config/os/mingw32-w64/os_defines.h
@@ -78,4 +78,7 @@
#define _GLIBCXX_LLP64 1
#endif
+// See libstdc++/59807
+#define _GTHREAD_USE_MUTEX_INIT_FUNC 1
+
#endif
diff --git a/libstdc++-v3/config/os/mingw32/os_defines.h b/libstdc++-v3/config/os/mingw32/os_defines.h
index a48c976a0f3..8e1fd51877f 100644
--- a/libstdc++-v3/config/os/mingw32/os_defines.h
+++ b/libstdc++-v3/config/os/mingw32/os_defines.h
@@ -75,4 +75,7 @@
#define _GLIBCXX_LLP64 1
#endif
+// See libstdc++/59807
+#define _GTHREAD_USE_MUTEX_INIT_FUNC 1
+
#endif
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index c1684543ca9..a5c038c6521 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -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"
diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h
index b48c36d4a1e..0e7f1b7855c 100644
--- a/libstdc++-v3/include/debug/functions.h
+++ b/libstdc++-v3/include/debug/functions.h
@@ -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
index 00000000000..99fc9f4007f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/63500.cc
@@ -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)));
+}
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index bf84e4baae9..56bab50a1e9 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index b58ed261466..c316c977b25 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog
index b598869d50b..c25c092a66d 100644
--- a/maintainer-scripts/ChangeLog
+++ b/maintainer-scripts/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/zlib/ChangeLog b/zlib/ChangeLog
index c7c8fa46e9a..6b6068be7d9 100644
--- a/zlib/ChangeLog
+++ b/zlib/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.