diff options
author | Peter Bergner <bergner@vnet.ibm.com> | 2016-08-03 17:42:15 +0000 |
---|---|---|
committer | Peter Bergner <bergner@vnet.ibm.com> | 2016-08-03 17:42:15 +0000 |
commit | 3055bfa7109d64b711c72e2091646fa3caa999f2 (patch) | |
tree | e217aa2f523fcc0b9b1b82aa54e06cb20c33bb9b | |
parent | 6dc26956185ac7fa84bf72036c4f9fc258078241 (diff) | |
parent | 9292dc98baf244da9c72b5c1c74ab87d961c381d (diff) |
Merge up to 239078.ibm/gcc-4_9-branch
Upstream FSF 4.9 release branch is now closed.
* REVISION: Update subversion id.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_9-branch@239087 138bc75d-0d04-0410-961f-82ee72b054a4
177 files changed, 3230 insertions, 298 deletions
diff --git a/ChangeLog b/ChangeLog index 773ee2922cd..ab4e8d04218 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-12-04 Andreas Tobler <andreast@gcc.gnu.org> Backport from mainline diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index b94b1c20aa9..aeb669f8e24 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/config/ChangeLog b/config/ChangeLog index b479e849c54..0d09d1f6bc6 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index d220728e8ce..37003c7cbe3 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-09-11 Markus Trippelsdorf <markus@trippelsdorf.de> * download_prerequisites: Make sure that script is run from diff --git a/contrib/reghunt/ChangeLog b/contrib/reghunt/ChangeLog index 7d9ae3fc7b9..2138388d775 100644 --- a/contrib/reghunt/ChangeLog +++ b/contrib/reghunt/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog index 8a4ddbcc0da..7ce3a942a76 100644 --- a/contrib/regression/ChangeLog +++ b/contrib/regression/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index f9da55d4cfd..1b9b59b700c 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2016-02-01 John David Anglin <danglin@gcc.gnu.org> PR target/68741 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6835cc902ef..a71eb925363 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,350 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-08-01 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2016-07-29 Marek Polacek <polacek@redhat.com> + + PR c/7652 + * config/rs6000/rs6000.c (altivec_expand_ld_builtin): Add break. + (altivec_expand_st_builtin): Likewise. + * config/i386/i386.c (ix86_expand_args_builtin): Likewise. + (ix86_expand_round_builtin): Likewise. + +2016-07-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71874 + * builtins.c (fold_builtin_memory_op): Use + get_addr_base_and_unit_offset instead of get_ref_base_and_extent. + +2016-07-19 Martin Jambor <mjambor@suse.cz> + + PR fortran/71688 + * trans-decl.c (gfc_generate_function_code): Use cgraph_get_create_node + rather than cgraph_create_node to get a call graph node. + +2016-07-19 Martin Liska <mliska@suse.cz> + + Backported from mainline + 2016-03-15 Richard Henderson <rth@redhat.com> + + * line-map.c (new_linemap): Make alloc_size a size_t. + +2016-07-19 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-07-11 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71758 + * omp-low.c (expand_omp_target): Gimplify device. + +2016-07-18 Martin Liska <mliska@suse.cz> + + Backported from mainline + 2016-07-12 Martin Liska <mliska@suse.cz> + + PR rtl-optimization/71634 + * ira-build.c (mark_loops_for_removal): Properly iterate + loops. + +2016-07-08 Martin Liska <mliska@suse.cz> + + Backported from mainline + 2016-07-08 Martin Liska <mliska@suse.cz> + + PR middle-end/71606 + * fold-const.c (fold_convertible_p): As COMPLEX_TYPE + folding produces SAVE_EXPRs, thus return false for the type. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-06-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71626 + * config/i386/i386.c (ix86_expand_vector_move): For SUBREG of + a constant, force its SUBREG_REG into memory or register instead + of whole op1. + + 2016-06-21 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/71588 + * tree-ssa-strlen.c (valid_builtin_call): New function. + (adjust_last_stmt, strlen_optimize_stmt): Use it. + + 2016-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71494 + * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO + without LABEL_DECL, set *handled_ops_p to false instead of true. + + 2016-03-29 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/70429 + * combine.c (simplify_shift_const_1): For ASHIFTRT don't optimize + (cst1 >> count) >> cst2 into (cst1 >> cst2) >> count if + mode != result_mode. + + 2016-03-15 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/70222 + * combine.c (simplify_shift_const_1): For A >> B >> C LSHIFTRT + optimization if mode is different from result_mode, queue up masking + of the result in outer_op. Formatting fix. + + 2016-03-11 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/70169 + * tree-ssa-loop.c (gen_lsm_tmp_name): Handle FUNCTION_DECL and + LABEL_DECL like VAR_DECL. Emit nothing instead of gcc_unreachable + for unknown codes. + + 2016-03-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/70152 + * tree-sra.c (replace_removed_params_ssa_names): Copy over + SSA_NAME_OCCURS_IN_ABNORMAL_PHI from old_name to new_name. + + 2016-02-26 Jakub Jelinek <jakub@redhat.com> + Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/69891 + * dse.c (scan_insn): If we can't figure out memset arguments + or they are non-constant, call clear_rhs_from_active_local_stores. + + 2016-02-16 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/69802 + * tree-ssa-reassoc.c (update_range_test): If op is + SSA_NAME_IS_DEFAULT_DEF, give up unless tem is a positive + op == 1 test of precision 1 integral op, otherwise handle + that case as op itself. Fix up formatting. + (optimize_range_tests_to_bit_test, optimize_range_tests): Fix + up formatting. + + 2014-12-12 Richard Biener <rguenther@suse.de> + + PR middle-end/64280 + * tree-cfg.c (replace_uses_by): Guard assert properly. + +2016-07-07 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-04-04 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/70484 + * rtl.h (canon_output_dependence): Declare. + * alias.c (canon_output_dependence): New function. + * dse.c (record_store): Use canon_output_dependence rather + than canon_true_dependence. + + 2016-06-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/71452 + * tree-ssa.c (non_rewritable_lvalue_p): Make sure that the + type used for the SSA rewrite has enough precision to cover + the dynamic type of the location. + + 2016-05-06 Richard Biener <rguenther@suse.de> + + PR middle-end/70931 + * dwarf2out.c (native_encode_initializer): Skip zero-sized fields. + + 2016-03-01 Richard Biener <rguenther@suse.de> + + PR middle-end/70022 + * fold-const.c (fold_indirect_ref_1): Fix range checking for + vector BIT_FIELD_REF extract. + +2016-06-30 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71693 + * fold-const.c (fold_binary_loc) <case RROTATE_EXPR>: Cast + TREE_OPERAND (arg0, 0) and TREE_OPERAND (arg0, 1) to type + first when permuting bitwise operation with rotate. Cast + TREE_OPERAND (arg0, 0) to type when cancelling two rotations. + +2016-06-21 Georg-Johann Lay <avr@gjlay.de> + + Backport from 2016-06-21 trunk r237639. + + PR target/30417 + * config/avr/driver-avr.c (avr_device_to_data_start): + Wrap -Tdata into %{!Tdata:...}. + +2016-06-21 Georg-Johann Lay <avr@gjlay.de> + + PR target/71103 + * config/avr/avr.md (movqi): Only handle loading subreg:qi of + constant addresses if can_create_pseudo_p. + +2016-06-20 Georg-Johann Lay <avr@gjlay.de> + Pitchumani Sivanupandi <pitchumani.s@atmel.com> + + Backport from 2016-06-20 trunk r237589, r236558. + + PR target/71103 + * config/avr/avr.md (movqi): Handle loading subreg:qi (const, + symbol_ref,label_ref). + +2016-06-16 Jakub Jelinek <jakub@redhat.com> + + PR target/71554 + * config/i386/i386.md (setcc + movzbl peephole2): Use reg_set_p. + (setcc + and peephole2): Likewise. + + Backported from mainline + 2015-04-29 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (setcc+movzbl peephole2): Check also clobbered + reg. + (setcc+andl peephole2): Ditto. + +2016-06-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/71505 + * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Make + assert match comment. + +2016-06-07 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + 2016-06-07 Peter Bergner <bergner@vnet.ibm.com> + + * doc/invoke.texi (RS/6000 and PowerPC Options): Document -mhtm and + -mno-htm. + +2016-06-07 Uros Bizjak <ubizjak@gmail.com> + + PR target/71389 + * config/i386/i386.c (ix86_avx256_split_vector_move_misalign): + Copy op1 RTX to avoid invalid sharing. + (ix86_expand_vector_move_misalign): Ditto. + +2016-06-05 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2016-06-01 Uros Bizjak <ubizjak@gmail.com> + Jocelyn Mayer <l_indien@magic.fr> + + PR target/67310 + * config/i386/driver-i386.c (host_detect_local_cpu): Correctly + detect processor family for signature_CENTAUR_ebx. + <case PROCESSOR_I486>: Pass c3, winchip2 or winchip-c6 for + signature_CENTAUR_ebx. + <case PROCESSOR _PENTIUMPRO>: Pass c3-2 for signature_CENTAUR_ebx. + <default>: Pass x86-64 for has_longmode. + +2016-05-22 Iain Sandoe <iain@codesourcery.com> + Dominique d'Humieres <dominiq@lps.ens.fr> + + Backport from mainline + 2015-12-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR target/67973 + * configure.ac (gcc_cv_as_stabs_directive): New test. + * configure: Regenerate. + * config.in: Regenerate. + * config/darwin.h (DBX_DEBUGGING_INFO): Wrap in + HAVE_AS_STABS_DIRECTIVE. + (PREFERRED_DEBUGGING_TYPE): Likewise. + * config/i386/darwin.h (PREFERRED_DEBUGGING_TYPE): Only include + DBX_DEBUG if HAVE_AS_STABS_DIRECTIVE. + + * doc/sourcebuild.texi (Effective-Target Keywords, Environment + attributes): Document stabs. + +2016-05-20 Eric Botcazou <ebotcazou@adacore.com> + + * config/arm/arm.c (arm_expand_prologue): Set the stack usage to 0 + for naked functions. + (thumb1_expand_prologue): Likewise. + +2016-05-20 Uros Bizjak <ubizjak@gmail.com> + + * sched-deps.c (sched_analyze_2) <case TRAP_IF>: Also + force pending loads from memory. + +2016-05-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2016-05-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/70809 + * config/aarch64/aarch64-simd.md (aarch64_vmls<mode>): Delete. + +2016-05-19 Martin Jambor <mjambor@suse.cz> + + PR ipa/70646 + * ipa-prop.c (determine_locally_known_aggregate_parts): Bail out early + if parameter PARAM_IPA_MAX_AGG_ITEMS is zero. + +2016-05-19 Martin Jambor <mjambor@suse.cz> + + PR ipa/70646 + * ipa-inline.h (condition): New field size. + * ipa-inline-analysis.c (add_condition): New parameter SIZE, use it + for comaprison and store it into the new condition. + (evaluate_conditions_for_known_args): Use condition size to check + access sizes for all but CHANGED conditions. + (unmodified_parm_1): New parameter size_p, store access size into it. + (unmodified_parm): Likewise. + (unmodified_parm_or_parm_agg_item): Likewise. + (eliminated_by_inlining_prob): Pass NULL to unmodified_parm as size_p. + (set_cond_stmt_execution_predicate): Extract access sizes and store + them to conditions. + (set_switch_stmt_execution_predicate): Likewise. + (will_be_nonconstant_expr_predicate): Likewise. + (will_be_nonconstant_predicate): Likewise. + (inline_read_section): Stream condition size. + (inline_write_summary): Likewise. + * lto-streamer.h (LTO_minor_version): Bump. + * ipa-prop.c (ipa_load_from_parm_agg): Added size_p parameter, pass it + to ipa_load_from_parm_agg_1. + * ipa-prop.h (ipa_load_from_parm_agg): Update declaration. + +2016-05-18 Uros Bizjak <ubizjak@gmail.com> + + PR target/71145 + * config/alpha/alpha.md (trap): Add (use (reg:DI 29)). + (*exception_receiver_1): Return "#" for TARGET_EXPLICIT_RELOCS. + +2016-05-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2016-03-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR driver/70132 + * config/arm/driver-arm.c (host_detect_local_cpu): Reorder exit logic + to not call fclose twice on file. + +2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/70963 + * config/rs6000/vsx.md (vsx_xvcvdpsxds_scale): Generate correct + code for a zero scale factor. + (vsx_xvcvdpuxds_scale): Likewise. + +2016-05-09 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline + 2016-04-27 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/rtems.h (LIB_SPEC): Add -latomic. + +2016-05-09 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline + 2016-04-27 Joel Sherrill <joel@rtems.org> + + * config/microblaze/rtems.h: Redefine LINK_SPEC to avoid + xilink.ld and flags not relevant to RTEMS. + 2016-04-28 Jakub Jelinek <jakub@redhat.com> PR target/70858 @@ -704,7 +1051,7 @@ Backport from mainline 2015-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> - Bernd Schmidt <bschmidt@redhat.com> + Bernd Schmidt <bschmidt@redhat.com> PR rtl-optimization/67226 * calls.c (store_one_arg): Take into account @@ -716,7 +1063,7 @@ Backport from mainline 2015-11-24 Bernd Schmidt <bschmidt@redhat.com> - Kyrylo Tkachov <kyrylo.tkachov@arm.com> + Kyrylo Tkachov <kyrylo.tkachov@arm.com> PR rtl-optimization/68194 PR rtl-optimization/68328 @@ -1852,7 +2199,7 @@ Backport from mainline r222205 2015-04-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> - Jakub Jelinek <jakub@redhat.com> + Jakub Jelinek <jakub@redhat.com> PR target/65787 * config/rs6000/rs6000.c (rtx_is_swappable_p): Ensure that a diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm index 8d53903bc5c..fabaf2d03eb 100644 --- a/gcc/ChangeLog.ibm +++ b/gcc/ChangeLog.ibm @@ -1,3 +1,9 @@ +2016-08-03 Peter Bergner <bergner@vnet.ibm.com> + + Merge up to 239078. + Upstream FSF 4.9 release branch is now closed. + * REVISION: Update subversion id. + 2016-04-29 Peter Bergner <bergner@vnet.ibm.com> Merge up to 235653. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2e1acb3f9a8..94783ba8168 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160429 +20160726 diff --git a/gcc/DEV-PHASE b/gcc/DEV-PHASE index 373fbc60bb9..e69de29bb2d 100644 --- a/gcc/DEV-PHASE +++ b/gcc/DEV-PHASE @@ -1 +0,0 @@ -prerelease diff --git a/gcc/REVISION b/gcc/REVISION index a3c59e67f4e..8f5a336a4f4 100644 --- a/gcc/REVISION +++ b/gcc/REVISION @@ -1 +1 @@ -[ibm/gcc-4_9-branch merged from gcc-4_9-branch, revision 235653] +[ibm/gcc-4_9-branch merged from gcc-4_9-branch, revision 239078] diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3024031c5c4..745f6acb8d6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2016-04-28 Eric Botcazou <ebotcazou@adacore.com> PR ada/70786 diff --git a/gcc/alias.c b/gcc/alias.c index a1e554058d7..2711b7df5b4 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -2746,6 +2746,20 @@ output_dependence (const_rtx mem, const_rtx x) /*mem_canonicalized=*/false, /*x_canonicalized*/false, /*writep=*/true); } + +/* Likewise, but we already have a canonicalized MEM, and X_ADDR for X. + Also, consider X in X_MODE (which might be from an enclosing + STRICT_LOW_PART / ZERO_EXTRACT). + If MEM_CANONICALIZED is true, MEM is canonicalized. */ + +int +canon_output_dependence (const_rtx mem, bool mem_canonicalized, + const_rtx x, machine_mode x_mode, rtx x_addr) +{ + return write_dependence_p (mem, x, x_mode, x_addr, + mem_canonicalized, /*x_canonicalized=*/true, + /*writep=*/true); +} diff --git a/gcc/builtins.c b/gcc/builtins.c index 7d536398daa..6c1d81794e7 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8793,21 +8793,21 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src, { tree src_base, dest_base, fn; HOST_WIDE_INT src_offset = 0, dest_offset = 0; - HOST_WIDE_INT size = -1; - HOST_WIDE_INT maxsize = -1; + HOST_WIDE_INT maxsize; srcvar = TREE_OPERAND (src, 0); - src_base = get_ref_base_and_extent (srcvar, &src_offset, - &size, &maxsize); + src_base = get_addr_base_and_unit_offset (srcvar, &src_offset); + if (src_base == NULL) + src_base = srcvar; destvar = TREE_OPERAND (dest, 0); - dest_base = get_ref_base_and_extent (destvar, &dest_offset, - &size, &maxsize); + dest_base = get_addr_base_and_unit_offset (destvar, + &dest_offset); + if (dest_base == NULL) + dest_base = destvar; if (tree_fits_uhwi_p (len)) maxsize = tree_to_uhwi (len); else maxsize = -1; - src_offset /= BITS_PER_UNIT; - dest_offset /= BITS_PER_UNIT; if (SSA_VAR_P (src_base) && SSA_VAR_P (dest_base)) { diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a51b2a2e93f..8e064465f99 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,21 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-02-15 Jakub Jelinek <jakub@redhat.com> + + PR c++/69797 + * c-common.c (sync_resolve_size): Diagnose too few arguments + even when params is non-NULL empty vector. + +2016-07-05 Markus Trippelsdorf <markus@trippelsdorf.de> + + PR c++/71214 + * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_rvalue_references. + 2016-02-11 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 88567018502..30dac625135 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -10203,7 +10203,7 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params) tree type; int size; - if (!params) + if (vec_safe_is_empty (params)) { error ("too few arguments to function %qE", function); return 0; diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index b65e08f3b99..1ba91b7aa7a 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -833,6 +833,7 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_decltype=200707"); cpp_define (pfile, "__cpp_attributes=200809"); cpp_define (pfile, "__cpp_rvalue_reference=200610"); + cpp_define (pfile, "__cpp_rvalue_references=200610"); cpp_define (pfile, "__cpp_variadic_templates=200704"); cpp_define (pfile, "__cpp_alias_templates=200704"); } diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 85f1d2ec8b2..276582c71fc 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/combine.c b/gcc/combine.c index a22aba7d48e..d2f00d1b7e7 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -10173,9 +10173,24 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode, && CONST_INT_P (XEXP (varop, 0)) && !CONST_INT_P (XEXP (varop, 1))) { + /* For ((unsigned) (cstULL >> count)) >> cst2 we have to make + sure the result will be masked. See PR70222. */ + if (code == LSHIFTRT + && mode != result_mode + && !merge_outer_ops (&outer_op, &outer_const, AND, + GET_MODE_MASK (result_mode) + >> orig_count, result_mode, + &complement_p)) + break; + /* For ((int) (cstLL >> count)) >> cst2 just give up. Queuing + up outer sign extension (often left and right shift) is + hardly more efficient than the original. See PR70429. */ + if (code == ASHIFTRT && mode != result_mode) + break; + rtx new_rtx = simplify_const_binary_operation (code, mode, - XEXP (varop, 0), - GEN_INT (count)); + XEXP (varop, 0), + GEN_INT (count)); varop = gen_rtx_fmt_ee (code, mode, new_rtx, XEXP (varop, 1)); count = 0; continue; diff --git a/gcc/config.in b/gcc/config.in index 6e120e70f39..f86133120bc 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -551,6 +551,12 @@ #endif +/* Define if your assembler supports .stabs. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_STABS_DIRECTIVE +#endif + + /* Define if your assembler and linker support thread-local storage. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_TLS diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 7626ed31fd6..9776816bfa7 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -1733,16 +1733,6 @@ } ) -(define_insn "aarch64_vmls<mode>" - [(set (match_operand:VDQF 0 "register_operand" "=w") - (minus:VDQF (match_operand:VDQF 1 "register_operand" "0") - (mult:VDQF (match_operand:VDQF 2 "register_operand" "w") - (match_operand:VDQF 3 "register_operand" "w"))))] - "TARGET_SIMD" - "fmls\\t%0.<Vtype>, %2.<Vtype>, %3.<Vtype>" - [(set_attr "type" "neon_fp_mla_<Vetype>_scalar<q>")] -) - ;; FP Max/Min ;; Max/Min are introduced by idiom recognition by GCC's mid-end. An ;; expression like: diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 3eabba2e3fc..4fd69c5809b 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -3754,7 +3754,8 @@ ;; BUGCHK is documented common to OSF/1 and VMS PALcode. (define_insn "trap" - [(trap_if (const_int 1) (const_int 0))] + [(trap_if (const_int 1) (const_int 0)) + (use (reg:DI 29))] "" "call_pal 0x81" [(set_attr "type" "callpal")]) @@ -5174,7 +5175,7 @@ "TARGET_ABI_OSF" { if (TARGET_EXPLICIT_RELOCS) - return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"; + return "#"; else return "ldgp $29,0($26)"; } diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 3844275d393..7fc7f0464ea 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -20685,7 +20685,11 @@ arm_expand_prologue (void) /* Naked functions don't have prologues. */ if (IS_NAKED (func_type)) - return; + { + if (flag_stack_usage_info) + current_function_static_stack_size = 0; + return; + } /* Make a copy of c_f_p_a_s as we may need to modify it locally. */ args_to_push = crtl->args.pretend_args_size; @@ -26709,7 +26713,11 @@ thumb1_expand_prologue (void) /* Naked functions don't have prologues. */ if (IS_NAKED (func_type)) - return; + { + if (flag_stack_usage_info) + current_function_static_stack_size = 0; + return; + } if (IS_INTERRUPT (func_type)) { diff --git a/gcc/config/arm/driver-arm.c b/gcc/config/arm/driver-arm.c index 6d9c4174c96..ea5c265ba96 100644 --- a/gcc/config/arm/driver-arm.c +++ b/gcc/config/arm/driver-arm.c @@ -124,12 +124,11 @@ host_detect_local_cpu (int argc, const char **argv) } } - fclose (f); - - if (val == NULL) - goto not_found; - - return concat ("-m", argv[0], "=", val, NULL); + if (val) + { + fclose (f); + return concat ("-m", argv[0], "=", val, NULL); + } not_found: { diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 07286206d0f..e385665847f 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -621,6 +621,22 @@ if (avr_mem_flash_p (dest)) DONE; + if (QImode == <MODE>mode + && SUBREG == GET_CODE (src) + && CONSTANT_ADDRESS_P (SUBREG_REG (src)) + && can_create_pseudo_p()) + { + // store_bitfield may want to store a SYMBOL_REF or CONST in a + // structure that's represented as PSImode. As the upper 16 bits + // of PSImode cannot be expressed as an HImode subreg, the rhs is + // decomposed into QImode (word_mode) subregs of SYMBOL_REF, + // CONST or LABEL_REF; cf. PR71103. + + rtx const_addr = SUBREG_REG (src); + operands[1] = src = copy_rtx (src); + SUBREG_REG (src) = copy_to_mode_reg (GET_MODE (const_addr), const_addr); + } + /* One of the operands has to be in a register. */ if (!register_operand (dest, <MODE>mode) && !reg_or_0_operand (src, <MODE>mode)) diff --git a/gcc/config/avr/driver-avr.c b/gcc/config/avr/driver-avr.c index 2d95f1b797c..4a879751535 100644 --- a/gcc/config/avr/driver-avr.c +++ b/gcc/config/avr/driver-avr.c @@ -101,7 +101,7 @@ avr_device_to_data_start (int argc, const char **argv) snprintf (data_section_start_str, sizeof(data_section_start_str) - 1, "0x%lX", data_section_start); - return concat ("-Tdata ", data_section_start_str, NULL); + return concat ("%{!Tdata:-Tdata ", data_section_start_str, "}", NULL); } /* Returns command line parameters that describe the device startfile. */ diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 12636409979..f8fd2fef3b4 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -1,5 +1,5 @@ /* Target definitions for Darwin (Mac OS X) systems. - Copyright (C) 1989-2014 Free Software Foundation, Inc. + Copyright (C) 1989-2016 Free Software Foundation, Inc. Contributed by Apple Computer Inc. This file is part of GCC. @@ -392,12 +392,13 @@ extern GTY(()) int darwin_ms_struct; #define ASM_DEBUG_SPEC "%{g*:%{!g0:%{!gdwarf*:--gstabs}}}" -/* We still allow output of STABS. */ - +/* We still allow output of STABS if the assembler supports it. */ +#ifdef HAVE_AS_STABS_DIRECTIVE #define DBX_DEBUGGING_INFO 1 +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +#endif #define DWARF2_DEBUGGING_INFO 1 -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG #define DEBUG_FRAME_SECTION "__DWARF,__debug_frame,regular,debug" #define DEBUG_INFO_SECTION "__DWARF,__debug_info,regular,debug" diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index a85aa42d5fc..185bf31c2fe 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -1,5 +1,5 @@ /* Target definitions for x86 running Darwin. - Copyright (C) 2001-2014 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. Contributed by Apple Computer Inc. This file is part of GCC. @@ -242,7 +242,11 @@ do { \ compiles default to stabs+. darwin9+ defaults to dwarf-2. */ #ifndef DARWIN_PREFER_DWARF #undef PREFERRED_DEBUGGING_TYPE +#ifdef HAVE_AS_STABS_DIRECTIVE #define PREFERRED_DEBUGGING_TYPE (TARGET_64BIT ? DWARF2_DEBUG : DBX_DEBUG) +#else +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +#endif #endif /* Darwin uses the standard DWARF register numbers but the default diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index 992f91f8a57..20866db3546 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -596,33 +596,27 @@ const char *host_detect_local_cpu (int argc, const char **argv) } else if (vendor == signature_CENTAUR_ebx) { - if (arch) + processor = PROCESSOR_GENERIC; + + switch (family) { - switch (family) - { - case 6: - if (model > 9) - /* Use the default detection procedure. */ - processor = PROCESSOR_GENERIC; - else if (model == 9) - cpu = "c3-2"; - else if (model >= 6) - cpu = "c3"; - else - processor = PROCESSOR_GENERIC; - break; - case 5: - if (has_3dnow) - cpu = "winchip2"; - else if (has_mmx) - cpu = "winchip2-c6"; - else - processor = PROCESSOR_GENERIC; - break; - default: - /* We have no idea. */ - processor = PROCESSOR_GENERIC; - } + default: + /* We have no idea. */ + break; + + case 5: + if (has_3dnow || has_mmx) + processor = PROCESSOR_I486; + break; + + case 6: + if (model > 9 || has_longmode) + /* Use the default detection procedure. */ + ; + else if (model == 9) + processor = PROCESSOR_PENTIUMPRO; + else if (model >= 6) + processor = PROCESSOR_I486; } } else @@ -653,7 +647,18 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* Default. */ break; case PROCESSOR_I486: - cpu = "i486"; + if (arch && vendor == signature_CENTAUR_ebx) + { + if (model >= 6) + cpu = "c3"; + else if (has_3dnow) + cpu = "winchip2"; + else + /* Assume WinChip C6. */ + cpu = "winchip-c6"; + } + else + cpu = "i486"; break; case PROCESSOR_PENTIUM: if (arch && has_mmx) @@ -766,8 +771,13 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* It is Pentium M. */ cpu = "pentium-m"; else if (has_sse) - /* It is Pentium III. */ - cpu = "pentium3"; + { + if (vendor == signature_CENTAUR_ebx) + cpu = "c3-2"; + else + /* It is Pentium III. */ + cpu = "pentium3"; + } else if (has_mmx) /* It is Pentium II. */ cpu = "pentium2"; @@ -848,6 +858,11 @@ const char *host_detect_local_cpu (int argc, const char **argv) else cpu = "prescott"; } + else if (has_longmode) + /* Perhaps some emulator? Assume x86-64, otherwise gcc + -march=native would be unusable for 64-bit compilations, + as all the CPUs below are 32-bit only. */ + cpu = "x86-64"; else if (has_sse2) cpu = "pentium4"; else if (has_cmov) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 20ad2cd0999..3a313007f5c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -16918,12 +16918,29 @@ ix86_expand_vector_move (enum machine_mode mode, rtx operands[]) of the register, once we have that information we may be able to handle some of them more efficiently. */ if (can_create_pseudo_p () - && register_operand (op0, mode) && (CONSTANT_P (op1) || (GET_CODE (op1) == SUBREG && CONSTANT_P (SUBREG_REG (op1)))) - && !standard_sse_constant_p (op1)) - op1 = validize_mem (force_const_mem (mode, op1)); + && ((register_operand (op0, mode) + && !standard_sse_constant_p (op1)) + /* ix86_expand_vector_move_misalign() does not like constants. */ + || (SSE_REG_MODE_P (mode) + && MEM_P (op0) + && MEM_ALIGN (op0) < align))) + { + if (GET_CODE (op1) == SUBREG) + { + machine_mode imode = GET_MODE (SUBREG_REG (op1)); + rtx r = force_const_mem (imode, SUBREG_REG (op1)); + if (r) + r = validize_mem (r); + else + r = force_reg (imode, SUBREG_REG (op1)); + op1 = simplify_gen_subreg (mode, r, imode, SUBREG_BYTE (op1)); + } + else + op1 = validize_mem (force_const_mem (mode, op1)); + } /* We need to check memory alignment for SSE mode since attribute can make operands unaligned. */ @@ -16934,13 +16951,8 @@ ix86_expand_vector_move (enum machine_mode mode, rtx operands[]) { rtx tmp[2]; - /* ix86_expand_vector_move_misalign() does not like constants ... */ - if (CONSTANT_P (op1) - || (GET_CODE (op1) == SUBREG - && CONSTANT_P (SUBREG_REG (op1)))) - op1 = validize_mem (force_const_mem (mode, op1)); - - /* ... nor both arguments in memory. */ + /* ix86_expand_vector_move_misalign() does not like both + arguments in memory. */ if (!register_operand (op0, mode) && !register_operand (op1, mode)) op1 = force_reg (mode, op1); @@ -17024,7 +17036,7 @@ ix86_avx256_split_vector_move_misalign (rtx op0, rtx op1) m = adjust_address (op0, mode, 0); emit_insn (extract (m, op1, const0_rtx)); m = adjust_address (op0, mode, 16); - emit_insn (extract (m, op1, const1_rtx)); + emit_insn (extract (m, copy_rtx (op1), const1_rtx)); } else emit_insn (store_unaligned (op0, op1)); @@ -17332,7 +17344,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[]) m = adjust_address (op0, V2SFmode, 0); emit_insn (gen_sse_storelps (m, op1)); m = adjust_address (op0, V2SFmode, 8); - emit_insn (gen_sse_storehps (m, op1)); + emit_insn (gen_sse_storehps (m, copy_rtx (op1))); } } } @@ -34248,6 +34260,7 @@ ix86_expand_args_builtin (const struct builtin_description *d, case 5: pat = GEN_FCN (icode) (real_target, args[0].op, args[1].op, args[2].op, args[3].op, args[4].op); + break; case 6: pat = GEN_FCN (icode) (real_target, args[0].op, args[1].op, args[2].op, args[3].op, args[4].op, @@ -34617,6 +34630,7 @@ ix86_expand_round_builtin (const struct builtin_description *d, case 5: pat = GEN_FCN (icode) (target, args[0].op, args[1].op, args[2].op, args[3].op, args[4].op); + break; case 6: pat = GEN_FCN (icode) (target, args[0].op, args[1].op, args[2].op, args[3].op, args[4].op, diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index ea02e64e818..97a4f108712 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -11248,7 +11248,8 @@ (zero_extend (match_dup 1)))] "(peep2_reg_dead_p (3, operands[1]) || operands_match_p (operands[1], operands[3])) - && ! reg_overlap_mentioned_p (operands[3], operands[0])" + && ! reg_overlap_mentioned_p (operands[3], operands[0]) + && ! reg_set_p (operands[3], operands[4])" [(parallel [(set (match_dup 5) (match_dup 0)) (match_dup 4)]) (set (strict_low_part (match_dup 6)) @@ -11291,7 +11292,8 @@ (clobber (reg:CC FLAGS_REG))])] "(peep2_reg_dead_p (3, operands[1]) || operands_match_p (operands[1], operands[3])) - && ! reg_overlap_mentioned_p (operands[3], operands[0])" + && ! reg_overlap_mentioned_p (operands[3], operands[0]) + && ! reg_set_p (operands[3], operands[4])" [(parallel [(set (match_dup 5) (match_dup 0)) (match_dup 4)]) (set (strict_low_part (match_dup 6)) diff --git a/gcc/config/microblaze/rtems.h b/gcc/config/microblaze/rtems.h index 4d8a29eaf9b..60f28bdac44 100644 --- a/gcc/config/microblaze/rtems.h +++ b/gcc/config/microblaze/rtems.h @@ -23,3 +23,10 @@ along with GCC; see the file COPYING3. If not see builtin_define( "__rtems__" ); \ builtin_assert( "system=rtems" ); \ } while (0) + +/* Redefine to include only items relevant for RTEMS */ +#undef LINK_SPEC +#define LINK_SPEC "%{shared:-shared} -N -relax \ + %{mbig-endian:-EB --oformat=elf32-microblaze} \ + %{mlittle-endian:-EL --oformat=elf32-microblazeel} \ + %{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0}" diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index f1d8dbccdbd..9a6a7d6c968 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -1415,10 +1415,15 @@ { rtx op0 = operands[0]; rtx op1 = operands[1]; - rtx tmp = gen_reg_rtx (V2DFmode); - int scale = INTVAL(operands[2]); - if (scale != 0) - rs6000_scale_v2df (tmp, op1, scale); + rtx tmp; + int scale = INTVAL (operands[2]); + if (scale == 0) + tmp = op1; + else + { + tmp = gen_reg_rtx (V2DFmode); + rs6000_scale_v2df (tmp, op1, scale); + } emit_insn (gen_vsx_xvcvdpsxds (op0, tmp)); DONE; }) @@ -1439,10 +1444,15 @@ { rtx op0 = operands[0]; rtx op1 = operands[1]; - rtx tmp = gen_reg_rtx (V2DFmode); - int scale = INTVAL(operands[2]); - if (scale != 0) - rs6000_scale_v2df (tmp, op1, scale); + rtx tmp; + int scale = INTVAL (operands[2]); + if (scale == 0) + tmp = op1; + else + { + tmp = gen_reg_rtx (V2DFmode); + rs6000_scale_v2df (tmp, op1, scale); + } emit_insn (gen_vsx_xvcvdpuxds (op0, tmp)); DONE; }) diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h index f14aed36aa6..ff1d1fb9e3c 100644 --- a/gcc/config/rtems.h +++ b/gcc/config/rtems.h @@ -45,6 +45,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \ "%{!nostdlib: %{qrtems: --start-group \ -lrtemsbsp -lrtemscpu \ - -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}" + -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}" #define TARGET_POSIX_IO diff --git a/gcc/configure b/gcc/configure index 1674e3063c2..282878fbd83 100755 --- a/gcc/configure +++ b/gcc/configure @@ -15917,7 +15917,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -20403,7 +20403,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -22987,6 +22987,37 @@ cat >>confdefs.h <<_ACEOF _ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for stabs directive" >&5 +$as_echo_n "checking assembler for stabs directive... " >&6; } +if test "${gcc_cv_as_stabs_directive+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_stabs_directive=no + if test x$gcc_cv_as != x; then + $as_echo '.stabs "gcc2_compiled.",60,0,0,0' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_stabs_directive=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_stabs_directive" >&5 +$as_echo "$gcc_cv_as_stabs_directive" >&6; } +if test $gcc_cv_as_stabs_directive = yes; then + +$as_echo "#define HAVE_AS_STABS_DIRECTIVE 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for COMDAT group support (GNU as)" >&5 $as_echo_n "checking assembler for COMDAT group support (GNU as)... " >&6; } if test "${gcc_cv_as_comdat_group+set}" = set; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index 1a009c87b0c..a57c0a2fb30 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2746,6 +2746,11 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE, [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`], [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.]) +gcc_GAS_CHECK_FEATURE([stabs directive], gcc_cv_as_stabs_directive, ,, +[.stabs "gcc2_compiled.",60,0,0,0],, +[AC_DEFINE(HAVE_AS_STABS_DIRECTIVE, 1, + [Define if your assembler supports .stabs.])]) + gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)], gcc_cv_as_comdat_group, [elf,2,16,0], [--fatal-warnings], diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3c172ee27b1..b926ef17cb0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,48 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-07-21 Jason Merrill <jason@redhat.com> + + PR c++/69223 + * semantics.c (apply_deduced_return_type): Call + complete_type_or_else before building the new RESULT_DECL. + + PR c++/71913 + * call.c (unsafe_copy_elision_p): It's OK to elide when + initializing an unknown object. + +2016-07-20 Jakub Jelinek <jakub@redhat.com> + + PR c++/71909 + * parser.c (cp_parser_save_member_function_body): Consume + __transaction_relaxed or __transaction_atomic with optional + attribute. Only skip catch with block if try keyword is seen. + +2016-07-19 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-07-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/71871 + * typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-02-19 Jakub Jelinek <jakub@redhat.com> + + PR c++/67767 + * parser.c (cp_parser_std_attribute_spec_seq): Don't assume + attr_spec is always single element chain, chain all the attributes + properly together in the right order. + +2016-05-18 Jason Merrill <jason@redhat.com> + + PR c++/70505 + * pt.c (tsubst_baselink): Give the new TEMPLATE_ID_EXPR + unknown_type_node, too. + 2016-04-13 Alan Modra <amodra@gmail.com> Backport from mainline diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d2de2abf503..59dc3633a74 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6757,10 +6757,11 @@ static bool unsafe_copy_elision_p (tree target, tree exp) { tree type = TYPE_MAIN_VARIANT (TREE_TYPE (exp)); - if (type == CLASSTYPE_AS_BASE (type)) + /* It's safe to elide the copy for a class with no tail padding. */ + if (tree_int_cst_equal (TYPE_SIZE (type), CLASSTYPE_SIZE (type))) return false; - if (!is_base_field_ref (target) - && resolves_to_fixed_type_p (target, NULL)) + /* It's safe to elide the copy if we aren't initializing a base object. */ + if (!is_base_field_ref (target)) return false; tree init = TARGET_EXPR_INITIAL (exp); /* build_compound_expr pushes COMPOUND_EXPR inside TARGET_EXPR. */ diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index cc556891251..e06bb0a1b4b 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22047,7 +22047,8 @@ cp_parser_std_attribute_spec (cp_parser *parser) static tree cp_parser_std_attribute_spec_seq (cp_parser *parser) { - tree attr_specs = NULL; + tree attr_specs = NULL_TREE; + tree attr_last = NULL_TREE; while (true) { @@ -22057,11 +22058,13 @@ cp_parser_std_attribute_spec_seq (cp_parser *parser) if (attr_spec == error_mark_node) return error_mark_node; - TREE_CHAIN (attr_spec) = attr_specs; - attr_specs = attr_spec; + if (attr_last) + TREE_CHAIN (attr_last) = attr_spec; + else + attr_specs = attr_last = attr_spec; + attr_last = tree_last (attr_last); } - attr_specs = nreverse (attr_specs); return attr_specs; } @@ -23363,6 +23366,7 @@ cp_parser_save_member_function_body (cp_parser* parser, cp_token *first; cp_token *last; tree fn; + bool function_try_block = false; /* Create the FUNCTION_DECL. */ fn = grokmethod (decl_specifiers, declarator, attributes); @@ -23383,9 +23387,48 @@ cp_parser_save_member_function_body (cp_parser* parser, /* Save away the tokens that make up the body of the function. */ first = parser->lexer->next_token; + + if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TRANSACTION_RELAXED)) + cp_lexer_consume_token (parser->lexer); + else if (cp_lexer_next_token_is_keyword (parser->lexer, + RID_TRANSACTION_ATOMIC)) + { + cp_lexer_consume_token (parser->lexer); + /* Match cp_parser_txn_attribute_opt [[ identifier ]]. */ + if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE) + && (cp_lexer_peek_nth_token (parser->lexer, 2)->type + == CPP_OPEN_SQUARE) + && (cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_NAME + || (cp_lexer_peek_nth_token (parser->lexer, 3)->type + == CPP_KEYWORD)) + && (cp_lexer_peek_nth_token (parser->lexer, 4)->type + == CPP_CLOSE_SQUARE) + && (cp_lexer_peek_nth_token (parser->lexer, 5)->type + == CPP_CLOSE_SQUARE)) + { + cp_lexer_consume_token (parser->lexer); + cp_lexer_consume_token (parser->lexer); + cp_lexer_consume_token (parser->lexer); + cp_lexer_consume_token (parser->lexer); + cp_lexer_consume_token (parser->lexer); + } + else + while (cp_next_tokens_can_be_gnu_attribute_p (parser) + && (cp_lexer_peek_nth_token (parser->lexer, 2)->type + == CPP_OPEN_PAREN)) + { + cp_lexer_consume_token (parser->lexer); + if (cp_parser_cache_group (parser, CPP_CLOSE_PAREN, /*depth=*/0)) + break; + } + } + /* Handle function try blocks. */ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TRY)) - cp_lexer_consume_token (parser->lexer); + { + cp_lexer_consume_token (parser->lexer); + function_try_block = true; + } /* We can have braced-init-list mem-initializers before the fn body. */ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { @@ -23403,8 +23446,9 @@ cp_parser_save_member_function_body (cp_parser* parser, } cp_parser_cache_group (parser, CPP_CLOSE_BRACE, /*depth=*/0); /* Handle function try blocks. */ - while (cp_lexer_next_token_is_keyword (parser->lexer, RID_CATCH)) - cp_parser_cache_group (parser, CPP_CLOSE_BRACE, /*depth=*/0); + if (function_try_block) + while (cp_lexer_next_token_is_keyword (parser->lexer, RID_CATCH)) + cp_parser_cache_group (parser, CPP_CLOSE_BRACE, /*depth=*/0); last = parser->lexer->next_token; /* Save away the inline definition; we will process it when the diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4b4cf4ec20b..e08a27d437b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12392,9 +12392,10 @@ tsubst_baselink (tree baselink, tree object_type, /* Add back the template arguments, if present. */ if (BASELINK_P (baselink) && template_id_p) BASELINK_FUNCTIONS (baselink) - = build_nt (TEMPLATE_ID_EXPR, - BASELINK_FUNCTIONS (baselink), - template_args); + = build2 (TEMPLATE_ID_EXPR, + unknown_type_node, + BASELINK_FUNCTIONS (baselink), + template_args); /* Update the conversion operator type. */ BASELINK_OPTYPE (baselink) = optype; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bc8fec1103b..7699765fe58 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -10664,6 +10664,10 @@ apply_deduced_return_type (tree fco, tree return_type) if (TREE_TYPE (result) == return_type) return; + if (!processing_template_decl && !VOID_TYPE_P (return_type) + && !complete_type_or_else (return_type, NULL_TREE)) + return; + /* We already have a DECL_RESULT from start_preparsed_function. Now we need to redo the work it and allocate_struct_function did to reflect the new type. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b3d3dfc77ed..6ed91251c96 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6055,8 +6055,7 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2, } expr = build_conditional_expr (loc, ifexp, op1, op2, complain); - if (processing_template_decl && expr != error_mark_node - && TREE_CODE (expr) != VEC_COND_EXPR) + if (processing_template_decl && expr != error_mark_node) { tree min = build_min_non_dep (COND_EXPR, expr, orig_ifexp, orig_op1, orig_op2); diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f310bf548be..effebf7f569 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -921,7 +921,7 @@ See RS/6000 and PowerPC Options. -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol -msave-toc-indirect -mno-save-toc-indirect @gol -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol --mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol +-mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol -mquad-memory -mno-quad-memory @gol -mquad-memory-atomic -mno-quad-memory-atomic @gol -mcompat-align-parm -mno-compat-align-parm} @@ -18990,7 +18990,7 @@ following options: -mpopcntb -mpopcntd -mpowerpc64 @gol -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol --mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol +-mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol -mquad-memory -mquad-memory-atomic} The particular options set for any particular CPU varies between @@ -19157,6 +19157,14 @@ Generate code that uses (does not use) the instructions to move data between the general purpose registers and the vector/scalar (VSX) registers that were added in version 2.07 of the PowerPC ISA. +@item -mhtm +@itemx -mno-htm +@opindex mhtm +@opindex mno-htm +Enable (disable) the use of the built-in functions that allow direct +access to the Hardware Transactional Memory (HTM) instructions that +were added in version 2.07 of the PowerPC ISA. + @item -mpower8-fusion @itemx -mno-power8-fusion @opindex mpower8-fusion diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 39152df272a..371ddf663bb 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1782,6 +1782,9 @@ time) should be run on this target. This can be enabled by setting the Test system runs executables on a simulator (i.e. slowly) rather than hardware (i.e. fast). +@item stabs +Target supports the stabs debugging format. + @item stdint_types Target has the basic signed and unsigned C types in @code{stdint.h}. This will be obsolete when GCC ensures a working @code{stdint.h} for diff --git a/gcc/dse.c b/gcc/dse.c index 8ebf63f046e..2aa5af0d5ca 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1639,10 +1639,9 @@ record_store (rtx body, bb_info_t bb_info) the value of store_info. If it is, set the rhs to NULL to keep it from being used to remove a load. */ { - if (canon_true_dependence (s_info->mem, - GET_MODE (s_info->mem), - s_info->mem_addr, - mem, mem_addr)) + if (canon_output_dependence (s_info->mem, true, + mem, GET_MODE (mem), + mem_addr)) { s_info->rhs = NULL; s_info->const_rhs = NULL; @@ -2583,6 +2582,8 @@ scan_insn (bb_info_t bb_info, rtx insn) active_local_stores = insn_info; } } + else + clear_rhs_from_active_local_stores (); } } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6b4e83ad566..f3226b62b46 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -15817,7 +15817,7 @@ native_encode_initializer (tree init, unsigned char *array, int size) fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field)); pos = int_byte_position (field); gcc_assert (pos + fieldsize <= size); - if (val + if (val && fieldsize != 0 && !native_encode_initializer (val, array + pos, fieldsize)) return false; } diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8e32c7222b5..f6d92abd250 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1933,7 +1933,6 @@ fold_convertible_p (const_tree type, const_tree arg) case REAL_TYPE: case FIXED_POINT_TYPE: - case COMPLEX_TYPE: case VECTOR_TYPE: case VOID_TYPE: return TREE_CODE (type) == TREE_CODE (orig); @@ -12746,11 +12745,15 @@ fold_binary_loc (location_t loc, || TREE_CODE (arg0) == BIT_IOR_EXPR || TREE_CODE (arg0) == BIT_XOR_EXPR) && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) - return fold_build2_loc (loc, TREE_CODE (arg0), type, - fold_build2_loc (loc, code, type, - TREE_OPERAND (arg0, 0), arg1), - fold_build2_loc (loc, code, type, - TREE_OPERAND (arg0, 1), arg1)); + { + tree arg00 = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); + tree arg01 = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 1)); + return fold_build2_loc (loc, TREE_CODE (arg0), type, + fold_build2_loc (loc, code, type, + arg00, arg1), + fold_build2_loc (loc, code, type, + arg01, arg1)); + } /* Two consecutive rotates adding up to the precision of the type can be ignored. */ @@ -12762,7 +12765,7 @@ fold_binary_loc (location_t loc, && ((TREE_INT_CST_LOW (arg1) + TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1))) == prec)) - return TREE_OPERAND (arg0, 0); + return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); /* Fold (X & C2) << C1 into (X << C1) & (C2 << C1) (X & C2) >> C1 into (X >> C1) & (C2 >> C1) @@ -16738,17 +16741,20 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) if (TREE_CODE (op00type) == VECTOR_TYPE && type == TREE_TYPE (op00type)) { - HOST_WIDE_INT offset = tree_to_shwi (op01); tree part_width = TYPE_SIZE (type); - unsigned HOST_WIDE_INT part_widthi = tree_to_shwi (part_width)/BITS_PER_UNIT; - unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; - tree index = bitsize_int (indexi); - - if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type)) - return fold_build3_loc (loc, - BIT_FIELD_REF, type, op00, - part_width, index); - + unsigned HOST_WIDE_INT max_offset + = (tree_to_uhwi (part_width) / BITS_PER_UNIT + * TYPE_VECTOR_SUBPARTS (op00type)); + if (tree_int_cst_sign_bit (op01) == 0 + && compare_tree_int (op01, max_offset) == -1) + { + unsigned HOST_WIDE_INT offset = tree_to_uhwi (op01); + unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; + tree index = bitsize_int (indexi); + return fold_build3_loc (loc, + BIT_FIELD_REF, type, op00, + part_width, index); + } } /* ((foo*)&complexfoo)[1] => __imag__ complexfoo */ else if (TREE_CODE (op00type) == COMPLEX_TYPE diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4e2610a161e..ebed0e7d615 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,47 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-07-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk: + PR fortran/71764 + * trans-expr.c (gfc_trans_structure_assign): Remove assert. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-07-01 Jakub Jelinek <jakub@redhat.com> + + PR fortran/71717 + * trans-openmp.c (gfc_omp_privatize_by_reference): Return false + for GFC_DECL_ASSOCIATE_VAR_P with POINTER_TYPE. + + 2016-06-30 Jakub Jelinek <jakub@redhat.com> + + PR fortran/71704 + * parse.c (matchs, matcho): If spec_only, only gfc_match the keyword + and if successful, goto do_spec_only. + (matchds, matchdo): Define. + (decode_omp_directive): Add spec_only local var and set it. + Use matchds or matchdo macros instead of matchs or matcho + for declare target, declare simd, declare reduction and threadprivate + directives. Return ST_GET_FCN_CHARACTERISTICS if a non-declarative + directive could be matched. + (next_statement): For ST_GET_FCN_CHARACTERISTICS restore + gfc_current_locus from old_locus even if there is no label. + + PR fortran/71705 + * trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on + decls in to/from clauses. + +2016-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk. + PR fortran/66461 + * scanner.c (gfc_next_char_literal): Clear end_flag when adjusting + current locus back to old_locus. + 2016-02-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> Backported from mainline diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 3428b331e7c..e55477e07cc 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -559,9 +559,12 @@ decode_statement (void) return ST_NONE; } -/* Like match, but set a flag simd_matched if keyword matched. */ +/* Like match, but set a flag simd_matched if keyword matched + and if spec_only, goto do_spec_only without actually matching. */ #define matchs(keyword, subr, st) \ do { \ + if (spec_only && gfc_match (keyword) == MATCH_YES) \ + goto do_spec_only; \ if (match_word_omp_simd (keyword, subr, &old_locus, \ &simd_matched) == MATCH_YES) \ return st; \ @@ -569,11 +572,36 @@ decode_statement (void) undo_new_statement (); \ } while (0); -/* Like match, but don't match anything if not -fopenmp. */ +/* Like match, but don't match anything if not -fopenmp + and if spec_only, goto do_spec_only without actually matching. */ #define matcho(keyword, subr, st) \ do { \ if (!gfc_option.gfc_flag_openmp) \ ; \ + else if (spec_only && gfc_match (keyword) == MATCH_YES) \ + goto do_spec_only; \ + else if (match_word (keyword, subr, &old_locus) \ + == MATCH_YES) \ + return st; \ + else \ + undo_new_statement (); \ + } while (0); + +/* Like match, but set a flag simd_matched if keyword matched. */ +#define matchds(keyword, subr, st) \ + do { \ + if (match_word_omp_simd (keyword, subr, &old_locus, \ + &simd_matched) == MATCH_YES) \ + return st; \ + else \ + undo_new_statement (); \ + } while (0); + +/* Like match, but don't match anything if not -fopenmp. */ +#define matchdo(keyword, subr, st) \ + do { \ + if (!gfc_option.gfc_flag_openmp) \ + ; \ else if (match_word (keyword, subr, &old_locus) \ == MATCH_YES) \ return st; \ @@ -587,6 +615,7 @@ decode_omp_directive (void) locus old_locus; char c; bool simd_matched = false; + bool spec_only = false; gfc_enforce_clean_symbol_state (); @@ -601,6 +630,10 @@ decode_omp_directive (void) return ST_NONE; } + if (gfc_current_state () == COMP_FUNCTION + && gfc_current_block ()->result->ts.kind == -1) + spec_only = true; + gfc_unset_implicit_pure (NULL); old_locus = gfc_current_locus; @@ -629,12 +662,12 @@ decode_omp_directive (void) matcho ("critical", gfc_match_omp_critical, ST_OMP_CRITICAL); break; case 'd': - matchs ("declare reduction", gfc_match_omp_declare_reduction, - ST_OMP_DECLARE_REDUCTION); - matchs ("declare simd", gfc_match_omp_declare_simd, - ST_OMP_DECLARE_SIMD); - matcho ("declare target", gfc_match_omp_declare_target, - ST_OMP_DECLARE_TARGET); + matchds ("declare reduction", gfc_match_omp_declare_reduction, + ST_OMP_DECLARE_REDUCTION); + matchds ("declare simd", gfc_match_omp_declare_simd, + ST_OMP_DECLARE_SIMD); + matchdo ("declare target", gfc_match_omp_declare_target, + ST_OMP_DECLARE_TARGET); matchs ("distribute parallel do simd", gfc_match_omp_distribute_parallel_do_simd, ST_OMP_DISTRIBUTE_PARALLEL_DO_SIMD); @@ -754,8 +787,8 @@ decode_omp_directive (void) matcho ("teams distribute", gfc_match_omp_teams_distribute, ST_OMP_TEAMS_DISTRIBUTE); matcho ("teams", gfc_match_omp_teams, ST_OMP_TEAMS); - matcho ("threadprivate", gfc_match_omp_threadprivate, - ST_OMP_THREADPRIVATE); + matchdo ("threadprivate", gfc_match_omp_threadprivate, + ST_OMP_THREADPRIVATE); break; case 'w': matcho ("workshare", gfc_match_omp_workshare, ST_OMP_WORKSHARE); @@ -778,6 +811,13 @@ decode_omp_directive (void) gfc_error_recovery (); return ST_NONE; + + do_spec_only: + reject_statement (); + gfc_clear_error (); + gfc_buffer_error (false); + gfc_current_locus = old_locus; + return ST_GET_FCN_CHARACTERISTICS; } static gfc_statement @@ -1126,10 +1166,13 @@ next_statement (void) gfc_buffer_error (0); - if (st == ST_GET_FCN_CHARACTERISTICS && gfc_statement_label != NULL) + if (st == ST_GET_FCN_CHARACTERISTICS) { - gfc_free_st_label (gfc_statement_label); - gfc_statement_label = NULL; + if (gfc_statement_label != NULL) + { + gfc_free_st_label (gfc_statement_label); + gfc_statement_label = NULL; + } gfc_current_locus = old_locus; } diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index aa4d7564706..1a6f4612b7c 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1259,6 +1259,7 @@ restart: not_continuation: c = '\n'; gfc_current_locus = old_loc; + end_flag = 0; done: if (c == '\n') diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 3106d798b01..07c22107a33 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -3692,8 +3692,12 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind) } else if (e->expr_type == EXPR_VARIABLE && e->ts.type == BT_CHARACTER && e->symtree->n.sym + && e->symtree->n.sym->ts.type != BT_DERIVED && e->symtree->n.sym->assoc && e->symtree->n.sym->assoc->target - && e->symtree->n.sym->assoc->target->ts.type == BT_DERIVED) + && e->symtree->n.sym->assoc->target->ts.type == BT_DERIVED + && e->symtree->n.sym->assoc->target->symtree->n.sym + && UNLIMITED_POLY (e->symtree->n.sym->assoc->target->symtree->n.sym)) + /* The expression in assoc->target points to a ref to the _data component of the unlimited polymorphic entity. To get the _len component the last _data ref needs to be stripped and a ref to the _len component added. */ diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 4b3e89b7910..331d4bc44a3 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5778,7 +5778,7 @@ gfc_generate_function_code (gfc_namespace * ns) function has already called cgraph_create_node, which also created the cgraph node for this function. */ if (!has_coarray_vars || gfc_option.coarray != GFC_FCOARRAY_LIB) - (void) cgraph_create_node (fndecl); + (void) cgraph_get_create_node (fndecl); } else cgraph_finalize_function (fndecl, true); diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 54ab8960e40..a2857551c82 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6184,7 +6184,6 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr) { gfc_se se, lse; - gcc_assert (cm->backend_decl == NULL); gfc_init_se (&se, NULL); gfc_init_se (&lse, NULL); gfc_conv_expr (&se, gfc_constructor_first (expr->value.constructor)->expr); diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index ed66ea1dd71..ab8641bafe3 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -59,6 +59,7 @@ gfc_omp_privatize_by_reference (const_tree decl) if (GFC_DECL_GET_SCALAR_POINTER (decl) || GFC_DECL_GET_SCALAR_ALLOCATABLE (decl) || GFC_DECL_CRAY_POINTEE (decl) + || GFC_DECL_ASSOCIATE_VAR_P (decl) || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl)))) return false; @@ -2114,6 +2115,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, tree decl = gfc_get_symbol_decl (n->sym); if (gfc_omp_privatize_by_reference (decl)) decl = build_fold_indirect_ref (decl); + else if (DECL_P (decl)) + TREE_ADDRESSABLE (decl) = 1; if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) { tree type = TREE_TYPE (decl); diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index ea93012d419..ea09a2b18e5 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 9e71f43e28d..47a381074f0 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -233,13 +233,14 @@ struct agg_position_info bool by_ref; }; -/* Add condition to condition list CONDS. AGGPOS describes whether the used - oprand is loaded from an aggregate and where in the aggregate it is. It can - be NULL, which means this not a load from an aggregate. */ +/* Add condition to condition list SUMMARY. OPERAND_NUM, SIZE, CODE and VAL + correspond to fields of condition structure. AGGPOS describes whether the + used operand is loaded from an aggregate and where in the aggregate it is. + It can be NULL, which means this not a load from an aggregate. */ static struct predicate add_condition (struct inline_summary *summary, int operand_num, - struct agg_position_info *aggpos, + HOST_WIDE_INT size, struct agg_position_info *aggpos, enum tree_code code, tree val) { int i; @@ -265,6 +266,7 @@ add_condition (struct inline_summary *summary, int operand_num, for (i = 0; vec_safe_iterate (summary->conds, i, &c); i++) { if (c->operand_num == operand_num + && c->size == size && c->code == code && c->val == val && c->agg_contents == agg_contents @@ -281,6 +283,7 @@ add_condition (struct inline_summary *summary, int operand_num, new_cond.agg_contents = agg_contents; new_cond.by_ref = by_ref; new_cond.offset = offset; + new_cond.size = size; vec_safe_push (summary->conds, new_cond); return single_cond_predicate (i + predicate_first_dynamic_condition); } @@ -859,21 +862,25 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, clause |= 1 << (i + predicate_first_dynamic_condition); continue; } - if (c->code == IS_NOT_CONSTANT || c->code == CHANGED) + if (c->code == CHANGED) continue; - if (operand_equal_p (TYPE_SIZE (TREE_TYPE (c->val)), - TYPE_SIZE (TREE_TYPE (val)), 0)) + if (tree_to_shwi (TYPE_SIZE (TREE_TYPE (val))) != c->size) { - val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c->val), val); + clause |= 1 << (i + predicate_first_dynamic_condition); + continue; + } + if (c->code == IS_NOT_CONSTANT) + continue; - res = val - ? fold_binary_to_constant (c->code, boolean_type_node, val, c->val) - : NULL; + val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c->val), val); + res = val + ? fold_binary_to_constant (c->code, boolean_type_node, val, c->val) + : NULL; + + if (res && integer_zerop (res)) + continue; - if (res && integer_zerop (res)) - continue; - } clause |= 1 << (i + predicate_first_dynamic_condition); } return clause; @@ -1495,16 +1502,21 @@ mark_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef ATTRIBUTE_UNUSED, } /* If OP refers to value of function parameter, return the corresponding - parameter. */ + parameter. If non-NULL, the size of the memory load (or the SSA_NAME of the + PARM_DECL) will be stored to *SIZE_P in that case too. */ static tree -unmodified_parm_1 (gimple stmt, tree op) +unmodified_parm_1 (gimple stmt, tree op, HOST_WIDE_INT *size_p) { /* SSA_NAME referring to parm default def? */ if (TREE_CODE (op) == SSA_NAME && SSA_NAME_IS_DEFAULT_DEF (op) && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL) - return SSA_NAME_VAR (op); + { + if (size_p) + *size_p = tree_to_shwi (TYPE_SIZE (TREE_TYPE (op))); + return SSA_NAME_VAR (op); + } /* Non-SSA parm reference? */ if (TREE_CODE (op) == PARM_DECL) { @@ -1515,18 +1527,24 @@ unmodified_parm_1 (gimple stmt, tree op) walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified, NULL); if (!modified) - return op; + { + if (size_p) + *size_p = tree_to_shwi (TYPE_SIZE (TREE_TYPE (op))); + return op; + } } return NULL_TREE; } /* If OP refers to value of function parameter, return the corresponding - parameter. Also traverse chains of SSA register assignments. */ + parameter. Also traverse chains of SSA register assignments. If non-NULL, + the size of the memory load (or the SSA_NAME of the PARM_DECL) will be + stored to *SIZE_P in that case too. */ static tree -unmodified_parm (gimple stmt, tree op) +unmodified_parm (gimple stmt, tree op, HOST_WIDE_INT *size_p) { - tree res = unmodified_parm_1 (stmt, op); + tree res = unmodified_parm_1 (stmt, op, size_p); if (res) return res; @@ -1534,23 +1552,25 @@ unmodified_parm (gimple stmt, tree op) && !SSA_NAME_IS_DEFAULT_DEF (op) && gimple_assign_single_p (SSA_NAME_DEF_STMT (op))) return unmodified_parm (SSA_NAME_DEF_STMT (op), - gimple_assign_rhs1 (SSA_NAME_DEF_STMT (op))); + gimple_assign_rhs1 (SSA_NAME_DEF_STMT (op)), + size_p); return NULL_TREE; } /* If OP refers to a value of a function parameter or value loaded from an aggregate passed to a parameter (either by value or reference), return TRUE - and store the number of the parameter to *INDEX_P and information whether - and how it has been loaded from an aggregate into *AGGPOS. INFO describes - the function parameters, STMT is the statement in which OP is used or - loaded. */ + and store the number of the parameter to *INDEX_P, the access size into + *SIZE_P, and information whether and how it has been loaded from an + aggregate into *AGGPOS. INFO describes the function parameters, STMT is the + statement in which OP is used or loaded. */ static bool unmodified_parm_or_parm_agg_item (struct ipa_node_params *info, gimple stmt, tree op, int *index_p, + HOST_WIDE_INT *size_p, struct agg_position_info *aggpos) { - tree res = unmodified_parm_1 (stmt, op); + tree res = unmodified_parm_1 (stmt, op, size_p); gcc_checking_assert (aggpos); if (res) @@ -1572,12 +1592,12 @@ unmodified_parm_or_parm_agg_item (struct ipa_node_params *info, op = gimple_assign_rhs1 (stmt); if (!REFERENCE_CLASS_P (op)) return unmodified_parm_or_parm_agg_item (info, stmt, op, index_p, - aggpos); + size_p, aggpos); } aggpos->agg_contents = true; return ipa_load_from_parm_agg (info, stmt, op, index_p, &aggpos->offset, - &aggpos->by_ref); + size_p, &aggpos->by_ref); } /* See if statement might disappear after inlining. @@ -1629,7 +1649,7 @@ eliminated_by_inlining_prob (gimple stmt) inner_lhs = lhs; /* Reads of parameter are expected to be free. */ - if (unmodified_parm (stmt, inner_rhs)) + if (unmodified_parm (stmt, inner_rhs, NULL)) rhs_free = true; /* Match expressions of form &this->field. Those will most likely combine with something upstream after inlining. */ @@ -1639,7 +1659,7 @@ eliminated_by_inlining_prob (gimple stmt) if (TREE_CODE (op) == PARM_DECL) rhs_free = true; else if (TREE_CODE (op) == MEM_REF - && unmodified_parm (stmt, TREE_OPERAND (op, 0))) + && unmodified_parm (stmt, TREE_OPERAND (op, 0), NULL)) rhs_free = true; } @@ -1652,7 +1672,7 @@ eliminated_by_inlining_prob (gimple stmt) /* Reads of parameters passed by reference expected to be free (i.e. optimized out after inlining). */ if (TREE_CODE (inner_rhs) == MEM_REF - && unmodified_parm (stmt, TREE_OPERAND (inner_rhs, 0))) + && unmodified_parm (stmt, TREE_OPERAND (inner_rhs, 0), NULL)) rhs_free = true; /* Copying parameter passed by reference into gimple register is @@ -1693,7 +1713,7 @@ eliminated_by_inlining_prob (gimple stmt) if (TREE_CODE (inner_lhs) == PARM_DECL || TREE_CODE (inner_lhs) == RESULT_DECL || (TREE_CODE (inner_lhs) == MEM_REF - && (unmodified_parm (stmt, TREE_OPERAND (inner_lhs, 0)) + && (unmodified_parm (stmt, TREE_OPERAND (inner_lhs, 0), NULL) || (TREE_CODE (TREE_OPERAND (inner_lhs, 0)) == SSA_NAME && SSA_NAME_VAR (TREE_OPERAND (inner_lhs, 0)) && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND @@ -1723,6 +1743,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, { gimple last; tree op; + HOST_WIDE_INT size; int index; struct agg_position_info aggpos; enum tree_code code, inverted_code; @@ -1740,7 +1761,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, /* TODO: handle conditionals like var = op0 < 4; if (var != 0). */ - if (unmodified_parm_or_parm_agg_item (info, last, op, &index, &aggpos)) + if (unmodified_parm_or_parm_agg_item (info, last, op, &index, &size, &aggpos)) { code = gimple_cond_code (last); inverted_code @@ -1756,7 +1777,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, unordered one. Be sure it is not confused with NON_CONSTANT. */ if (this_code != ERROR_MARK) { - struct predicate p = add_condition (summary, index, &aggpos, + struct predicate p = add_condition (summary, index, size, &aggpos, this_code, gimple_cond_rhs (last)); e->aux = pool_alloc (edge_predicate_pool); @@ -1786,11 +1807,11 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, return; op2 = gimple_call_arg (set_stmt, 0); if (!unmodified_parm_or_parm_agg_item - (info, set_stmt, op2, &index, &aggpos)) + (info, set_stmt, op2, &index, &size, &aggpos)) return; FOR_EACH_EDGE (e, ei, bb->succs) if (e->flags & EDGE_FALSE_VALUE) { - struct predicate p = add_condition (summary, index, &aggpos, + struct predicate p = add_condition (summary, index, size, &aggpos, IS_NOT_CONSTANT, NULL_TREE); e->aux = pool_alloc (edge_predicate_pool); *(struct predicate *) e->aux = p; @@ -1809,6 +1830,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, gimple last; tree op; int index; + HOST_WIDE_INT size; struct agg_position_info aggpos; edge e; edge_iterator ei; @@ -1819,7 +1841,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, if (!last || gimple_code (last) != GIMPLE_SWITCH) return; op = gimple_switch_index (last); - if (!unmodified_parm_or_parm_agg_item (info, last, op, &index, &aggpos)) + if (!unmodified_parm_or_parm_agg_item (info, last, op, &index, &size, &aggpos)) return; FOR_EACH_EDGE (e, ei, bb->succs) @@ -1844,12 +1866,12 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, if (!min && !max) p = true_predicate (); else if (!max) - p = add_condition (summary, index, &aggpos, EQ_EXPR, min); + p = add_condition (summary, index, size, &aggpos, EQ_EXPR, min); else { struct predicate p1, p2; - p1 = add_condition (summary, index, &aggpos, GE_EXPR, min); - p2 = add_condition (summary, index, &aggpos, LE_EXPR, max); + p1 = add_condition (summary, index, size, &aggpos, GE_EXPR, min); + p2 = add_condition (summary, index, size, &aggpos, LE_EXPR, max); p = and_predicates (summary->conds, &p1, &p2); } *(struct predicate *) e->aux @@ -1949,13 +1971,14 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info, { tree parm; int index; + HOST_WIDE_INT size; while (UNARY_CLASS_P (expr)) expr = TREE_OPERAND (expr, 0); - parm = unmodified_parm (NULL, expr); + parm = unmodified_parm (NULL, expr, &size); if (parm && (index = ipa_get_param_decl_index (info, parm)) >= 0) - return add_condition (summary, index, NULL, CHANGED, NULL_TREE); + return add_condition (summary, index, size, NULL, CHANGED, NULL_TREE); if (is_gimple_min_invariant (expr)) return false_predicate (); if (TREE_CODE (expr) == SSA_NAME) @@ -2016,6 +2039,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, struct predicate op_non_const; bool is_load; int base_index; + HOST_WIDE_INT size; struct agg_position_info aggpos; /* What statments might be optimized away @@ -2039,7 +2063,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, tree op; gcc_assert (gimple_assign_single_p (stmt)); op = gimple_assign_rhs1 (stmt); - if (!unmodified_parm_or_parm_agg_item (info, stmt, op, &base_index, + if (!unmodified_parm_or_parm_agg_item (info, stmt, op, &base_index, &size, &aggpos)) return p; } @@ -2050,7 +2074,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, adding conditionals. */ FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) { - tree parm = unmodified_parm (stmt, use); + tree parm = unmodified_parm (stmt, use, NULL); /* For arguments we can build a condition. */ if (parm && ipa_get_param_decl_index (info, parm) >= 0) continue; @@ -2065,18 +2089,18 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, if (is_load) op_non_const = - add_condition (summary, base_index, &aggpos, CHANGED, NULL); + add_condition (summary, base_index, size, &aggpos, CHANGED, NULL); else op_non_const = false_predicate (); FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) { - tree parm = unmodified_parm (stmt, use); + tree parm = unmodified_parm (stmt, use, &size); int index; if (parm && (index = ipa_get_param_decl_index (info, parm)) >= 0) { if (index != base_index) - p = add_condition (summary, index, NULL, CHANGED, NULL_TREE); + p = add_condition (summary, index, size, NULL, CHANGED, NULL_TREE); else continue; } @@ -3300,7 +3324,8 @@ remap_predicate (struct inline_summary *info, ap.by_ref = c->by_ref; cond_predicate = add_condition (info, operand_map[c->operand_num], - &ap, c->code, c->val); + c->size, &ap, c->code, + c->val); } } /* Fixed conditions remains same, construct single @@ -4119,6 +4144,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, { struct condition c; c.operand_num = streamer_read_uhwi (&ib); + c.size = streamer_read_uhwi (&ib); c.code = (enum tree_code) streamer_read_uhwi (&ib); c.val = stream_read_tree (&ib, data_in); bp = streamer_read_bitpack (&ib); @@ -4280,6 +4306,7 @@ inline_write_summary (void) for (i = 0; vec_safe_iterate (info->conds, i, &c); i++) { streamer_write_uhwi (ob, c->operand_num); + streamer_write_uhwi (ob, c->size); streamer_write_uhwi (ob, c->code); stream_write_tree (ob, c->val, true); bp = bitpack_create (ob->main_stream); diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h index 7860dec2fa4..110ed4f94d8 100644 --- a/gcc/ipa-inline.h +++ b/gcc/ipa-inline.h @@ -32,6 +32,8 @@ struct GTY(()) condition /* If agg_contents is set, this is the offset from which the used data was loaded. */ HOST_WIDE_INT offset; + /* Size of the access reading the data (or the PARM_DECL SSA_NAME). */ + HOST_WIDE_INT size; tree val; int operand_num; ENUM_BITFIELD(tree_code) code : 16; diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index c3890f74bfb..16afa2a610c 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -971,10 +971,10 @@ ipa_load_from_parm_agg_1 (vec<ipa_param_descriptor> descriptors, bool ipa_load_from_parm_agg (struct ipa_node_params *info, gimple stmt, tree op, int *index_p, HOST_WIDE_INT *offset_p, - bool *by_ref_p) + HOST_WIDE_INT *size_p, bool *by_ref_p) { return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p, - offset_p, NULL, by_ref_p); + offset_p, size_p, by_ref_p); } /* Given that an actual argument is an SSA_NAME (given in NAME) and is a result @@ -1374,6 +1374,9 @@ determine_known_aggregate_parts (gimple call, tree arg, tree arg_type, bool check_ref, by_ref; ao_ref r; + if (PARAM_VALUE (PARAM_IPA_MAX_AGG_ITEMS) == 0) + return; + /* The function operates in three stages. First, we prepare check_ref, r, arg_base and arg_offset based on what is actually passed as an actual argument. */ diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 70185b2f4ac..5b3e8cd6e8f 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -594,7 +594,7 @@ void ipa_analyze_node (struct cgraph_node *); tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *, HOST_WIDE_INT, bool); bool ipa_load_from_parm_agg (struct ipa_node_params *, gimple, tree, int *, - HOST_WIDE_INT *, bool *); + HOST_WIDE_INT *, HOST_WIDE_INT *, bool *); /* Debugging interface. */ void ipa_print_node_params (FILE *, struct cgraph_node *node); diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 643bbe9a08b..b13a87c5872 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -2277,7 +2277,7 @@ mark_loops_for_removal (void) ); } qsort (sorted_loops, n, sizeof (ira_loop_tree_node_t), loop_compare_func); - for (i = 0; n - i + 1 > IRA_MAX_LOOPS_NUM; i++) + for (i = 0; i < n - IRA_MAX_LOOPS_NUM; i++) { sorted_loops[i]->to_remove_p = true; if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index d2677bed98d..9321534574d 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 51b1903cc05..62a5fe0c698 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -141,7 +141,7 @@ along with GCC; see the file COPYING3. If not see #define LTO_SECTION_NAME_PREFIX ".gnu.lto_" #define LTO_major_version 3 -#define LTO_minor_version 0 +#define LTO_minor_version 1 typedef unsigned char lto_decl_flags_t; diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index bf67693d8fc..39945c966e2 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index ee722a86573..befeed03e95 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index 1f3f9065b68..1ba0cb619a0 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 8b27a4570bd..6d1218d3f0a 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -8234,9 +8234,15 @@ expand_omp_target (struct omp_region *region) make_edge (else_bb, new_bb, EDGE_FALLTHRU); device = tmp_var; + gsi = gsi_last_bb (new_bb); + } + else + { + gsi = gsi_last_bb (new_bb); + device = force_gimple_operand_gsi (&gsi, device, true, NULL_TREE, + true, GSI_SAME_STMT); } - gsi = gsi_last_bb (new_bb); t = gimple_omp_target_data_arg (entry_stmt); if (t == NULL) { diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 37387203bba..547ece9873a 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/gcc/rtl.h b/gcc/rtl.h index f1cda4c04b5..722ec796b3e 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2712,6 +2712,8 @@ extern int anti_dependence (const_rtx, const_rtx); extern int canon_anti_dependence (const_rtx, bool, const_rtx, enum machine_mode, rtx); extern int output_dependence (const_rtx, const_rtx); +extern int canon_output_dependence (const_rtx, bool, + const_rtx, machine_mode, rtx); extern int may_alias_p (const_rtx, const_rtx); extern void init_alias_target (void); extern void init_alias_analysis (void); diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index dc87187459e..1c7f0fbf0fb 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -2714,9 +2714,12 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn) return; } - /* Force pending stores to memory in case a trap handler needs them. */ + /* Force pending stores to memory in case a trap handler needs them. + Also force pending loads from memory; loads and stores can segfault + and the signal handler won't be triggered if the trap insn was moved + above load or store insn. */ case TRAP_IF: - flush_pending_lists (deps, insn, true, false); + flush_pending_lists (deps, insn, true, true); break; case PREFETCH: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad59aa11ed3..19bcfd04416 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,234 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org> + + Backport from trunk: + PR fortran/70842 + * gfortran.dg/select_type_35.f03: New test. + +2016-07-20 Jakub Jelinek <jakub@redhat.com> + + PR c++/71909 + * g++.dg/parse/pr71909.C: New test. + * g++.dg/tm/pr71909.C: New test. + +2016-07-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71874 + * g++.dg/torture/pr71874.C: New test. + +2016-07-19 Martin Jambor <mjambor@suse.cz> + + PR fortran/71688 + * gfortran.dg/pr71688.f90: New test. + +2016-07-19 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-07-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/71871 + * g++.dg/ext/vector31.C: New test. + + 2016-07-11 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71758 + * c-c++-common/gomp/pr71758.c: New test. + * gfortran.dg/gomp/pr71758.f90: New test. + +2016-07-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk: + PR fortran/71764 + * gfortran.dg/pr71764.f90: New test. + +2016-07-08 Martin Liska <mliska@suse.cz> + + Backported from mainline + 2016-07-08 Martin Liska <mliska@suse.cz> + + * gcc.dg/torture/pr71606.c: New test. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-06-30 Jakub Jelinek <jakub@redhat.com> + + PR fortran/71704 + * gfortran.dg/gomp/pr71704.f90: New test. + + PR fortran/71705 + * gfortran.dg/gomp/pr71705.f90: New test. + + 2016-06-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71626 + * gcc.c-torture/execute/pr71626-1.c: New test. + * gcc.c-torture/execute/pr71626-2.c: New test. + + 2016-06-21 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/71588 + * gcc.dg/pr71558.c: New test. + + 2016-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71494 + * gcc.c-torture/execute/pr71494.c: New test. + + 2016-03-29 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/70429 + * gcc.c-torture/execute/pr70429.c: New test. + + 2016-03-15 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/70222 + * gcc.c-torture/execute/pr70222-1.c: New test. + * gcc.c-torture/execute/pr70222-2.c: New test. + + 2016-03-11 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/70169 + * gcc.dg/pr70169.c: New test. + + 2016-03-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/70152 + * gcc.dg/pr70152.c: New test. + + 2016-02-26 Jakub Jelinek <jakub@redhat.com> + Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/69891 + * gcc.target/i386/pr69891.c: New test. + + 2016-02-19 Jakub Jelinek <jakub@redhat.com> + + PR c++/67767 + * g++.dg/cpp0x/pr67767.C: New test. + + 2016-02-16 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/69802 + * gcc.dg/pr69802.c: New test. + + 2016-02-15 Jakub Jelinek <jakub@redhat.com> + + PR c++/69797 + * c-c++-common/pr69797.c: New test. + + 2016-03-02 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/70022 + * gcc.dg/pr70022.c: Add -w -Wno-psabi to dg-options. + + 2014-12-12 Richard Biener <rguenther@suse.de> + + PR middle-end/64280 + * g++.dg/torture/pr64280.C: New testcase. + +2016-07-07 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-04-04 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/70484 + * gcc.dg/torture/pr70484.c: New testcase. + + 2016-06-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/71452 + * gcc.dg/torture/pr71452.c: New testcase. + + 2016-05-06 Richard Biener <rguenther@suse.de> + + PR middle-end/70931 + * gfortran.dg/pr70931.f90: New testcase. + + 2016-03-01 Richard Biener <rguenther@suse.de> + + PR middle-end/70022 + * gcc.dg/pr70022.c: New testcase. + +2016-06-30 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71693 + * gcc.c-torture/compile/pr71693.c: New test. + +2016-06-20 Georg-Johann Lay <avr@gjlay.de> + Pitchumani Sivanupandi <pitchumani.s@atmel.com> + + Backport from 2016-06-20 trunk r237589, r236558. + + PR target/71103 + * gcc.target/avr/pr71103.c: New test. + * gcc.target/avr/torture/pr71103-2.c: New test. + +2016-06-07 Uros Bizjak <ubizjak@gmail.com> + + PR target/71389 + * g++.dg/pr71389.C: New test. + +2016-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk. + PR fortran/66461 + * gfortran.dg/unexpected_eof.f: New test + +2016-05-22 Iain Sandoe <iain@codesourcery.com> + Dominique d'Humieres <dominiq@lps.ens.fr> + + Backport from mainline + 2015-12-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR target/67973 + + * lib/target-supports.exp (check_effective_target_stabs): New proc. + * g++.dg/cpp0x/alias-decl-debug-0.C: Restrict to stabs targets. + * g++.dg/other/PR23205.C: Likewise. + * g++.dg/other/pr23205-2.C: Likewise. + * gcc.dg/20040813-1.c: Likewise. + * gcc.dg/darwin-20040809-2.c: Likewise. + * objc.dg/stabs-1.m: Likewise. + +2016-05-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2016-05-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/70809 + * gcc.target/aarch64/pr70809_1.c: New test. + +2016-05-19 Martin Jambor <mjambor@suse.cz> + + PR ipa/70646 + * gcc.dg/ipa/pr70646.c: New test. + +2016-05-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-05-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/pr70963.c: Require at least power8 at both + compile and run time. + +2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/70963 + * gcc.target/powerpc/pr70963.c: New. + +2016-05-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk. + PR libgfortran/70684 + * gfortran.dg/list_read_14.f90: New test. + 2016-04-28 Jakub Jelinek <jakub@redhat.com> PR target/70858 diff --git a/gcc/testsuite/c-c++-common/gomp/pr71758.c b/gcc/testsuite/c-c++-common/gomp/pr71758.c new file mode 100644 index 00000000000..d3c86972ef5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr71758.c @@ -0,0 +1,10 @@ +/* PR middle-end/71758 */ + +void +foo (int *p) +{ + long long i = 0; + #pragma omp target device (i) + ; + #pragma omp target update device (i) to (p[0]) +} diff --git a/gcc/testsuite/c-c++-common/pr69797.c b/gcc/testsuite/c-c++-common/pr69797.c new file mode 100644 index 00000000000..fe2d4304c34 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr69797.c @@ -0,0 +1,8 @@ +/* PR c++/69797 */ +/* { dg-do compile } */ + +void +foo () +{ + __atomic_fetch_add (); /* { dg-error "too few arguments to function" } */ +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C index 524216ad5c0..8464aa35a1a 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C @@ -1,6 +1,5 @@ // Origin: PR c++/51032 -// { dg-do compile { target c++11 } } -// { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* nios2-*-* } { "*" } { "" } } +// { dg-do compile { target { c++11 && stabs } } } // { dg-options "-gstabs+" } template <class C> diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C new file mode 100644 index 00000000000..d63f1cc630f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C @@ -0,0 +1,17 @@ +// PR c++/70505 +// { dg-do compile { target c++11 } } + +template <class X> +struct s +{ + template <class T> + static constexpr T f1(const T x) {return x;} + template <class T, T = f1<T>(sizeof(T))> + static constexpr T f2(const T x) {return x;} + static void f() {s<int>::f2(42);} +}; + +int main() +{ + s<int>::f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce3.C new file mode 100644 index 00000000000..68ac29c9eac --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce3.C @@ -0,0 +1,15 @@ +// PR c++/69223 +// { dg-do compile { target c++11 } } + +template <class T> struct A +{ + T x[20]; +}; + +int main() +{ + auto l = [](const A<int>& i){ return i; }; + A<int> a; + + l(a); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr67767.C b/gcc/testsuite/g++.dg/cpp0x/pr67767.C new file mode 100644 index 00000000000..fd4ae2d3f35 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr67767.C @@ -0,0 +1,10 @@ +// PR c++/67767 +// { dg-do compile { target c++11 } } +// { dg-options "-Wsuggest-attribute=noreturn" } + +void foo [[gnu::cold, gnu::noreturn]] (); + +void foo () // { dg-bogus "function might be candidate for attribute" } +{ + throw 1; +} diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C index 606a5cec618..0d1c7f7d38d 100644 --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C @@ -55,10 +55,10 @@ # error "__cpp_attributes != 200809" #endif -#ifndef __cpp_rvalue_reference -# error "__cpp_rvalue_reference" -#elif __cpp_rvalue_reference != 200610 -# error "__cpp_rvalue_reference != 200610" +#ifndef __cpp_rvalue_references +# error "__cpp_rvalue_references" +#elif __cpp_rvalue_references != 200610 +# error "__cpp_rvalue_references != 200610" #endif #ifndef __cpp_variadic_templates diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C index 8a05f666064..d82c365fadd 100644 --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C @@ -57,10 +57,10 @@ # error "__cpp_attributes != 200809" #endif -#ifndef __cpp_rvalue_reference -# error "__cpp_rvalue_reference" -#elif __cpp_rvalue_reference != 200610 -# error "__cpp_rvalue_reference != 200610" +#ifndef __cpp_rvalue_references +# error "__cpp_rvalue_references" +#elif __cpp_rvalue_references != 200610 +# error "__cpp_rvalue_references != 200610" #endif #ifndef __cpp_variadic_templates diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C index b99b57efe0e..a2de19e1028 100644 --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C @@ -41,8 +41,8 @@ # error "__cpp_attributes" // { dg-error "error" } #endif -#ifndef __cpp_rvalue_reference -# error "__cpp_rvalue_reference" // { dg-error "error" } +#ifndef __cpp_rvalue_references +# error "__cpp_rvalue_references" // { dg-error "error" } #endif #ifndef __cpp_variadic_templates diff --git a/gcc/testsuite/g++.dg/ext/vector31.C b/gcc/testsuite/g++.dg/ext/vector31.C new file mode 100644 index 00000000000..a0568394315 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector31.C @@ -0,0 +1,29 @@ +// PR c++/71871 +// { dg-do compile } + +typedef unsigned int V __attribute__ ((__vector_size__ (32))); + +template <int N> +void +foo (V *x) +{ + V a = *x; + a = a ? a : -1; + *x = a; +} + +template <typename T> +void +bar (T *x) +{ + T a = *x; + a = a ? a : -1; + *x = a; +} + +void +test (V *x, V *y) +{ + foo<0> (x); + bar<V> (y); +} diff --git a/gcc/testsuite/g++.dg/init/elide5.C b/gcc/testsuite/g++.dg/init/elide5.C new file mode 100644 index 00000000000..0a9978ca661 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/elide5.C @@ -0,0 +1,27 @@ +// PR c++/71913 +// { dg-do link { target c++11 } } + +void* operator new(unsigned long, void* p) { return p; } + +struct IndirectReturn { + IndirectReturn() {} + // Undefined so we get a link error if the indirect return value is copied + IndirectReturn(const IndirectReturn&); + IndirectReturn& operator=(const IndirectReturn&) = delete; + ~IndirectReturn() {} +}; + +IndirectReturn foo() { return IndirectReturn(); } + +void bar(void* ptr) { + new (ptr) IndirectReturn(foo()); +} + +alignas (alignof (IndirectReturn)) +unsigned char c[sizeof(IndirectReturn)]; + +int main() +{ + bar(c); +} + diff --git a/gcc/testsuite/g++.dg/other/PR23205.C b/gcc/testsuite/g++.dg/other/PR23205.C index b05087b5420..65ba1f6f306 100644 --- a/gcc/testsuite/g++.dg/other/PR23205.C +++ b/gcc/testsuite/g++.dg/other/PR23205.C @@ -1,5 +1,4 @@ -/* { dg-do compile } */ -/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* nios2-*-* tile*-*-* *-*-vxworks } { "*" } { "" } } */ +/* { dg-do compile { target stabs } } */ /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types" } */ const int foobar = 4; diff --git a/gcc/testsuite/g++.dg/other/pr23205-2.C b/gcc/testsuite/g++.dg/other/pr23205-2.C index c7eefaa58c9..7b25c071a67 100644 --- a/gcc/testsuite/g++.dg/other/pr23205-2.C +++ b/gcc/testsuite/g++.dg/other/pr23205-2.C @@ -1,5 +1,4 @@ -/* { dg-do compile } */ -/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* } { "*" } { "" } } */ +/* { dg-do compile { target stabs } } */ /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -ftoplevel-reorder" } */ const int foobar = 4; diff --git a/gcc/testsuite/g++.dg/parse/pr71909.C b/gcc/testsuite/g++.dg/parse/pr71909.C new file mode 100644 index 00000000000..ee592bf8e2b --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr71909.C @@ -0,0 +1,22 @@ +// PR c++/71909 +// { dg-do compile } + +struct S +{ + S () try : m (0) {} + catch (...) {} + void foo () try {} + catch (int) {} + catch (...) {} + int m; +}; + +struct T +{ + T () : m (0) {} + catch (...) {} // { dg-error "expected unqualified-id before" } + void foo () {} + catch (int) {} // { dg-error "expected unqualified-id before" } + catch (...) {} // { dg-error "expected unqualified-id before" } + int m; +}; diff --git a/gcc/testsuite/g++.dg/pr71389.C b/gcc/testsuite/g++.dg/pr71389.C new file mode 100644 index 00000000000..023abe1755c --- /dev/null +++ b/gcc/testsuite/g++.dg/pr71389.C @@ -0,0 +1,23 @@ +// { dg-do compile { target i?86-*-* x86_64-*-* } } +// { dg-options "-std=c++11 -O3 -march=ivybridge" } + +#include <functional> + +extern int le_s6, le_s9, le_s11; +long foo_v14[16][16]; + +void fn1() { + std::array<std::array<int, 16>, 16> v13; + for (; le_s6;) + for (int k1 = 2; k1 < 4; k1 = k1 + 1) { + for (int n1 = 0; n1 < le_s9; n1 = 8) { + *foo_v14[6] = 20923310; + for (int i2 = n1; i2 < n1 + 8; i2 = i2 + 1) + v13.at(5).at(i2 + 6 - n1) = 306146921; + } + + for (int l2 = 0; l2 < le_s11; l2 = l2 + 1) + *(l2 + v13.at(5).begin()) = 306146921; + } + v13.at(le_s6 - 4); +} diff --git a/gcc/testsuite/g++.dg/tm/pr71909.C b/gcc/testsuite/g++.dg/tm/pr71909.C new file mode 100644 index 00000000000..941f2315170 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr71909.C @@ -0,0 +1,18 @@ +// PR c++/71909 +// { dg-do compile { target c++11 } } +// { dg-options "-fgnu-tm" } + +struct S +{ + S () __transaction_atomic [[outer]] try : m {0} {} catch (int) {} catch (...) {} + int m; +}; + +struct T +{ + T () __transaction_atomic __attribute__((outer)) try : m {0} {} catch (int) {} catch (...) {} + int m; +}; + +void foo () __transaction_atomic [[outer]] try {} catch (int) {} catch (...) {} +void bar () __transaction_atomic __attribute__((outer)) try {} catch (int) {} catch (...) {} diff --git a/gcc/testsuite/g++.dg/torture/pr64280.C b/gcc/testsuite/g++.dg/torture/pr64280.C new file mode 100644 index 00000000000..6ea31481bd5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr64280.C @@ -0,0 +1,42 @@ +// { dg-do compile } + +class A +{ +public: + A (); +}; +class B +{ +public: + B (int); + operator void *() { return m_fn1 () ? 0 : this; } + int m_fn1 (); +}; +typedef int jmp_buf[]; +struct C +{ + jmp_buf cond_; +}; +class F +{ + C what_; + bool m_fn2 (); +}; +int _setjmp (int[]); +void longjmp (); +class D +{ +public: + D () { longjmp (); } +}; +bool +F::m_fn2 () +{ + B a (0); + if (a) + if (_setjmp (what_.cond_)) + return 0; + else + D (); + A b; +} diff --git a/gcc/testsuite/g++.dg/torture/pr71452.C b/gcc/testsuite/g++.dg/torture/pr71452.C new file mode 100644 index 00000000000..3ebe3a176f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr71452.C @@ -0,0 +1,10 @@ +// { dg-do run } + +int main() +{ + bool b; + *(char *)&b = 123; + if (*(char *)&b != 123) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/torture/pr71874.C b/gcc/testsuite/g++.dg/torture/pr71874.C new file mode 100644 index 00000000000..d9b4e2f8849 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr71874.C @@ -0,0 +1,12 @@ +// PR middle-end/71874 +// { dg-do run } + +int +main () +{ + char str[] = "abcdefghijklmnopqrstuvwxyzABCDEF"; + __builtin_memmove (str + 20, str + 15, 11); + if (__builtin_strcmp (str, "abcdefghijklmnopqrstpqrstuvwxyzF") != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71693.c b/gcc/testsuite/gcc.c-torture/compile/pr71693.c new file mode 100644 index 00000000000..fc9249c922c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr71693.c @@ -0,0 +1,10 @@ +/* PR middle-end/71693 */ + +unsigned short v; + +void +foo (int x) +{ + v = ((((unsigned short) (0x0001 | (x & 0x0070) | 0x0100) & 0x00ffU) << 8) + | (((unsigned short) (0x0001 | (x & 0x0070) | 0x0100) >> 8) & 0x00ffU)); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70222-1.c b/gcc/testsuite/gcc.c-torture/execute/pr70222-1.c new file mode 100644 index 00000000000..d79672e7fb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr70222-1.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/70222 */ + +int a = 1; +unsigned int b = 2; +int c = 0; +int d = 0; + +void +foo () +{ + int e = ((-(c >= c)) < b) > ((int) (-1ULL >> ((a / a) * 15))); + d = -e; +} + +__attribute__((noinline, noclone)) void +bar (int x) +{ + if (x != -1) + __builtin_abort (); +} + +int +main () +{ +#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 + foo (); + bar (d); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70222-2.c b/gcc/testsuite/gcc.c-torture/execute/pr70222-2.c new file mode 100644 index 00000000000..7611c986a9b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr70222-2.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/70222 */ + +#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 +__attribute__((noinline, noclone)) unsigned int +foo (int x) +{ + unsigned long long y = -1ULL >> x; + return (unsigned int) y >> 31; +} +#endif + +int +main () +{ +#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 + if (foo (15) != 1 || foo (32) != 1 || foo (33) != 0) + __builtin_abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70429.c b/gcc/testsuite/gcc.c-torture/execute/pr70429.c new file mode 100644 index 00000000000..6b08c8ead08 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr70429.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/70429 */ + +__attribute__((noinline, noclone)) int +foo (int a) +{ + return (int) (0x14ff6e2207db5d1fLL >> a) >> 4; +} + +int +main () +{ + if (sizeof (int) != 4 || sizeof (long long) != 8 || __CHAR_BIT__ != 8) + return 0; + if (foo (1) != 0x3edae8 || foo (2) != -132158092) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71494.c b/gcc/testsuite/gcc.c-torture/execute/pr71494.c new file mode 100644 index 00000000000..f962f2c2e21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71494.c @@ -0,0 +1,22 @@ +/* PR middle-end/71494 */ + +int +main () +{ + void *label = &&out; + int i = 0; + void test (void) + { + label = &&out2; + goto *label; + out2:; + i++; + } + goto *label; + out: + i += 2; + test (); + if (i != 3) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71626-1.c b/gcc/testsuite/gcc.c-torture/execute/pr71626-1.c new file mode 100644 index 00000000000..26cfa9650e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71626-1.c @@ -0,0 +1,19 @@ +/* PR middle-end/71626 */ + +typedef __INTPTR_TYPE__ V __attribute__((__vector_size__(sizeof (__INTPTR_TYPE__)))); + +__attribute__((noinline, noclone)) V +foo () +{ + V v = { (__INTPTR_TYPE__) foo }; + return v; +} + +int +main () +{ + V v = foo (); + if (v[0] != (__INTPTR_TYPE__) foo) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71626-2.c b/gcc/testsuite/gcc.c-torture/execute/pr71626-2.c new file mode 100644 index 00000000000..4a27c54fbf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71626-2.c @@ -0,0 +1,4 @@ +/* PR middle-end/71626 */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +#include "pr71626-1.c" diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c index 8be831d96b6..9cf664dd769 100644 --- a/gcc/testsuite/gcc.dg/20040813-1.c +++ b/gcc/testsuite/gcc.dg/20040813-1.c @@ -1,8 +1,7 @@ /* Test lang in N_SO stab. */ /* Contributed by Devang Patel <dpatel@apple.com> */ -/* { dg-do compile } */ -/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* *-*-vxworks* } { "*" } { "" } } */ +/* { dg-do compile { target stabs } } */ /* { dg-options "-gstabs" } */ int diff --git a/gcc/testsuite/gcc.dg/darwin-20040809-2.c b/gcc/testsuite/gcc.dg/darwin-20040809-2.c index a38f75f26b7..98d571276d0 100644 --- a/gcc/testsuite/gcc.dg/darwin-20040809-2.c +++ b/gcc/testsuite/gcc.dg/darwin-20040809-2.c @@ -1,7 +1,7 @@ /* Test dead code strip support. */ /* Contributed by Devang Patel <dpatel@apple.com> */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile { target { *-*-darwin* && stabs } } } */ /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-symbols" } */ int diff --git a/gcc/testsuite/gcc.dg/ipa/pr70646.c b/gcc/testsuite/gcc.dg/ipa/pr70646.c new file mode 100644 index 00000000000..f85816e7303 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr70646.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#pragma GCC optimize("no-unit-at-a-time") + +typedef unsigned char u8; +typedef unsigned long long u64; + +static inline __attribute__((always_inline)) u64 __swab64p(const u64 *p) +{ + return (__builtin_constant_p((u64)(*p)) ? ((u64)( (((u64)(*p) & (u64)0x00000000000000ffULL) << 56) | (((u64)(*p) & (u64)0x000000000000ff00ULL) << 40) | (((u64)(*p) & (u64)0x0000000000ff0000ULL) << 24) | (((u64)(*p) & (u64)0x00000000ff000000ULL) << 8) | (((u64)(*p) & (u64)0x000000ff00000000ULL) >> 8) | (((u64)(*p) & (u64)0x0000ff0000000000ULL) >> 24) | (((u64)(*p) & (u64)0x00ff000000000000ULL) >> 40) | (((u64)(*p) & (u64)0xff00000000000000ULL) >> 56))) : __builtin_bswap64(*p)); +} + +static inline u64 wwn_to_u64(void *wwn) +{ + return __swab64p(wwn); +} + +void __attribute__((noinline,noclone)) broken(u64* shost) +{ + u8 node_name[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + *shost = wwn_to_u64(node_name); +} + +void __attribute__((noinline,noclone)) dummy(void) +{ + __builtin_abort(); +} + +int main(int argc, char* argv[]) +{ + u64 v; + + broken(&v); + + if(v != (u64)-1) + __builtin_abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr69802.c b/gcc/testsuite/gcc.dg/pr69802.c new file mode 100644 index 00000000000..27ee02f36b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69802.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/69802 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall" } */ + +struct S { unsigned f : 1; }; +int a, d; + +int +foo (void) +{ + unsigned b = 0; + struct S c; + d = ((1 && b) < c.f) & c.f; /* { dg-warning "is used uninitialized" } */ + return a; +} + +int +bar (_Bool c) +{ + unsigned b = 0; + d = ((1 && b) < c) & c; + return a; +} diff --git a/gcc/testsuite/gcc.dg/pr70022.c b/gcc/testsuite/gcc.dg/pr70022.c new file mode 100644 index 00000000000..30eb7ece250 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70022.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-w -Wno-psabi" } */ + +typedef int v4si __attribute__ ((vector_size (16))); + +int +foo (v4si v) +{ + return v[~0UL]; +} diff --git a/gcc/testsuite/gcc.dg/pr70152.c b/gcc/testsuite/gcc.dg/pr70152.c new file mode 100644 index 00000000000..27a092d199a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70152.c @@ -0,0 +1,27 @@ +/* PR tree-optimization/70152 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int a; +int foo (void); +int setjmp (char *); +char buf[64]; + +static int +bar (int x) +{ + x = 0; + setjmp (buf); + for (;;) + { + switch (x) + case 5: + x = foo (); + } +} + +void +baz (void) +{ + bar (a); +} diff --git a/gcc/testsuite/gcc.dg/pr70169.c b/gcc/testsuite/gcc.dg/pr70169.c new file mode 100644 index 00000000000..8d08f5c6472 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70169.c @@ -0,0 +1,40 @@ +/* PR tree-optimization/70169 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing -fno-tree-dce" } */ + +int printf (const char *, ...); + +void +foo () +{ + unsigned char *p = (unsigned char *) &printf; + for (;;) + (*p)++; +} + +void +bar (int x) +{ + unsigned char *p = (unsigned char *) &printf; + int i; + for (i = 0; i < x; i++) + (*p)++; +} + +void +baz (int x, int y) +{ + unsigned char *p = (unsigned char *) &&lab; + int i; + if (y) + { + for (i = 0; i < x; i++) + (*p)++; + } + else + { + lab: + asm volatile (""); + foo (); + } +} diff --git a/gcc/testsuite/gcc.dg/pr71558.c b/gcc/testsuite/gcc.dg/pr71558.c new file mode 100644 index 00000000000..33a648e108c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr71558.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/71588 */ + +/* strcpy must not be pure, but make sure we don't ICE even when + it is declared incorrectly. */ +char *strcpy (char *, const char *) __attribute__ ((__pure__)); +__SIZE_TYPE__ strlen (const char *); +void *malloc (__SIZE_TYPE__); + +char a[20]; + +char * +foo (void) +{ + __SIZE_TYPE__ b = strlen (a); + char *c = malloc (b); + return strcpy (c, a); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70484.c b/gcc/testsuite/gcc.dg/torture/pr70484.c new file mode 100644 index 00000000000..7604c654fbe --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70484.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ + +extern void abort (void); + +int __attribute__((noinline,noclone)) +f(int *pi, long *pl) +{ + *pi = 1; + *pl = 0; + return *(char *)pi; +} + +int main() +{ + union { long l; int i; } a; + if (f (&a.i, &a.l) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr71452.c b/gcc/testsuite/gcc.dg/torture/pr71452.c new file mode 100644 index 00000000000..8948d39fdaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr71452.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ + +int main() +{ + _Bool b; + *(char *)&b = 123; + if (*(char *)&b != 123) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr71606.c b/gcc/testsuite/gcc.dg/torture/pr71606.c new file mode 100644 index 00000000000..b0cc26ac771 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr71606.c @@ -0,0 +1,11 @@ +_Complex a; +void fn1 (); + +int main () { + fn1 (a); + return 0; +} + +void fn1 (__complex__ long double p1) { + __imag__ p1 = 6.0L; +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr70809_1.c b/gcc/testsuite/gcc.target/aarch64/pr70809_1.c new file mode 100644 index 00000000000..2e1bbf4b090 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr70809_1.c @@ -0,0 +1,18 @@ +/* PR target/70809. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -ffp-contract=off -mtune=generic" } */ + +/* Check that vector FMLS is not generated when contraction is disabled. */ + +void +foo (float *__restrict__ __attribute__ ((aligned (16))) a, + float *__restrict__ __attribute__ ((aligned (16))) x, + float *__restrict__ __attribute__ ((aligned (16))) y, + float *__restrict__ __attribute__ ((aligned (16))) z) +{ + unsigned i = 0; + for (i = 0; i < 256; i++) + a[i] = x[i] - (y[i] * z[i]); +} + +/* { dg-final { scan-assembler-not "fmls\tv.*" } } */ diff --git a/gcc/testsuite/gcc.target/avr/pr71103.c b/gcc/testsuite/gcc.target/avr/pr71103.c new file mode 100644 index 00000000000..43244d15e97 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr71103.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +struct ResponseStruct{ + unsigned char responseLength; + char *response; +}; + +static char response[5]; +struct ResponseStruct something(){ + struct ResponseStruct returnValue; + returnValue.responseLength = 5; + returnValue.response = response; + return returnValue; +} + diff --git a/gcc/testsuite/gcc.target/avr/torture/pr71103-2.c b/gcc/testsuite/gcc.target/avr/torture/pr71103-2.c new file mode 100644 index 00000000000..480ad05acab --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr71103-2.c @@ -0,0 +1,118 @@ +/* Use -g0 so that this test case doesn't just fail because + of PR52472. */ + +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -g0" } */ + +struct S12 +{ + char c; + const char *p; +}; + +struct S12f +{ + char c; + struct S12f (*f)(void); +}; + +struct S12labl +{ + char c; + void **labl; +}; + +struct S121 +{ + char c; + const char *p; + char d; +}; + +const char str[5] = "abcd"; + +struct S12 test_S12_0 (void) +{ + struct S12 s; + s.c = 'A'; + s.p = str; + return s; +} + +struct S12 test_S12_4 (void) +{ + struct S12 s; + s.c = 'A'; + s.p = str + 4; + return s; +} + +struct S12f test_S12f (void) +{ + struct S12f s; + s.c = 'A'; + s.f = test_S12f; + return s; +} + +struct S121 test_S121 (void) +{ + struct S121 s; + s.c = 'c'; + s.p = str + 4; + s.d = 'd'; + return s; +} + +extern void use_S12lab (struct S12labl*); + +struct S12labl test_S12lab (void) +{ + struct S12labl s; +labl:; + s.c = 'A'; + s.labl = &&labl; + return s; +} + +#ifdef __MEMX + +struct S13 +{ + char c; + const __memx char *p; +}; + +const __memx char str_x[] = "abcd"; + +struct S13 test_S13_0 (void) +{ + struct S13 s; + s.c = 'A'; + s.p = str_x; + return s; +} + +struct S13 test_S13_4a (void) +{ + struct S13 s; + s.c = 'A'; + s.p = str_x + 4; + return s; +} + +#ifdef __FLASH1 + +const __flash1 char str_1[] = "abcd"; + +struct S13 test_13_4b (void) +{ + struct S13 s; + s.c = 'A'; + s.p = str_1 + 4; + return s; +} + +#endif /* have __flash1 */ +#endif /* have __memx */ + diff --git a/gcc/testsuite/gcc.target/i386/pr69891.c b/gcc/testsuite/gcc.target/i386/pr69891.c new file mode 100644 index 00000000000..2c5e86372e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr69891.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/69891 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-fre -mstringop-strategy=libcall -Wno-psabi" } */ +/* { dg-additional-options "-mno-sse" { target ia32 } } */ + +typedef unsigned short A; +typedef unsigned short B __attribute__ ((vector_size (32))); +typedef unsigned int C; +typedef unsigned int D __attribute__ ((vector_size (32))); +typedef unsigned long long E; +typedef unsigned long long F __attribute__ ((vector_size (32))); + +__attribute__((noinline, noclone)) unsigned +foo(D a, B b, D c, F d) +{ + b /= (B) {1, -c[0]} | 1; + c[0] |= 7; + a %= c | 1; + c ^= c; + return a[0] + b[15] + c[0] + d[3]; +} + +int +main () +{ + unsigned x = foo ((D) {}, (B) {}, (D) {}, (F) {}); + if (x != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr70963.c b/gcc/testsuite/gcc.target/powerpc/pr70963.c new file mode 100644 index 00000000000..128ebd9f09f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr70963.c @@ -0,0 +1,44 @@ +/* { dg-do run { target powerpc64*-*-* } } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8" } */ + +#include <stdlib.h> +#include <stdio.h> +#include <altivec.h> + +static int failed; +static void test (void); + +static void check (int result, const char *name) +{ + if (!result) + { + failed++; + printf ("fail %s\n", name); + } +} + +int main (void) +{ + test (); + if (failed) + abort (); + return 0; +} + +vector double x = { 81.0, 76.0 }; +vector long long y = { 81, 76 }; + +static void test() +{ + vector long long a = vec_cts (x, 0); + vector double b = vec_ctf (a, 0); + vector long long c = __builtin_vsx_xvcvdpuxds_scale (x, 0); + vector double d = vec_ctf (c, 0); + check (vec_all_eq (a, y), "vec_cts"); + check (vec_all_eq (b, x), "vec_ctf"); + check (vec_all_eq (c, y), "xvcvdpuxds"); + check (vec_all_eq (d, x), "vec_ctf unsigned"); +} diff --git a/gcc/testsuite/gfortran.dg/gomp/pr71704.f90 b/gcc/testsuite/gfortran.dg/gomp/pr71704.f90 new file mode 100644 index 00000000000..5c1c003ca57 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr71704.f90 @@ -0,0 +1,58 @@ +! PR fortran/71704 +! { dg-do compile } + +real function f0 () +!$omp declare simd (f0) + f0 = 1 +end + +real function f1 () +!$omp declare target (f1) + f1 = 1 +end + +real function f2 () +!$omp declare reduction (foo : integer : omp_out = omp_out + omp_in) & +!$omp & initializer (omp_priv = 0) + f2 = 1 +end + +real function f3 () + real, save :: t +!$omp threadprivate (t) + f3 = 1 +end + +real function f4 () +!$omp taskwait + f4 = 1 +end + +real function f5 () +!$omp barrier + f5 = 1 +end + +real function f6 () +!$omp parallel +!$omp end parallel + f6 = 1 +end + +real function f7 () +!$omp single +!$omp end single + f7 = 1 +end + +real function f8 () +!$omp critical +!$omp end critical + f8 = 1 +end + +real function f9 () +!$omp critical +!$omp end critical + f9 = 1 +end diff --git a/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 b/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 new file mode 100644 index 00000000000..4813aacfdc3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 @@ -0,0 +1,7 @@ +! PR fortran/71705 +! { dg-do compile } + + real :: x + x = 0.0 + !$omp target update to(x) +end diff --git a/gcc/testsuite/gfortran.dg/gomp/pr71758.f90 b/gcc/testsuite/gfortran.dg/gomp/pr71758.f90 new file mode 100644 index 00000000000..47215ba5cd9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr71758.f90 @@ -0,0 +1,10 @@ +! PR middle-end/71758 + +subroutine pr71758 (p) + integer(8) :: i + integer :: p(20) + i = 0 + !$omp target device(i) + !$omp end target + !$omp target update to(p(1:1)) device(i) +end subroutine diff --git a/gcc/testsuite/gfortran.dg/list_read_14.f90 b/gcc/testsuite/gfortran.dg/list_read_14.f90 new file mode 100644 index 00000000000..15bcfad500d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/list_read_14.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! PR70684 incorrect reading of values from file on Windows +program test +implicit none +integer,parameter :: isize=12 +integer,parameter :: funit=12 +integer :: i +character(1), parameter :: cr=char(13) +double precision, dimension(isize) :: a, res +res= (/ 1.0000000000000000, 2.0000000000000000, 3.0000000000000000, & + 4.0000000000000000, 5.0000000000000000, 6.0000000000000000, & + 7.0000000000000000, 8.0000000000000000, 9.0000000000000000, & + 10.000000000000000, 11.000000000000000, 12.000000000000000 /) +do i=1,isize + a(i)=dble(i) +enddo +open(funit,status="scratch") +write(funit,'(1x,6(f25.20,'',''),a)') (a(i),i=1,6), cr +write(funit,'(1x,6(f25.20,'',''),a)') (a(i),i=7,12), cr +rewind(funit) +a=0d0 +read(funit,*) (a(i),i=1,isize) +close(funit) +if (any(a /= res)) call abort +end diff --git a/gcc/testsuite/gfortran.dg/pr70931.f90 b/gcc/testsuite/gfortran.dg/pr70931.f90 new file mode 100644 index 00000000000..08ecd687752 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr70931.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! { dg-options "-g" } +program p + type t + integer :: a + integer :: b(0) + end type + type(t), parameter :: z = t(1, [2]) + print *, z +end diff --git a/gcc/testsuite/gfortran.dg/pr71688.f90 b/gcc/testsuite/gfortran.dg/pr71688.f90 new file mode 100644 index 00000000000..dbb6d185cf4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71688.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } + +program p + call s +contains + subroutine s + real :: x[*] = 1 + block + end block + x = 2 + end +end diff --git a/gcc/testsuite/gfortran.dg/pr71764.f90 b/gcc/testsuite/gfortran.dg/pr71764.f90 new file mode 100644 index 00000000000..48176f8297e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71764.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! PR71764 +program p + use iso_c_binding, only: c_ptr, c_null_ptr, c_ptr, c_associated, c_loc + logical, target :: rls + real, target :: t = 3.14 + type(c_ptr) :: nullptr,c + real, pointer :: k + nullptr = c_null_ptr + c = nullptr + rls = c_associated(c) + if (rls) call abort + if (c_associated(c)) call abort + c = c_loc(rls) + if (.not. c_associated(c)) call abort + c = nullptr + if (c_associated(c)) call abort + c = c_loc(t) + k => t + call association_test(k, c) +contains + subroutine association_test(a,b) + use iso_c_binding, only: c_associated, c_loc, c_ptr + implicit none + real, pointer :: a + type(c_ptr) :: b + if(c_associated(b, c_loc(a))) then + return + else + call abort + end if + end subroutine association_test +end + diff --git a/gcc/testsuite/gfortran.dg/select_type_35.f03 b/gcc/testsuite/gfortran.dg/select_type_35.f03 new file mode 100644 index 00000000000..92d2f275313 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/select_type_35.f03 @@ -0,0 +1,41 @@ +! { dg-do run } +! +! Contributed by Nathanael Huebbe +! Check fix for PR/70842 + +program foo + + TYPE, ABSTRACT :: t_Intermediate + END TYPE t_Intermediate + + type, extends(t_Intermediate) :: t_Foo + character(:), allocatable :: string + end type t_Foo + + class(t_Foo), allocatable :: obj + + allocate(obj) + obj%string = "blabarfoo" + + call bar(obj) + + deallocate(obj) +contains + subroutine bar(me) + class(t_Intermediate), target :: me + + class(*), pointer :: alias + + select type(me) + type is(t_Foo) + if (len(me%string) /= 9) call abort() + end select + + alias => me + select type(alias) + type is(t_Foo) + if (len(alias%string) /= 9) call abort() + end select + end subroutine bar +end program foo + diff --git a/gcc/testsuite/gfortran.dg/unexpected_eof.f b/gcc/testsuite/gfortran.dg/unexpected_eof.f new file mode 100644 index 00000000000..d3cdb99596a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unexpected_eof.f @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR66461 ICE on missing end program in fixed source + program p + integer x(2) + x = -1 + if ( x(1) < 0 .or. + & x(2) < 0 ) print *, x +! { dg-error "Unexpected end of file" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 19c512f4eb9..04ef21ca7ea 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -804,6 +804,15 @@ proc check_effective_target_pthread {} { } "-pthread"] } +# Return 1 if compilation with -gstabs is error-free for trivial +# code, 0 otherwise. + +proc check_effective_target_stabs {} { + return [check_no_compiler_messages stabs object { + void foo (void) { } + } "-gstabs"] +} + # Return 1 if compilation with -mpe-aligned-commons is error-free # for trivial code, 0 otherwise. diff --git a/gcc/testsuite/objc.dg/stabs-1.m b/gcc/testsuite/objc.dg/stabs-1.m index e43f7d84aa4..452993ed916 100644 --- a/gcc/testsuite/objc.dg/stabs-1.m +++ b/gcc/testsuite/objc.dg/stabs-1.m @@ -1,8 +1,7 @@ /* Check if the final SO STABS record goes into the .text section. */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ -/* { dg-do compile } */ -/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */ +/* { dg-do compile { target stabs } } */ /* { dg-options "-gstabs" } */ @interface MyClass diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 1469d782f73..1dc22109902 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1719,7 +1719,8 @@ replace_uses_by (tree name, tree val) if (gimple_code (stmt) == GIMPLE_PHI) { e = gimple_phi_arg_edge (stmt, PHI_ARG_INDEX_FROM_USE (use)); - if (e->flags & EDGE_ABNORMAL) + if (e->flags & EDGE_ABNORMAL + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val)) { /* This can only occur for virtual operands, since for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 28753c16c89..5efbbc52695 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1313,7 +1313,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, { wi->val_only = true; wi->is_lhs = false; - *handled_ops_p = true; + *handled_ops_p = false; return NULL_TREE; } break; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 03209f4f2d0..3659ff38a0e 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4491,6 +4491,8 @@ replace_removed_params_ssa_names (tree old_name, gimple stmt, repl = get_replaced_param_substitute (adj); new_name = make_ssa_name (repl, stmt); + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_name) + = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (old_name); if (dump_file) { diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index e71519acf7b..aabca0f67e3 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -621,6 +621,8 @@ gen_lsm_tmp_name (tree ref) case SSA_NAME: case VAR_DECL: case PARM_DECL: + case FUNCTION_DECL: + case LABEL_DECL: name = get_name (ref); if (!name) name = "D"; @@ -636,11 +638,9 @@ gen_lsm_tmp_name (tree ref) break; case INTEGER_CST: + default: /* Nothing. */ break; - - default: - gcc_unreachable (); } } diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 60b4dae38a7..6bd52cca3d5 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2091,10 +2091,33 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange, tree tem = build_range_check (loc, optype, exp, in_p, low, high); enum warn_strict_overflow_code wc = WARN_STRICT_OVERFLOW_COMPARISON; gimple_stmt_iterator gsi; + unsigned int uid; if (tem == NULL_TREE) return false; + /* If op is default def SSA_NAME, there is no place to insert the + new comparison. Give up, unless we can use OP itself as the + range test. */ + if (op && SSA_NAME_IS_DEFAULT_DEF (op)) + { + if (op == range->exp + && ((TYPE_PRECISION (optype) == 1 && TYPE_UNSIGNED (optype)) + || TREE_CODE (optype) == BOOLEAN_TYPE) + && (op == tem + || (TREE_CODE (tem) == EQ_EXPR + && TREE_OPERAND (tem, 0) == op + && integer_onep (TREE_OPERAND (tem, 1)))) + && opcode != BIT_IOR_EXPR + && (opcode != ERROR_MARK || oe->rank != BIT_IOR_EXPR)) + { + stmt = NULL; + tem = op; + } + else + return false; + } + if (strict_overflow_p && issue_strict_overflow_warning (wc)) warning_at (loc, OPT_Wstrict_overflow, "assuming signed overflow does not occur " @@ -2128,11 +2151,22 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange, tem = invert_truthvalue_loc (loc, tem); tem = fold_convert_loc (loc, optype, tem); - gsi = gsi_for_stmt (stmt); + if (stmt) + { + gsi = gsi_for_stmt (stmt); + uid = gimple_uid (stmt); + } + else + { + gsi = gsi_none (); + uid = 0; + } + if (stmt == NULL) + gcc_checking_assert (tem == op); /* In rare cases range->exp can be equal to lhs of stmt. In that case we have to insert after the stmt rather then before it. */ - if (op == range->exp) + else if (op == range->exp) tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, false, GSI_CONTINUE_LINKING); else @@ -2145,7 +2179,7 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange, if (gimple_uid (gsi_stmt (gsi))) break; else - gimple_set_uid (gsi_stmt (gsi), gimple_uid (stmt)); + gimple_set_uid (gsi_stmt (gsi), uid); oe->op = tem; range->exp = exp; diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 8d99a31d5df..bd6cbe82e82 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -768,6 +768,49 @@ find_equal_ptrs (tree ptr, int idx) } } +/* Return true if STMT is a call to a builtin function with the right + arguments and attributes that should be considered for optimization + by this pass. */ + +static bool +valid_builtin_call (gimple stmt) +{ + if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)) + return false; + + tree callee = gimple_call_fndecl (stmt); + switch (DECL_FUNCTION_CODE (callee)) + { + case BUILT_IN_STRCHR: + case BUILT_IN_STRLEN: + /* The above functions should be pure. Punt if they aren't. */ + if (gimple_vdef (stmt) || gimple_vuse (stmt) == NULL_TREE) + return false; + break; + + case BUILT_IN_MEMCPY: + case BUILT_IN_MEMCPY_CHK: + case BUILT_IN_MEMPCPY: + case BUILT_IN_MEMPCPY_CHK: + case BUILT_IN_STPCPY: + case BUILT_IN_STPCPY_CHK: + case BUILT_IN_STRCAT: + case BUILT_IN_STRCAT_CHK: + case BUILT_IN_STRCPY: + case BUILT_IN_STRCPY_CHK: + /* The above functions should be neither const nor pure. Punt if they + aren't. */ + if (gimple_vdef (stmt) == NULL_TREE || gimple_vuse (stmt) == NULL_TREE) + return false; + break; + + default: + break; + } + + return true; +} + /* If the last .MEM setter statement before STMT is memcpy (x, y, strlen (y) + 1), the only .MEM use of it is STMT and STMT is known to overwrite x[strlen (x)], adjust the last memcpy to @@ -842,7 +885,7 @@ adjust_last_stmt (strinfo si, gimple stmt, bool is_strcat) return; } - if (!gimple_call_builtin_p (last.stmt, BUILT_IN_NORMAL)) + if (!valid_builtin_call (last.stmt)) return; callee = gimple_call_fndecl (last.stmt); @@ -1827,7 +1870,7 @@ strlen_optimize_stmt (gimple_stmt_iterator *gsi) if (is_gimple_call (stmt)) { tree callee = gimple_call_fndecl (stmt); - if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)) + if (valid_builtin_call (stmt)) switch (DECL_FUNCTION_CODE (callee)) { case BUILT_IN_STRLEN: diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 8ea1853fa89..3d3ffaa8982 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1380,6 +1380,14 @@ non_rewritable_lvalue_p (tree lhs) tree decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0); if (DECL_P (decl) && DECL_SIZE (decl) == TYPE_SIZE (TREE_TYPE (lhs)) + /* If the dynamic type of the decl has larger precision than + the decl itself we can't use the decls type for SSA rewriting. */ + && ((! INTEGRAL_TYPE_P (TREE_TYPE (decl)) + || compare_tree_int (DECL_SIZE (decl), + TYPE_PRECISION (TREE_TYPE (decl))) == 0) + || (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + && (TYPE_PRECISION (TREE_TYPE (decl)) + >= TYPE_PRECISION (TREE_TYPE (lhs))))) && (TREE_THIS_VOLATILE (decl) == TREE_THIS_VOLATILE (lhs))) return false; } diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 7e801838522..a298020c2fd 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2563,7 +2563,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) /* Sorting has ensured that DR_INIT (dra) <= DR_INIT (drb). */ HOST_WIDE_INT init_a = TREE_INT_CST_LOW (DR_INIT (dra)); HOST_WIDE_INT init_b = TREE_INT_CST_LOW (DR_INIT (drb)); - gcc_assert (init_a < init_b); + gcc_assert (init_a <= init_b); /* If init_b == init_a + the size of the type * k, we have an interleaving, and DRA is accessed before DRB. */ diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index 7d214030324..dd73453b103 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/include/ChangeLog b/include/ChangeLog index 59839bd5747..8941985f339 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,17 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-05-19 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-11-27 Pedro Alves <palves@redhat.com> + + PR other/61321 + PR other/61233 + * demangle.h (enum demangle_component_type) + <DEMANGLE_COMPONENT_CONVERSION>: New value. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/include/demangle.h b/include/demangle.h index bbad71bd8c7..7dc26489d6f 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -373,6 +373,10 @@ enum demangle_component_type /* A typecast, represented as a unary operator. The one subtree is the type to which the argument should be cast. */ DEMANGLE_COMPONENT_CAST, + /* A conversion operator, represented as a unary operator. The one + subtree is the type to which the argument should be converted + to. */ + DEMANGLE_COMPONENT_CONVERSION, /* A nullary expression. The left subtree is the operator. */ DEMANGLE_COMPONENT_NULLARY, /* A unary expression. The left subtree is the operator, and the diff --git a/intl/ChangeLog b/intl/ChangeLog index eb4589fb025..e790f668c12 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libada/ChangeLog b/libada/ChangeLog index 3f0f98f145d..e1c994db9d8 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index afe96b791df..fab6ad6a3b2 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,17 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-05-09 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline: + 2016-04-27 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * configure.tgt (configure_tgt_pre_target_cpu_XCFLAGS): New variable. + (*-*-rtems*): New supported target. + * config/rtems/host-config.h: New file. + * config/rtems/lock.c: Likewise. + 2016-01-06 Szabolcs Nagy <szabolcs.nagy@arm.com> Backport from mainline: diff --git a/libatomic/config/rtems/host-config.h b/libatomic/config/rtems/host-config.h new file mode 100644 index 00000000000..d11e9efb01f --- /dev/null +++ b/libatomic/config/rtems/host-config.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2016 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Atomic Library (libatomic). + + Libatomic 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 of the License, or + (at your option) any later version. + + Libatomic 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* Included after all more target-specific host-config.h. */ + +#include <machine/_libatomic.h> + +static inline UWORD +protect_start (void *ptr) +{ + return _Libatomic_Protect_start (ptr); +} + +static inline void +protect_end (void *ptr, UWORD isr_level) +{ + _Libatomic_Protect_end (ptr, isr_level); +} + +#include_next <host-config.h> diff --git a/libatomic/config/rtems/lock.c b/libatomic/config/rtems/lock.c new file mode 100644 index 00000000000..f999f9b6837 --- /dev/null +++ b/libatomic/config/rtems/lock.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2016 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Atomic Library (libatomic). + + Libatomic 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 of the License, or + (at your option) any later version. + + Libatomic 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +#include "libatomic_i.h" + +void +libat_lock_n (void *ptr, size_t n) +{ + _Libatomic_Lock_n (ptr, n); +} + +void +libat_unlock_n (void *ptr, size_t n) +{ + _Libatomic_Unlock_n (ptr, n); +} diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt index a3757efbbe2..403906dd786 100644 --- a/libatomic/configure.tgt +++ b/libatomic/configure.tgt @@ -26,6 +26,10 @@ # Map the target cpu to an ARCH sub-directory. At the same time, # work out any special compilation flags as necessary. +# Give operating systems the opportunity to discard XCFLAGS modifications based +# on ${target_cpu}. For example to allow proper use of multilibs. +configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}" + case "${target_cpu}" in alpha*) ARCH=alpha ;; rs6000 | powerpc*) ARCH=powerpc ;; @@ -108,6 +112,11 @@ case "${target}" in config_path="${config_path} posix" ;; + *-*-rtems*) + XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}" + config_path="rtems" + ;; + *-*-elf*) # ??? No target OS. We could be targeting bare-metal kernel-mode, # or user-mode for some custom OS. If the target supports TAS, diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index 0a0fa7abbfd..7b376bef10f 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,13 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-05-18 Uros Bizjak <ubizjak@gmail.com> + + PR target/71161 + * elf.c (phdr_callback) [__i386__]: Add + __attribute__((__force_align_arg_pointer__)). + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index e63aaf5dbdf..4c4e7cd0bb4 100644 --- a/libbacktrace/elf.c +++ b/libbacktrace/elf.c @@ -867,6 +867,9 @@ struct phdr_data libraries. */ static int +#ifdef __i386__ +__attribute__ ((__force_align_arg_pointer__)) +#endif phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED, void *pdata) { diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog index 96a4999ec11..d84d7a98dd1 100644 --- a/libcilkrts/ChangeLog +++ b/libcilkrts/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7bd7afd92f1..34d5ee8e713 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2016-02-11 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 78c43933d83..873f80327a0 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -216,7 +216,7 @@ new_linemap (struct line_maps *set, if (LINEMAPS_USED (set, macro_map_p) == LINEMAPS_ALLOCATED (set, macro_map_p)) { /* We ran out of allocated line maps. Let's allocate more. */ - unsigned alloc_size; + size_t alloc_size; /* Cast away extern "C" from the type of xrealloc. */ line_map_realloc reallocator = (set->reallocator diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index 20982da4c16..b82292109de 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index b1088a146f8..ea1d086e621 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 9652c6eb8d1..1c403048e9e 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index b8fedcc2f82..edbf3e60d98 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,17 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-05-17 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline + 2016-05-10 Joel Sherrill <joel@rtems.org> + + PR libgcc/70720 + * config.host (moxie-*-rtems*): Merge this stanza with other moxie + targets so the same extra_parts are built. Also have tmake_file add + on to its value rather than override. + 2016-03-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Backport from mainline diff --git a/libgcc/config.host b/libgcc/config.host index f4a74287293..e4e2234ee03 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -867,14 +867,9 @@ mmix-knuth-mmixware) mn10300-*-*) tmake_file=t-fdpbit ;; -moxie-*-elf | moxie-*-uclinux*) - tmake_file="moxie/t-moxie t-softfp-sfdf t-softfp-excl t-softfp" - extra_parts="$extra_parts crti.o crtn.o" - ;; -moxie-*-rtems*) +moxie-*-elf | moxie-*-uclinux* | moxie-*-rtems*) tmake_file="$tmake_file moxie/t-moxie t-softfp-sfdf t-softfp-excl t-softfp" - # Don't use default. - extra_parts= + extra_parts="$extra_parts crti.o crtn.o" ;; msp430*-*-elf) tmake_file="$tm_file t-crtstuff t-fdpbit msp430/t-msp430" diff --git a/libgcc/config/libbid/ChangeLog b/libgcc/config/libbid/ChangeLog index b445b46e2e3..01f9844400e 100644 --- a/libgcc/config/libbid/ChangeLog +++ b/libgcc/config/libbid/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index dba6ffbb502..c1aa49af741 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,14 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-05-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk. + PR libgfortran/70684 + * io/list_read (next_char): Add '\r' to check for end of line. + factor. (two places) + 2016-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> Dominique d'Humieres <dominiq@lps.ens.fr> diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index d3fac4c52a5..9e6dd315371 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -141,7 +141,8 @@ next_char (st_parameter_dt *dtp) dtp->u.p.at_eol = 0; c = dtp->u.p.last_char; dtp->u.p.last_char = EOF - 1; - goto done; + dtp->u.p.at_eol = (c == '\n' || c == '\r' || c == EOF); + return c; } /* Read from line_buffer if enabled. */ @@ -155,7 +156,8 @@ next_char (st_parameter_dt *dtp) { dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos] = '\0'; dtp->u.p.line_buffer_pos++; - goto done; + dtp->u.p.at_eol = (c == '\n' || c == '\r' || c == EOF); + return c; } dtp->u.p.line_buffer_pos = 0; diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 7749bb26e01..33b1a3f9564 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,15 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-07-01 Jakub Jelinek <jakub@redhat.com> + + PR fortran/71717 + * testsuite/libgomp.fortran/associate3.f90: New test. + 2016-02-16 Tom de Vries <tom@codesourcery.com> backport from trunk: diff --git a/libgomp/testsuite/libgomp.fortran/associate3.f90 b/libgomp/testsuite/libgomp.fortran/associate3.f90 new file mode 100644 index 00000000000..ec3d8dc33b9 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/associate3.f90 @@ -0,0 +1,20 @@ +! PR fortran/71717 +! { dg-do run } + + type t + real, allocatable :: f(:) + end type + type (t) :: v + integer :: i, j + allocate (v%f(4)) + v%f = 19. + i = 5 + associate (u => v, k => i) + !$omp parallel do + do j = 1, 4 + u%f(j) = 21. + if (j.eq.1) k = 7 + end do + end associate + if (any (v%f(:).ne.21.) .or. i.ne.7) call abort +end diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index df722b33a1a..8c62484a9a2 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,132 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-05-19 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-05-19 Jakub Jelinek <jakub@redhat.com> + + PR c++/70498 + * cp-demangle.c (d_expression_1): Formatting fix. + + 2016-05-02 Marcel Böhme <boehme.marcel@gmail.com> + + PR c++/70498 + * cp-demangle.c: Parse numbers as integer instead of long to avoid + overflow after sanity checks. Include <limits.h> if available. + (INT_MAX): Define if necessary. + (d_make_template_param): Takes integer argument instead of long. + (d_make_function_param): Likewise. + (d_append_num): Likewise. + (d_identifier): Likewise. + (d_number): Parse as and return integer. + (d_compact_number): Handle overflow. + (d_source_name): Change variable type to integer for parsed number. + (d_java_resource): Likewise. + (d_special_name): Likewise. + (d_discriminator): Likewise. + (d_unnamed_type): Likewise. + * testsuite/demangle-expected: Add regression test cases. + + 2016-04-08 Marcel Böhme <boehme.marcel@gmail.com> + + PR c++/69687 + * cplus-dem.c: Include <limits.h> if available. + (INT_MAX): Define if necessary. + (remember_type, remember_Ktype, register_Btype, string_need): + Abort if we detect cases where we the size of the allocation would + overflow. + + PR c++/70492 + * cplus-dem.c (gnu_special): Handle case where consume_count returns + -1. + + 2016-03-31 Mikhail Maltsev <maltsevm@gmail.com> + Marcel Bohme <boehme.marcel@gmail.com> + + PR c++/67394 + PR c++/70481 + * cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing + btypevec/ktypevec. + * testsuite/demangle-expected: Add coverage tests. + + 2015-11-27 Pedro Alves <palves@redhat.com> + + PR other/61321 + PR other/61233 + * cp-demangle.c (d_demangle_callback, d_make_comp): Handle + DEMANGLE_COMPONENT_CONVERSION. + (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION + instead of DEMANGLE_COMPONENT_CAST. + (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION + component if handling a conversion. + (d_count_templates_scopes, d_print_comp_inner): Handle + DEMANGLE_COMPONENT_CONVERSION. + (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead + of DEMANGLE_COMPONENT_CAST. + (d_print_cast): Rename as ... + (d_print_conversion): ... this. Adjust comments. + (d_print_cast): Rewrite - simply print the left subcomponent. + * cp-demint.c (cplus_demangle_fill_component): Handle + DEMANGLE_COMPONENT_CONVERSION. + + * testsuite/demangle-expected: Add tests. + + 2015-07-13 Mikhail Maltsev <maltsevm@gmail.com> + + * cp-demangle.c (d_dump): Fix syntax error. + (d_identifier): Adjust type of len to match d_source_name. + (d_expression_1): Fix out-of-bounds access. Check code variable for + NULL before dereferencing it. + (d_find_pack): Do not recurse for FIXED_TYPE, DEFAULT_ARG and NUMBER. + (d_print_comp_inner): Add NULL pointer check. + * testsuite/demangle-expected: Add new testcases. + + 2014-08-29 Andrew Burgess <aburgess@broadcom.com> + + * cp-demangle.c (d_dump): Only access field from s_fixed part of + the union for DEMANGLE_COMPONENT_FIXED_TYPE. + (d_count_templates_scopes): Likewise. + + 2014-08-13 Gary Benson <gbenson@redhat.com> + + * testsuite/demangler-fuzzer.c: New file. + * testsuite/Makefile.in (fuzz-demangler): New rule. + (demangler-fuzzer): Likewise. + (mostlyclean): Clean up demangler fuzzer. + + 2014-06-11 Andrew Burgess <aburgess@broadcom.com> + + * cplus-dem.c (do_type): Call string_delete even if the call to + demangle_template fails. + + 2014-05-28 Pedro Alves <palves@redhat.com> + + * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM + and DEMANGLE_COMPONENT_NUMBER. + + 2014-05-22 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/demangle-expected: Fix last commit. + + 2014-05-14 Andrew Burgess <aburgess@broadcom.com> + + * cplus-dmem.c (internal_cplus_demangle): Free any resources + allocated by possible previous call to gnu_special. + (squangle_mop_up): Reset pointers to NULL after calling free. + * testsuite/demangle-expected: New test case. + + 2014-05-08 Gary Benson <gbenson@redhat.com> + + * cp-demangle.c (struct d_component_stack): New structure. + (struct d_print_info): New field component_stack. + (d_print_init): Initialize the above. + (d_print_comp_inner): Renamed from d_print_comp. + Do not restore template stack if it would cause a loop. + (d_print_comp): New function. + * testsuite/demangle-expected: New test cases. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 3d5d33ef591..3e3dd98bbe0 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -124,6 +124,13 @@ extern char *alloca (); # endif /* alloca */ #endif /* HAVE_ALLOCA_H */ +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifndef INT_MAX +# define INT_MAX (int)(((unsigned int) ~0) >> 1) /* 0x7FFFFFFF */ +#endif + #include "ansidecl.h" #include "libiberty.h" #include "demangle.h" @@ -275,6 +282,16 @@ struct d_growable_string int allocation_failure; }; +/* Stack of components, innermost first, used to avoid loops. */ + +struct d_component_stack +{ + /* This component. */ + const struct demangle_component *dc; + /* This component's parent. */ + const struct d_component_stack *parent; +}; + /* A demangle component and some scope captured when it was first traversed. */ @@ -327,6 +344,8 @@ struct d_print_info int pack_index; /* Number of d_print_flush calls so far. */ unsigned long int flush_count; + /* Stack of components, innermost first, used to avoid loops. */ + const struct d_component_stack *component_stack; /* Array of saved scopes for evaluating substitutions. */ struct d_saved_scope *saved_scopes; /* Index of the next unused saved scope in the above array. */ @@ -382,7 +401,7 @@ d_make_dtor (struct d_info *, enum gnu_v3_dtor_kinds, struct demangle_component *); static struct demangle_component * -d_make_template_param (struct d_info *, long); +d_make_template_param (struct d_info *, int); static struct demangle_component * d_make_sub (struct d_info *, const char *, int); @@ -405,7 +424,7 @@ static struct demangle_component *d_unqualified_name (struct d_info *); static struct demangle_component *d_source_name (struct d_info *); -static long d_number (struct d_info *); +static int d_number (struct d_info *); static struct demangle_component *d_identifier (struct d_info *, int); @@ -526,8 +545,10 @@ d_print_array_type (struct d_print_info *, int, static void d_print_expr_op (struct d_print_info *, int, const struct demangle_component *); -static void -d_print_cast (struct d_print_info *, int, const struct demangle_component *); +static void d_print_cast (struct d_print_info *, int, + const struct demangle_component *); +static void d_print_conversion (struct d_print_info *, int, + const struct demangle_component *); static int d_demangle_callback (const char *, int, demangle_callbackref, void *); @@ -563,6 +584,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_TEMPLATE_PARAM: printf ("template parameter %ld\n", dc->u.s_number.number); return; + case DEMANGLE_COMPONENT_FUNCTION_PARAM: + printf ("function parameter %ld\n", dc->u.s_number.number); + return; case DEMANGLE_COMPONENT_CTOR: printf ("constructor %d\n", (int) dc->u.s_ctor.kind); d_dump (dc->u.s_ctor.name, indent + 2); @@ -698,7 +722,9 @@ d_dump (struct demangle_component *dc, int indent) printf ("pointer to member type\n"); break; case DEMANGLE_COMPONENT_FIXED_TYPE: - printf ("fixed-point type\n"); + printf ("fixed-point type, accum? %d, sat? %d\n", + dc->u.s_fixed.accum, dc->u.s_fixed.sat); + d_dump (dc->u.s_fixed.length, indent + 2); break; case DEMANGLE_COMPONENT_ARGLIST: printf ("argument list\n"); @@ -712,6 +738,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_CAST: printf ("cast\n"); break; + case DEMANGLE_COMPONENT_CONVERSION: + printf ("conversion operator\n"); + break; case DEMANGLE_COMPONENT_NULLARY: printf ("nullary operator\n"); break; @@ -748,6 +777,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_CHARACTER: printf ("character '%c'\n", dc->u.s_character.character); return; + case DEMANGLE_COMPONENT_NUMBER: + printf ("number %ld\n", dc->u.s_number.number); + return; case DEMANGLE_COMPONENT_DECLTYPE: printf ("decltype\n"); break; @@ -918,6 +950,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_IMAGINARY: case DEMANGLE_COMPONENT_VENDOR_TYPE: case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_CONVERSION: case DEMANGLE_COMPONENT_JAVA_RESOURCE: case DEMANGLE_COMPONENT_DECLTYPE: case DEMANGLE_COMPONENT_PACK_EXPANSION: @@ -1085,7 +1118,7 @@ d_make_dtor (struct d_info *di, enum gnu_v3_dtor_kinds kind, /* Add a new template parameter. */ static struct demangle_component * -d_make_template_param (struct d_info *di, long i) +d_make_template_param (struct d_info *di, int i) { struct demangle_component *p; @@ -1101,7 +1134,7 @@ d_make_template_param (struct d_info *di, long i) /* Add a new function parameter. */ static struct demangle_component * -d_make_function_param (struct d_info *di, long i) +d_make_function_param (struct d_info *di, int i) { struct demangle_component *p; @@ -1209,7 +1242,7 @@ is_ctor_dtor_or_conversion (struct demangle_component *dc) return is_ctor_dtor_or_conversion (d_right (dc)); case DEMANGLE_COMPONENT_CTOR: case DEMANGLE_COMPONENT_DTOR: - case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_CONVERSION: return 1; } } @@ -1575,7 +1608,7 @@ d_unqualified_name (struct d_info *di) static struct demangle_component * d_source_name (struct d_info *di) { - long len; + int len; struct demangle_component *ret; len = d_number (di); @@ -1588,12 +1621,12 @@ d_source_name (struct d_info *di) /* number ::= [n] <(non-negative decimal integer)> */ -static long +static int d_number (struct d_info *di) { int negative; char peek; - long ret; + int ret; negative = 0; peek = d_peek_char (di); @@ -1765,11 +1798,16 @@ d_operator_name (struct d_info *di) { struct demangle_component *type; int was_conversion = di->is_conversion; + struct demangle_component *res; di->is_conversion = ! di->is_expression; type = cplus_demangle_type (di); + if (di->is_conversion) + res = d_make_comp (di, DEMANGLE_COMPONENT_CONVERSION, type, NULL); + else + res = d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL); di->is_conversion = was_conversion; - return d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL); + return res; } else { @@ -1820,7 +1858,7 @@ d_java_resource (struct d_info *di) { struct demangle_component *p = NULL; struct demangle_component *next = NULL; - long len, i; + int len, i; char c; const char *str; @@ -1962,7 +2000,7 @@ d_special_name (struct d_info *di) case 'C': { struct demangle_component *derived_type; - long offset; + int offset; struct demangle_component *base_type; derived_type = cplus_demangle_type (di); @@ -2885,10 +2923,10 @@ d_pointer_to_member_type (struct d_info *di) /* <non-negative number> _ */ -static long +static int d_compact_number (struct d_info *di) { - long num; + int num; if (d_peek_char (di) == '_') num = 0; else if (d_peek_char (di) == 'n') @@ -2896,7 +2934,7 @@ d_compact_number (struct d_info *di) else num = d_number (di) + 1; - if (! d_check_char (di, '_')) + if (num < 0 || ! d_check_char (di, '_')) return -1; return num; } @@ -2908,7 +2946,7 @@ d_compact_number (struct d_info *di) static struct demangle_component * d_template_param (struct d_info *di) { - long param; + int param; if (! d_check_char (di, 'T')) return NULL; @@ -3110,9 +3148,10 @@ d_expression_1 (struct d_info *di) } else { - index = d_compact_number (di) + 1; - if (index == 0) + index = d_compact_number (di); + if (index == INT_MAX || index == -1) return NULL; + index++; } return d_make_function_param (di, index); } @@ -3143,6 +3182,8 @@ d_expression_1 (struct d_info *di) struct demangle_component *type = NULL; if (peek == 't') type = cplus_demangle_type (di); + if (!d_peek_next_char (di)) + return NULL; d_advance (di, 2); return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST, type, d_exprlist (di, 'E')); @@ -3217,6 +3258,8 @@ d_expression_1 (struct d_info *di) struct demangle_component *left; struct demangle_component *right; + if (code == NULL) + return NULL; if (op_is_new_cast (op)) left = cplus_demangle_type (di); else @@ -3244,7 +3287,9 @@ d_expression_1 (struct d_info *di) struct demangle_component *second; struct demangle_component *third; - if (!strcmp (code, "qu")) + if (code == NULL) + return NULL; + else if (!strcmp (code, "qu")) { /* ?: expression. */ first = d_expression_1 (di); @@ -3435,7 +3480,7 @@ d_local_name (struct d_info *di) static int d_discriminator (struct d_info *di) { - long discrim; + int discrim; if (d_peek_char (di) != '_') return 1; @@ -3491,7 +3536,7 @@ static struct demangle_component * d_unnamed_type (struct d_info *di) { struct demangle_component *ret; - long num; + int num; if (! d_check_char (di, 'U')) return NULL; @@ -3857,12 +3902,12 @@ d_count_templates_scopes (int *num_templates, int *num_scopes, case DEMANGLE_COMPONENT_FUNCTION_TYPE: case DEMANGLE_COMPONENT_ARRAY_TYPE: case DEMANGLE_COMPONENT_PTRMEM_TYPE: - case DEMANGLE_COMPONENT_FIXED_TYPE: case DEMANGLE_COMPONENT_VECTOR_TYPE: case DEMANGLE_COMPONENT_ARGLIST: case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: case DEMANGLE_COMPONENT_INITIALIZER_LIST: case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_CONVERSION: case DEMANGLE_COMPONENT_NULLARY: case DEMANGLE_COMPONENT_UNARY: case DEMANGLE_COMPONENT_BINARY: @@ -3902,6 +3947,11 @@ d_count_templates_scopes (int *num_templates, int *num_scopes, dc->u.s_extended_operator.name); break; + case DEMANGLE_COMPONENT_FIXED_TYPE: + d_count_templates_scopes (num_templates, num_scopes, + dc->u.s_fixed.length); + break; + case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS: case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS: d_count_templates_scopes (num_templates, num_scopes, @@ -3934,6 +3984,8 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback, dpi->demangle_failure = 0; + dpi->component_stack = NULL; + dpi->saved_scopes = NULL; dpi->next_saved_scope = 0; dpi->num_saved_scopes = 0; @@ -4002,10 +4054,10 @@ d_append_string (struct d_print_info *dpi, const char *s) } static inline void -d_append_num (struct d_print_info *dpi, long l) +d_append_num (struct d_print_info *dpi, int l) { char buf[25]; - sprintf (buf,"%ld", l); + sprintf (buf,"%d", l); d_append_string (dpi, buf); } @@ -4158,6 +4210,9 @@ d_find_pack (struct d_print_info *dpi, case DEMANGLE_COMPONENT_CHARACTER: case DEMANGLE_COMPONENT_FUNCTION_PARAM: case DEMANGLE_COMPONENT_UNNAMED_TYPE: + case DEMANGLE_COMPONENT_FIXED_TYPE: + case DEMANGLE_COMPONENT_DEFAULT_ARG: + case DEMANGLE_COMPONENT_NUMBER: return NULL; case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: @@ -4269,8 +4324,8 @@ d_get_saved_scope (struct d_print_info *dpi, /* Subroutine to handle components. */ static void -d_print_comp (struct d_print_info *dpi, int options, - const struct demangle_component *dc) +d_print_comp_inner (struct d_print_info *dpi, int options, + const struct demangle_component *dc) { /* Magic variable to let reference smashing skip over the next modifier without needing to modify *dc. */ @@ -4393,6 +4448,11 @@ d_print_comp (struct d_print_info *dpi, int options, local_name = d_right (typed_name); if (local_name->type == DEMANGLE_COMPONENT_DEFAULT_ARG) local_name = local_name->u.s_unary_num.sub; + if (local_name == NULL) + { + d_print_error (dpi); + return; + } while (local_name->type == DEMANGLE_COMPONENT_RESTRICT_THIS || local_name->type == DEMANGLE_COMPONENT_VOLATILE_THIS || local_name->type == DEMANGLE_COMPONENT_CONST_THIS @@ -4673,11 +4733,30 @@ d_print_comp (struct d_print_info *dpi, int options, } else { + const struct d_component_stack *dcse; + int found_self_or_parent = 0; + /* This traversal is reentering SUB as a substition. - Restore the original templates temporarily. */ - saved_templates = dpi->templates; - dpi->templates = scope->templates; - need_template_restore = 1; + If we are not beneath SUB or DC in the tree then we + need to restore SUB's template stack temporarily. */ + for (dcse = dpi->component_stack; dcse != NULL; + dcse = dcse->parent) + { + if (dcse->dc == sub + || (dcse->dc == dc + && dcse != dpi->component_stack)) + { + found_self_or_parent = 1; + break; + } + } + + if (!found_self_or_parent) + { + saved_templates = dpi->templates; + dpi->templates = scope->templates; + need_template_restore = 1; + } } a = d_lookup_template_argument (dpi, sub); @@ -4962,9 +5041,9 @@ d_print_comp (struct d_print_info *dpi, int options, d_print_comp (dpi, options, dc->u.s_extended_operator.name); return; - case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_CONVERSION: d_append_string (dpi, "operator "); - d_print_cast (dpi, options, dc); + d_print_conversion (dpi, options, dc); return; case DEMANGLE_COMPONENT_NULLARY: @@ -5316,6 +5395,21 @@ d_print_comp (struct d_print_info *dpi, int options, } } +static void +d_print_comp (struct d_print_info *dpi, int options, + const struct demangle_component *dc) +{ + struct d_component_stack self; + + self.dc = dc; + self.parent = dpi->component_stack; + dpi->component_stack = &self; + + d_print_comp_inner (dpi, options, dc); + + dpi->component_stack = self.parent; +} + /* Print a Java dentifier. For Java we try to handle encoded extended Unicode characters. The C++ ABI doesn't mention Unicode encoding, so we don't it for C++. Characters are encoded as @@ -5682,11 +5776,20 @@ d_print_expr_op (struct d_print_info *dpi, int options, static void d_print_cast (struct d_print_info *dpi, int options, - const struct demangle_component *dc) + const struct demangle_component *dc) +{ + d_print_comp (dpi, options, d_left (dc)); +} + +/* Print a conversion operator. */ + +static void +d_print_conversion (struct d_print_info *dpi, int options, + const struct demangle_component *dc) { struct d_print_template dpt; - /* For a cast operator, we need the template parameters from + /* For a conversion operator, we need the template parameters from the enclosing template in scope for processing the type. */ if (dpi->current_template != NULL) { diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c index 1d1a77af748..efcc5b7f5c0 100644 --- a/libiberty/cp-demint.c +++ b/libiberty/cp-demint.c @@ -110,6 +110,7 @@ cplus_demangle_fill_component (struct demangle_component *p, case DEMANGLE_COMPONENT_IMAGINARY: case DEMANGLE_COMPONENT_VENDOR_TYPE: case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_CONVERSION: if (right != NULL) return 0; break; diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index e94848767e7..aace73302cb 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -56,6 +56,13 @@ void * malloc (); void * realloc (); #endif +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifndef INT_MAX +# define INT_MAX (int)(((unsigned int) ~0) >> 1) /* 0x7FFFFFFF */ +#endif + #include <demangle.h> #undef CURRENT_DEMANGLING_STYLE #define CURRENT_DEMANGLING_STYLE work->options @@ -1175,6 +1182,11 @@ internal_cplus_demangle (struct work_stuff *work, const char *mangled) if ((AUTO_DEMANGLING || GNU_DEMANGLING)) { success = gnu_special (work, &mangled, &decl); + if (!success) + { + delete_work_stuff (work); + string_delete (&decl); + } } if (!success) { @@ -1218,10 +1230,14 @@ squangle_mop_up (struct work_stuff *work) if (work -> btypevec != NULL) { free ((char *) work -> btypevec); + work->btypevec = NULL; + work->bsize = 0; } if (work -> ktypevec != NULL) { free ((char *) work -> ktypevec); + work->ktypevec = NULL; + work->ksize = 0; } } @@ -2979,6 +2995,11 @@ gnu_special (struct work_stuff *work, const char **mangled, string *declp) success = 1; break; } + else if (n == -1) + { + success = 0; + break; + } } else { @@ -3656,7 +3677,10 @@ do_type (struct work_stuff *work, const char **mangled, string *result) string_delete (&temp); } else - break; + { + string_delete (&temp); + break; + } } else if (**mangled == 'Q') { @@ -4231,6 +4255,8 @@ remember_type (struct work_stuff *work, const char *start, int len) } else { + if (work -> typevec_size > INT_MAX / 2) + xmalloc_failed (INT_MAX); work -> typevec_size *= 2; work -> typevec = XRESIZEVEC (char *, work->typevec, work->typevec_size); @@ -4258,6 +4284,8 @@ remember_Ktype (struct work_stuff *work, const char *start, int len) } else { + if (work -> ksize > INT_MAX / 2) + xmalloc_failed (INT_MAX); work -> ksize *= 2; work -> ktypevec = XRESIZEVEC (char *, work->ktypevec, work->ksize); @@ -4287,6 +4315,8 @@ register_Btype (struct work_stuff *work) } else { + if (work -> bsize > INT_MAX / 2) + xmalloc_failed (INT_MAX); work -> bsize *= 2; work -> btypevec = XRESIZEVEC (char *, work->btypevec, work->bsize); @@ -4741,6 +4771,8 @@ string_need (string *s, int n) else if (s->e - s->p < n) { tem = s->p - s->b; + if (n > INT_MAX / 2 - tem) + xmalloc_failed (INT_MAX); n += tem; n *= 2; s->b = XRESIZEVEC (char, s->b, n); diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 69ac1f5105e..d23c09c8b2d 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -59,6 +59,10 @@ check-pexecute: test-pexecute check-expandargv: test-expandargv ./test-expandargv +# Run the demangler fuzzer +fuzz-demangler: demangler-fuzzer + ./demangler-fuzzer + TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES) test-demangle: $(srcdir)/test-demangle.c ../libiberty.a $(TEST_COMPILE) -o test-demangle \ @@ -72,6 +76,10 @@ test-expandargv: $(srcdir)/test-expandargv.c ../libiberty.a $(TEST_COMPILE) -DHAVE_CONFIG_H -I.. -o test-expandargv \ $(srcdir)/test-expandargv.c ../libiberty.a +demangler-fuzzer: $(srcdir)/demangler-fuzzer.c ../libiberty.a + $(TEST_COMPILE) -o demangler-fuzzer \ + $(srcdir)/demangler-fuzzer.c ../libiberty.a + # Standard (either GNU or Cygnus) rules we don't use. html install-html info install-info clean-info dvi pdf install-pdf \ install etags tags installcheck: @@ -81,6 +89,7 @@ mostlyclean: rm -f test-demangle rm -f test-pexecute rm -f test-expandargv + rm -f demangler-fuzzer rm -f core clean: mostlyclean distclean: clean diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 3ff08e6e5f2..706c0cd760b 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4091,6 +4091,36 @@ void g<1>(A<1>&, B<static_cast<bool>(1)>&) _ZNKSt7complexIiE4realB5cxx11Ev std::complex<int>::real[abi:cxx11]() const # +# Some more crashes revealed by fuzz-testing: +# Check for NULL pointer when demangling trinary operators +--format=gnu-v3 +_Z1fAv32_f +_Z1fAv32_f +# Do not overflow when decoding identifier length +--format=gnu-v3 +_Z11111111111 +_Z11111111111 +# Check out-of-bounds access when decoding braced initializer list +--format=gnu-v3 +_ZDTtl +_ZDTtl +# Check for NULL pointer when demangling DEMANGLE_COMPONENT_LOCAL_NAME +--format=gnu-v3 +_ZZN1fEEd_lEv +_ZZN1fEEd_lEv +# Handle DEMANGLE_COMPONENT_FIXED_TYPE in d_find_pack +--format=gnu-v3 +_Z1fDpDFT_ +_Z1fDpDFT_ +# Likewise, DEMANGLE_COMPONENT_DEFAULT_ARG +--format=gnu-v3 +_Z1fIDpZ1fEd_E +_Z1fIDpZ1fEd_E +# Likewise, DEMANGLE_COMPONENT_NUMBER +--format=gnu-v3 +_Z1fDpDv1_c +f((char __vector(1))...) +# # Ada (GNAT) tests. # # Simple test. @@ -4294,6 +4324,7 @@ void n<void (A::*)() const &>(void (A::*)() const &) --format=gnu-v3 _ZL1fIiEvv void f<int>() +# https://sourceware.org/bugzilla/show_bug.cgi?id=14963#c3 --format=gnu-v3 _ZSt7forwardIRN1x14refobjiteratorINS0_3refINS0_4mime30multipart_section_processorObjIZ15get_body_parserIZZN14mime_processor21make_section_iteratorERKNS2_INS3_10sectionObjENS0_10ptrrefBaseEEEbENKUlvE_clEvEUlSB_bE_ZZNS6_21make_section_iteratorESB_bENKSC_clEvEUlSB_E0_ENS1_INS2_INS0_20outputrefiteratorObjIiEES8_EEEERKSsSB_OT_OT0_EUlmE_NS3_32make_multipart_default_discarderISP_EEEES8_EEEEEOT_RNSt16remove_referenceISW_E4typeE x::refobjiterator<x::ref<x::mime::multipart_section_processorObj<x::refobjiterator<x::ref<x::outputrefiteratorObj<int>, x::ptrrefBase> > get_body_parser<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}>(std::string const&, x::ref<x::mime::sectionObj, x::ptrrefBase> const&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&> >, x::ptrrefBase> >& std::forward<x::refobjiterator<x::ref<x::mime::multipart_section_processorObj<x::refobjiterator<x::ref<x::outputrefiteratorObj<int>, x::ptrrefBase> > get_body_parser<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}>(std::string const&, x::ref<x::mime::sectionObj, x::ptrrefBase> const&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&> >, x::ptrrefBase> >&>(std::remove_reference<x::mime::multipart_section_processorObj<x::refobjiterator<x::ref<x::outputrefiteratorObj<int>, x::ptrrefBase> > get_body_parser<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}>(std::string const&, x::ref<x::mime::sectionObj, x::ptrrefBase> const&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&> > >::type&) @@ -4317,3 +4348,81 @@ A::operator C*<C> _ZN1AcvT_IiEI1CEEv A::operator C<int><C>() A::operator C<int><C> +# https://sourceware.org/bugzilla/show_bug.cgi?id=14963#c16 +--format=gnu-v3 +_ZN3mdr16in_cached_threadIRZNK4cudr6GPUSet17parallel_for_eachIZN5tns3d20shape_representation7compute7GPUImpl7executeERKNS_1AINS_7ptr_refIKjEELl3ELl3ENS_8c_strideILl1ELl0EEEEERKNS8_INS9_IjEELl4ELl1ESD_EEEUliRKNS1_7ContextERNS7_5StateEE_JSt6vectorISO_SaISO_EEEEEvOT_DpRT0_EUlSP_E_JSt17reference_wrapperISO_EEEENS_12ScopedFutureIDTclfp_spcl7forwardISW_Efp0_EEEEESV_DpOSW_ +mdr::ScopedFuture<decltype ({parm#1}(((forward<void cudr::GPUSet::parallel_for_each<tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> > >(tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}&&, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> >&) const::{lambda(tns3d::shape_representation::compute::GPUImpl::State&)#1}&>)({parm#2}))...))> mdr::in_cached_thread<void cudr::GPUSet::parallel_for_each<tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> > >(void cudr::GPUSet::parallel_for_each<tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> > >(tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}&&, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> >&) const::{lambda(tns3d::shape_representation::compute::GPUImpl::State&)#1}&, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> >&) const::{lambda(tns3d::shape_representation::compute::GPUImpl::State&)#1}&, std::reference_wrapper<tns3d::shape_representation::compute::GPUImpl::State> >(void cudr::GPUSet::parallel_for_each<tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> > >(tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}&&, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> >&) const::{lambda(tns3d::shape_representation::compute::GPUImpl::State&)#1}&, (void cudr::GPUSet::parallel_for_each<tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> > >(tns3d::shape_representation::compute::GPUImpl::execute(mdr::A<mdr::ptr_ref<unsigned int const>, 3l, 3l, mdr::c_stride<1l, 0l> > const&, mdr::A<mdr::ptr_ref<unsigned int>, 4l, 1l, mdr::c_stride<1l, 0l> > const&)::{lambda(int, cudr::Context const&, tns3d::shape_representation::compute::GPUImpl::State&)#1}&&, std::vector<tns3d::shape_representation::compute::GPUImpl::State, std::allocator<tns3d::shape_representation::compute::GPUImpl::State> >&) const::{lambda(tns3d::shape_representation::compute::GPUImpl::State&)#1}&&&)...) +# https://sourceware.org/bugzilla/show_bug.cgi?id=14963#c18 +--format=gnu-v3 +_ZNSt9_Any_data9_M_accessIPZN13ThreadManager10futureTaskISt5_BindIFSt7_Mem_fnIM6RunnerFvvEEPS5_EEEEvOT_EUlvE_EERSC_v +void ThreadManager::futureTask<std::_Bind<std::_Mem_fn<void (Runner::*)()> (Runner*)> >(std::_Bind<std::_Mem_fn<void (Runner::*)()> (Runner*)>&&)::{lambda()#1}*& std::_Any_data::_M_access<void ThreadManager::futureTask<std::_Bind<std::_Mem_fn<void (Runner::*)()> (Runner*)> >(void ThreadManager::futureTask<std::_Bind<std::_Mem_fn<void (Runner::*)()> (Runner*)> >(std::_Bind<std::_Mem_fn<void (Runner::*)()> (Runner*)>&&)::{lambda()#1}*&&)::{lambda()#1}*>() +# https://sourceware.org/bugzilla/show_bug.cgi?id=14963#c24 +# aka https://sourceware.org/bugzilla/show_bug.cgi?id=16593 +--format=gnu-v3 +_ZNSt9_Any_data9_M_accessIPZN3sel8Selector6SetObjI3FooJPKcMS4_FviEEEEvRT_DpT0_EUlvE_EESA_v +void sel::Selector::SetObj<Foo, char const*, void (Foo::*)(int)>(Foo&, char const*, void (Foo::*)(int))::{lambda()#1}*& std::_Any_data::_M_access<void sel::Selector::SetObj<Foo, char const*, void (Foo::*)(int)>(void sel::Selector::SetObj<Foo, char const*, void (Foo::*)(int)>(Foo&, char const*, void (Foo::*)(int))::{lambda()#1}*&, char const*, void (Foo::*)(int))::{lambda()#1}*>() +# https://sourceware.org/bugzilla/show_bug.cgi?id=16752#c1 +--format=gnu-v3 +_ZNSt9_Any_data9_M_accessIPZN13ThreadManager7newTaskIRSt5_BindIFSt7_Mem_fnIM5DiaryFivEEPS5_EEIEEESt6futureINSt9result_ofIFT_DpT0_EE4typeEEOSF_DpOSG_EUlvE_EERSF_v +std::future<std::result_of<std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>& ()>::type> ThreadManager::newTask<std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>&>(std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>&)::{lambda()#1}*& std::_Any_data::_M_access<std::future<std::result_of<std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>& ()>::type> ThreadManager::newTask<std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>&>(std::future<std::result_of<std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>& ()>::type> ThreadManager::newTask<std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>&>(std::_Bind<std::_Mem_fn<int (Diary::*)()> (Diary*)>&)::{lambda()#1}*&&)::{lambda()#1}*>() +# https://sourceware.org/bugzilla/show_bug.cgi?id=16752#c6 +--format=gnu-v3 +_ZNSt9_Any_data9_M_accessIPZN6cereal18polymorphic_detail15getInputBindingINS1_16JSONInputArchiveEEENS1_6detail15InputBindingMapIT_E11SerializersERS7_jEUlPvRSt10unique_ptrIvNS5_12EmptyDeleterIvEEEE0_EESA_v +cereal::detail::InputBindingMap<cereal::JSONInputArchive>::Serializers cereal::polymorphic_detail::getInputBinding<cereal::JSONInputArchive>(cereal::JSONInputArchive&, unsigned int)::{lambda(void*, std::unique_ptr<void, cereal::detail::EmptyDeleter<void> >&)#2}*& std::_Any_data::_M_access<cereal::detail::InputBindingMap<cereal::JSONInputArchive>::Serializers cereal::polymorphic_detail::getInputBinding<cereal::JSONInputArchive>(cereal::detail::InputBindingMap<cereal::JSONInputArchive>::Serializers cereal::polymorphic_detail::getInputBinding<cereal::JSONInputArchive>(cereal::JSONInputArchive&, unsigned int)::{lambda(void*, std::unique_ptr<void, cereal::detail::EmptyDeleter<void> >&)#2}*&, unsigned int)::{lambda(void*, std::unique_ptr<void, cereal::detail::EmptyDeleter<void> >&)#2}*>() +# https://sourceware.org/bugzilla/show_bug.cgi?id=16845#c2 +--format=gnu-v3 +_ZNSt9_Any_data9_M_accessIPZ4postISt8functionIFvvEEEvOT_EUlvE_EERS5_v +void post<std::function<void ()> >(std::function<void ()>&&)::{lambda()#1}*& std::_Any_data::_M_access<void post<std::function<void ()> >(void post<std::function<void ()> >(std::function<void ()>&&)::{lambda()#1}*&&)::{lambda()#1}*>() +# +--format=auto --no-params +_Z3xxxDFyuVb +xxx(unsigned long long _Fract, bool volatile) +xxx +# https://sourceware.org/bugzilla/show_bug.cgi?id=16817 +--format=auto --no-params +_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z +_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z +_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z +# +# These two are from gcc PR61321, and gcc PR61233 / gdb PR16957 +# +--format=gnu-v3 +_Z13function_tempIiEv1AIXszcvT_Li999EEE +void function_temp<int>(A<sizeof ((int)(999))>) +# +--format=gnu-v3 +_Z7ZipWithI7QStringS0_5QListZN4oral6detail16AdaptCreateTableI7AccountEES0_RKNS3_16CachedFieldsDataEEUlRKS0_SA_E_ET1_IDTclfp1_cvT__EcvT0__EEEERKT1_ISC_ERKT1_ISD_ET2_ +QList<decltype ({parm#3}((QString)(), (QString)()))> ZipWith<QString, QString, QList, QString oral::detail::AdaptCreateTable<Account>(oral::detail::CachedFieldsData const&)::{lambda(QString const&, QString const&)#1}>(QList<QString oral::detail::AdaptCreateTable<Account>(oral::detail::CachedFieldsData const&)::{lambda(QString const&, QString const&)#1}> const&, QList<QList> const&, QString oral::detail::AdaptCreateTable<Account>(oral::detail::CachedFieldsData const&)::{lambda(QString const&, QString const&)#1}) +# +# These three are symbols generated by g++'s testsuite, which triggered the same bug as above. +--format=gnu-v3 +_Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE +int& int_if_addable<Y>(A<sizeof ((*((Y*)(0)))+(*((Y*)(0))))>*) +# +--format=gnu-v3 +_Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE +void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*) +# +--format=gnu-v3 +_Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv +X<sizeof ((P(((F)())())).array)>::Type foo<F>() +# +# Tests a use-after-free problem PR70481 + +_Q.__0 +::Q.(void) +# +# Tests a use-after-free problem PR70481 + +_Q10-__9cafebabe. +cafebabe.::-(void) +# +# Tests integer overflow problem PR70492 + +__vt_90000000000cafebabe +__vt_90000000000cafebabe +# +# Tests write access violation PR70498 + +_Z80800000000000000000000 +_Z80800000000000000000000 diff --git a/libiberty/testsuite/demangler-fuzzer.c b/libiberty/testsuite/demangler-fuzzer.c new file mode 100644 index 00000000000..aff70247301 --- /dev/null +++ b/libiberty/testsuite/demangler-fuzzer.c @@ -0,0 +1,108 @@ +/* Demangler fuzzer. + + Copyright (C) 2014 Free Software Foundation, Inc. + + This file is part of GNU libiberty. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <time.h> +#include "demangle.h" + +#define MAXLEN 253 +#define ALPMIN 33 +#define ALPMAX 127 + +static char *program_name; + +#define DEFAULT_MAXCOUNT 7500000 + +static void +print_usage (FILE *fp, int exit_value) +{ + fprintf (fp, "Usage: %s [OPTION]...\n", program_name); + fprintf (fp, "Options:\n"); + fprintf (fp, " -h Display this message.\n"); + fprintf (fp, " -s SEED Select the random seed to be used.\n"); + fprintf (fp, " The default is to base one on the"); + fprintf (fp, " current time.\n"); + fprintf (fp, " -m MAXCOUNT Exit after MAXCOUNT symbols.\n"); + fprintf (fp, " The default is %d.", DEFAULT_MAXCOUNT); + fprintf (fp, " Set to `-1' for no limit.\n"); + + exit (exit_value); +} + +int +main (int argc, char *argv[]) +{ + char symbol[2 + MAXLEN + 1] = "_Z"; + int seed = -1, seed_set = 0; + int count = 0, maxcount = DEFAULT_MAXCOUNT; + int optchr; + + program_name = argv[0]; + + do + { + optchr = getopt (argc, argv, "hs:m:t:"); + switch (optchr) + { + case '?': /* Unrecognized option. */ + print_usage (stderr, 1); + break; + + case 'h': + print_usage (stdout, 0); + break; + + case 's': + seed = atoi (optarg); + seed_set = 1; + break; + + case 'm': + maxcount = atoi (optarg); + break; + } + } + while (optchr != -1); + + if (!seed_set) + seed = time (NULL); + srand (seed); + printf ("%s: seed = %d\n", program_name, seed); + + while (maxcount < 0 || count < maxcount) + { + char *buffer = symbol + 2; + int length, i; + + length = rand () % MAXLEN; + for (i = 0; i < length; i++) + *buffer++ = (rand () % (ALPMAX - ALPMIN)) + ALPMIN; + + *buffer++ = '\0'; + + cplus_demangle (symbol, DMGL_AUTO | DMGL_ANSI | DMGL_PARAMS); + + count++; + } + + printf ("%s: successfully demangled %d symbols\n", program_name, count); + exit (0); +} diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 8e15808f6d5..459f4d29631 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-07-03 Carlos Sánchez de La Lama <csanchezdll@gmail.com> PR target/52482 diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 485ff84d289..ed8a4048cd0 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2016-04-23 Dominique d'Humieres <dominiq@lps.ens.fr> backport from trunk: diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index 13c31aa6003..ecf0df58995 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog index 79a238d891d..9c0a7827e77 100644 --- a/libjava/libltdl/ChangeLog +++ b/libjava/libltdl/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index caa71601c21..bb7e1e16a38 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog index 01000d6442d..90c5da74011 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 143dfd4b442..a9c18205d7d 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,16 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + +2016-07-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-05-17 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/71160 + * asan/asan_malloc_linux.cc: Cherry pick upstream r254395 + and r269633. + 2016-04-05 Maxim Ostapenko <m.ostapenko@samsung.com> PR sanitizer/70474 diff --git a/libsanitizer/asan/asan_malloc_linux.cc b/libsanitizer/asan/asan_malloc_linux.cc index e3495cb0900..d74789b1510 100644 --- a/libsanitizer/asan/asan_malloc_linux.cc +++ b/libsanitizer/asan/asan_malloc_linux.cc @@ -58,39 +58,62 @@ void ReplaceSystemMalloc() { // ---------------------- Replacement functions ---------------- {{{1 using namespace __asan; // NOLINT +static uptr allocated_for_dlsym; +static const uptr kDlsymAllocPoolSize = 1024; +static uptr alloc_memory_for_dlsym[kDlsymAllocPoolSize]; + +static bool IsInDlsymAllocPool(const void *ptr) { + uptr off = (uptr)ptr - (uptr)alloc_memory_for_dlsym; + return off < sizeof(alloc_memory_for_dlsym); +} + +static void *AllocateFromLocalPool(uptr size_in_bytes) { + uptr size_in_words = RoundUpTo(size_in_bytes, kWordSize) / kWordSize; + void *mem = (void*)&alloc_memory_for_dlsym[allocated_for_dlsym]; + allocated_for_dlsym += size_in_words; + CHECK_LT(allocated_for_dlsym, kDlsymAllocPoolSize); + return mem; +} + INTERCEPTOR(void, free, void *ptr) { GET_STACK_TRACE_FREE; + if (UNLIKELY(IsInDlsymAllocPool(ptr))) + return; asan_free(ptr, &stack, FROM_MALLOC); } INTERCEPTOR(void, cfree, void *ptr) { GET_STACK_TRACE_FREE; + if (UNLIKELY(IsInDlsymAllocPool(ptr))) + return; asan_free(ptr, &stack, FROM_MALLOC); } INTERCEPTOR(void*, malloc, uptr size) { + if (UNLIKELY(!asan_inited)) + // Hack: dlsym calls malloc before REAL(malloc) is retrieved from dlsym. + return AllocateFromLocalPool(size); GET_STACK_TRACE_MALLOC; return asan_malloc(size, &stack); } INTERCEPTOR(void*, calloc, uptr nmemb, uptr size) { - if (!asan_inited) { + if (UNLIKELY(!asan_inited)) // Hack: dlsym calls calloc before REAL(calloc) is retrieved from dlsym. - const uptr kCallocPoolSize = 1024; - static uptr calloc_memory_for_dlsym[kCallocPoolSize]; - static uptr allocated; - uptr size_in_words = ((nmemb * size) + kWordSize - 1) / kWordSize; - void *mem = (void*)&calloc_memory_for_dlsym[allocated]; - allocated += size_in_words; - CHECK(allocated < kCallocPoolSize); - return mem; - } + return AllocateFromLocalPool(nmemb * size); GET_STACK_TRACE_MALLOC; return asan_calloc(nmemb, size, &stack); } INTERCEPTOR(void*, realloc, void *ptr, uptr size) { GET_STACK_TRACE_MALLOC; + if (UNLIKELY(IsInDlsymAllocPool(ptr))) { + uptr offset = (uptr)ptr - (uptr)alloc_memory_for_dlsym; + uptr copy_size = Min(size, kDlsymAllocPoolSize - offset); + void *new_ptr = asan_malloc(size, &stack); + internal_memcpy(new_ptr, ptr, copy_size); + return new_ptr; + } return asan_realloc(ptr, size, &stack); } diff --git a/libssp/ChangeLog b/libssp/ChangeLog index 290978cf67d..5c08811607b 100644 --- a/libssp/ChangeLog +++ b/libssp/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4bdba8d002b..ba361b1a5a7 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2016-04-20 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog index 76198a8925b..77a973af32b 100644 --- a/libvtv/ChangeLog +++ b/libvtv/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index 3558b371134..fbb0f3da585 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index c209b5c796a..23ce6e36971 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. diff --git a/zlib/ChangeLog b/zlib/ChangeLog index b1c429b87f9..5e32a38f48f 100644 --- a/zlib/ChangeLog +++ b/zlib/ChangeLog @@ -1,3 +1,7 @@ +2016-08-03 Release Manager + + * GCC 4.9.4 released. + 2015-06-26 Release Manager * GCC 4.9.3 released. |