diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2016-06-06 11:16:47 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2016-06-06 11:16:47 +0200 |
commit | 5961cb80233dcfe9a83be08cb830616744e3872c (patch) | |
tree | 9d5bf2541c5fc98e8a62a4777fc378eedfaa3c88 | |
parent | 0f4f344ea10c5ce87079df54430c008a0f7b95d8 (diff) |
Merge branches/gcc-5-branch rev 237113.
Change-Id: Id2b625ab8c6d4c001fad5357c9b883c78ddd9e0c
166 files changed, 3244 insertions, 386 deletions
diff --git a/ChangeLog b/ChangeLog index 82d7d8878f0..d060affbacf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Andreas Tobler <andreast@gcc.gnu.org> Backport from mainline diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index 5c5d5aa238d..71511de87e4 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/config/ChangeLog b/config/ChangeLog index 370ed72b2b5..210ecccb3fc 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index d151fd97fa3..56f239ec37b 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/contrib/reghunt/ChangeLog b/contrib/reghunt/ChangeLog index c3b36a23d5f..b11274798da 100644 --- a/contrib/reghunt/ChangeLog +++ b/contrib/reghunt/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog index d6296668118..170e5368100 100644 --- a/contrib/regression/ChangeLog +++ b/contrib/regression/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 55cbe58d6e7..c9be7713d76 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-02-01 John David Anglin <danglin@gcc.gnu.org> PR target/68741 diff --git a/gcc/BASE-VER b/gcc/BASE-VER index c7cb1311a64..ade65226e0a 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -5.3.1 +5.4.1 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 694f4507164..bf629dc2161 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,278 @@ +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-06-03 Andreas Tobler <andreast@gcc.gnu.org> + + Backport from mainline + 2016-05-30 Andreas Tobler <andreast@gcc.gnu.org> + + * config.gcc: Move hard float support for arm*hf*-*-freebsd* into + armv6*-*-freebsd* for FreeBSD 11. Eliminate the arm*hf*-*-freebsd* + target. + +2016-06-03 Richard Biener <rguenther@suse.de> + + * BASE-VER: Set to 5.4.1. + +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-31 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/68696 + * config/aarch64/aarch64-simd.md (*aarch64_simd_bsl<mode>_alt): + New pattern. + (aarch64_simd_bsl<mode>_internal): Update comment to reflect + the above. + +2016-05-25 Jakub Jelinek <jakub@redhat.com> + + * config/i386/i386.h (TARGET_AVOID_4BYTE_PREFIXES): Define. + * config/i386/constraints.md (Yr): Test TARGET_AVOID_4BYTE_PREFIXES + rather than X86_TUNE_AVOID_4BYTE_PREFIXES. Use SSE_REGS instead + of ALL_SSE_REGS. Return SSE_REGS also when TARGET_AVX. + +2016-05-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-11 Alexandre Oliva <aoliva@redhat.com> + + PR target/69634 + * regstat.c (regstat_bb_compute_calls_crossed): Disregard + debug insns. + + 2015-10-30 Richard Biener <rguenther@suse.de> + + PR middle-end/68142 + * fold-const.c (extract_muldiv_1): Avoid introducing undefined + overflow. + + 2016-03-24 Richard Henderson <rth@redhat.com> + + PR middle-end/69845 + * fold-const.c (extract_muldiv_1): Correct test for multiplication + overflow. + +2016-05-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-12-11 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/68814 + * rtlanal.c (set_noop_p): Use BITS_BIG_ENDIAN instead of + BYTES_BIG_ENDIAN. + + 2016-01-12 Jan Hubicka <hubicka@ucw.cz> + + PR lto/69003 + * lto-partition.c (rename_statics): Fix pasto. + + 2016-01-13 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/66487 + * ipa-polymorphic-call.c (inlined_polymorphic_ctor_dtor_block_p): + use block_ultimate_origin + (noncall-stmt_may_be_vtbl_ptr_store): Likewise. + + 2016-01-21 Roman Zhuykov <zhroma@ispras.ru> + + PR target/69252 + * modulo-sched.c (optimize_sc): Allow branch-scheduling to add a new + first stage. + +2016-05-21 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-21 Chung-Lin Tang <cltang@codesourcery.com> + + Backport from mainline + 2015-06-29 Sandra Loosemore <sandra@codesourcery.com> + + * config/nios2/nios2.c (nios2_delegitimize_address): Make + assert less restrictive. + +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 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-03-02 Richard Biener <rguenther@suse.de> + + PR middle-end/67278 + * tree-cfg.c (verify_expr): Adjust BIT_FIELD_REF case. + + 2016-03-02 Richard Biener <rguenther@suse.de> + Uros Bizjak <ubizjak@gmail.com> + + PR target/67278 + * config/i386/i386.c (type_natural_mode): Handle XFmode vectors. + +2016-05-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69720 + * tree-vect-loop.c (get_initial_def_for_reduction): Avoid + the adjustment_def path for possibly vectorized defs. + (vect_create_epilog_for_reduction): Handle vectorized initial + defs properly. + +2016-05-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-01 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/67921 + * fold-const.c (split_tree): New parameters. Convert pointer + type variable part to proper type before negating. + (fold_binary_loc): Pass new arguments to split_tree. + + 2016-05-06 Richard Biener <rguenther@suse.de> + + PR middle-end/70941 + * fold-const.c (split_tree): Always convert to the original type + before negating. + + 2016-05-06 Richard Biener <rguenther@suse.de> + + PR middle-end/70931 + * dwarf2out.c (native_encode_initializer): Skip zero-sized fields. + + 2016-04-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70623 + * tree-ssa-pre.c (changed_blocks): Make global ... + (compute_antic): ... local here. Move and fix worklist + handling here. Do not clear EDGE_DFS_BACK. + (compute_antic_aux): Add dumping for MAX assumed succs. Remove + worklist handling, dump when ANTIC_IN changed. + (compute_partial_antic_aux): Remove worklist handling. + (init_pre): Do not compute post dominators. Add a comment about + the CFG order chosen. + (fini_pre): Do not free post dominators. + + 2016-04-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70780 + * tree-ssa-pre.c (compute_antic_aux): Also return true if the block + wasn't visited yet. + (compute_antic): Mark blocks with abnormal preds as visited as + they have a final empty antic-in solution already. + +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. + +2016-05-19 Richard Sandiford <richard.sandiford@arm.com> + +2016-01-26 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/69400 + * wide-int.cc (wi_pack): Take the precision as argument and + perform canonicalization here rather than in the callers. + Use the main loop to handle all full-width HWIs. Add a + zero HWI if in_len isn't a full result. + (wi::divmod_internal): Update accordingly. + (wi::mul_internal): Likewise. Simplify. + +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-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/70353 + * tree-inline.c (remap_decls): Don't add_local_decl if + cfun is null. + +2016-05-18 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-17 Jim Wilson <jim.wilson@linaro.org> + + Partial backport from trunk r228017. + 2015-09-22 Jason Merrill <jason@redhat.com> + + PR c++/70613 + * doc/invoke.texi (-fabi-version): Document version 9. + (-Wabi): Document version 9. Mention version 8 is default for GCC 5.1. + +2016-05-12 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2016-05-10 Martin Liska <mliska@suse.cz> + + * tree-inline.c (remap_dependence_clique): Do not remap + debugging statements. + 2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline @@ -119,7 +394,7 @@ Use proper memory operand modifiers. 2016-04-14 Nick Clifton <nickc@redhat.com> - Kyrylo Tkachov <kyrylo.tkachov@arm.com> + Kyrylo Tkachov <kyrylo.tkachov@arm.com> PR target/70044 * config/aarch64/aarch64.c diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4578ac08819..602e5397582 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160511 +20160606 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 393704d055e..9b0a98b5762 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-31 Eric Botcazou <ebotcazou@adacore.com> + + * s-osinte-kfreebsd-gnu.ads (clock_getres): Define. + +2016-05-31 Jan Sommer <soja-lists@aries.uberspace.de> + + PR ada/71317 + * s-osinte-rtems.ads (clock_getres): Define. + 2016-05-06 Eric Botcazou <ebotcazou@adacore.com> PR ada/70969 diff --git a/gcc/ada/s-osinte-kfreebsd-gnu.ads b/gcc/ada/s-osinte-kfreebsd-gnu.ads index 3f6ef9bb409..33d67afd371 100644 --- a/gcc/ada/s-osinte-kfreebsd-gnu.ads +++ b/gcc/ada/s-osinte-kfreebsd-gnu.ads @@ -7,7 +7,7 @@ -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -216,6 +216,11 @@ package System.OS_Interface is return int; pragma Import (C, clock_gettime, "clock_gettime"); + function clock_getres + (clock_id : clockid_t; + res : access timespec) return int; + pragma Import (C, clock_getres, "clock_getres"); + function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads index 5a143cc666a..2d0e14a6ebf 100644 --- a/gcc/ada/s-osinte-rtems.ads +++ b/gcc/ada/s-osinte-rtems.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2011 Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2016 Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -188,6 +188,11 @@ package System.OS_Interface is tp : access timespec) return int; pragma Import (C, clock_gettime, "clock_gettime"); + function clock_getres + (clock_id : clockid_t; + res : access timespec) return int; + pragma Import (C, clock_getres, "clock_getres"); + function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 494e9655b61..9f5c0e900cd 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-03-30 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index b0868c5753c..d9a8b4e8767 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-04-18 Marek Polacek <polacek@redhat.com> Backport from mainline diff --git a/gcc/config.gcc b/gcc/config.gcc index 9c24db2bf43..71224b33b42 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1031,11 +1031,9 @@ arm*-*-freebsd*) # ARM FreeBSD EABI case $target in armv6*-*-freebsd*) tm_defines="${tm_defines} TARGET_FREEBSD_ARMv6=1" - ;; - esac - case $target in - arm*hf-*-freebsd*) - tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1" + if test $fbsd_major -ge 11; then + tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1" + fi ;; esac with_tls=${with_tls:-gnu} diff --git a/gcc/config.in b/gcc/config.in index e7a3e552055..b421ef96f19 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -568,6 +568,12 @@ #endif +/* Define if your assembler supports relocs needed by -fpic. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_SMALL_PIC_RELOCS +#endif + + /* Define if your assembler supports SPARC4 instructions. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_SPARC4 @@ -600,9 +606,9 @@ #endif -/* Define if your assembler supports relocs needed by -fpic. */ +/* Define if your assembler supports .stabs. */ #ifndef USED_FOR_TARGET -#undef HAVE_AS_SMALL_PIC_RELOCS +#undef HAVE_AS_STABS_DIRECTIVE #endif diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 4cc60889f48..eda2f308fc9 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -1872,16 +1872,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 7b46347afcc..123c69ea065 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 8f6679ed262..954af557a81 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -21217,7 +21217,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; @@ -24453,7 +24457,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/darwin.h b/gcc/config/darwin.h index b61dbb5eb94..201445a4222 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -393,12 +393,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/constraints.md b/gcc/config/i386/constraints.md index 00a84a03885..f4a05a70923 100644 --- a/gcc/config/i386/constraints.md +++ b/gcc/config/i386/constraints.md @@ -141,8 +141,12 @@ "(ix86_fpmath & FPMATH_387) ? FLOAT_REGS : NO_REGS" "@internal Any x87 register when 80387 FP arithmetic is enabled.") +;; Yr constraint is meant to be used in noavx contexts only, for VEX and EVEX +;; the lower register numbers need the same instruction sizes as any other. +;; In case Yr constraint is misused, try to limit the damage, by treating +;; it as x constraint in avx mode, not v constraint. (define_register_constraint "Yr" - "TARGET_SSE ? (X86_TUNE_AVOID_4BYTE_PREFIXES ? NO_REX_SSE_REGS : ALL_SSE_REGS) : NO_REGS" + "TARGET_SSE ? ((TARGET_AVOID_4BYTE_PREFIXES && !TARGET_AVX) ? NO_REX_SSE_REGS : SSE_REGS) : NO_REGS" "@internal Lower SSE register when avoiding REX prefix and all SSE registers otherwise.") ;; We use the B prefix to denote any number of internal operands: diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 6a2471a1d80..75f98072c5d 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-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. Contributed by Apple Computer Inc. This file is part of GCC. @@ -236,7 +236,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 1c6c22172d4..c2cdb49ff68 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -630,33 +630,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 @@ -687,7 +681,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) @@ -804,8 +809,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"; @@ -886,6 +896,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 1899a11204c..7a7a4f8f1fd 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6590,6 +6590,10 @@ type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum, { machine_mode innermode = TYPE_MODE (TREE_TYPE (type)); + /* There are no XFmode vector modes. */ + if (innermode == XFmode) + return mode; + if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE) mode = MIN_MODE_VECTOR_FLOAT; else diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index d8315079a42..c9c376e38eb 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -454,6 +454,8 @@ extern unsigned char ix86_tune_features[X86_TUNE_LAST]; ix86_tune_features[X86_TUNE_SLOW_PSHUFB] #define TARGET_VECTOR_PARALLEL_EXECUTION \ ix86_tune_features[X86_TUNE_VECTOR_PARALLEL_EXECUTION] +#define TARGET_AVOID_4BYTE_PREFIXES \ + ix86_tune_features[X86_TUNE_AVOID_4BYTE_PREFIXES] #define TARGET_FUSE_CMP_AND_BRANCH_32 \ ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH_32] #define TARGET_FUSE_CMP_AND_BRANCH_64 \ diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index 7b6b389989b..3b223316e06 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -1930,7 +1930,7 @@ nios2_delegitimize_address (rtx x) case UNSPEC_LOAD_TLS_IE: case UNSPEC_ADD_TLS_LE: x = XVECEXP (XEXP (x, 0), 0, 0); - gcc_assert (GET_CODE (x) == SYMBOL_REF); + gcc_assert (CONSTANT_P (x)); break; } } diff --git a/gcc/configure b/gcc/configure index 56a8bb29e73..d91fde1e7b1 100755 --- a/gcc/configure +++ b/gcc/configure @@ -16141,7 +16141,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 @@ -20627,7 +20627,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*) @@ -23187,6 +23187,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 db50559e831..e9d10a97ac6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2837,6 +2837,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 0ec4290de33..5c93ca46568 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,56 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-03-23 Patrick Palka <ppalka@gcc.gnu.org> + + PR c++/70347 + * typeck.c (process_init_constructor_union): If the initializer + is empty, use the union's NSDMI if it has one. + +2016-05-20 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/70466 + * call.c (convert_like_real): Check that we are actually converting + from an init list. + +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. + + PR c++/70494 + * decl.c (cxx_maybe_build_cleanup): Handle non-decls. + * typeck2.c (split_nonconstant_init_1): Use it. + + PR c++/70648 + * constexpr.c (cxx_eval_store_expression): Also copy + CONSTRUCTOR_NO_IMPLICIT_ZERO. + + PR c++/70353 + * decl.c (make_rtl_for_nonlocal_decl): Don't defer local statics + in constexpr functions. + + PR c++/70095 + * pt.c (instantiate_decl): Fix call to variable_template_p. + +2016-05-18 Jason Merrill <jason@redhat.com> + Jakub Jelinek <jakub@redhat.com> + + PR c++/70135 + * constexpr.c (struct constexpr_ctx): Add save_exprs field. + (cxx_eval_loop_expr): Discard SAVE_EXPR values before looping. + (cxx_eval_constant_expression) [SAVE_EXPR]: Add it to the set. + (cxx_eval_outermost_constant_expr, is_sub_constant_expr): Initialize. + +2016-05-18 Jason Merrill <jason@redhat.com> + + * method.c (synthesized_method_walk): operator= can also be constexpr. + 2016-05-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/70635 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 0751b6daf45..a095cb4a59f 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6250,8 +6250,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, /* When converting from an init list we consider explicit constructors, but actually trying to call one is an error. */ if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn) + && BRACE_ENCLOSED_INITIALIZER_P (expr) /* Unless this is for direct-list-initialization. */ - && !DIRECT_LIST_INIT_P (expr)) + && !CONSTRUCTOR_IS_DIRECT_INIT (expr)) { if (!(complain & tf_error)) return error_mark_node; diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 390cc5a3b14..50e2338a13f 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -899,6 +899,9 @@ struct constexpr_ctx { /* Values for any temporaries or local variables within the constant-expression. */ hash_map<tree,tree> *values; + /* SAVE_EXPRs that we've seen within the current LOOP_EXPR. NULL if we + aren't inside a loop. */ + hash_set<tree> *save_exprs; /* The CONSTRUCTOR we're currently building up for an aggregate initializer. */ tree ctor; @@ -2917,6 +2920,8 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, /* An outer ctx->ctor might be pointing to *valp, so just replace its contents. */ CONSTRUCTOR_ELTS (*valp) = CONSTRUCTOR_ELTS (init); + CONSTRUCTOR_NO_IMPLICIT_ZERO (*valp) + = CONSTRUCTOR_NO_IMPLICIT_ZERO (init); } else *valp = init; @@ -3106,6 +3111,15 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t, return r; } +namespace { +bool +save_exprs_remover (const tree &expr, constexpr_ctx &ctx) +{ + ctx.values->remove (expr); + return true; +} +} + /* Evaluate a LOOP_EXPR for side-effects. Handles break and return semantics; continue semantics are covered by cxx_eval_statement_list. */ @@ -3114,16 +3128,25 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t, bool *non_constant_p, bool *overflow_p, tree *jump_target) { + constexpr_ctx new_ctx = *ctx; + tree body = TREE_OPERAND (t, 0); - while (true) + do { - cxx_eval_statement_list (ctx, body, + hash_set<tree> save_exprs; + new_ctx.save_exprs = &save_exprs; + + cxx_eval_statement_list (&new_ctx, body, non_constant_p, overflow_p, jump_target); - if (returns (jump_target) || breaks (jump_target) || *non_constant_p) - break; + + /* Forget saved values of SAVE_EXPRs. */ + save_exprs.traverse<constexpr_ctx &, save_exprs_remover>(new_ctx); } + while (!returns (jump_target) && !breaks (jump_target) && !*non_constant_p); + if (breaks (jump_target)) *jump_target = NULL_TREE; + return NULL_TREE; } @@ -3418,6 +3441,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0), false, non_constant_p, overflow_p); ctx->values->put (t, r); + if (ctx->save_exprs) + ctx->save_exprs->add (t); } break; @@ -3799,7 +3824,10 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant, bool non_constant_p = false; bool overflow_p = false; hash_map<tree,tree> map; - constexpr_ctx ctx = { NULL, &map, NULL, NULL, allow_non_constant, strict }; + + constexpr_ctx ctx = { NULL, &map, NULL, NULL, NULL, + allow_non_constant, strict }; + tree type = initialized_type (t); tree r = t; if (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)) @@ -3907,7 +3935,9 @@ is_sub_constant_expr (tree t) bool non_constant_p = false; bool overflow_p = false; hash_map <tree, tree> map; - constexpr_ctx ctx = { NULL, &map, NULL, NULL, true, true }; + + constexpr_ctx ctx = { NULL, &map, NULL, NULL, NULL, true, true }; + cxx_eval_constant_expression (&ctx, t, false, &non_constant_p, &overflow_p); return !non_constant_p && !overflow_p; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d38e49d84cf..3d68b637bca 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6151,8 +6151,11 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) return; /* We defer emission of local statics until the corresponding - DECL_EXPR is expanded. */ - defer_p = DECL_FUNCTION_SCOPE_P (decl) || DECL_VIRTUAL_P (decl); + DECL_EXPR is expanded. But with constexpr its function might never + be expanded, so go ahead and tell cgraph about the variable now. */ + defer_p = ((DECL_FUNCTION_SCOPE_P (decl) + && !DECL_DECLARED_CONSTEXPR_P (DECL_CONTEXT (decl))) + || DECL_VIRTUAL_P (decl)); /* Defer template instantiations. */ if (DECL_LANG_SPECIFIC (decl) @@ -14584,7 +14587,8 @@ complete_vars (tree type) /* If DECL is of a type which needs a cleanup, build and return an expression to perform that cleanup here. Return NULL_TREE if no - cleanup need be done. */ + cleanup need be done. DECL can also be a _REF when called from + split_nonconstant_init_1. */ tree cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) @@ -14602,7 +14606,10 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) /* Handle "__attribute__((cleanup))". We run the cleanup function before the destructor since the destructor is what actually terminates the lifetime of the object. */ - attr = lookup_attribute ("cleanup", DECL_ATTRIBUTES (decl)); + if (DECL_P (decl)) + attr = lookup_attribute ("cleanup", DECL_ATTRIBUTES (decl)); + else + attr = NULL_TREE; if (attr) { tree id; @@ -14662,6 +14669,7 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION); if (cleanup + && DECL_P (decl) && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl))) /* Treat objects with destructors as used; the destructor may do something substantive. */ diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 11fc20cb35f..d6fcc5b9c39 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1385,9 +1385,18 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, /* If that user-written default constructor would satisfy the requirements of a constexpr constructor (7.1.5), the - implicitly-defined default constructor is constexpr. */ + implicitly-defined default constructor is constexpr. + + The implicitly-defined copy/move assignment operator is constexpr if + - X is a literal type, and + - the assignment operator selected to copy/move each direct base class + subobject is a constexpr function, and + - for each non-static data member of X that is of class type (or array + thereof), the assignment operator selected to copy/move that member is a + constexpr function. */ if (constexpr_p) - *constexpr_p = ctor_p; + *constexpr_p = ctor_p + || (assign_p && cxx_dialect >= cxx14); move_p = false; switch (sfk) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e80377e7ee0..2889795aff3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12824,9 +12824,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; @@ -20597,7 +20598,7 @@ instantiate_decl (tree d, int defer_ok, if (enter_context) pop_nested_class (); - if (variable_template_p (td)) + if (variable_template_p (gen_tmpl)) note_variable_template_instantiation (d); } else if (TREE_CODE (d) == FUNCTION_DECL && DECL_DEFAULTED_FN (code_pattern)) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index a10a7623510..2ae483077e6 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -700,14 +700,9 @@ split_nonconstant_init_1 (tree dest, tree init) code = build_stmt (input_location, EXPR_STMT, code); code = maybe_cleanup_point_expr_void (code); add_stmt (code); - if (type_build_dtor_call (inner_type)) - { - code = (build_special_member_call - (sub, complete_dtor_identifier, NULL, inner_type, - LOOKUP_NORMAL, tf_warning_or_error)); - if (!TYPE_HAS_TRIVIAL_DESTRUCTOR (inner_type)) - finish_eh_cleanup (code); - } + if (tree cleanup + = cxx_maybe_build_cleanup (sub, tf_warning_or_error)) + finish_eh_cleanup (cleanup); } num_split_elts++; @@ -1487,9 +1482,24 @@ process_init_constructor_union (tree type, tree init, constructor_elt *ce; int len; - /* If the initializer was empty, use default zero initialization. */ + /* If the initializer was empty, use the union's NSDMI if it has one. + Otherwise use default zero initialization. */ if (vec_safe_is_empty (CONSTRUCTOR_ELTS (init))) - return 0; + { + for (tree field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) + { + if (DECL_INITIAL (field)) + { + CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (init), + field, + get_nsdmi (field, /*in_ctor=*/false)); + break; + } + } + + if (vec_safe_is_empty (CONSTRUCTOR_ELTS (init))) + return 0; + } len = CONSTRUCTOR_ELTS (init)->length (); if (len > 1) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d88a0f06d23..7ae4b21902f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2119,6 +2119,9 @@ scope. Version 8, which first appeared in G++ 4.9, corrects the substitution behavior of function types with function-cv-qualifiers. +Version 9, which first appeared in G++ 5.2, corrects the alignment of +@code{nullptr_t}. + See also @option{-Wabi}. @item -fabi-compat-version=@var{n} @@ -2620,7 +2623,15 @@ When mangling a function type with function-cv-qualifiers, the un-qualified function type was incorrectly treated as a substitution candidate. -This was fixed in @option{-fabi-version=8}. +This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. + +@item +@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to +unaligned accesses. Note that this did not affect the ABI of a +function with a @code{nullptr_t} parameter, as parameters have a +minimum alignment. + +This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. @end itemize It also warns about psABI-related changes. The known psABI changes at this diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index b2d46f10646..3121445bdcc 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1833,6 +1833,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/dwarf2out.c b/gcc/dwarf2out.c index e7e5788c4e3..6808cc15919 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -16255,7 +16255,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 540d4478684..1adf97f0f5f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -129,7 +129,8 @@ enum comparison_code { static bool negate_mathfn_p (enum built_in_function); static bool negate_expr_p (tree); static tree negate_expr (tree); -static tree split_tree (tree, enum tree_code, tree *, tree *, tree *, int); +static tree split_tree (location_t, tree, tree, enum tree_code, + tree *, tree *, tree *, int); static tree associate_trees (location_t, tree, tree, enum tree_code, tree); static enum comparison_code comparison_to_compcode (enum tree_code); static enum tree_code compcode_to_comparison (enum comparison_code); @@ -819,7 +820,10 @@ negate_expr (tree t) literal for which we use *MINUS_LITP instead. If NEGATE_P is true, we are negating all of IN, again except a literal - for which we use *MINUS_LITP instead. + for which we use *MINUS_LITP instead. If a variable part is of pointer + type, it is negated after converting to TYPE. This prevents us from + generating illegal MINUS pointer expression. LOC is the location of + the converted variable part. If IN is itself a literal or constant, return it as appropriate. @@ -827,8 +831,8 @@ negate_expr (tree t) same type as IN, but they will have the same signedness and mode. */ static tree -split_tree (tree in, enum tree_code code, tree *conp, tree *litp, - tree *minus_litp, int negate_p) +split_tree (location_t loc, tree in, tree type, enum tree_code code, + tree *conp, tree *litp, tree *minus_litp, int negate_p) { tree var = 0; @@ -884,8 +888,12 @@ split_tree (tree in, enum tree_code code, tree *conp, tree *litp, *minus_litp = *litp, *litp = 0; if (neg_conp_p) *conp = negate_expr (*conp); - if (neg_var_p) - var = negate_expr (var); + if (neg_var_p && var) + { + /* Convert to TYPE before negating. */ + var = fold_convert_loc (loc, type, var); + var = negate_expr (var); + } } else if (TREE_CODE (in) == BIT_NOT_EXPR && code == PLUS_EXPR) @@ -906,7 +914,12 @@ split_tree (tree in, enum tree_code code, tree *conp, tree *litp, else if (*minus_litp) *litp = *minus_litp, *minus_litp = 0; *conp = negate_expr (*conp); - var = negate_expr (var); + if (var) + { + /* Convert to TYPE before negating. */ + var = fold_convert_loc (loc, type, var); + var = negate_expr (var); + } } return var; @@ -5983,8 +5996,15 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, or (for divide and modulus) if it is a multiple of our constant. */ if (code == MULT_EXPR || wi::multiple_of_p (t, c, TYPE_SIGN (type))) - return const_binop (code, fold_convert (ctype, t), - fold_convert (ctype, c)); + { + tree tem = const_binop (code, fold_convert (ctype, t), + fold_convert (ctype, c)); + /* If the multiplication overflowed, we lost information on it. + See PR68142 and PR69845. */ + if (TREE_OVERFLOW (tem)) + return NULL_TREE; + return tem; + } break; CASE_CONVERT: case NON_LVALUE_EXPR: @@ -10383,9 +10403,10 @@ fold_binary_loc (location_t loc, then the result with variables. This increases the chances of literals being recombined later and of generating relocatable expressions for the sum of a constant and literal. */ - var0 = split_tree (arg0, code, &con0, &lit0, &minus_lit0, 0); - var1 = split_tree (arg1, code, &con1, &lit1, &minus_lit1, - code == MINUS_EXPR); + var0 = split_tree (loc, arg0, type, code, + &con0, &lit0, &minus_lit0, 0); + var1 = split_tree (loc, arg1, type, code, + &con1, &lit1, &minus_lit1, code == MINUS_EXPR); /* Recombine MINUS_EXPR operands by using PLUS_EXPR. */ if (code == MINUS_EXPR) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3e3d160f735..6172f0a192a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,33 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-06-02 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk. + PR fortran/70350 + * trans-expr.c (gfc_trans_assignment_1): Exclude initialization + assignments from check on assignment of scalars to unassigned + arrays and correct wrong code within the corresponding block. + +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-05-20 Jakub Jelinek <jakub@redhat.com> + + PR fortran/71204 + * frontend-passes.c (realloc_string_callback): Clear inserted_block + and changed_statement before calling create_var. + +2016-05-15 Harald Anlauf <anlauf@gmx.de> + + PR fortran/69603 + * interface.c (compare_parameter): Check for non-NULL pointer. + 2016-04-04 Andre Vehreschild <vehre@gmx.de> PR fortran/66911 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index d5d54ceddad..cc718e98c8b 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -155,8 +155,10 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees, if (!gfc_check_dependency (expr1, expr2, true)) return 0; - + current_code = c; + inserted_block = NULL; + changed_statement = NULL; n = create_var (expr2); co->expr2 = n; return 0; diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 0ada5ede18c..8571a747baf 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1993,7 +1993,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, } ppc = gfc_get_proc_ptr_comp (actual); - if (ppc) + if (ppc && ppc->ts.interface) { if (!gfc_compare_interfaces (formal, ppc->ts.interface, ppc->name, 0, 1, err, sizeof(err), NULL, NULL)) diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index db234630db2..7e368372ad9 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1499,6 +1499,7 @@ restart: not_continuation: c = '\n'; gfc_current_locus = old_loc; + end_flag = 0; done: if (c == '\n') diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 642ce26d02b..6f0bf6148b6 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -9125,8 +9125,9 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, } else { - gfc_conv_expr (&lse, expr1); + gfc_conv_expr (&lse, expr1); if (gfc_option.rtcheck & GFC_RTCHECK_MEM + && !init_flag && gfc_expr_attr (expr1).allocatable && expr1->rank && !expr2->rank) @@ -9134,14 +9135,17 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, tree cond; const char* msg; - tmp = expr1->symtree->n.sym->backend_decl; - if (POINTER_TYPE_P (TREE_TYPE (tmp))) - tmp = build_fold_indirect_ref_loc (input_location, tmp); + /* We should only get array references here. */ + gcc_assert (TREE_CODE (lse.expr) == POINTER_PLUS_EXPR + || TREE_CODE (lse.expr) == ARRAY_REF); - if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (tmp))) - tmp = gfc_conv_descriptor_data_get (tmp); - else - tmp = TREE_OPERAND (lse.expr, 0); + /* 'tmp' is either the pointer to the array(POINTER_PLUS_EXPR) + or the array itself(ARRAY_REF). */ + tmp = TREE_OPERAND (lse.expr, 0); + + /* Provide the address of the array. */ + if (TREE_CODE (lse.expr) == ARRAY_REF) + tmp = gfc_build_addr_expr (NULL_TREE, tmp); cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, tmp, build_int_cst (TREE_TYPE (tmp), 0)); diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 9b1d1c8b689..d6837d09485 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 54b6abeb34e..ff40b2b4e73 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -249,13 +249,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; @@ -281,6 +282,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 @@ -297,6 +299,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); } @@ -900,21 +903,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; @@ -1551,16 +1558,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) { @@ -1571,18 +1583,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; @@ -1590,23 +1608,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_func_body_info *fbi, 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) @@ -1627,14 +1647,14 @@ unmodified_parm_or_parm_agg_item (struct ipa_func_body_info *fbi, stmt = SSA_NAME_DEF_STMT (op); op = gimple_assign_rhs1 (stmt); if (!REFERENCE_CLASS_P (op)) - return unmodified_parm_or_parm_agg_item (fbi, stmt, op, index_p, + return unmodified_parm_or_parm_agg_item (fbi, stmt, op, index_p, size_p, aggpos); } aggpos->agg_contents = true; return ipa_load_from_parm_agg (fbi, fbi->info->descriptors, stmt, op, index_p, &aggpos->offset, - NULL, &aggpos->by_ref); + size_p, &aggpos->by_ref); } /* See if statement might disappear after inlining. @@ -1685,7 +1705,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. */ @@ -1695,7 +1715,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; } @@ -1708,7 +1728,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 @@ -1749,7 +1769,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 @@ -1779,6 +1799,7 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi, { gimple last; tree op; + HOST_WIDE_INT size; int index; struct agg_position_info aggpos; enum tree_code code, inverted_code; @@ -1796,7 +1817,7 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi, /* TODO: handle conditionals like var = op0 < 4; if (var != 0). */ - if (unmodified_parm_or_parm_agg_item (fbi, last, op, &index, &aggpos)) + if (unmodified_parm_or_parm_agg_item (fbi, last, op, &index, &size, &aggpos)) { code = gimple_cond_code (last); inverted_code = invert_tree_comparison (code, HONOR_NANS (op)); @@ -1810,7 +1831,7 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi, 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); @@ -1839,11 +1860,12 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi, || gimple_call_num_args (set_stmt) != 1) return; op2 = gimple_call_arg (set_stmt, 0); - if (!unmodified_parm_or_parm_agg_item (fbi, set_stmt, op2, &index, &aggpos)) + if (!unmodified_parm_or_parm_agg_item (fbi, 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; @@ -1862,6 +1884,7 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, gimple lastg; tree op; int index; + HOST_WIDE_INT size; struct agg_position_info aggpos; edge e; edge_iterator ei; @@ -1873,7 +1896,7 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, return; gswitch *last = as_a <gswitch *> (lastg); op = gimple_switch_index (last); - if (!unmodified_parm_or_parm_agg_item (fbi, last, op, &index, &aggpos)) + if (!unmodified_parm_or_parm_agg_item (fbi, last, op, &index, &size, &aggpos)) return; FOR_EACH_EDGE (e, ei, bb->succs) @@ -1898,12 +1921,12 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, 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 @@ -2003,13 +2026,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) @@ -2070,6 +2094,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, 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 @@ -2093,7 +2118,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, tree op; gcc_assert (gimple_assign_single_p (stmt)); op = gimple_assign_rhs1 (stmt); - if (!unmodified_parm_or_parm_agg_item (fbi, stmt, op, &base_index, + if (!unmodified_parm_or_parm_agg_item (fbi, stmt, op, &base_index, &size, &aggpos)) return p; } @@ -2104,7 +2129,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, 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 (fbi->info, parm) >= 0) continue; @@ -2119,18 +2144,19 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, 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); + HOST_WIDE_INT size; + tree parm = unmodified_parm (stmt, use, &size); int index; if (parm && (index = ipa_get_param_decl_index (fbi->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; } @@ -3384,7 +3410,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 @@ -4239,6 +4266,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); @@ -4403,6 +4431,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 85041f67dd7..5a2599d54f9 100644 --- a/gcc/ipa-inline.h +++ b/gcc/ipa-inline.h @@ -34,6 +34,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-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index 17e0a46130e..9fd302e03d3 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -528,7 +528,7 @@ contains_type_p (tree outer_type, HOST_WIDE_INT offset, tree inlined_polymorphic_ctor_dtor_block_p (tree block, bool check_clones) { - tree fn = BLOCK_ABSTRACT_ORIGIN (block); + tree fn = block_ultimate_origin (block); if (fn == NULL || TREE_CODE (fn) != FUNCTION_DECL) return NULL_TREE; @@ -1184,7 +1184,7 @@ noncall_stmt_may_be_vtbl_ptr_store (gimple stmt) for (tree block = gimple_block (stmt); block && TREE_CODE (block) == BLOCK; block = BLOCK_SUPERCONTEXT (block)) if (BLOCK_ABSTRACT_ORIGIN (block) - && TREE_CODE (BLOCK_ABSTRACT_ORIGIN (block)) == FUNCTION_DECL) + && TREE_CODE (block_ultimate_origin (block)) == FUNCTION_DECL) return inlined_polymorphic_ctor_dtor_block_p (block, false); return (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE && (DECL_CXX_CONSTRUCTOR_P (current_function_decl) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 747ab18f845..a7515f1791f 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1461,6 +1461,9 @@ determine_locally_known_aggregate_parts (gcall *call, tree arg, 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/java/ChangeLog b/gcc/java/ChangeLog index 5e4fa6187a5..ac7002909ca 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-04-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR java/70839 diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index fcb62110456..254c99a6019 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index b383631a747..15113722c7c 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -134,7 +134,7 @@ along with GCC; see the file COPYING3. If not see form followed by the data for the string. */ #define LTO_major_version 4 -#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 051f7334cc9..045d632c016 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 7d117e9a495..7244eda3332 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -1038,8 +1038,8 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node *node) for (s = symtab_node::get_for_asmname (name); s;) if (!s->externally_visible && ((s->real_symbol_p () - && !DECL_EXTERNAL (node->decl) - && !TREE_PUBLIC (node->decl)) + && !DECL_EXTERNAL (s->decl) + && !TREE_PUBLIC (s->decl)) || may_need_named_section_p (encoder, s)) && (!encoder || lto_symtab_encoder_lookup (encoder, s) != LCC_NOT_FOUND)) diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 22cd21650f6..a5da8b42cc7 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -1023,7 +1023,7 @@ optimize_sc (partial_schedule_ptr ps, ddg_ptr g) int row = SMODULO (branch_cycle, ps->ii); int num_splits = 0; sbitmap must_precede, must_follow, tmp_precede, tmp_follow; - int c; + int min_cycle, c; if (dump_file) fprintf (dump_file, "\nTrying to schedule node %d " @@ -1078,6 +1078,7 @@ optimize_sc (partial_schedule_ptr ps, ddg_ptr g) if (next_ps_i->id == g->closing_branch->cuid) break; + min_cycle = PS_MIN_CYCLE (ps) - SMODULO (PS_MIN_CYCLE (ps), ps->ii); remove_node_from_ps (ps, next_ps_i); success = try_scheduling_node_in_cycle (ps, g->closing_branch->cuid, c, @@ -1117,6 +1118,10 @@ optimize_sc (partial_schedule_ptr ps, ddg_ptr g) ok = true; } + /* This might have been added to a new first stage. */ + if (PS_MIN_CYCLE (ps) < min_cycle) + reset_sched_times (ps, 0); + free (must_precede); free (must_follow); } diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index e469069d455..cedc2e261d1 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index 91c26f1986b..4b2797d664c 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 3b9750332d9..70a526a19f9 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-01-11 Joseph Myers <joseph@codesourcery.com> * zh_CN.po: Update. diff --git a/gcc/regstat.c b/gcc/regstat.c index c683a49f0ff..a0c8a171e73 100644 --- a/gcc/regstat.c +++ b/gcc/regstat.c @@ -458,7 +458,7 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live) struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn); unsigned int regno; - if (!INSN_P (insn)) + if (!NONDEBUG_INSN_P (insn)) continue; /* Process the defs. */ diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 01e4d42799b..77f3013549c 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1328,7 +1328,7 @@ set_noop_p (const_rtx set) if (GET_CODE (dst) == ZERO_EXTRACT) return rtx_equal_p (XEXP (dst, 0), src) - && ! BYTES_BIG_ENDIAN && XEXP (dst, 2) == const0_rtx + && !BITS_BIG_ENDIAN && XEXP (dst, 2) == const0_rtx && !side_effects_p (src); if (GET_CODE (dst) == STRICT_LOW_PART) diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index e7ed32e4b75..7caebc9e806 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -2742,9 +2742,12 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *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 bfab499d54f..1b86563936c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,206 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-30 Dominique d'Humieres <dominiq@lps.ens.fr> + + Backport from trunk. + 2015-10-23 Maxim Ostapenko <m.ostapenko@partner.samsung.com> + + PR sanitizer/68042 + * c-c++-common/asan/sanity-check-pure-c-1.c: Adjust test + to pass on Darwin. + +2016-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk. + PR fortran/66461 + * gfortran.dg/unexpected_eof.f: New test. + +2016-05-24 Richard Biener <rguenther@suse.de> + + PR testsuite/71254 + * gcc.dg/simd-7.c: Compile on x86_64 and i?86 only. + +2016-05-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-11 Alexandre Oliva <aoliva@redhat.com> + + PR target/69634 + * gcc.dg/pr69634.c: New. + + 2016-03-23 Patrick Palka <ppalka@gcc.gnu.org> + + PR c++/70347 + * g++.dg/cpp1y/nsdmi-union1.C: New test. + + 2015-10-30 Richard Biener <rguenther@suse.de> + + PR middle-end/68142 + * c-c++-common/ubsan/pr68142.c: New testcase. + + 2016-03-24 Richard Henderson <rth@redhat.com> + + PR middle-end/69845 + * gcc.dg/tree-ssa/pr69845-1.c: New test. + * gcc.dg/tree-ssa/pr69845-2.c: New test. + +2016-05-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-08 Jakub Jelinek <jakub@redhat.com> + + PR ipa/69239 + * g++.dg/ipa/pr69239.C: New test. + + 2016-01-21 Martin Sebor <msebor@redhat.com> + + PR target/69252 + * gcc.target/powerpc/pr69252.c: New test. + +2016-05-21 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 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/70466 + * g++.dg/template/pr70466-1.C: New. + * g++.dg/template/pr70466-2.C: Likewise. + +2016-05-20 Jakub Jelinek <jakub@redhat.com> + + PR fortran/71204 + * gfortran.dg/pr71204.f90: New test. + +2016-05-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-03-02 Richard Biener <rguenther@suse.de> + + PR middle-end/67278 + * gcc.dg/simd-7.c: New testcase. + + 2016-03-02 Richard Biener <rguenther@suse.de> + Uros Bizjak <ubizjak@gmail.com> + + PR target/67278 + * gcc.dg/simd-8.c: New testcase. + + 2016-03-09 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/67278 + * gcc.dg/simd-7.c: Add -w -Wno-psabi to dg-options. + + PR target/67278 + * gcc.dg/simd-8.c: Add -w -Wno-psabi to dg-options. + +2016-05-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69720 + * gcc.dg/vect/vect-outer-pr69720.c: New testcase. + +2016-05-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-02-01 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/67921 + * c-c++-common/ubsan/pr67921.c: New test. + + 2016-05-06 Richard Biener <rguenther@suse.de> + + PR middle-end/70941 + * gcc.dg/torture/pr70941.c: New testcase. + + 2016-05-06 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/70941 + * gcc.dg/torture/pr70941.c (abort): Remove prototype. + (a, b, c, d): Change type from char to signed char. + (main): Compare against (signed char) -1634678893 instead of + hardcoded -109. Use __builtin_abort instead of abort. + + 2016-05-06 Richard Biener <rguenther@suse.de> + + PR middle-end/70931 + * gfortran.dg/pr70931.f90: New testcase. + + 2016-04-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70623 + * gcc.dg/torture/pr70623.c: New testcase. + * gcc.dg/torture/pr70623-2.c: Likewise. + + 2016-04-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70780 + * gcc.dg/torture/pr70780.c: New testcase. + +2016-05-19 Martin Jambor <mjambor@suse.cz> + + PR ipa/70646 + * gcc.dg/ipa/pr70646.c: New test. + +2016-05-19 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/69400 + * gcc.dg/plugin/wide-int_plugin.c (test_wide_int_mod_trunc): New + function. + (plugin_init): Call it. + * gcc.dg/torture/pr69400.c: New test. + +2016-03-08 Jakub Jelinek <jakub@redhat.com> + + PR c++/70135 + * g++.dg/cpp1y/constexpr-loop4.C: New test. + * g++.dg/ubsan/pr70135.C: New test. + +2016-05-18 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-18 Christophe Lyon <christophe.lyon@linaro.org> + + Backport from mainline r236377. + 2016-05-18 Christophe Lyon <christophe.lyon@linaro.org> + + * gcc.target/aarch64/tail_indirect_call_1.c: Scan for "br\t", + "blr\t" and switch to scan-assembler-times. + +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-15 Harald Anlauf <anlauf@gmx.de> + + PR fortran/69603 + * gfortran.dg/pr69603.f90: New testcase. + 2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline diff --git a/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c b/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c index 78d15e1aad3..219fcf8ac32 100644 --- a/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c +++ b/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c @@ -10,7 +10,7 @@ int main() { } /* { dg-output "heap-use-after-free.*(\n|\r\n|\r)" } */ -/* { dg-output " #0 \[^\n\r]*(in _*(interceptor_|)free|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 \[^\n\r]*(in _*(interceptor_|wrap_)free|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #1 \[^\n\r]*(in _*main (\[^\n\r]*sanity-check-pure-c-1.c:8|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ -/* { dg-output " #0 \[^\n\r]*(in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 \[^\n\r]*(in _*(interceptor_|wrap_)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #1 \[^\n\r]*(in _*main (\[^\n\r]*sanity-check-pure-c-1.c:7|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/pr67921.c b/gcc/testsuite/c-c++-common/ubsan/pr67921.c new file mode 100644 index 00000000000..728ff93a60f --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr67921.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=undefined" } */ + +struct s +{ + int n; + int arr[][6]; +}; +void bar (int); +void foo (struct s *ptr) +{ + int i; + for (; i < 2; i++) + for (; ptr->n;) + { + int *a = ptr->arr[i]; + int b[66]; + int j = 0; + + for (; j < 56; j++) + bar (a[j] - b[j]); + } +} diff --git a/gcc/testsuite/c-c++-common/ubsan/pr68142.c b/gcc/testsuite/c-c++-common/ubsan/pr68142.c new file mode 100644 index 00000000000..9498f08ae41 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr68142.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=undefined -fsanitize-undefined-trap-on-error" } */ + +int __attribute__((noinline,noclone)) +h(int a) +{ + return 2 * (a * (__INT_MAX__/2 + 1)); +} +int __attribute__((noinline,noclone)) +i(int a) +{ + return (2 * a) * (__INT_MAX__/2 + 1); +} +int __attribute__((noinline,noclone)) +j(int a, int b) +{ + return (b * a) * (__INT_MAX__/2 + 1); +} +int __attribute__((noinline,noclone)) +k(int a, int b) +{ + return (2 * a) * b; +} +int main() +{ + volatile int tem = h(-1); + tem = i(-1); + tem = j(-1, 2); + tem = k(-1, __INT_MAX__/2 + 1); + return 0; +} 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-__func__2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-__func__2.C new file mode 100644 index 00000000000..e6782905423 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-__func__2.C @@ -0,0 +1,13 @@ +// PR c++/70353 +// { dg-do link { target c++11 } } + +constexpr const char* ce () +{ + return __func__; +} + +const char *c = ce(); + +int main() +{ +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C new file mode 100644 index 00000000000..c12347dcc80 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C @@ -0,0 +1,11 @@ +// PR c++/70648 +// { dg-do compile { target c++11 } } + +struct C +{ + template <class... U> + constexpr C (...) : c { static_cast<U &&>(0)... } {} + int c[1]; +}; + +static constexpr int b = C{}.c[0]; 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-array2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array2.C new file mode 100644 index 00000000000..d0063e11cbf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array2.C @@ -0,0 +1,10 @@ +// PR c++/70494 +// { dg-do compile { target c++11 } } + +struct A { ~A(); }; + +int main() +{ + A v[] = { A(), A() }; + auto lambda = [v]{}; +} diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-assign1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-assign1.C new file mode 100644 index 00000000000..4583b64e3af --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-assign1.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++14 } } + +struct A { }; + +struct B +{ + A a; + constexpr B& operator=(const B&) = default; +}; diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C new file mode 100644 index 00000000000..5e7c3c97dc2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C @@ -0,0 +1,23 @@ +// { dg-do compile { target c++14 } } + +struct A +{ + int i; +}; + +constexpr bool f() +{ + A ar[4] = { 1, 2, 3, 4 }; + A *ap = ar; + int i = 0; + do + *ap++ = A{i}; + while (++i < 3); + return (ar[0].i == 0 + && ar[1].i == 1 + && ar[2].i == 2 + && ar[3].i == 4); +} + +#define SA(X) static_assert((X),#X) +SA(f()); diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-loop4.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop4.C new file mode 100644 index 00000000000..67f7cfa1d1d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop4.C @@ -0,0 +1,27 @@ +// { dg-do compile { target c++14 } } + +struct A +{ + int i; +}; + +constexpr bool f() +{ + A ar[5] = { 6, 7, 8, 9, 10 }; + A *ap = ar; + int i = 0, j = 0; + for (j = 0; j < 2; j++) + { + do + *ap++ = A{i}; + while (++i < j * 2 + 2); + } + return (ar[0].i == 0 + && ar[1].i == 1 + && ar[2].i == 2 + && ar[3].i == 3 + && ar[4].i == 10); +} + +#define SA(X) static_assert((X),#X) +SA(f()); diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-union1.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-union1.C new file mode 100644 index 00000000000..d9dd0bfcc91 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-union1.C @@ -0,0 +1,33 @@ +// PR c++/70347 +// { dg-do run { target c++14 } } + +union A { + char a; + long b = -42; +}; + +struct B { + union { + char a = 10; + long b; + }; +}; + +A c1{}; +A c2{4}; +B c3{}; +B c4{{9}}; + +int main() { + if (c1.b != -42) + __builtin_abort (); + + if (c2.a != 4) + __builtin_abort (); + + if (c3.a != 10) + __builtin_abort (); + + if (c4.a != 9) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ50.C b/gcc/testsuite/g++.dg/cpp1y/var-templ50.C new file mode 100644 index 00000000000..138a3997122 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ50.C @@ -0,0 +1,11 @@ +// PR c++/70095 +// { dg-do link { target c++14 } } + +template <typename T> struct Foo; +template <typename T> int variable_template = 0; +template <typename T> int variable_template<Foo<T>> = 0; +template <typename T> int get_variable_template() { return variable_template<T>; } + +int main() { + get_variable_template<Foo<int>>(); +} diff --git a/gcc/testsuite/g++.dg/ipa/pr69239.C b/gcc/testsuite/g++.dg/ipa/pr69239.C new file mode 100644 index 00000000000..913e4b198c0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr69239.C @@ -0,0 +1,71 @@ +// PR ipa/69239 +// { dg-do run } +// { dg-options "-O2 --param=early-inlining-insns=196" } +// { dg-additional-options "-fPIC" { target fpic } } + +struct D +{ + float f; + D () {} + virtual float bar (float z); +}; + +struct A +{ + A (); + virtual int foo (int i); +}; + +struct B : public D, public A +{ + virtual int foo (int i); +}; + +float +D::bar (float) +{ + return f / 2; +} + +int +A::foo (int i) +{ + return i + 1; +} + +int +B::foo (int i) +{ + return i + 2; +} + +int __attribute__ ((noinline,noclone)) +baz () +{ + return 1; +} + +static int __attribute__ ((noinline)) +fn (A *obj, int i) +{ + return obj->foo (i); +} + +inline __attribute__ ((always_inline)) +A::A () +{ + if (fn (this, baz ()) != 2) + __builtin_abort (); +} + +static void +bah () +{ + B b; +} + +int +main () +{ + bah (); +} 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/template/pr70466-1.C b/gcc/testsuite/g++.dg/template/pr70466-1.C new file mode 100644 index 00000000000..7eb83eab957 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr70466-1.C @@ -0,0 +1,27 @@ +// PR c++/70466 + +template < class T, class T > // { dg-error "conflicting" } +class A +{ +public: + explicit A (T (S::*f) ()) {} // { dg-error "expected" } +}; + +template < class T, class S > +A < T, S > foo (T (S::*f) ()) +{ + return A < T, S > (f); +} + +class B +{ +public: + void bar () {} +}; + +int +main () +{ + foo (&B::bar); + return 0; +} diff --git a/gcc/testsuite/g++.dg/template/pr70466-2.C b/gcc/testsuite/g++.dg/template/pr70466-2.C new file mode 100644 index 00000000000..7a7458a61f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr70466-2.C @@ -0,0 +1,25 @@ +// PR c++/70466 + +template < class T, class S > +struct A +{ + explicit A (...) {} +}; + +template < class T, class S > +A < T, S > foo (T (S::*f) ()) +{ + return A < T, S > (f); +} + +struct B +{ + void bar () {} +}; + +int +main () +{ + foo (&B::bar); + return 0; +} diff --git a/gcc/testsuite/g++.dg/ubsan/pr70135.C b/gcc/testsuite/g++.dg/ubsan/pr70135.C new file mode 100644 index 00000000000..f5b47c9efbe --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr70135.C @@ -0,0 +1,36 @@ +// PR c++/70135 +// { dg-do run } +// { dg-options "-fsanitize=bounds -std=c++14" } + +template <bool... b> +struct S { + static constexpr bool c[] {b...}; + static constexpr auto foo () + { + unsigned long n = 0; + for (unsigned long i = 0; i < sizeof (c); i++) + if (!c[i]) + ++n; + return n; + } + static constexpr auto n = foo () + 1; + static constexpr auto bar () + { + int h = 0; + for (int g = 0, i = 0; g < n; ++g) + { + while (i < sizeof...(b) && c[i++]) + ++h; + h += 64; + } + return h; + } +}; + +int +main () +{ + S <true, false, false, true, true, true, false, true> s; + constexpr auto c = s.bar (); + static_assert (s.bar () == 4 * 64 + 5, ""); +} diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c index 782fccb086b..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* nvptx-*-* } { "*" } { "" } } */ +/* { 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/pr69634.c b/gcc/testsuite/gcc.dg/pr69634.c new file mode 100644 index 00000000000..59e37390714 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69634.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-vrp -fcompare-debug" } */ +/* { dg-additional-options "-Wno-psabi -mno-sse" { target i?86-*-* x86_64-*-* } } */ + +typedef unsigned short u16; +typedef short v16u16 __attribute__ ((vector_size (16))); +typedef unsigned v16u32 __attribute__ ((vector_size (16))); +typedef unsigned long long v16u64 __attribute__ ((vector_size (16))); + +u16 +foo(u16 u16_1, v16u16 v16u16_0, v16u32 v16u64_0, v16u16 v16u16_1, v16u32 v16u32_1, v16u64 v16u64_1) +{ + v16u64_1 /= (v16u64){~v16u32_1[1]}; + u16_1 = 0; + u16_1 /= v16u32_1[2]; + v16u64_1 -= (v16u64) v16u16_1; + u16_1 >>= 1; + u16_1 -= ~0; + v16u16_1 /= (v16u16){~u16_1, 1 - v16u64_0[0], 0xffb6}; + return u16_1 + v16u16_0[1] + v16u16_1[3] + v16u64_1[0] + v16u64_1[1]; +} diff --git a/gcc/testsuite/gcc.dg/simd-7.c b/gcc/testsuite/gcc.dg/simd-7.c new file mode 100644 index 00000000000..d8b0f44ce0c --- /dev/null +++ b/gcc/testsuite/gcc.dg/simd-7.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target x86_64-*-* i?86-*-* } } */ +/* { dg-options "-w -Wno-psabi" } */ + +#if __SIZEOF_LONG_DOUBLE__ == 16 || __SIZEOF_LONG_DOUBLE__ == 8 +typedef long double a __attribute__((vector_size (16))); + +a __attribute__((noinline)) +sum (a first, a second) +{ + return first + second; +} + +a +foo (a x, a y, a z) +{ + return sum (x, y) + z; +} +#else +int main() {} +#endif diff --git a/gcc/testsuite/gcc.dg/simd-8.c b/gcc/testsuite/gcc.dg/simd-8.c new file mode 100644 index 00000000000..5bc8637c86b --- /dev/null +++ b/gcc/testsuite/gcc.dg/simd-8.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-w -Wno-psabi" } */ + +#if __SIZEOF_LONG_DOUBLE__ == 16 || __SIZEOF_LONG_DOUBLE__ == 8 +typedef long double a __attribute__((vector_size (32))); + +a __attribute__((noinline)) +sum (a first, a second) +{ + return first + second; +} + +a +foo (a x, a y, a z) +{ + return sum (x, y) + z; +} +#else +int main() {} +#endif diff --git a/gcc/testsuite/gcc.dg/torture/pr69166.c b/gcc/testsuite/gcc.dg/torture/pr69166.c new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69166.c diff --git a/gcc/testsuite/gcc.dg/torture/pr70623-2.c b/gcc/testsuite/gcc.dg/torture/pr70623-2.c new file mode 100644 index 00000000000..8e8dc96df0e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70623-2.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ + +int b8, il, rc, nm; + +void +h9(void) +{ + int *av = &b8; + +is: + for (;;) { + int vj, wk; + int *m9 = &b8; + + if (*m9 == *av) { + if (il == 0) + goto is; + +di: + continue; + for (vj = 0; vj < 1; ++vj) { + goto di; +kz: + ; + } + } + + for (rc = 0; rc < 2; ++rc) { + int bc = rc ? rc : nm; + int ud = bc ? (*av ? 0 : rc) : 1; + + if (ud != 0) + if (*av != 0) + goto kz; + } + + for (wk = 0; wk < 3; ++wk) + ++(*av); + av = 0; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70623.c b/gcc/testsuite/gcc.dg/torture/pr70623.c new file mode 100644 index 00000000000..37f2712d87d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70623.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +int nm; +int *av; + +void +h9(void) +{ + for (;;) { + int wk, rc; + int **ptr_10 = &av; + if (*av != 0) { + } +u4: + wk = 0; + for (rc = 0; rc < 3; ++rc) { + int bc = (rc ? rc : nm); + int ud = bc ? (*av ? 0 : rc) : 1; + if (ud != 0) { + if (*av != 0) + goto u4; + for (;;) { + } + } + } + while (wk < 3) { + av = **ptr_10; + ++wk; + } + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70780.c b/gcc/testsuite/gcc.dg/torture/pr70780.c new file mode 100644 index 00000000000..2f7a5cbea06 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70780.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ + +int a, b, c, *d, e; + +static int +fn1 () +{ + if (a) + goto l1; +l2: while (b) + if (*d) + return c; + for (e = 0; e; e++) + { + goto l2; +l1:; + } + return 0; +} + +int +main () +{ + fn1 (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70941.c b/gcc/testsuite/gcc.dg/torture/pr70941.c new file mode 100644 index 00000000000..eb37a1fb293 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70941.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +signed char a = 0, b = 0, c = 0, d = 0; + +int main() +{ + a = -(b - 405418259) - ((d && c) ^ 2040097152); + if (a != (signed char) -1634678893) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr69845-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr69845-1.c new file mode 100644 index 00000000000..92927ba4913 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr69845-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target int32 } */ +/* { dg-options "-O -fdump-tree-gimple -fdump-tree-optimized" } */ + +int +main () +{ + struct S { char s; } v; + v.s = 47; + int a = (int) v.s; + int b = (27005061 + (a + 680455)); + int c = ((1207142401 * (((8 * b) + 9483541) - 230968044)) + 469069442); + if (c != 1676211843) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "b \\\* 8" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr69845-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr69845-2.c new file mode 100644 index 00000000000..e0b38e9966c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr69845-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target int32 } */ +/* { dg-options "-O -fdump-tree-gimple -fdump-tree-optimized" } */ + +int +main () +{ + struct S { char s; } v; + v.s = 47; + unsigned int a = (unsigned int) v.s; + unsigned int b = (27005061 + (a + 680455)); + unsigned int c + = ((1207142401u * (((8u * b) + 9483541u) - 230968044u)) + 469069442u); + if (c != 1676211843u) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "b \\\* 1067204616" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c b/gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c new file mode 100644 index 00000000000..bcfcc6db8ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c @@ -0,0 +1,28 @@ +extern void abort (void); + +int a[128]; +double b[128] = { 1., 2., 3., 4. }; + +void __attribute__((noinline)) foo() +{ + int i; + for (i = 0; i < 128; ++i) + { + double tem1 = b[i]; + for (int j = 0; j < 32; ++j) + tem1 += 1; + b[i] = tem1; + a[i] = i; + } +} + +int main() +{ + foo (); + if (b[0] != 33. || b[1] != 34. + || b[2] != 35. || b[3] != 36.) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_double && vect_int } } } } */ 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..df88c71c42a --- /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=xgene1" } */ + +/* 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/aarch64/tail_indirect_call_1.c b/gcc/testsuite/gcc.target/aarch64/tail_indirect_call_1.c index 4759d20df9c..de8f12d6e22 100644 --- a/gcc/testsuite/gcc.target/aarch64/tail_indirect_call_1.c +++ b/gcc/testsuite/gcc.target/aarch64/tail_indirect_call_1.c @@ -3,8 +3,8 @@ typedef void FP (int); -/* { dg-final { scan-assembler "br" } } */ -/* { dg-final { scan-assembler-not "blr" } } */ +/* { dg-final { scan-assembler-times "br\t" 2 } } */ +/* { dg-final { scan-assembler-not "blr\t" } } */ void f1 (FP fp, int n) { diff --git a/gcc/testsuite/gcc.target/powerpc/pr69252.c b/gcc/testsuite/gcc.target/powerpc/pr69252.c new file mode 100644 index 00000000000..23334a900cb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr69252.c @@ -0,0 +1,28 @@ +/* PR target/69252 - [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs + with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure */ +/* { dg-do run } */ +/* { dg-options "-Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure " } */ +#define N 26 +int a[N]; +__attribute__ ((noinline, noclone)) + int main1 (int X) +{ + int s = X; + int i; + for (i = 0; i < N; i++) + s += (i + a[i]); + return s; +} + +int +main (void) +{ + int s, i; + for (i = 0; i < N; i++) + a[i] = 2 * i; + s = main1 (3); + if (s != 978) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/pr70963.c b/gcc/testsuite/gcc.target/powerpc/pr70963.c index b5d8316b722..128ebd9f09f 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr70963.c +++ b/gcc/testsuite/gcc.target/powerpc/pr70963.c @@ -1,7 +1,8 @@ -/* { dg-do run { target { powerpc64*-*-* && vsx_hw } } } */ -/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-do run { target powerpc64*-*-* } } */ +/* { dg-require-effective-target p8vector_hw } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -/* { dg-options "-maltivec" } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8" } */ #include <stdlib.h> #include <stdio.h> diff --git a/gcc/testsuite/gfortran.dg/pr69603.f90 b/gcc/testsuite/gfortran.dg/pr69603.f90 new file mode 100644 index 00000000000..dca4eb15fc6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69603.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-options "-fimplicit-none" } +! PR fortran/69603 - segfault with -fimplicit-none and proc_ptr_comp_24.f90 +! Based on reduced testcase by Dominique d'Humieres +PROGRAM prog + implicit none + TYPE object + PROCEDURE(), POINTER, NOPASS :: f + END TYPE object + TYPE (object) :: o1 + CALL set_func(o1%f) +CONTAINS + SUBROUTINE set_func(f) + PROCEDURE(), POINTER :: f + END SUBROUTINE set_func +END PROGRAM prog 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/pr71204.f90 b/gcc/testsuite/gfortran.dg/pr71204.f90 new file mode 100644 index 00000000000..1d1ee5c34a1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71204.f90 @@ -0,0 +1,17 @@ +! PR fortran/71204 +! { dg-do compile } +! { dg-options "-O0" } + +module pr71204 + character(10), allocatable :: z(:) +end module + +subroutine s1 + use pr71204 + z(2) = z(1) +end + +subroutine s2 + use pr71204 + z(2) = z(1) +end 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 e1597282466..15cb54cd10c 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -910,6 +910,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 a6ed03bf200..a1e48acef6c 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2927,10 +2927,10 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) } else if (!INTEGRAL_TYPE_P (TREE_TYPE (t)) && TYPE_MODE (TREE_TYPE (t)) != BLKmode - && (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (t))) + && (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (t))) != tree_to_uhwi (t1))) { - error ("mode precision of non-integral result does not " + error ("mode size of non-integral result does not " "match field size of BIT_FIELD_REF"); return t; } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 0099693bf17..83fb5d3eb39 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -649,7 +649,8 @@ remap_decls (tree decls, vec<tree, va_gc> **nonlocalized_list, /* We need to add this variable to the local decls as otherwise nothing else will do so. */ if (TREE_CODE (old_var) == VAR_DECL - && ! DECL_EXTERNAL (old_var)) + && ! DECL_EXTERNAL (old_var) + && cfun) add_local_decl (cfun, old_var); if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE) && !DECL_IGNORED_P (old_var) @@ -872,7 +873,7 @@ is_parm (tree decl) static unsigned short remap_dependence_clique (copy_body_data *id, unsigned short clique) { - if (clique == 0) + if (clique == 0 || processing_debug_stmt) return 0; if (!id->dependence_map) id->dependence_map diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 1537451de96..c5c06ca4b14 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2112,11 +2112,6 @@ prune_clobbered_mems (bitmap_set_t set, basic_block block) static sbitmap has_abnormal_preds; -/* List of blocks that may have changed during ANTIC computation and - thus need to be iterated over. */ - -static sbitmap changed_blocks; - /* Compute the ANTIC set for BLOCK. If succs(BLOCK) > 1 then @@ -2136,6 +2131,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) unsigned int bii; edge e; edge_iterator ei; + bool was_visited = BB_VISITED (block); old = ANTIC_OUT = S = NULL; BB_VISITED (block) = 1; @@ -2175,6 +2171,16 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) first = e->dest; else if (BB_VISITED (e->dest)) worklist.quick_push (e->dest); + else + { + /* Unvisited successors get their ANTIC_IN replaced by the + maximal set to arrive at a maximum ANTIC_IN solution. + We can ignore them in the intersection operation and thus + need not explicitely represent that maximum solution. */ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "ANTIC_IN is MAX on %d->%d\n", + e->src->index, e->dest->index); + } } /* Of multiple successors we have to have visited one already @@ -2216,15 +2222,8 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) clean (ANTIC_IN (block)); - if (!bitmap_set_equal (old, ANTIC_IN (block))) - { - changed = true; - bitmap_set_bit (changed_blocks, block->index); - FOR_EACH_EDGE (e, ei, block->preds) - bitmap_set_bit (changed_blocks, e->src->index); - } - else - bitmap_clear_bit (changed_blocks, block->index); + if (!was_visited || !bitmap_set_equal (old, ANTIC_IN (block))) + changed = true; maybe_dump_sets: if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2232,6 +2231,8 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) if (ANTIC_OUT) print_bitmap_set (dump_file, ANTIC_OUT, "ANTIC_OUT", block->index); + if (changed) + fprintf (dump_file, "[changed] "); print_bitmap_set (dump_file, ANTIC_IN (block), "ANTIC_IN", block->index); @@ -2363,14 +2364,7 @@ compute_partial_antic_aux (basic_block block, dependent_clean (PA_IN (block), ANTIC_IN (block)); if (!bitmap_set_equal (old_PA_IN, PA_IN (block))) - { - changed = true; - bitmap_set_bit (changed_blocks, block->index); - FOR_EACH_EDGE (e, ei, block->preds) - bitmap_set_bit (changed_blocks, e->src->index); - } - else - bitmap_clear_bit (changed_blocks, block->index); + changed = true; maybe_dump_sets: if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2396,6 +2390,8 @@ compute_antic (void) int num_iterations = 0; basic_block block; int i; + edge_iterator ei; + edge e; /* If any predecessor edges are abnormal, we punt, so antic_in is empty. We pre-build the map of blocks with incoming abnormal edges here. */ @@ -2404,20 +2400,17 @@ compute_antic (void) FOR_ALL_BB_FN (block, cfun) { - edge_iterator ei; - edge e; + BB_VISITED (block) = 0; FOR_EACH_EDGE (e, ei, block->preds) - { - e->flags &= ~EDGE_DFS_BACK; - if (e->flags & EDGE_ABNORMAL) - { - bitmap_set_bit (has_abnormal_preds, block->index); - break; - } - } + if (e->flags & EDGE_ABNORMAL) + { + bitmap_set_bit (has_abnormal_preds, block->index); - BB_VISITED (block) = 0; + /* We also anticipate nothing. */ + BB_VISITED (block) = 1; + break; + } /* While we are here, give empty ANTIC_IN sets to each block. */ ANTIC_IN (block) = bitmap_set_new (); @@ -2427,8 +2420,8 @@ compute_antic (void) /* At the exit block we anticipate nothing. */ BB_VISITED (EXIT_BLOCK_PTR_FOR_FN (cfun)) = 1; - changed_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun) + 1); - bitmap_ones (changed_blocks); + sbitmap worklist = sbitmap_alloc (last_basic_block_for_fn (cfun) + 1); + bitmap_ones (worklist); while (changed) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2441,12 +2434,18 @@ compute_antic (void) changed = false; for (i = postorder_num - 1; i >= 0; i--) { - if (bitmap_bit_p (changed_blocks, postorder[i])) + if (bitmap_bit_p (worklist, postorder[i])) { basic_block block = BASIC_BLOCK_FOR_FN (cfun, postorder[i]); - changed |= compute_antic_aux (block, - bitmap_bit_p (has_abnormal_preds, - block->index)); + bitmap_clear_bit (worklist, block->index); + if (compute_antic_aux (block, + bitmap_bit_p (has_abnormal_preds, + block->index))) + { + FOR_EACH_EDGE (e, ei, block->preds) + bitmap_set_bit (worklist, e->src->index); + changed = true; + } } } /* Theoretically possible, but *highly* unlikely. */ @@ -2458,7 +2457,7 @@ compute_antic (void) if (do_partial_partial) { - bitmap_ones (changed_blocks); + bitmap_ones (worklist); mark_dfs_back_edges (); num_iterations = 0; changed = true; @@ -2470,13 +2469,18 @@ compute_antic (void) changed = false; for (i = postorder_num - 1 ; i >= 0; i--) { - if (bitmap_bit_p (changed_blocks, postorder[i])) + if (bitmap_bit_p (worklist, postorder[i])) { basic_block block = BASIC_BLOCK_FOR_FN (cfun, postorder[i]); - changed - |= compute_partial_antic_aux (block, - bitmap_bit_p (has_abnormal_preds, - block->index)); + bitmap_clear_bit (worklist, block->index); + if (compute_partial_antic_aux (block, + bitmap_bit_p (has_abnormal_preds, + block->index))) + { + FOR_EACH_EDGE (e, ei, block->preds) + bitmap_set_bit (worklist, e->src->index); + changed = true; + } } } /* Theoretically possible, but *highly* unlikely. */ @@ -2486,7 +2490,7 @@ compute_antic (void) num_iterations); } sbitmap_free (has_abnormal_preds); - sbitmap_free (changed_blocks); + sbitmap_free (worklist); } @@ -4768,12 +4772,14 @@ init_pre (void) connect_infinite_loops_to_exit (); memset (&pre_stats, 0, sizeof (pre_stats)); + /* For ANTIC computation we need a postorder that also guarantees that + a block with a single successor is visited after its successor. + RPO on the inverted CFG has this property. */ postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun)); postorder_num = inverted_post_order_compute (postorder); alloc_aux_for_blocks (sizeof (struct bb_bitmap_sets)); - calculate_dominance_info (CDI_POST_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS); bitmap_obstack_initialize (&grand_bitmap_obstack); @@ -4811,8 +4817,6 @@ fini_pre () name_to_id.release (); free_aux_for_blocks (); - - free_dominance_info (CDI_POST_DOMINATORS); } namespace { diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 05515b522b0..fac1d39b289 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -3791,6 +3791,15 @@ get_initial_def_for_reduction (gimple stmt, tree init_val, else init_value = init_val; + /* In case of a nested reduction do not use an adjustment def as + that case is not supported by the epilogue generation correctly + if ncopies is not one. */ + if (adjustment_def && nested_in_vect_loop) + { + *adjustment_def = NULL; + return vect_get_vec_def_for_operand (init_val, stmt, NULL); + } + switch (code) { case WIDEN_SUM_EXPR: @@ -3805,13 +3814,7 @@ get_initial_def_for_reduction (gimple stmt, tree init_val, /* ADJUSMENT_DEF is NULL when called from vect_create_epilog_for_reduction to vectorize double reduction. */ if (adjustment_def) - { - if (nested_in_vect_loop) - *adjustment_def = vect_get_vec_def_for_operand (init_val, stmt, - NULL); - else - *adjustment_def = init_val; - } + *adjustment_def = init_val; if (code == MULT_EXPR) { @@ -4035,17 +4038,25 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt, (in case of SLP, do it for all the phis). */ /* Get the loop-entry arguments. */ + enum vect_def_type initial_def_dt = vect_unknown_def_type; if (slp_node) vect_get_vec_defs (reduction_op, NULL_TREE, stmt, &vec_initial_defs, NULL, slp_node, reduc_index); else { - vec_initial_defs.create (1); + /* Get at the scalar def before the loop, that defines the initial value + of the reduction variable. */ + gimple def_stmt = SSA_NAME_DEF_STMT (reduction_op); + tree initial_def = PHI_ARG_DEF_FROM_EDGE (def_stmt, + loop_preheader_edge (loop)); + vect_is_simple_use (initial_def, NULL, loop_vinfo, NULL, + &def_stmt, &initial_def, &initial_def_dt); /* For the case of reduction, vect_get_vec_def_for_operand returns the scalar def before the loop, that defines the initial value of the reduction variable. */ vec_initial_def = vect_get_vec_def_for_operand (reduction_op, stmt, &adjustment_def); + vec_initial_defs.create (1); vec_initial_defs.quick_push (vec_initial_def); } @@ -4060,6 +4071,15 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt, def = vect_defs[i]; for (j = 0; j < ncopies; j++) { + if (j != 0) + { + phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi)); + if (nested_in_vect_loop) + vec_init_def + = vect_get_vec_def_for_stmt_copy (initial_def_dt, + vec_init_def); + } + /* Set the loop-entry arg of the reduction-phi. */ add_phi_arg (as_a <gphi *> (phi), vec_init_def, loop_preheader_edge (loop), UNKNOWN_LOCATION); @@ -4080,8 +4100,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt, dump_gimple_stmt (MSG_NOTE, TDF_SLIM, SSA_NAME_DEF_STMT (def), 0); dump_printf (MSG_NOTE, "\n"); } - - phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi)); } } diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index 25436f9f736..2204183d74c 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gotools/ChangeLog b/gotools/ChangeLog index 5d52b0106ec..8dd431e0d91 100644 --- a/gotools/ChangeLog +++ b/gotools/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/include/ChangeLog b/include/ChangeLog index ed929aacef7..a13d15cf57e 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,17 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 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-12-04 Release Manager * GCC 5.3.0 released. diff --git a/include/demangle.h b/include/demangle.h index d2a6731a9ee..7fa7557b2c1 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -380,6 +380,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 96dd07d868b..dfdb461254e 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libada/ChangeLog b/libada/ChangeLog index 643c3c861db..471b10b6d65 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index 58826de45ca..488ec85588f 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-05-10 Sebastian Huber <sebastian.huber@embedded-brains.de> Backport from mainline: diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index a8597884819..2ba1798a755 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,13 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-18 Uros Bizjak <ubizjak@gmail.com> + + PR target/71161 + * elf.c (phdr_callback) [__i386__]: Add + __attribute__((__force_align_arg_pointer__)). + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index 3f14b11a43c..7a8fd5477b1 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/libcc1/ChangeLog b/libcc1/ChangeLog index 09ac00702fb..e25342d430c 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog index 904c67f7fa3..ed05e253961 100644 --- a/libcilkrts/ChangeLog +++ b/libcilkrts/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-05-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Backport from mainline diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 385c3b0bd10..589317304b2 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-03-30 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index 0e70b57a336..7acb445464b 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-01-31 Joseph Myers <joseph@codesourcery.com> * fi.po: Update. diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index 8567763a31a..a14cf4e1f8f 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 7bcce8191ac..52fc419c7c0 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,14 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-23 Thomas Schwinge <thomas@codesourcery.com> + + Backport trunk r236594: + + PR libffi/65567 + * testsuite/lib/libffi.exp (libffi_feature_test): Fix, and simply. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp index 169fe74ca7c..a0f6ab397ee 100644 --- a/libffi/testsuite/lib/libffi.exp +++ b/libffi/testsuite/lib/libffi.exp @@ -227,20 +227,21 @@ proc libffi_target_compile { source dest type options } { # TEST should be a preprocessor condition. Returns true if it holds. proc libffi_feature_test { test } { - set src "ffitest.c" + set src "ffitest[pid].c" set f [open $src "w"] puts $f "#include <ffi.h>" puts $f $test - puts $f "xyzzy" + puts $f "/* OK */" + puts $f "#else" + puts $f "# error Failed $test" puts $f "#endif" close $f - set lines [libffi_target_compile $src "" "preprocess" ""] + set lines [libffi_target_compile $src /dev/null assembly ""] file delete $src - set last [lindex [split $lines] end] - return [regexp -- "xyzzy" $last] + return [string match "" $lines] } # Utility routines. diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 3e73b7694d7..6cded6d8529 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,17 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 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-04-04 Eric Botcazou <ebotcazou@adacore.com> PR target/67172 diff --git a/libgcc/config.host b/libgcc/config.host index ee8460fdf44..452366703c5 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -915,14 +915,9 @@ mmix-knuth-mmixware) mn10300-*-*) tmake_file=t-fdpbit ;; -moxie-*-elf | moxie-*-moxiebox* | moxie-*-uclinux*) - tmake_file="moxie/t-moxie t-softfp-sfdf t-softfp-excl t-softfp" - extra_parts="$extra_parts crti.o crtn.o crtbegin.o crtend.o" - ;; -moxie-*-rtems*) +moxie-*-elf | moxie-*-moxiebox* | 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 crtbegin.o crtend.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 ea0bd9a3dd6..d31f051a6d3 100644 --- a/libgcc/config/libbid/ChangeLog +++ b/libgcc/config/libbid/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index b356340f478..b8ce7e7404c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-05-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> Backport from trunk. diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index ed890e0095c..ee0fbf5969d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-04-07 Thomas Schwinge <thomas@codesourcery.com> Backport trunk r234428: diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index c1eedd2d76e..9859ad34458 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,88 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 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. + 2015-12-04 Release Manager * GCC 5.3.0 released. @@ -1769,7 +1854,7 @@ that are locale-independent. * Makefile.in (filename_cmp.o): Add dependency on safe-ctype.h. -2007-04-11 Thomas Neumann tneumann@users.sourceforge.net +2007-04-11 Thomas Neumann <tneumann@users.sourceforge.net> * argv.c: Use ANSI C declarations. * make-relative-prefix.c: Likewise. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 77c2cee9d17..aef2e9b3292 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" @@ -394,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); @@ -417,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); @@ -538,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 *); @@ -715,7 +724,7 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_FIXED_TYPE: 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) + d_dump (dc->u.s_fixed.length, indent + 2); break; case DEMANGLE_COMPONENT_ARGLIST: printf ("argument list\n"); @@ -729,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; @@ -938,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: @@ -1105,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; @@ -1121,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; @@ -1229,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; } } @@ -1595,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); @@ -1608,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); @@ -1785,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 { @@ -1840,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; @@ -1982,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); @@ -2905,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') @@ -2916,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; } @@ -2928,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; @@ -3130,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); } @@ -3163,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')); @@ -3237,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 @@ -3264,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); @@ -3455,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; @@ -3511,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; @@ -3891,6 +3916,7 @@ d_count_templates_scopes (int *num_templates, int *num_scopes, 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: @@ -4037,10 +4063,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); } @@ -4193,6 +4219,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: @@ -4428,6 +4457,11 @@ d_print_comp_inner (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 @@ -5016,9 +5050,9 @@ d_print_comp_inner (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: @@ -5751,11 +5785,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 c68b9813de2..7514e57913c 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 @@ -1237,11 +1244,13 @@ squangle_mop_up (struct work_stuff *work) { free ((char *) work -> btypevec); work->btypevec = NULL; + work->bsize = 0; } if (work -> ktypevec != NULL) { free ((char *) work -> ktypevec); work->ktypevec = NULL; + work->ksize = 0; } } @@ -2999,6 +3008,11 @@ gnu_special (struct work_stuff *work, const char **mangled, string *declp) success = 1; break; } + else if (n == -1) + { + success = 0; + break; + } } else { @@ -4254,6 +4268,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); @@ -4281,6 +4297,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); @@ -4310,6 +4328,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); @@ -4764,6 +4784,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/demangle-expected b/libiberty/testsuite/demangle-expected index a030685de08..1d8b771579d 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. @@ -4356,3 +4386,46 @@ _QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z --format=gnu-v3 _Z1fSsB3fooS_ f(std::string[abi:foo], std::string[abi:foo]) +# +# 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/libitm/ChangeLog b/libitm/ChangeLog index 9f2bee1d313..213d243e11a 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 41be2bf6c1d..5d360b5e4d3 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 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 01375a691f5..c5ef1ff5177 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog index f309a2652bc..b3a273fc9af 100644 --- a/libjava/libltdl/ChangeLog +++ b/libjava/libltdl/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog index 89d88cc19fb..a0f7de29242 100644 --- a/libmpx/ChangeLog +++ b/libmpx/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2016-01-20 Ilya Enkovich <enkovich.gnu@gmail.com> Backport from mainline r232619. diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 940fd0ebf56..246a63001d0 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog index f6b1d9f80d8..f79ba9d8b56 100644 --- a/liboffloadmic/ChangeLog +++ b/liboffloadmic/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog index c332649ba4c..45a160998b7 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index abd1d21f64f..009441757fe 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,16 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-18 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-01-13 Maxim Ostapenko <m.ostapenko@partner.samsung.com> PR sanitizer/69147 diff --git a/libsanitizer/asan/asan_malloc_linux.cc b/libsanitizer/asan/asan_malloc_linux.cc index d03f1bb89c8..bfe72af69e6 100644 --- a/libsanitizer/asan/asan_malloc_linux.cc +++ b/libsanitizer/asan/asan_malloc_linux.cc @@ -24,39 +24,62 @@ // ---------------------- 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 (UNLIKELY(!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 496e8afbc1d..69d96c98761 100644 --- a/libssp/ChangeLog +++ b/libssp/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 04e167fc31a..58373fde82d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,139 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + +2016-05-26 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-04-24 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/70762 + * testsuite/util/testsuite_fs.h (__gnu_test::nonexistent_path): Use + static counter to return a different path on every call. + + * testsuite/experimental/filesystem/path/native/string.cc: Add + dg-require-filesystem-ts directive. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-04-20 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/69703 + * src/c++11/codecvt.cc (__codecvt_utf8_base<char16_t>::do_in, + __codecvt_utf8_utf16_base<char16_t>::do_in): Fix mask operations. + + Backport from mainline + 2016-04-19 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/69703 + * src/c++11/codecvt.cc (__codecvt_utf8_base<char16_t>::do_in)): + Override endianness bit in mode. + * testsuite/22_locale/codecvt/codecvt_utf8/69703.cc: New test. + * testsuite/22_locale/codecvt/codecvt_utf8_utf16/66855.cc: Test + that little_endian mode is ignored. + * testsuite/experimental/filesystem/path/native/string.cc: New test. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-10 Jonathan Wakely <jwakely@redhat.com> + + * include/experimental/bits/fs_dir.h (begin, end): Add noexcept. + * testsuite/experimental/filesystem/iterators/directory_iterator.cc: + Test begin and end functions. + * testsuite/experimental/filesystem/iterators/ + recursive_directory_iterator.cc: Likewise. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-10 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/71038 + * src/filesystem/ops.cc (do_copy_file): Fix backwards conditions. + * testsuite/experimental/filesystem/operations/copy_file.cc: New test. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-10 Jonathan Wakely <jwakely@redhat.com> + + * include/experimental/bits/fs_dir.h (__directory_iterator_proxy): + Overload operator* to move from rvalues. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-10 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/71036 + * src/filesystem/ops.cc (create_dir): Handle EEXIST from mkdir. + * testsuite/experimental/filesystem/operations/create_directory.cc: + New test. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-10 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/71037 + * src/filesystem/ops.cc (canonical(const path&, const path&)): Add + base path to exception. + * testsuite/experimental/filesystem/operations/canonical.cc: Test + paths contained in exception. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-10 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/71005 + * include/experimental/bits/fs_dir.h (__directory_iterator_proxy): + New type. + (directory_iterator::operator++(int)): Return proxy. + (recursive_directory_iterator::operator++(int)): Likewise. + * testsuite/experimental/filesystem/iterators/directory_iterator.cc: + Test post-increment. + * testsuite/experimental/filesystem/iterators/ + recursive_directory_iterator.cc: Likewise. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-05-09 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/71004 + * include/experimental/bits/fs_dir.h (recursive_directory_iterator): + Initialize scalar member variables in default constructor. + * testsuite/experimental/filesystem/iterators/ + recursive_directory_iterator.cc: Test default construction. + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-04-19 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/70609 + * src/filesystem/ops.cc (close_fd): New function. + (do_copy_file): Set permissions before copying file contents. Check + result of closing file descriptors. Don't copy streambuf when file + is empty. + (copy(const path&, const path&, copy_options, error_code&)): Use + lstat for source file when copy_symlinks is set. + * testsuite/experimental/filesystem/operations/copy.cc: Test copy(). + +2016-05-25 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-04-19 Jonathan Wakely <jwakely@redhat.com> + + * include/experimental/bits/fs_fwd.h (operator&, operator|, operator^, + operator~ operator&=, operator|=, operator^=): Add noexcept to + overloaded operators for copy_options, perms and directory_options. + * src/filesystem/ops.cc (make_file_type, make_file_status, + is_not_found_errno, file_time): Add noexcept. + 2016-04-20 Jonathan Wakely <jwakely@redhat.com> Backport from mainline diff --git a/libstdc++-v3/include/experimental/fs_dir.h b/libstdc++-v3/include/experimental/fs_dir.h index 0c5253fb62d..7c5f8e8ab21 100644 --- a/libstdc++-v3/include/experimental/fs_dir.h +++ b/libstdc++-v3/include/experimental/fs_dir.h @@ -153,8 +153,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 }; struct _Dir; + class directory_iterator; class recursive_directory_iterator; + struct __directory_iterator_proxy + { + const directory_entry& operator*() const& noexcept { return _M_entry; } + + directory_entry operator*() && noexcept { return std::move(_M_entry); } + + private: + friend class directory_iterator; + friend class recursive_directory_iterator; + + explicit + __directory_iterator_proxy(const directory_entry& __e) : _M_entry(__e) { } + + directory_entry _M_entry; + }; + class directory_iterator { public: @@ -177,7 +194,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 : directory_iterator(__p, directory_options::none, __ec) { } directory_iterator(const path& __p, - directory_options __options, error_code& __ec) noexcept + directory_options __options, + error_code& __ec) noexcept : directory_iterator(__p, __options, &__ec) { } directory_iterator(const directory_iterator& __rhs) = default; @@ -186,19 +204,22 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 ~directory_iterator() = default; - directory_iterator& operator=(const directory_iterator& __rhs) = default; - directory_iterator& operator=(directory_iterator&& __rhs) noexcept = default; + directory_iterator& + operator=(const directory_iterator& __rhs) = default; + + directory_iterator& + operator=(directory_iterator&& __rhs) noexcept = default; const directory_entry& operator*() const; const directory_entry* operator->() const { return &**this; } directory_iterator& operator++(); directory_iterator& increment(error_code& __ec) noexcept; - directory_iterator operator++(int) + __directory_iterator_proxy operator++(int) { - auto __tmp = *this; + __directory_iterator_proxy __pr{**this}; ++*this; - return __tmp; + return __pr; } private: @@ -214,10 +235,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 }; inline directory_iterator - begin(directory_iterator __iter) { return __iter; } + begin(directory_iterator __iter) noexcept + { return __iter; } inline directory_iterator - end(directory_iterator) { return directory_iterator(); } + end(directory_iterator) noexcept + { return directory_iterator(); } inline bool operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) @@ -274,18 +297,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // modifiers recursive_directory_iterator& - operator=(const recursive_directory_iterator& __rhs) noexcept; + operator=(const recursive_directory_iterator& __rhs) noexcept; recursive_directory_iterator& - operator=(recursive_directory_iterator&& __rhs) noexcept; + operator=(recursive_directory_iterator&& __rhs) noexcept; recursive_directory_iterator& operator++(); recursive_directory_iterator& increment(error_code& __ec) noexcept; - recursive_directory_iterator operator++(int) + __directory_iterator_proxy operator++(int) { - auto __tmp = *this; + __directory_iterator_proxy __pr{**this}; ++*this; - return __tmp; + return __pr; } void pop(); @@ -301,15 +324,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 struct _Dir_stack; std::shared_ptr<_Dir_stack> _M_dirs; - directory_options _M_options; - bool _M_pending; + directory_options _M_options = {}; + bool _M_pending = false; }; inline recursive_directory_iterator - begin(recursive_directory_iterator __iter) { return __iter; } + begin(recursive_directory_iterator __iter) noexcept + { return __iter; } inline recursive_directory_iterator - end(recursive_directory_iterator) { return recursive_directory_iterator(); } + end(recursive_directory_iterator) noexcept + { return recursive_directory_iterator(); } inline bool operator==(const recursive_directory_iterator& __lhs, diff --git a/libstdc++-v3/include/experimental/fs_fwd.h b/libstdc++-v3/include/experimental/fs_fwd.h index dd6f5e6dd2c..9cf903fe902 100644 --- a/libstdc++-v3/include/experimental/fs_fwd.h +++ b/libstdc++-v3/include/experimental/fs_fwd.h @@ -93,7 +93,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 }; constexpr copy_options - operator&(copy_options __x, copy_options __y) + operator&(copy_options __x, copy_options __y) noexcept { using __utype = typename std::underlying_type<copy_options>::type; return static_cast<copy_options>( @@ -101,7 +101,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr copy_options - operator|(copy_options __x, copy_options __y) + operator|(copy_options __x, copy_options __y) noexcept { using __utype = typename std::underlying_type<copy_options>::type; return static_cast<copy_options>( @@ -109,7 +109,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr copy_options - operator^(copy_options __x, copy_options __y) + operator^(copy_options __x, copy_options __y) noexcept { using __utype = typename std::underlying_type<copy_options>::type; return static_cast<copy_options>( @@ -117,22 +117,22 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr copy_options - operator~(copy_options __x) + operator~(copy_options __x) noexcept { using __utype = typename std::underlying_type<copy_options>::type; return static_cast<copy_options>(~static_cast<__utype>(__x)); } inline copy_options& - operator&=(copy_options& __x, copy_options __y) + operator&=(copy_options& __x, copy_options __y) noexcept { return __x = __x & __y; } inline copy_options& - operator|=(copy_options& __x, copy_options __y) + operator|=(copy_options& __x, copy_options __y) noexcept { return __x = __x | __y; } inline copy_options& - operator^=(copy_options& __x, copy_options __y) + operator^=(copy_options& __x, copy_options __y) noexcept { return __x = __x ^ __y; } @@ -163,7 +163,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 }; constexpr perms - operator&(perms __x, perms __y) + operator&(perms __x, perms __y) noexcept { using __utype = typename std::underlying_type<perms>::type; return static_cast<perms>( @@ -171,7 +171,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr perms - operator|(perms __x, perms __y) + operator|(perms __x, perms __y) noexcept { using __utype = typename std::underlying_type<perms>::type; return static_cast<perms>( @@ -179,7 +179,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr perms - operator^(perms __x, perms __y) + operator^(perms __x, perms __y) noexcept { using __utype = typename std::underlying_type<perms>::type; return static_cast<perms>( @@ -187,22 +187,22 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr perms - operator~(perms __x) + operator~(perms __x) noexcept { using __utype = typename std::underlying_type<perms>::type; return static_cast<perms>(~static_cast<__utype>(__x)); } inline perms& - operator&=(perms& __x, perms __y) + operator&=(perms& __x, perms __y) noexcept { return __x = __x & __y; } inline perms& - operator|=(perms& __x, perms __y) + operator|=(perms& __x, perms __y) noexcept { return __x = __x | __y; } inline perms& - operator^=(perms& __x, perms __y) + operator^=(perms& __x, perms __y) noexcept { return __x = __x ^ __y; } // Bitmask type @@ -211,7 +211,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 }; constexpr directory_options - operator&(directory_options __x, directory_options __y) + operator&(directory_options __x, directory_options __y) noexcept { using __utype = typename std::underlying_type<directory_options>::type; return static_cast<directory_options>( @@ -219,7 +219,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr directory_options - operator|(directory_options __x, directory_options __y) + operator|(directory_options __x, directory_options __y) noexcept { using __utype = typename std::underlying_type<directory_options>::type; return static_cast<directory_options>( @@ -227,7 +227,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr directory_options - operator^(directory_options __x, directory_options __y) + operator^(directory_options __x, directory_options __y) noexcept { using __utype = typename std::underlying_type<directory_options>::type; return static_cast<directory_options>( @@ -235,22 +235,22 @@ _GLIBCXX_END_NAMESPACE_CXX11 } constexpr directory_options - operator~(directory_options __x) + operator~(directory_options __x) noexcept { using __utype = typename std::underlying_type<directory_options>::type; return static_cast<directory_options>(~static_cast<__utype>(__x)); } inline directory_options& - operator&=(directory_options& __x, directory_options __y) + operator&=(directory_options& __x, directory_options __y) noexcept { return __x = __x & __y; } inline directory_options& - operator|=(directory_options& __x, directory_options __y) + operator|=(directory_options& __x, directory_options __y) noexcept { return __x = __x | __y; } inline directory_options& - operator^=(directory_options& __x, directory_options __y) + operator^=(directory_options& __x, directory_options __y) noexcept { return __x = __x ^ __y; } typedef chrono::time_point<chrono::system_clock> file_time_type; diff --git a/libstdc++-v3/src/c++11/codecvt.cc b/libstdc++-v3/src/c++11/codecvt.cc index a454064ce60..8cd8eb46a96 100644 --- a/libstdc++-v3/src/c++11/codecvt.cc +++ b/libstdc++-v3/src/c++11/codecvt.cc @@ -789,7 +789,11 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end, { range<const char> from{ __from, __from_end }; range<char16_t> to{ __to, __to_end }; - auto res = ucs2_in(from, to, _M_maxcode, _M_mode); + codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header)); +#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ + mode = codecvt_mode(mode | little_endian); +#endif + auto res = ucs2_in(from, to, _M_maxcode, mode); __from_next = from.next; __to_next = to.next; return res; @@ -1264,7 +1268,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end, { range<const char> from{ __from, __from_end }; range<char16_t> to{ __to, __to_end }; - codecvt_mode mode = codecvt_mode(_M_mode | (consume_header|generate_header)); + codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header)); #if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ mode = codecvt_mode(mode | little_endian); #endif diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index 81525609698..0f09cebf050 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -220,8 +220,9 @@ fs::canonical(const path& p, const path& base) { error_code ec; path can = canonical(p, base, ec); - if (ec.value()) - _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot canonicalize", p, ec)); + if (ec) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot canonicalize", p, base, + ec)); return can; } @@ -249,7 +250,7 @@ namespace typedef struct ::stat stat_type; inline fs::file_type - make_file_type(const stat_type& st) + make_file_type(const stat_type& st) noexcept { using fs::file_type; #ifdef _GLIBCXX_HAVE_S_ISREG @@ -273,7 +274,7 @@ namespace } inline fs::file_status - make_file_status(const stat_type& st) + make_file_status(const stat_type& st) noexcept { return fs::file_status{ make_file_type(st), @@ -282,13 +283,13 @@ namespace } inline bool - is_not_found_errno(int err) + is_not_found_errno(int err) noexcept { return err == ENOENT || err == ENOTDIR; } inline fs::file_time_type - file_time(const stat_type& st) + file_time(const stat_type& st) noexcept { using namespace std::chrono; return fs::file_time_type{ @@ -300,6 +301,17 @@ namespace }; } + // Returns true if the file descriptor was successfully closed, + // otherwise returns false and the reason will be in errno. + inline bool + close_fd(int fd) + { + while (::close(fd)) + if (errno != EINTR) + return false; + return true; + } + bool do_copy_file(const fs::path& from, const fs::path& to, fs::copy_options option, @@ -376,7 +388,8 @@ namespace } struct CloseFD { - ~CloseFD() { if (fd != -1) ::close(fd); } + ~CloseFD() { if (fd != -1) close_fd(fd); } + bool close() { return close_fd(std::exchange(fd, -1)); } int fd; }; @@ -401,34 +414,49 @@ namespace return false; } +#ifdef _GLIBCXX_USE_FCHMOD + if (::fchmod(out.fd, from_st->st_mode)) +#elif _GLIBCXX_USE_FCHMODAT + if (::fchmodat(AT_FDCWD, to.c_str(), from_st->st_mode, 0)) +#else + if (::chmod(to.c_str(), from_st->st_mode)) +#endif + { + ec.assign(errno, std::generic_category()); + return false; + } + #ifdef _GLIBCXX_USE_SENDFILE - auto n = ::sendfile(out.fd, in.fd, nullptr, from_st->st_size); + const auto n = ::sendfile(out.fd, in.fd, nullptr, from_st->st_size); if (n != from_st->st_size) { ec.assign(errno, std::generic_category()); return false; } + if (!out.close() || !in.close()) + { + ec.assign(errno, std::generic_category()); + return false; + } #else __gnu_cxx::stdio_filebuf<char> sbin(in.fd, std::ios::in); __gnu_cxx::stdio_filebuf<char> sbout(out.fd, std::ios::out); - if ( !(std::ostream(&sbout) << &sbin) ) + if (sbin.is_open()) + in.fd = -1; + if (sbout.is_open()) + out.fd = -1; + if (from_st->st_size && !(std::ostream(&sbout) << &sbin)) { ec = std::make_error_code(std::errc::io_error); return false; } -#endif - -#ifdef _GLIBCXX_USE_FCHMOD - if (::fchmod(out.fd, from_st->st_mode)) -#elif _GLIBCXX_USE_FCHMODAT - if (::fchmodat(AT_FDCWD, to.c_str(), from_st->st_mode, 0)) -#else - if (::chmod(to.c_str(), from_st->st_mode)) -#endif + if (!sbout.close() || !sbin.close()) { ec.assign(errno, std::generic_category()); return false; } +#endif + ec.clear(); return true; } @@ -439,13 +467,15 @@ void fs::copy(const path& from, const path& to, copy_options options, error_code& ec) noexcept { - bool skip_symlinks = is_set(options, copy_options::skip_symlinks); - bool create_symlinks = is_set(options, copy_options::create_symlinks); - bool use_lstat = create_symlinks || skip_symlinks; + const bool skip_symlinks = is_set(options, copy_options::skip_symlinks); + const bool create_symlinks = is_set(options, copy_options::create_symlinks); + const bool copy_symlinks = is_set(options, copy_options::copy_symlinks); + const bool use_lstat = create_symlinks || skip_symlinks; file_status f, t; stat_type from_st, to_st; - if (use_lstat + // N4099 doesn't check copy_symlinks here, but I think that's a defect. + if (use_lstat || copy_symlinks ? ::lstat(from.c_str(), &from_st) : ::stat(from.c_str(), &from_st)) { @@ -488,7 +518,7 @@ fs::copy(const path& from, const path& to, copy_options options, { if (skip_symlinks) ec.clear(); - else if (!exists(t) && is_set(options, copy_options::copy_symlinks)) + else if (!exists(t) && copy_symlinks) copy_symlink(from, to, ec); else // Not clear what should be done here. @@ -630,22 +660,26 @@ namespace bool create_dir(const fs::path& p, fs::perms perm, std::error_code& ec) { + bool created = false; #ifdef _GLIBCXX_HAVE_SYS_STAT_H ::mode_t mode = static_cast<std::underlying_type_t<fs::perms>>(perm); if (::mkdir(p.c_str(), mode)) { - ec.assign(errno, std::generic_category()); - return false; + const int err = errno; + if (err != EEXIST || !is_directory(p)) + ec.assign(err, std::generic_category()); + else + ec.clear(); } else { ec.clear(); - return true; + created = true; } #else ec = std::make_error_code(std::errc::not_supported); - return false; #endif + return created; } } // namespace diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc new file mode 100644 index 00000000000..745d2c27917 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc @@ -0,0 +1,103 @@ +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <codecvt> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + const char out[] = "abc"; + char16_t in[4]; + std::codecvt_utf8<char16_t> cvt; + std::mbstate_t st; + const char* no; + char16_t* ni; + auto res = cvt.in(st, out, out+3, no, in, in+3, ni); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( in[0] == u'a' ); + VERIFY( in[1] == u'b' ); + VERIFY( in[2] == u'c' ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + + const char out[] = "abc"; + char16_t in[4]; + std::codecvt_utf8<char16_t, 0x10ffff, std::little_endian> cvt; + std::mbstate_t st; + const char* no; + char16_t* ni; + auto res = cvt.in(st, out, out+3, no, in, in+3, ni); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( in[0] == u'a' ); + VERIFY( in[1] == u'b' ); + VERIFY( in[2] == u'c' ); +} + +void +test03() +{ + bool test __attribute__((unused)) = true; + + const char out[] = "abc"; + char32_t in[4]; + std::codecvt_utf8<char32_t> cvt; + std::mbstate_t st; + const char* no; + char32_t* ni; + auto res = cvt.in(st, out, out+3, no, in, in+3, ni); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( in[0] == U'a' ); + VERIFY( in[1] == U'b' ); + VERIFY( in[2] == U'c' ); +} + + +void +test04() +{ + bool test __attribute__((unused)) = true; + + const char out[] = "abc"; + char32_t in[4]; + std::codecvt_utf8<char32_t, 0x10ffff, std::little_endian> cvt; + std::mbstate_t st; + const char* no; + char32_t* ni; + auto res = cvt.in(st, out, out+3, no, in, in+3, ni); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( in[0] == U'a' ); + VERIFY( in[1] == U'b' ); + VERIFY( in[2] == U'c' ); +} + +int +main() +{ + test01(); + test02(); + test01(); + test02(); +} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/66855.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/66855.cc index 3f99cb416f4..1870a3aab46 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/66855.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/66855.cc @@ -45,8 +45,35 @@ test01() VERIFY( buf[3] == utf16[3] ); } +void +test02() +{ + // Endianness flag should make no difference. + std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::little_endian> cvt; + char16_t utf16[] = u"\ub098\ub294\ud0dc\uc624"; + const char16_t* nf16; + char utf8[16]; + char* nt8; + std::mbstate_t st{}; + auto res = cvt.out(st, utf16, utf16+4, nf16, utf8, utf8+16, nt8); + VERIFY( res == std::codecvt_base::ok ); + + st = {}; + char16_t buf[4] = {}; + const char* nf8 = nt8; + char16_t* nt16; + res = cvt.in(st, utf8, nf8, nf8, buf, buf+4, nt16); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( nt16 == buf+4 ); + VERIFY( buf[0] == utf16[0] ); + VERIFY( buf[1] == utf16[1] ); + VERIFY( buf[2] == utf16[2] ); + VERIFY( buf[3] == utf16[3] ); +} + int main() { test01(); + test02(); } diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/directory_iterator.cc index 56b808d3252..60d91e2eb1b 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/directory_iterator.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/directory_iterator.cc @@ -70,8 +70,79 @@ test01() remove_all(p, ec); } +void +test02() +{ + bool test __attribute__((unused)) = false; + + std::error_code ec; + const auto p = __gnu_test::nonexistent_path(); + create_directory(p, fs::current_path(), ec); + create_directory_symlink(p, p / "l", ec); + VERIFY( !ec ); + + // Test post-increment (libstdc++/71005) + auto iter = fs::directory_iterator(p, ec); + VERIFY( !ec ); + VERIFY( iter != fs::directory_iterator() ); + const auto entry1 = *iter; + const auto entry2 = *iter++; + VERIFY( entry1 == entry2 ); + VERIFY( entry1.path() == p/"l" ); + VERIFY( iter == fs::directory_iterator() ); + + remove_all(p, ec); +} + +void +test03() +{ + bool test __attribute__((unused)) = false; + + std::error_code ec; + const auto p = __gnu_test::nonexistent_path(); + create_directories(p / "longer_than_small_string_buffer", ec); + VERIFY( !ec ); + + // Test for no reallocation on each dereference (this is a GNU extension) + auto iter = fs::directory_iterator(p, ec); + const auto* s1 = iter->path().c_str(); + const auto* s2 = iter->path().c_str(); + VERIFY( s1 == s2 ); + + remove_all(p, ec); +} + +void +test04() +{ + bool test __attribute__((unused)) = false; + + const fs::directory_iterator it; + VERIFY( it == fs::directory_iterator() ); +} + +void +test05() +{ + bool test __attribute__((unused)) = false; + + auto p = __gnu_test::nonexistent_path(); + create_directory(p); + create_directory_symlink(p, p / "l"); + fs::directory_iterator it(p), endit; + VERIFY( begin(it) == it ); + static_assert( noexcept(begin(it)), "begin is noexcept" ); + VERIFY( end(it) == endit ); + static_assert( noexcept(end(it)), "end is noexcept" ); +} + int main() { test01(); + test02(); + test03(); + test04(); + test05(); } diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc index 9424c80ab83..ae98bee66c1 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc @@ -97,8 +97,83 @@ test01() remove_all(p, ec); } +void +test02() +{ + bool test __attribute__((unused)) = false; + + std::error_code ec; + const auto p = __gnu_test::nonexistent_path(); + create_directories(p / "d1/d2", ec); + VERIFY( !ec ); + + // Test post-increment (libstdc++/71005) + auto iter = fs::recursive_directory_iterator(p, ec); + VERIFY( !ec ); + VERIFY( iter != fs::recursive_directory_iterator() ); + const auto entry1 = *iter; + const auto entry2 = *iter++; + VERIFY( entry1 == entry2 ); + VERIFY( entry1.path() == p/"d1" ); + const auto entry3 = *iter; + const auto entry4 = *iter++; + VERIFY( entry3 == entry4 ); + VERIFY( entry3.path() == p/"d1/d2" ); + VERIFY( iter == fs::recursive_directory_iterator() ); + + remove_all(p, ec); +} + +void +test03() +{ + bool test __attribute__((unused)) = false; + + std::error_code ec; + const auto p = __gnu_test::nonexistent_path(); + create_directories(p / "longer_than_small_string_buffer", ec); + VERIFY( !ec ); + + // Test for no reallocation on each dereference (this is a GNU extension) + auto iter = fs::recursive_directory_iterator(p, ec); + const auto* s1 = iter->path().c_str(); + const auto* s2 = iter->path().c_str(); + VERIFY( s1 == s2 ); + + remove_all(p, ec); +} + +void +test04() +{ + bool test __attribute__((unused)) = false; + + // libstdc++/71004 + const fs::recursive_directory_iterator it; + VERIFY( it == fs::recursive_directory_iterator() ); +} + +void +test05() +{ + bool test __attribute__((unused)) = false; + + auto p = __gnu_test::nonexistent_path(); + create_directory(p); + create_directory_symlink(p, p / "l"); + fs::recursive_directory_iterator it(p), endit; + VERIFY( begin(it) == it ); + static_assert( noexcept(begin(it)), "begin is noexcept" ); + VERIFY( end(it) == endit ); + static_assert( noexcept(end(it)), "end is noexcept" ); +} + int main() { test01(); + test02(); + test03(); + test04(); + test05(); } diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc index 5091a709c41..c1d2a7a6c42 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc @@ -59,8 +59,28 @@ test01() VERIFY( !ec ); } +void +test02() +{ +#if __cpp_exceptions + bool test __attribute__((unused)) = false; + + fs::path p = "rel", base = __gnu_test::nonexistent_path(); + fs::path e1, e2; + try { + canonical(p, base); + } catch (const fs::filesystem_error& e) { + e1 = e.path1(); + e2 = e.path2(); + } + VERIFY( e1 == p ); + VERIFY( e2 == base ); +#endif +} + int main() { test01(); + test02(); } diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc index 35d49f0f7f7..ef28677e5b3 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc @@ -21,34 +21,127 @@ // 15.3 Copy [fs.op.copy] #include <experimental/filesystem> +#include <fstream> #include <testsuite_fs.h> #include <testsuite_hooks.h> -using std::experimental::filesystem::path; +namespace fs = std::experimental::filesystem; +// Test error conditions. void test01() { bool test __attribute__((unused)) = false; - for (const path& p : __gnu_test::test_paths) - VERIFY( absolute(p).is_absolute() ); + auto p = __gnu_test::nonexistent_path(); + std::error_code ec; + + VERIFY( !fs::exists(p) ); + fs::copy(p, ".", fs::copy_options::none, ec); + VERIFY( ec ); + + ec.clear(); + fs::copy(".", ".", fs::copy_options::none, ec); + VERIFY( ec ); + + std::ofstream{p.native()}; + VERIFY( fs::is_directory(".") ); + VERIFY( fs::is_regular_file(p) ); + ec.clear(); + fs::copy(".", p, fs::copy_options::none, ec); + VERIFY( ec ); + + remove(p, ec); } +// Test is_symlink(f) case. void test02() { bool test __attribute__((unused)) = false; - path p1("/"); - VERIFY( absolute(p1) == p1 ); - VERIFY( absolute(p1, "/bar") == p1 ); - path p2("/foo"); - VERIFY( absolute(p2) == p2 ); - VERIFY( absolute(p2, "/bar") == p2 ); - path p3("foo"); - VERIFY( absolute(p3) != p3 ); - VERIFY( absolute(p3, "/bar") == "/bar/foo" ); + auto from = __gnu_test::nonexistent_path(); + auto to = __gnu_test::nonexistent_path(); + std::error_code ec; + + fs::create_symlink(".", from, ec); + VERIFY( !ec ); + VERIFY( fs::exists(from) ); + + fs::copy(from, to, fs::copy_options::skip_symlinks, ec); + VERIFY( !ec ); + VERIFY( !fs::exists(to) ); + + fs::copy(from, to, fs::copy_options::skip_symlinks, ec); + VERIFY( !ec ); + VERIFY( !fs::exists(to) ); + + fs::copy(from, to, + fs::copy_options::skip_symlinks|fs::copy_options::copy_symlinks, + ec); + VERIFY( !ec ); + VERIFY( !fs::exists(to) ); + + fs::copy(from, to, fs::copy_options::copy_symlinks, ec); + VERIFY( !ec ); + VERIFY( fs::exists(to) ); + + fs::copy(from, to, fs::copy_options::copy_symlinks, ec); + VERIFY( ec ); + + remove(from, ec); + remove(to, ec); +} + +// Test is_regular_file(f) case. +void +test03() +{ + bool test __attribute__((unused)) = false; + + auto from = __gnu_test::nonexistent_path(); + auto to = __gnu_test::nonexistent_path(); + + // test empty file + std::ofstream{from.native()}; + VERIFY( fs::exists(from) ); + VERIFY( fs::file_size(from) == 0 ); + fs::copy(from, to); + VERIFY( fs::exists(to) ); + VERIFY( fs::file_size(to) == 0 ); + + remove(to); + VERIFY( !fs::exists(to) ); + std::ofstream{from.native()} << "Hello, filesystem!"; + VERIFY( fs::file_size(from) != 0 ); + fs::copy(from, to); + VERIFY( fs::exists(to) ); + VERIFY( fs::file_size(to) == fs::file_size(from) ); +} + +// Test is_directory(f) case. +void +test04() +{ + bool test __attribute__((unused)) = false; + + auto from = __gnu_test::nonexistent_path(); + auto to = __gnu_test::nonexistent_path(); + std::error_code ec; + +} + +// Test no-op cases. +void +test05() +{ + bool test __attribute__((unused)) = false; + + auto to = __gnu_test::nonexistent_path(); + std::error_code ec; + + fs::copy("/", to, fs::copy_options::create_symlinks, ec); + VERIFY( !ec ); } int @@ -56,4 +149,7 @@ main() { test01(); test02(); + test03(); + test04(); + test05(); } diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy_file.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy_file.cc new file mode 100644 index 00000000000..cdb79111351 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy_file.cc @@ -0,0 +1,82 @@ +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// 15.4 Copy [fs.op.copy_file] + +#include <experimental/filesystem> +#include <fstream> +#include <testsuite_fs.h> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = false; + using std::experimental::filesystem::copy_options; + std::error_code ec; + + auto from = __gnu_test::nonexistent_path(); + auto to = __gnu_test::nonexistent_path(); + + // test non-existent file + bool b = copy_file(from, to, ec); + VERIFY( !b ); + VERIFY( ec ); + VERIFY( !exists(to) ); + + // test empty file + std::ofstream{from.native()}; + VERIFY( exists(from) ); + VERIFY( file_size(from) == 0 ); + + b = copy_file(from, to); + VERIFY( b ); + VERIFY( exists(to) ); + VERIFY( file_size(to) == 0 ); + remove(to); + VERIFY( !exists(to) ); + b = copy_file(from, to, copy_options::none, ec); + VERIFY( b ); + VERIFY( !ec ); + VERIFY( exists(to) ); + VERIFY( file_size(to) == 0 ); + + std::ofstream{from.native()} << "Hello, filesystem!"; + VERIFY( file_size(from) != 0 ); + remove(to); + VERIFY( !exists(to) ); + b = copy_file(from, to); + VERIFY( b ); + VERIFY( exists(to) ); + VERIFY( file_size(to) == file_size(from) ); + remove(to); + VERIFY( !exists(to) ); + b = copy_file(from, to); + VERIFY( b ); + VERIFY( !ec ); + VERIFY( exists(to) ); + VERIFY( file_size(to) == file_size(from) ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc new file mode 100644 index 00000000000..66c2b3fb796 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +#include <experimental/filesystem> +#include <testsuite_hooks.h> +#include <testsuite_fs.h> + +namespace fs = std::experimental::filesystem; + +void +test01() +{ + bool test __attribute__((unused)) = false; + std::error_code ec; + + // Test empty path. + fs::path p; + bool b = create_directory( p, ec ); + VERIFY( ec ); + VERIFY( !b ); + + // Test non-existent path + p = __gnu_test::nonexistent_path(); + VERIFY( !exists(p) ); + + b = create_directory(p, ec); // create the directory once + VERIFY( !ec ); + VERIFY( b ); + VERIFY( exists(p) ); + + // Test existing path (libstdc++/71036). + b = create_directory(p, ec); + VERIFY( !ec ); + VERIFY( !b ); + b = create_directory(p); + VERIFY( !ec ); + VERIFY( !b ); + + remove_all(p, ec); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc new file mode 100644 index 00000000000..e56fda7b95f --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc @@ -0,0 +1,73 @@ +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +#include <experimental/filesystem> +#include <string> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + using namespace std::experimental::filesystem; + const std::string s = "abc"; + path p(s); + + VERIFY( p.native() == s ); + VERIFY( p.c_str() == s ); + VERIFY( static_cast<std::string>(p) == s ); + + std::string s2 = p; // implicit conversion + VERIFY( s2 == p.native() ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + + using namespace std::experimental::filesystem; + const char* s = "abc"; + path p(s); + + auto str = p.string<char>(); + VERIFY( str == u"abc" ); + VERIFY( str == p.string() ); + + auto strw = p.string<wchar_t>(); + VERIFY( strw == L"abc" ); + VERIFY( strw == p.wstring() ); + + auto str16 = p.string<char16_t>(); + VERIFY( str16 == u"abc" ); + VERIFY( str16 == p.u16string() ); + + auto str32 = p.string<char32_t>(); + VERIFY( str32 == U"abc" ); + VERIFY( str32 == p.u32string() ); +} + +int +main() +{ + test01(); + test02(); +} diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h index 524972ece9b..ddcb2b7e395 100644 --- a/libstdc++-v3/testsuite/util/testsuite_fs.h +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h @@ -83,7 +83,9 @@ namespace __gnu_test p = tmp; #else char buf[64]; - std::sprintf(buf, "test.%lu", (unsigned long)::getpid()); + static int counter; + std::sprintf(buf, "filesystem-ts-test.%d.%lu", counter++, + (unsigned long) ::getpid()); p = buf; #endif return p; diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog index 6295ac3b34d..5571f6753cb 100644 --- a/libvtv/ChangeLog +++ b/libvtv/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index 81f7df7c66d..39788af6c8b 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index cbc27535a91..8fa4318ab03 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/zlib/ChangeLog b/zlib/ChangeLog index 902f9929f64..1085e3ebee9 100644 --- a/zlib/ChangeLog +++ b/zlib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-03 Release Manager + + * GCC 5.4.0 released. + 2015-12-04 Release Manager * GCC 5.3.0 released. |