diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2018-11-09 12:03:50 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2018-11-09 12:03:50 +0000 |
commit | 28477d96c28e9e6f644509b5a58ffc1aa0e3e68e (patch) | |
tree | dd8c1efce28e27fe87e89b34a5d0a1e2e9bb66d0 | |
parent | ff997251a89e52d4486c7dab080f61998bde95f8 (diff) |
Merge branches/gcc-6-branch rev 265890.
Change-Id: I455aeaee1501d788ce5c2059ca82fb7a66ee2fca
192 files changed, 4556 insertions, 499 deletions
diff --git a/ChangeLog b/ChangeLog index 099c9049c80..c178df50a47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index cbbb03b7d11..a305e5539e6 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/config/ChangeLog b/config/ChangeLog index 4c5e807b2c2..b1043b5749c 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 2ca2cddb038..578db5b7c0c 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-10-02 Thomas Schwinge <thomas@codesourcery.com> * gcc_update (files_and_dependencies): Handle libbacktrace. diff --git a/contrib/header-tools/ChangeLog b/contrib/header-tools/ChangeLog index c37243b11c3..f4c46dba032 100644 --- a/contrib/header-tools/ChangeLog +++ b/contrib/header-tools/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/contrib/reghunt/ChangeLog b/contrib/reghunt/ChangeLog index d58feafbb0c..b1c7d1807ef 100644 --- a/contrib/reghunt/ChangeLog +++ b/contrib/reghunt/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog index 954ed2fd3f0..a0382c98efc 100644 --- a/contrib/regression/ChangeLog +++ b/contrib/regression/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 930cdd65984..7f999292601 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-11-11 John David Anglin <danglin@gcc.gnu.org> Backport from mainline diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 4c77920fd2c..f22d756da39 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -6.4.1 +6.5.0 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b61f8486906..df94dfda70b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,232 @@ +2018-11-07 Max Filippov <jcmvbkbc@gmail.com> + + Backport from mainline + 2018-11-05 Max Filippov <jcmvbkbc@gmail.com> + + * config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0. + +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-17 Eric Botcazou <ebotcazou@adacore.com> + + PR middle-end/87623 + * fold-const.c (fold_truth_andor_1): If the right side is not constant, + bail out if both sides do not have the same storage order. + +2018-10-15 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2018-08-23 Richard Biener <rguenther@suse.de> + + PR middle-end/87024 + * tree-inline.c (copy_bb): Drop unused __builtin_va_arg_pack_len + calls. + + 2018-08-17 Richard Biener <rguenther@suse.de> + + PR middle-end/86505 + * tree-inline.c (copy_bb): When inlining __builtin_va_arg_pack_len () + across a va-arg-pack using call adjust its return value accordingly. + +2018-10-12 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2018-10-10 Jakub Jelinek <jakub@redhat.com> + + PR target/87550 + * config/i386/i386.c (bdesc_args): Move IX86_BUILTIN_RDPMC + from here to ... + (bdesc_special_args): ... here. + + 2018-09-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/87248 + * fold-const.c (fold_ternary_loc) <case COND_EXPR>: Verify also that + BIT_AND_EXPR's second operand is a power of two. Formatting fix. + + 2018-08-27 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/87065 + * combine.c (simplify_if_then_else): Formatting fix. + (if_then_else_cond): Guard MULT optimization with SCALAR_INT_MODE_P + check. + (known_cond): Don't return const_true_rtx for vector modes. Use + CONST0_RTX instead of const0_rtx. Formatting fixes. + + 2018-07-24 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/86627 + * expmed.c (expand_divmod): Punt if d == HOST_WIDE_INT_MIN + and size > HOST_BITS_PER_WIDE_INT. For size > HOST_BITS_PER_WIDE_INT + and abs_d == d, do the power of two handling if profitable. + + 2018-07-17 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/86542 + * omp-low.c (create_task_copyfn): Copy over also fields corresponding + to _looptemp_ clauses, other than the first two. + + PR middle-end/86539 + * gimplify.c (gimplify_omp_for): Ensure taskloop firstprivatized init + and cond temporaries don't have reference type if iterator has + pointer type. For init use &for_pre_body instead of pre_p if + for_pre_body is non-empty. + + 2018-07-26 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/86660 + * omp-low.c (scan_sharing_clauses): Don't ignore map clauses for + declare target to variables if they have always,{to,from,tofrom} map + kinds. + +2018-10-12 Richard Biener <rguenther@suse.de> + + PR c++/54278 + Backport from mainline + 2017-03-23 Richard Biener <rguenther@suse.de> + + PR tree-optimization/80032 + * gimplify.c (gimple_push_cleanup): Forced unconditional + cleanups still have to go to the conditional_cleanups + sequence. + + 2017-03-21 Richard Biener <rguenther@suse.de> + + PR tree-optimization/80032 + * gimplify.c (gimple_push_cleanup): Add force_uncond parameter, + if set force the cleanup to happen unconditionally. + (gimplify_target_expr): Push inserted clobbers with force_uncond + to avoid them being removed by control-dependent DCE. + +2018-10-12 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2018-10-08 H.J. Lu <hongjiu.lu@intel.com> + + PR target/87517 + * config/i386/avx512fintrin.h (_mm512_mask_fmaddsub_round_pd): + Defined with __builtin_ia32_vfmaddsubpd512_mask. + +2018-10-12 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2018-10-05 H.J. Lu <hongjiu.lu@intel.com> + + PR target/87522 + * config/i386/gnu-user.h (ASM_SPEC): Don't pass -msse2avx to + assembler for -mavx. + * config/i386/gnu-user64.h (ASM_SPEC): Likewise. + +2018-09-19 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/pa.md (atomic_storeqi): Restore deleted expander. + (atomic_storehi): Likewise. + (atomic_storesi): Likewise. + (atomic_loaddi): Restore compare and swap exchange loop code. + +2018-09-04 Max Filippov <jcmvbkbc@gmail.com> + + Backport from mainline + 2018-09-04 Max Filippov <jcmvbkbc@gmail.com> + + * config/xtensa/xtensa.c (xtensa_expand_atomic): Reorder AND and + XOR operations in NAND case. + +2018-09-03 Tom de Vries <tdevries@suse.de> + + backport from trunk: + 2018-06-21 Tom de Vries <tdevries@suse.de> + + PR tree-optimization/85859 + * tree-ssa-tail-merge.c (stmt_local_def): Copy gimple_is_call + test with comment from bb_no_side_effects_p. + +2018-08-21 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2018-08-20 H.J. Lu <hongjiu.lu@intel.com> + + PR target/87014 + * config/i386/i386.md (eh_return): Always update EH return + address in word_mode. + +2018-08-17 John David Anglin <danglin@gcc.gnu.org> + + Backport from mainline + 2018-08-11 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum. + Update comment for atomic instructions. + (atomic_storeqi, atomic_storehi, atomic_storesi, atomic_storesf, + atomic_loaddf, atomic_loaddf_1, atomic_storedf, atomic_storedf_1): + Remove. + (atomic_loaddi): Revise fence expansion to only emit fence prior to + load for __ATOMIC_SEQ_CST model. + (atomic_loaddi_1): Remove float register target. + (atomic_storedi): Handle CONST_INT values. + (atomic_storedi_1): Remove float register source. Add special case + for zero value. + (memory_barrier): New expander and insn. + +2018-08-14 Matthias Klose <doko@ubuntu.com> + + Backport from mainline + 2018-08-01 Richard Biener <rguenther@suse.de> + + PR bootstrap/86724 + * graphite.h: Include isl/id.h and isl/space.h to allow build + with ISL 0.20. + +2018-08-10 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from mainline + 2018-06-19 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/86197 + * config/rs6000/rs6000.md (rs6000_discover_homogeneous_aggregate): An + ieee128 argument takes up only one (vector) register, not two (floating + point) registers. + +2018-07-29 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/pa.c (pa_output_addr_vec): Align address table. + * config/pa/pa.h (JUMP_TABLES_IN_TEXT_SECTION): Revise comment. + * config/pa/pa32-linux.h (JUMP_TABLES_IN_TEXT_SECTION): Define. + +2018-07-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + PR target/84168 + 2017-09-28 Joseph Myers <joseph@codesourcery.com> + + * config/aarch64/aarch64.c (aarch64_elf_asm_constructor) + (aarch64_elf_asm_destructor): Pass SECTION_NOTYPE to get_section + when creating .init_array and .fini_array sections with priority + specified. + +2018-07-12 Richard Biener <rguenther@suse.de> + + PR target/84829 + * config/gnu-user.h (GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC): + Remove -mieee-fp handling. + +2018-07-01 David Edelsohn <dje.gcc@gmail.com> + + Backported from mainline. + 2018-06-19 Tony Reix <tony.reix@atos.com> + Damien Bergamini <damien.bergamini@atos.com> + David Edelsohn <dje.gcc@gmail.com> + + * collect2.c (static_obj): New variable. + (static_libs): New variable. + (is_in_list): Uncomment declaration. + (main): Track AIX libraries linked statically. + (is_in_list): Uncomment definition. + (scan_prog_file): Don't add AIX shared libraries initializer + to constructor list if linking statically. + 2018-06-26 Kelvin Nilsen <kelvin@gcc.gnu.org> Backported from mainline diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cc9cd77611b..30a71f8107a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20180627 +20181026 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7f6106e0fbd..589118745ff 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2018-06-02 Eric Botcazou <ebotcazou@adacore.com> Backport from mainline diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 7ff31517ead..3c0a0db42bf 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2018-06-25 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 494a470bb2f..da41c501644 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2018-06-25 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/collect2.c b/gcc/collect2.c index bffac802b8f..319fcb31e3f 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -1,6 +1,6 @@ /* Collect static initialization info into data structures that can be traversed by C++ initialization and finalization routines. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. Contributed by Chris Smith (csmith@convex.com). Heavily modified by Michael Meissner (meissner@cygnus.com), Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.com). @@ -201,6 +201,7 @@ static enum lto_mode_d lto_mode = LTO_MODE_NONE; bool helpflag; /* true if --help */ static int shared_obj; /* true if -shared */ +static int static_obj; /* true if -static */ static const char *c_file; /* <xxx>.c for constructor/destructor list. */ static const char *o_file; /* <xxx>.o for constructor/destructor list. */ @@ -255,6 +256,7 @@ bool may_unlink_output_file = false; #ifdef COLLECT_EXPORT_LIST /* Lists to keep libraries to be scanned for global constructors/destructors. */ static struct head libs; /* list of libraries */ +static struct head static_libs; /* list of statically linked libraries */ static struct path_prefix cmdline_lib_dirs; /* directories specified with -L */ static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */ static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs, @@ -320,9 +322,7 @@ static void write_c_file_glob (FILE *, const char *); static void scan_libraries (const char *); #endif #ifdef COLLECT_EXPORT_LIST -#if 0 static int is_in_list (const char *, struct id *); -#endif static void write_aix_file (FILE *, struct id *); static char *resolve_lib_name (const char *); #endif @@ -761,7 +761,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, do_wait (prog, pex); pex = NULL; - /* Compute memory needed for new LD arguments. At most number of original arguemtns + /* Compute memory needed for new LD arguments. At most number of original arguments plus number of partitions. */ for (lto_ld_argv_size = 0; lto_ld_argv[lto_ld_argv_size]; lto_ld_argv_size++) ; @@ -911,6 +911,9 @@ main (int argc, char **argv) int first_file; int num_c_args; char **old_argv; +#ifdef COLLECT_EXPORT_LIST + bool is_static = false; +#endif int i; for (i = 0; i < USE_LD_MAX; i++) @@ -1241,6 +1244,8 @@ main (int argc, char **argv) *c_ptr++ = xstrdup (q); if (strcmp (q, "-shared") == 0) shared_obj = 1; + if (strcmp (q, "-static") == 0) + static_obj = 1; if (*q == '-' && q[1] == 'B') { *c_ptr++ = xstrdup (q); @@ -1269,6 +1274,9 @@ main (int argc, char **argv) /* Parse arguments. Remember output file spec, pass the rest to ld. */ /* After the first file, put in the c++ rt0. */ +#ifdef COLLECT_EXPORT_LIST + is_static = static_obj; +#endif first_file = 1; while ((arg = *++argv) != (char *) 0) { @@ -1374,6 +1382,18 @@ main (int argc, char **argv) #endif break; +#ifdef COLLECT_EXPORT_LIST + case 'b': + if (!strcmp (arg, "-bstatic")) + { + is_static = true; + } + else if (!strcmp (arg, "-bdynamic") || !strcmp (arg, "-bshared")) + { + is_static = false; + } + break; +#endif case 'l': if (first_file) { @@ -1390,6 +1410,8 @@ main (int argc, char **argv) /* Saving a full library name. */ add_to_list (&libs, s); + if (is_static) + add_to_list (&static_libs, s); } #endif break; @@ -1490,6 +1512,8 @@ main (int argc, char **argv) { /* Saving a full library name. */ add_to_list (&libs, arg); + if (is_static) + add_to_list (&static_libs, arg); } #endif } @@ -1501,6 +1525,8 @@ main (int argc, char **argv) { fprintf (stderr, "List of libraries:\n"); dump_list (stderr, "\t", libs.first); + fprintf (stderr, "List of statically linked libraries:\n"); + dump_list (stderr, "\t", static_libs.first); } /* The AIX linker will discard static constructors in object files if @@ -1525,9 +1551,11 @@ main (int argc, char **argv) this_filter &= ~SCAN_DWEH; #endif + /* Scan object files. */ while (export_object_lst < object) scan_prog_file (*export_object_lst++, PASS_OBJ, this_filter); + /* Scan libraries. */ for (; list; list = list->next) scan_prog_file (list->name, PASS_FIRST, this_filter); @@ -1975,7 +2003,6 @@ write_list (FILE *stream, const char *prefix, struct id *list) #ifdef COLLECT_EXPORT_LIST /* This function is really used only on AIX, but may be useful. */ -#if 0 static int is_in_list (const char *prefix, struct id *list) { @@ -1986,7 +2013,6 @@ is_in_list (const char *prefix, struct id *list) } return 0; } -#endif #endif /* COLLECT_EXPORT_LIST */ /* Added for debugging purpose. */ @@ -2815,7 +2841,12 @@ scan_prog_file (const char *prog_name, scanpass which_pass, case SYM_AIXI: if (! (filter & SCAN_CTOR)) break; - if (is_shared && !aixlazy_flag) + if (is_shared && !aixlazy_flag +#ifdef COLLECT_EXPORT_LIST + && ! static_obj + && ! is_in_list (prog_name, static_libs.first) +#endif + ) add_to_list (&constructors, name); break; diff --git a/gcc/combine.c b/gcc/combine.c index b6024bf075d..ed07cb69078 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6277,7 +6277,7 @@ simplify_if_then_else (rtx x) pc_rtx, pc_rtx, 0, 0, 0); if (reg_mentioned_p (from, false_rtx)) false_rtx = subst (known_cond (copy_rtx (false_rtx), false_code, - from, false_val), + from, false_val), pc_rtx, pc_rtx, 0, 0, 0); SUBST (XEXP (x, 1), swapped ? false_rtx : true_rtx); @@ -9035,6 +9035,7 @@ if_then_else_cond (rtx x, rtx *ptrue, rtx *pfalse) if (COMPARISON_P (cond0) && COMPARISON_P (cond1) + && SCALAR_INT_MODE_P (mode) && ((GET_CODE (cond0) == reversed_comparison_code (cond1, NULL) && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 0)) && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 1))) @@ -9183,12 +9184,12 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val) if (COMPARISON_P (x)) { if (comparison_dominates_p (cond, code)) - return const_true_rtx; + return VECTOR_MODE_P (GET_MODE (x)) ? x : const_true_rtx; code = reversed_comparison_code (x, NULL); if (code != UNKNOWN && comparison_dominates_p (cond, code)) - return const0_rtx; + return CONST0_RTX (GET_MODE (x)); else return x; } @@ -9231,7 +9232,7 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val) /* We must simplify subreg here, before we lose track of the original inner_mode. */ new_rtx = simplify_subreg (GET_MODE (x), r, - inner_mode, SUBREG_BYTE (x)); + inner_mode, SUBREG_BYTE (x)); if (new_rtx) return new_rtx; else @@ -9256,7 +9257,7 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val) /* We must simplify the zero_extend here, before we lose track of the original inner_mode. */ new_rtx = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x), - r, inner_mode); + r, inner_mode); if (new_rtx) return new_rtx; else diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index f3f55aa7ca9..c842c66a357 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5486,7 +5486,7 @@ aarch64_elf_asm_constructor (rtx symbol, int priority) -Wformat-truncation false positive, use a larger size. */ char buf[23]; snprintf (buf, sizeof (buf), ".init_array.%.5u", priority); - s = get_section (buf, SECTION_WRITE, NULL); + s = get_section (buf, SECTION_WRITE | SECTION_NOTYPE, NULL); switch_to_section (s); assemble_align (POINTER_SIZE); assemble_aligned_integer (POINTER_BYTES, symbol); @@ -5506,7 +5506,7 @@ aarch64_elf_asm_destructor (rtx symbol, int priority) -Wformat-truncation false positive, use a larger size. */ char buf[23]; snprintf (buf, sizeof (buf), ".fini_array.%.5u", priority); - s = get_section (buf, SECTION_WRITE, NULL); + s = get_section (buf, SECTION_WRITE | SECTION_NOTYPE, NULL); switch_to_section (s); assemble_align (POINTER_SIZE); assemble_aligned_integer (POINTER_BYTES, symbol); diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h index 8c579aac3f6..d21b3f44707 100644 --- a/gcc/config/gnu-user.h +++ b/gcc/config/gnu-user.h @@ -122,7 +122,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \ "%{shared:-lc} \ - %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" #define GNU_USER_TARGET_LIB_SPEC \ "%{pthread:-lpthread} " \ diff --git a/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h index f9a11ffe2bd..a0ce35ef194 100644 --- a/gcc/config/i386/avx512fintrin.h +++ b/gcc/config/i386/avx512fintrin.h @@ -3312,7 +3312,7 @@ _mm512_maskz_fnmsub_round_ps (__mmask16 __U, __m512 __A, __m512 __B, (__m512d)__builtin_ia32_vfmaddsubpd512_mask(A, B, C, -1, R) #define _mm512_mask_fmaddsub_round_pd(A, U, B, C, R) \ - (__m512d)__builtin_ia32_vfmaddpd512_mask(A, B, C, U, R) + (__m512d)__builtin_ia32_vfmaddsubpd512_mask(A, B, C, U, R) #define _mm512_mask3_fmaddsub_round_pd(A, B, C, U, R) \ (__m512d)__builtin_ia32_vfmaddsubpd512_mask3(A, B, C, U, R) diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h index fee33a3efdc..3842f8928d5 100644 --- a/gcc/config/i386/gnu-user.h +++ b/gcc/config/i386/gnu-user.h @@ -67,7 +67,7 @@ along with GCC; see the file COPYING3. If not see #undef ASM_SPEC #define ASM_SPEC \ - "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" + "--32 %{msse2avx:%{!mavx:-msse2avx}}" #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h index 7a02a7eb4d7..5aa2876739f 100644 --- a/gcc/config/i386/gnu-user64.h +++ b/gcc/config/i386/gnu-user64.h @@ -50,7 +50,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define ASM_SPEC "%{" SPEC_32 ":--32} \ %{" SPEC_64 ":--64} \ %{" SPEC_X32 ":--x32} \ - %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" + %{msse2avx:%{!mavx:-msse2avx}}" #define GNU_USER_TARGET_LINK_SPEC \ "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index efeecd7cf33..5d166033cc7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -33510,6 +33510,7 @@ static const struct builtin_description bdesc_special_args[] = { { 0, CODE_FOR_nothing, "__builtin_ia32_rdtsc", IX86_BUILTIN_RDTSC, UNKNOWN, (int) UINT64_FTYPE_VOID }, { 0, CODE_FOR_nothing, "__builtin_ia32_rdtscp", IX86_BUILTIN_RDTSCP, UNKNOWN, (int) UINT64_FTYPE_PUNSIGNED }, + { 0, CODE_FOR_nothing, "__builtin_ia32_rdpmc", IX86_BUILTIN_RDPMC, UNKNOWN, (int) UINT64_FTYPE_INT }, { 0, CODE_FOR_pause, "__builtin_ia32_pause", IX86_BUILTIN_PAUSE, UNKNOWN, (int) VOID_FTYPE_VOID }, /* 80387 (for use internally for atomic compound assignment). */ @@ -33807,7 +33808,6 @@ static const struct builtin_description bdesc_args[] = { { 0, CODE_FOR_bsr, "__builtin_ia32_bsrsi", IX86_BUILTIN_BSRSI, UNKNOWN, (int) INT_FTYPE_INT }, { OPTION_MASK_ISA_64BIT, CODE_FOR_bsr_rex64, "__builtin_ia32_bsrdi", IX86_BUILTIN_BSRDI, UNKNOWN, (int) INT64_FTYPE_INT64 }, - { 0, CODE_FOR_nothing, "__builtin_ia32_rdpmc", IX86_BUILTIN_RDPMC, UNKNOWN, (int) UINT64_FTYPE_INT }, { 0, CODE_FOR_rotlqi3, "__builtin_ia32_rolqi", IX86_BUILTIN_ROLQI, UNKNOWN, (int) UINT8_FTYPE_UINT8_INT }, { 0, CODE_FOR_rotlhi3, "__builtin_ia32_rolhi", IX86_BUILTIN_ROLHI, UNKNOWN, (int) UINT16_FTYPE_UINT16_INT }, { 0, CODE_FOR_rotrqi3, "__builtin_ia32_rorqi", IX86_BUILTIN_RORQI, UNKNOWN, (int) UINT8_FTYPE_UINT8_INT }, diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 9db79988ceb..925e78329aa 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -12699,7 +12699,10 @@ stack address we wish to restore. */ tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa); tmp = plus_constant (Pmode, tmp, -UNITS_PER_WORD); - tmp = gen_rtx_MEM (Pmode, tmp); + /* Return address is always in word_mode. */ + tmp = gen_rtx_MEM (word_mode, tmp); + if (GET_MODE (ra) != word_mode) + ra = convert_to_mode (word_mode, ra, 1); emit_move_insn (tmp, ra); emit_jump_insn (gen_eh_return_internal ()); diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index ffa30641f8f..9946ae8a663 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -10598,6 +10598,8 @@ pa_output_addr_vec (rtx lab, rtx body) { int idx, vlen = XVECLEN (body, 0); + if (!TARGET_SOM) + fputs ("\t.align 4\n", asm_out_file); targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (lab)); if (TARGET_GAS) fputs ("\t.begin_brtab\n", asm_out_file); diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index c58bd87fdb5..f6dd60293be 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1188,21 +1188,23 @@ do { \ #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \ pa_output_ascii ((FILE), (P), (SIZE)) -/* Jump tables are always placed in the text section. Technically, it - is possible to put them in the readonly data section. This has the - benefit of getting the table out of .text and reducing branch lengths - as a result. +/* Jump tables are always placed in the text section. We have to do + this for the HP-UX SOM target as we can't switch sections in the + middle of a function. - The downside is that an additional insn (addil) is needed to access + On ELF targets, it is possible to put them in the readonly-data section. + This would get the table out of .text and reduce branch lengths. + + A downside is that an additional insn (addil) is needed to access the table when generating PIC code. The address difference table - also has to use 32-bit pc-relative relocations. Currently, GAS does - not support these relocations, although it is easily modified to do - this operation. + also has to use 32-bit pc-relative relocations. The table entries need to look like "$L1+(.+8-$L0)-$PIC_pcrel$0" when using ELF GAS. A simple difference can be used when using - SOM GAS or the HP assembler. The final downside is GDB complains - about the nesting of the label for the table when debugging. */ + the HP assembler. + + The final downside is GDB complains about the nesting of the label + for the table. */ #define JUMP_TABLES_IN_TEXT_SECTION 1 diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 29a0749f7a3..10e3a08a044 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -84,6 +84,7 @@ UNSPEC_TLSGD_PIC UNSPEC_TLSLDM_PIC UNSPEC_TLSIE_PIC + UNSPEC_MEMORY_BARRIER ]) ;; UNSPEC_VOLATILE: @@ -9966,14 +9967,8 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" ;; doubleword loads and stores are not guaranteed to be atomic ;; when referencing the I/O address space. -;; The kernel cmpxchg operation on linux is not atomic with respect to -;; memory stores on SMP machines, so we must do stores using a cmpxchg -;; operation. - ;; These patterns are at the bottom so the non atomic versions are preferred. -;; Implement atomic QImode store using exchange. - (define_expand "atomic_storeqi" [(match_operand:QI 0 "memory_operand") ;; memory (match_operand:QI 1 "register_operand") ;; val out @@ -10026,25 +10021,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" FAIL; }) -;; Implement atomic SFmode store using exchange. - -(define_expand "atomic_storesf" - [(match_operand:SF 0 "memory_operand") ;; memory - (match_operand:SF 1 "register_operand") ;; val out - (match_operand:SI 2 "const_int_operand")] ;; model - "" -{ - if (TARGET_SYNC_LIBCALL) - { - rtx mem = operands[0]; - rtx val = operands[1]; - if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val)) - DONE; - } - FAIL; -}) - -;; Implement atomic DImode load using 64-bit floating point load. +;; Implement atomic DImode load. (define_expand "atomic_loaddi" [(match_operand:DI 0 "register_operand") ;; val out @@ -10059,29 +10036,27 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" model = memmodel_from_int (INTVAL (operands[2])); operands[1] = force_reg (SImode, XEXP (operands[1], 0)); - expand_mem_thread_fence (model); - emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1])); if (is_mm_seq_cst (model)) expand_mem_thread_fence (model); + emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1])); + expand_mem_thread_fence (model); DONE; }) (define_insn "atomic_loaddi_1" - [(set (match_operand:DI 0 "register_operand" "=f,r") - (mem:DI (match_operand:SI 1 "register_operand" "r,r"))) - (clobber (match_scratch:DI 2 "=X,f"))] + [(set (match_operand:DI 0 "register_operand" "=r") + (mem:DI (match_operand:SI 1 "register_operand" "r"))) + (clobber (match_scratch:DI 2 "=f"))] "!TARGET_64BIT && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT" - "@ - {fldds|fldd} 0(%1),%0 - {fldds|fldd} 0(%1),%2\n\t{fstds|fstd} %2,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0\n\t{ldws|ldw} -12(%%sp),%R0" - [(set_attr "type" "move,move") - (set_attr "length" "4,16")]) + "{fldds|fldd} 0(%1),%2\n\t{fstds|fstd} %2,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0\n\t{ldws|ldw} -12(%%sp),%R0" + [(set_attr "type" "move") + (set_attr "length" "16")]) ;; Implement atomic DImode store. (define_expand "atomic_storedi" [(match_operand:DI 0 "memory_operand") ;; memory - (match_operand:DI 1 "register_operand") ;; val out + (match_operand:DI 1 "reg_or_cint_move_operand") ;; val out (match_operand:SI 2 "const_int_operand")] ;; model "" { @@ -10100,6 +10075,8 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" model = memmodel_from_int (INTVAL (operands[2])); operands[0] = force_reg (SImode, XEXP (operands[0], 0)); + if (operands[1] != CONST0_RTX (DImode)) + operands[1] = force_reg (DImode, operands[1]); expand_mem_thread_fence (model); emit_insn (gen_atomic_storedi_1 (operands[0], operands[1])); if (is_mm_seq_cst (model)) @@ -10109,87 +10086,33 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" (define_insn "atomic_storedi_1" [(set (mem:DI (match_operand:SI 0 "register_operand" "r,r")) - (match_operand:DI 1 "register_operand" "f,r")) + (match_operand:DI 1 "reg_or_0_operand" "M,r")) (clobber (match_scratch:DI 2 "=X,f"))] - "!TARGET_64BIT && !TARGET_DISABLE_FPREGS - && !TARGET_SOFT_FLOAT && !TARGET_SYNC_LIBCALL" + "!TARGET_64BIT && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT" "@ - {fstds|fstd} %1,0(%0) + {fstds|fstd} %%fr0,0(%0) {stws|stw} %1,-16(%%sp)\n\t{stws|stw} %R1,-12(%%sp)\n\t{fldds|fldd} -16(%%sp),%2\n\t{fstds|fstd} %2,0(%0)" [(set_attr "type" "move,move") (set_attr "length" "4,16")]) -;; Implement atomic DFmode load using 64-bit floating point load. +;; PA 2.0 hardware supports out-of-order execution of loads and stores, so +;; we need a memory barrier to enforce program order for memory references. +;; Since we want PA 1.x code to be PA 2.0 compatible, we also need the +;; barrier when generating PA 1.x code. -(define_expand "atomic_loaddf" - [(match_operand:DF 0 "register_operand") ;; val out - (match_operand:DF 1 "memory_operand") ;; memory - (match_operand:SI 2 "const_int_operand")] ;; model +(define_expand "memory_barrier" + [(set (match_dup 0) + (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))] "" { - enum memmodel model; - - if (TARGET_64BIT || TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT) - FAIL; - - model = memmodel_from_int (INTVAL (operands[2])); - operands[1] = force_reg (SImode, XEXP (operands[1], 0)); - expand_mem_thread_fence (model); - emit_insn (gen_atomic_loaddf_1 (operands[0], operands[1])); - if (is_mm_seq_cst (model)) - expand_mem_thread_fence (model); - DONE; + operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); + MEM_VOLATILE_P (operands[0]) = 1; }) -(define_insn "atomic_loaddf_1" - [(set (match_operand:DF 0 "register_operand" "=f,r") - (mem:DF (match_operand:SI 1 "register_operand" "r,r"))) - (clobber (match_scratch:DF 2 "=X,f"))] - "!TARGET_64BIT && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT" - "@ - {fldds|fldd} 0(%1),%0 - {fldds|fldd} 0(%1),%2\n\t{fstds|fstd} %2,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0\n\t{ldws|ldw} -12(%%sp),%R0" - [(set_attr "type" "move,move") - (set_attr "length" "4,16")]) - -;; Implement atomic DFmode store using 64-bit floating point store. - -(define_expand "atomic_storedf" - [(match_operand:DF 0 "memory_operand") ;; memory - (match_operand:DF 1 "register_operand") ;; val out - (match_operand:SI 2 "const_int_operand")] ;; model +(define_insn "*memory_barrier" + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))] "" -{ - enum memmodel model; - - if (TARGET_SYNC_LIBCALL) - { - rtx mem = operands[0]; - rtx val = operands[1]; - if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val)) - DONE; - } - - if (TARGET_64BIT || TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT) - FAIL; - - model = memmodel_from_int (INTVAL (operands[2])); - operands[0] = force_reg (SImode, XEXP (operands[0], 0)); - expand_mem_thread_fence (model); - emit_insn (gen_atomic_storedf_1 (operands[0], operands[1])); - if (is_mm_seq_cst (model)) - expand_mem_thread_fence (model); - DONE; -}) - -(define_insn "atomic_storedf_1" - [(set (mem:DF (match_operand:SI 0 "register_operand" "r,r")) - (match_operand:DF 1 "register_operand" "f,r")) - (clobber (match_scratch:DF 2 "=X,f"))] - "!TARGET_64BIT && !TARGET_DISABLE_FPREGS - && !TARGET_SOFT_FLOAT && !TARGET_SYNC_LIBCALL" - "@ - {fstds|fstd} %1,0(%0) - {stws|stw} %1,-16(%%sp)\n\t{stws|stw} %R1,-12(%%sp)\n\t{fldds|fldd} -16(%%sp),%2\n\t{fstds|fstd} %2,0(%0)" - [(set_attr "type" "move,move") - (set_attr "length" "4,16")]) + "sync" + [(set_attr "type" "binary") + (set_attr "length" "4")]) diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h index 9c3ec00dcb9..dce2bf21d37 100644 --- a/gcc/config/pa/pa32-linux.h +++ b/gcc/config/pa/pa32-linux.h @@ -62,3 +62,12 @@ call_ ## FUNC (void) \ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD + +/* Place jump tables in the text section except when generating non-PIC + code. When generating non-PIC code, the relocations needed to load the + address of the jump table result in a text label in the final executable + if the jump table is placed in the text section. This breaks the unwind + data for the function. Thus, the jump table needs to be placed in + rodata when generating non-PIC code. */ +#undef JUMP_TABLES_IN_TEXT_SECTION +#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5fdcd0ed535..4092ed84a14 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -10382,12 +10382,12 @@ rs6000_discover_homogeneous_aggregate (machine_mode mode, const_tree type, if (field_count > 0) { - int n_regs = (SCALAR_FLOAT_MODE_P (field_mode) ? - (GET_MODE_SIZE (field_mode) + 7) >> 3 : 1); + int reg_size = ALTIVEC_OR_VSX_VECTOR_MODE (field_mode) ? 16 : 8; + int field_size = ROUND_UP (GET_MODE_SIZE (field_mode), reg_size); /* The ELFv2 ABI allows homogeneous aggregates to occupy up to AGGR_ARG_NUM_REG registers. */ - if (field_count * n_regs <= AGGR_ARG_NUM_REG) + if (field_count * field_size <= AGGR_ARG_NUM_REG * reg_size) { if (elt_mode) *elt_mode = field_mode; diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h index 6279a9934ae..82ec2602f41 100644 --- a/gcc/config/xtensa/uclinux.h +++ b/gcc/config/xtensa/uclinux.h @@ -59,8 +59,8 @@ along with GCC; see the file COPYING3. If not see #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." -/* Always enable "-fpic" for Xtensa Linux. */ -#define XTENSA_ALWAYS_PIC 1 +/* Don't enable "-fpic" for Xtensa uclinux. */ +#define XTENSA_ALWAYS_PIC 0 #undef TARGET_LIBC_HAS_FUNCTION #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 92fdeb08046..b679937878a 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -1583,9 +1583,9 @@ xtensa_expand_atomic (enum rtx_code code, rtx target, rtx mem, rtx val, break; case MULT: /* NAND */ - tmp = expand_simple_binop (SImode, XOR, old, ac.modemask, + tmp = expand_simple_binop (SImode, AND, old, val, NULL_RTX, 1, OPTAB_DIRECT); - tmp = expand_simple_binop (SImode, AND, tmp, val, + tmp = expand_simple_binop (SImode, XOR, tmp, ac.modemask, new_rtx, 1, OPTAB_DIRECT); break; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 738b043732a..b255b83fb36 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,25 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-23 Tom de Vries <tdevries@suse.de> + + backport from trunk: + 2018-07-31 Tom de Vries <tdevries@suse.de> + + PR debug/86687 + * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE. + +2018-10-12 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2018-07-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/3698 + PR c++/86208 + * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or + in TREE_USED flag from stmt to h->to. + 2018-06-26 Jakub Jelinek <jakub@redhat.com> PR c++/86291 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 58037e56e6c..e071569b794 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1064,6 +1064,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) if (h) { *stmt_p = h->to; + TREE_USED (h->to) |= TREE_USED (stmt); *walk_subtrees = 0; return NULL; } diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 6f80b3d6d84..e7bfc7614ea 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -46,6 +46,8 @@ update_cloned_parm (tree parm, tree cloned_parm, bool first) /* We may have taken its address. */ TREE_ADDRESSABLE (cloned_parm) = TREE_ADDRESSABLE (parm); + DECL_BY_REFERENCE (cloned_parm) = DECL_BY_REFERENCE (parm); + /* The definition might have different constness. */ TREE_READONLY (cloned_parm) = TREE_READONLY (parm); diff --git a/gcc/expmed.c b/gcc/expmed.c index 8cee888b3c5..784cdca53b8 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -4337,6 +4337,11 @@ expand_divmod (int rem_flag, enum tree_code code, machine_mode mode, HOST_WIDE_INT d = INTVAL (op1); unsigned HOST_WIDE_INT abs_d; + /* Not prepared to handle division/remainder by + 0xffffffffffffffff8000000000000000 etc. */ + if (d == HOST_WIDE_INT_MIN && size > HOST_BITS_PER_WIDE_INT) + break; + /* Since d might be INT_MIN, we have to cast to unsigned HOST_WIDE_INT before negating to avoid undefined signed overflow. */ @@ -4380,9 +4385,7 @@ expand_divmod (int rem_flag, enum tree_code code, machine_mode mode, compute_mode) != CODE_FOR_nothing))) ; - else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d) - && (size <= HOST_BITS_PER_WIDE_INT - || abs_d != (unsigned HOST_WIDE_INT) d)) + else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d)) { if (rem_flag) { diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e4a642798ce..ff40410dbac 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5855,12 +5855,13 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type, } /* If the right sides are not constant, do the same for it. Also, - disallow this optimization if a size or signedness mismatch occurs - between the left and right sides. */ + disallow this optimization if a size, signedness or storage order + mismatch occurs between the left and right sides. */ if (l_const == 0) { if (ll_bitsize != lr_bitsize || rl_bitsize != rr_bitsize || ll_unsignedp != lr_unsignedp || rl_unsignedp != rr_unsignedp + || ll_reversep != lr_reversep /* Make sure the two fields on the right correspond to the left without being swapped. */ || ll_bitpos - rl_bitpos != lr_bitpos - rr_bitpos) @@ -11875,10 +11876,16 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, && integer_pow2p (arg1) && TREE_CODE (TREE_OPERAND (arg0, 0)) == BIT_AND_EXPR && operand_equal_p (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1), - arg1, OEP_ONLY_CONST)) + arg1, OEP_ONLY_CONST) + /* operand_equal_p compares just value, not precision, so e.g. + arg1 could be 8-bit -128 and be power of two, but BIT_AND_EXPR + second operand 32-bit -128, which is not a power of two (or vice + versa. */ + && integer_pow2p (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1))) return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, - TREE_OPERAND (arg0, 0))); + fold_convert_loc (loc, type, + TREE_OPERAND (arg0, + 0))); /* Disable the transformations below for vectors, since fold_binary_op_with_conditional_arg may undo them immediately, diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 695caeb0c97..c86d6e10b6e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,24 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-09-07 Janus Weil <janus@gcc.gnu.org> + + Backported from trunk + PR fortran/86116 + * interface.c (compare_type): Remove a CLASS/TYPE check. + (compare_type_characteristics): New function that behaves like the old + 'compare_type'. + (gfc_check_dummy_characteristics, gfc_check_result_characteristics): + Call 'compare_type_characteristics' instead of 'compare_type'. + +2018-07-03 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/82969 + PR fortran/86242 + * trans-array.c (structure_alloc_comps): Do not explicitly copy + procedure pointer components. + 2018-06-25 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 725ffd18ed2..d4ca4366695 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -638,13 +638,20 @@ compare_type (gfc_symbol *s1, gfc_symbol *s2) if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK)) return 1; + return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED; +} + + +static bool +compare_type_characteristics (gfc_symbol *s1, gfc_symbol *s2) +{ /* TYPE and CLASS of the same declared type are type compatible, but have different characteristics. */ if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED) || (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS)) return 0; - return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED; + return compare_type (s1, s2); } @@ -1190,7 +1197,8 @@ gfc_check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2, /* Check type and rank. */ if (type_must_agree) { - if (!compare_type (s1, s2) || !compare_type (s2, s1)) + if (!compare_type_characteristics (s1, s2) + || !compare_type_characteristics (s2, s1)) { snprintf (errmsg, err_len, "Type mismatch in argument '%s' (%s/%s)", s1->name, gfc_typename (&s1->ts), gfc_typename (&s2->ts)); @@ -1409,7 +1417,7 @@ gfc_check_result_characteristics (gfc_symbol *s1, gfc_symbol *s2, return true; /* Check type and rank. */ - if (!compare_type (r1, r2)) + if (!compare_type_characteristics (r1, r2)) { snprintf (errmsg, err_len, "Type mismatch in function result (%s/%s)", gfc_typename (&r1->ts), gfc_typename (&r2->ts)); diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 0842a39db1a..a719cb57f91 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -8240,7 +8240,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, break; case COPY_ALLOC_COMP: - if (c->attr.pointer) + if (c->attr.pointer || c->attr.proc_pointer) continue; /* We need source and destination components. */ diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e55f5b4216d..1181e8e06a2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5534,10 +5534,13 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p) /* Insert a cleanup marker for gimplify_cleanup_point_expr. CLEANUP is the cleanup action required. EH_ONLY is true if the cleanup should - only be executed if an exception is thrown, not on normal exit. */ + only be executed if an exception is thrown, not on normal exit. + If FORCE_UNCOND is true perform the cleanup unconditionally; this is + only valid for clobbers. */ static void -gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) +gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p, + bool force_uncond = false) { gimple *wce; gimple_seq cleanup_stmts = NULL; @@ -5569,22 +5572,31 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) } val */ - tree flag = create_tmp_var (boolean_type_node, "cleanup"); - gassign *ffalse = gimple_build_assign (flag, boolean_false_node); - gassign *ftrue = gimple_build_assign (flag, boolean_true_node); - - cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL); - gimplify_stmt (&cleanup, &cleanup_stmts); - wce = gimple_build_wce (cleanup_stmts); - - gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, ffalse); - gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce); - gimplify_seq_add_stmt (pre_p, ftrue); - - /* Because of this manipulation, and the EH edges that jump - threading cannot redirect, the temporary (VAR) will appear - to be used uninitialized. Don't warn. */ - TREE_NO_WARNING (var) = 1; + if (force_uncond) + { + gimplify_stmt (&cleanup, &cleanup_stmts); + wce = gimple_build_wce (cleanup_stmts); + gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce); + } + else + { + tree flag = create_tmp_var (boolean_type_node, "cleanup"); + gassign *ffalse = gimple_build_assign (flag, boolean_false_node); + gassign *ftrue = gimple_build_assign (flag, boolean_true_node); + + cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL); + gimplify_stmt (&cleanup, &cleanup_stmts); + wce = gimple_build_wce (cleanup_stmts); + + gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, ffalse); + gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce); + gimplify_seq_add_stmt (pre_p, ftrue); + + /* Because of this manipulation, and the EH edges that jump + threading cannot redirect, the temporary (VAR) will appear + to be used uninitialized. Don't warn. */ + TREE_NO_WARNING (var) = 1; + } } else { @@ -5661,11 +5673,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) NULL); TREE_THIS_VOLATILE (clobber) = true; clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber); - if (cleanup) - cleanup = build2 (COMPOUND_EXPR, void_type_node, cleanup, - clobber); - else - cleanup = clobber; + gimple_push_cleanup (temp, clobber, false, pre_p, true); } if (cleanup) @@ -8717,9 +8725,25 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i); if (!is_gimple_constant (TREE_OPERAND (t, 1))) { + tree type = TREE_TYPE (TREE_OPERAND (t, 0)); TREE_OPERAND (t, 1) = get_initialized_tmp_var (TREE_OPERAND (t, 1), - pre_p, NULL); + gimple_seq_empty_p (for_pre_body) + ? pre_p : &for_pre_body, NULL); + /* Reference to pointer conversion is considered useless, + but is significant for firstprivate clause. Force it + here. */ + if (TREE_CODE (type) == POINTER_TYPE + && (TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 1))) + == REFERENCE_TYPE)) + { + tree v = create_tmp_var (TYPE_MAIN_VARIANT (type)); + tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, + TREE_OPERAND (t, 1)); + gimplify_and_add (m, gimple_seq_empty_p (for_pre_body) + ? pre_p : &for_pre_body); + TREE_OPERAND (t, 1) = v; + } tree c = build_omp_clause (input_location, OMP_CLAUSE_FIRSTPRIVATE); OMP_CLAUSE_DECL (c) = TREE_OPERAND (t, 1); @@ -8731,10 +8755,25 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i); if (!is_gimple_constant (TREE_OPERAND (t, 1))) { + tree type = TREE_TYPE (TREE_OPERAND (t, 0)); TREE_OPERAND (t, 1) = get_initialized_tmp_var (TREE_OPERAND (t, 1), gimple_seq_empty_p (for_pre_body) ? pre_p : &for_pre_body, NULL); + /* Reference to pointer conversion is considered useless, + but is significant for firstprivate clause. Force it + here. */ + if (TREE_CODE (type) == POINTER_TYPE + && (TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 1))) + == REFERENCE_TYPE)) + { + tree v = create_tmp_var (TYPE_MAIN_VARIANT (type)); + tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, + TREE_OPERAND (t, 1)); + gimplify_and_add (m, gimple_seq_empty_p (for_pre_body) + ? pre_p : &for_pre_body); + TREE_OPERAND (t, 1) = v; + } tree c = build_omp_clause (input_location, OMP_CLAUSE_FIRSTPRIVATE); OMP_CLAUSE_DECL (c) = TREE_OPERAND (t, 1); diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index ecc73a4ce12..2e7dc5d49e7 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gcc/graphite.h b/gcc/graphite.h index 578fa1a6d98..431d0ed0a5e 100644 --- a/gcc/graphite.h +++ b/gcc/graphite.h @@ -40,6 +40,8 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS /* isl 0.15 or later. */ #include <isl/schedule_node.h> +#include <isl/id.h> +#include <isl/space.h> #else /* isl 0.14 or 0.13. */ diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index dbe921b67a5..7d95bfd5a53 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index a8249fae489..57d19c880d1 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index ddc3c6be92d..74d98e86ed2 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2018-04-25 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 3b4c9ae7e73..02b8d7561bf 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index 0e2e434f3f7..bb849a9930a 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index e92f53a59e7..304cde82194 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2063,13 +2063,16 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, /* Global variables with "omp declare target" attribute don't need to be copied, the receiver side will use them directly. However, global variables with "omp declare target link" - attribute need to be copied. */ + attribute need to be copied. Or when ALWAYS modifier is used. */ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP && DECL_P (decl) && ((OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FIRSTPRIVATE_POINTER && (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FIRSTPRIVATE_REFERENCE)) || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) + && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_TO + && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_FROM + && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_TOFROM && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) && varpool_node::get_create (decl)->offloadable && !lookup_attribute ("omp declare target link", @@ -15390,6 +15393,7 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx) splay_tree_node n; struct omp_taskcopy_context tcctx; location_t loc = gimple_location (task_stmt); + size_t looptempno = 0; child_fn = gimple_omp_task_copy_fn (task_stmt); child_cfun = DECL_STRUCT_FUNCTION (child_fn); @@ -15503,6 +15507,15 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx) t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); append_to_statement_list (t, &list); break; + case OMP_CLAUSE__LOOPTEMP_: + /* Fields for first two _looptemp_ clauses are initialized by + GOMP_taskloop*, the rest are handled like firstprivate. */ + if (looptempno < 2) + { + looptempno++; + break; + } + /* FALLTHRU */ case OMP_CLAUSE_FIRSTPRIVATE: decl = OMP_CLAUSE_DECL (c); if (is_variable_sized (decl)) @@ -15528,7 +15541,10 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx) src = decl; dst = build_simple_mem_ref_loc (loc, arg); dst = omp_build_component_ref (dst, f); - t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src); + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE__LOOPTEMP_) + t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); + else + t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src); append_to_statement_list (t, &list); break; case OMP_CLAUSE_PRIVATE: diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 3362b593268..d7df9f1542a 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1cb8d92ecf9..f86be0d2e30 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,103 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-23 Tom de Vries <tdevries@suse.de> + + backport from trunk: + 2018-07-31 Tom de Vries <tdevries@suse.de> + + PR debug/86687 + * g++.dg/guality/pr86687.C: New test. + +2018-10-17 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/pr87623.c: New test. + +2018-10-15 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2018-08-23 Richard Biener <rguenther@suse.de> + + PR middle-end/87024 + * gcc.dg/pr87024.c: New testcase. + + 2018-08-17 Richard Biener <rguenther@suse.de> + + PR middle-end/86505 + * gcc.dg/torture/pr86505.c: New testcase. + +2018-10-12 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2018-10-10 Jakub Jelinek <jakub@redhat.com> + + PR target/87550 + * gcc.target/i386/pr87550.c: New test. + + 2018-09-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/87248 + * c-c++-common/torture/pr87248.c: New test. + + 2018-08-27 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/87065 + * gcc.target/i386/pr87065.c: New test. + + 2018-07-24 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/86627 + * gcc.target/i386/pr86627.c: New test. + + 2018-07-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/3698 + PR c++/86208 + * g++.dg/opt/pr3698.C: New test. + +2018-10-12 Richard Biener <rguenther@suse.de> + + PR c++/54278 + Backport from mainline + 2017-03-21 Richard Biener <rguenther@suse.de> + + PR tree-optimization/80032 + * g++.dg/opt/pr80032.C: New testcase. + +2018-09-07 Janus Weil <janus@gcc.gnu.org> + + Backported from trunk + PR fortran/86116 + * gfortran.dg/generic_34.f90: New test case. + +2018-09-03 Tom de Vries <tdevries@suse.de> + + backport from trunk: + 2018-06-21 Tom de Vries <tdevries@suse.de> + + PR tree-optimization/85859 + * gcc.dg/pr85859.c: New test. + +2018-08-21 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2018-08-20 H.J. Lu <hongjiu.lu@intel.com> + + PR target/87014 + * g++.dg/torture/pr87014.C: New file. + +2018-07-12 Richard Biener <rguenther@suse.de> + + PR target/84829 + * gcc.target/i386/pr84829.c: New testcase. + +2018-07-03 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/82969 + PR fortran/86242 + * gfortran.dg/proc_ptr_50.f90: New test. + 2018-06-26 Kelvin Nilsen <kelvin@gcc.gnu.org> Backported from mainline @@ -279,7 +379,7 @@ * gcc.target/i386/pr80819-2.c: New test. 2017-11-24 Jakub Jelinek <jakub@redhat.com> - + PR sanitizer/83014 * gcc.dg/ubsan/pr83014.c: New test. @@ -332,7 +432,7 @@ * gcc.dg/torture/pr85989.c: New test. 2018-06-21 Richard Biener <rguenther@suse.de> - + Backport from mainline 2017-09-06 Richard Biener <rguenther@suse.de> diff --git a/gcc/testsuite/c-c++-common/torture/pr87248.c b/gcc/testsuite/c-c++-common/torture/pr87248.c new file mode 100644 index 00000000000..6f89bc9a31c --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/pr87248.c @@ -0,0 +1,36 @@ +/* PR middle-end/87248 */ +/* { dg-do run } */ + +void +foo (signed char *p, int q) +{ + *p = q & (-__SCHAR_MAX__ - 1) ? (-__SCHAR_MAX__ - 1) : 0; +} + +int +bar (long long x) +{ + return x & (-__INT_MAX__ - 1) ? (-__INT_MAX__ - 1) : 0; +} + +int +main () +{ +#if __INT_MAX__ > 4 * __SCHAR_MAX__ + signed char a[4]; + foo (a, __SCHAR_MAX__ + 1U); + foo (a + 1, 2 * (__SCHAR_MAX__ + 1U)); + foo (a + 2, -__INT_MAX__ - 1); + foo (a + 3, (__SCHAR_MAX__ + 1U) / 2); + if (a[0] != (-__SCHAR_MAX__ - 1) || a[1] != a[0] || a[2] != a[0] || a[3] != 0) + __builtin_abort (); +#endif +#if __LONG_LONG_MAX__ > 4 * __INT_MAX__ + if (bar (__INT_MAX__ + 1LL) != (-__INT_MAX__ - 1) + || bar (2 * (__INT_MAX__ + 1LL)) != (-__INT_MAX__ - 1) + || bar (-__LONG_LONG_MAX__ - 1) != (-__INT_MAX__ - 1) + || bar ((__INT_MAX__ + 1LL) / 2) != 0) + __builtin_abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/g++.dg/guality/pr86687.C b/gcc/testsuite/g++.dg/guality/pr86687.C new file mode 100644 index 00000000000..b2cdaf8547b --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/pr86687.C @@ -0,0 +1,28 @@ +// PR debug/86687 +// { dg-do run } +// { dg-options "-g" } + +class string { +public: + string (int p) { this->p = p ; } + string (const string &s) { this->p = s.p; } + + int p; +}; + +class foo { +public: + foo (string dir_hint) { + p = dir_hint.p; // { dg-final { gdb-test 16 "dir_hint.p" 3 } } + } + + int p; +}; + +int +main (void) +{ + string s = 3; + foo bar(s); + return !(bar.p == 3); +} diff --git a/gcc/testsuite/g++.dg/opt/pr3698.C b/gcc/testsuite/g++.dg/opt/pr3698.C new file mode 100644 index 00000000000..ebdf5731eb3 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr3698.C @@ -0,0 +1,21 @@ +// PR c++/3698 +// { dg-do link } +// { dg-options "-O0" } + +struct X { + int i; +}; + +inline const int& +OHashKey (const X& x) +{ + return x.i; +} + +int +main () +{ + extern const int& OHashKey (const X& x); + X x; + return OHashKey (x); +} diff --git a/gcc/testsuite/g++.dg/opt/pr80032.C b/gcc/testsuite/g++.dg/opt/pr80032.C new file mode 100644 index 00000000000..8475fdbc960 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr80032.C @@ -0,0 +1,121 @@ +// PR tree-optimization/80032 +/* { dg-do compile } */ +/* { dg-require-effective-target c++11 } */ +/* { dg-options "-O2" } */ +/* If DCE removes too many CLOBBERs then stack usage goes through the + roof as stack slots can no longer be shared. */ +/* { dg-additional-options "-Wstack-usage=200" { target x86_64-*-* i?86-*-* } } */ + +typedef unsigned a; +namespace test { + enum b { c }; + class ADataContainer; + class BitMask; + namespace api { + enum DataStore { candidate }; + } + using d = api::DataStore; + namespace db { + class e; + class f; + class g; + class ManagedObjectConst { + public: + ManagedObjectConst(const ManagedObjectConst &); + bool isFieldDefault(a, d) const; + ADataContainer &getFieldDefault(a, d) const; + g *h; + e *i; + f *j; + }; + struct FieldInfo { + FieldInfo(ManagedObjectConst, a, d); + ManagedObjectConst k; + }; + b compare(const FieldInfo &, const ADataContainer &); + class ManagedObject : public ManagedObjectConst {}; + } + using namespace db; + void FN(ManagedObject &k, const BitMask &) { + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + if (!k.isFieldDefault(8, d::candidate) && + !compare(FieldInfo(k, 11, d::candidate), + k.getFieldDefault(11, d::candidate)) == c) + return; + } +} diff --git a/gcc/testsuite/g++.dg/torture/pr87014.C b/gcc/testsuite/g++.dg/torture/pr87014.C new file mode 100644 index 00000000000..614954ef464 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr87014.C @@ -0,0 +1,37 @@ +// { dg-do run } + +void +fillstack () +{ + long long foo[] = + { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }; +} + +void +f (long long=-1,long long=-1,long long=-1,long long=-1, + long long=-1,long long=-1,long long arg7_on_stack=-1) +{ + throw 0; +} + +void +g() +{ + try + { + f (); + } + catch (int) + { + } +} + +int +main() +{ + fillstack (); + g (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr87623.c b/gcc/testsuite/gcc.c-torture/execute/pr87623.c new file mode 100644 index 00000000000..54d8b5e4571 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr87623.c @@ -0,0 +1,34 @@ +/* PR middle-end/87623 */ +/* Testcase by George Thopas <george.thopas@gmail.com> */ + +struct be { + unsigned short pad[1]; + unsigned char a; + unsigned char b; +} __attribute__((scalar_storage_order("big-endian"))); + +typedef struct be t_be; + +struct le { + unsigned short pad[3]; + unsigned char a; + unsigned char b; +}; + +typedef struct le t_le; + +int a_or_b_different(t_be *x,t_le *y) +{ + return (x->a != y->a) || (x->b != y->b); +} + +int main (void) +{ + t_be x = { .a=1, .b=2 }; + t_le y = { .a=1, .b=2 }; + + if (a_or_b_different(&x,&y)) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr85859.c b/gcc/testsuite/gcc.dg/pr85859.c new file mode 100644 index 00000000000..96eb9671137 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr85859.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-ftree-tail-merge -Wno-div-by-zero -O2 -fno-dce -fno-isolate-erroneous-paths-dereference -fno-tree-dce -fno-tree-vrp" } */ + +int b, c, d, e; + +__attribute__ ((noinline, noclone)) +int foo (short f) +{ + f %= 0; + return f; +} + +int +main (void) +{ + b = (unsigned char) __builtin_parity (d); + e ? foo (0) : (long) &c; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr87024.c b/gcc/testsuite/gcc.dg/pr87024.c new file mode 100644 index 00000000000..a8a58aafc26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr87024.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-dce" } */ + +static inline void __attribute__((always_inline)) +mp () +{ + (void) __builtin_va_arg_pack_len (); +} + +void +ui (void) +{ + mp (); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr86505.c b/gcc/testsuite/gcc.dg/torture/pr86505.c new file mode 100644 index 00000000000..db102d308e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr86505.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +static inline __attribute__(( __always_inline__)) int +funA(unsigned int param, ...) +{ + return __builtin_va_arg_pack_len(); +} + +static inline __attribute__(( __always_inline__)) int +funB(unsigned int param, ...) +{ + return funA(param, 2, 4, __builtin_va_arg_pack()); +} + +int +testBuiltin(void) +{ + int rc = funB(0,1,2); + if (rc != 4) + return 1; + return 0; +} + +int +main() +{ + int rc = testBuiltin(); + if (rc == 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr84829.c b/gcc/testsuite/gcc.target/i386/pr84829.c new file mode 100644 index 00000000000..a63a49b1317 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr84829.c @@ -0,0 +1,7 @@ +/* { dg-do link } */ +/* { dg-options "-mieee-fp" } */ + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr86627.c b/gcc/testsuite/gcc.target/i386/pr86627.c new file mode 100644 index 00000000000..5aefbed0a0b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr86627.c @@ -0,0 +1,28 @@ +/* PR middle-end/86627 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "call\[^\n\r]*__divti3" } } */ + +__int128_t +f1 (__int128_t a) +{ + return a / 2; +} + +__int128_t +f2 (__int128_t a) +{ + return a / -2; +} + +__int128_t +f3 (__int128_t a) +{ + return a / 0x4000000000000000LL; +} + +__int128_t +f4 (__int128_t a) +{ + return a / -0x4000000000000000LL; +} diff --git a/gcc/testsuite/gcc.target/i386/pr87065.c b/gcc/testsuite/gcc.target/i386/pr87065.c new file mode 100644 index 00000000000..f1cc6f92679 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87065.c @@ -0,0 +1,22 @@ +/* PR rtl-optimization/87065 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mxop -mprefer-avx128" } */ + +int a, c, d, e; +short *b; + +void +foo (void) +{ + short *g = b; + int h = 1; + unsigned i; + for (; h <= 1; h++) + g = (short *) &c; + for (; c; c++) + { + for (; i <= 1; i++) + ; + a ^= (a > 0 <= i) + ((e += d) == 0 ?: (*g = 8)); + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr87550.c b/gcc/testsuite/gcc.target/i386/pr87550.c new file mode 100644 index 00000000000..ef77e321d6e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87550.c @@ -0,0 +1,21 @@ +/* PR target/87550 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include <x86intrin.h> + +int +foo (int x) +{ + return __rdtsc () + __rdtsc (); +} + +/* { dg-final { scan-assembler-times "\trdtsc\[\n\r]" 2 } } */ + +int +bar (int x) +{ + return __rdpmc (0) + __rdpmc (0); +} + +/* { dg-final { scan-assembler-times "\trdpmc\[\n\r]" 2 } } */ diff --git a/gcc/testsuite/gfortran.dg/generic_34.f90 b/gcc/testsuite/gfortran.dg/generic_34.f90 new file mode 100644 index 00000000000..1bcbfa089fa --- /dev/null +++ b/gcc/testsuite/gfortran.dg/generic_34.f90 @@ -0,0 +1,27 @@ +! { dg-do compile } +! +! PR 86116: [6/7/8/9 Regression] Ambiguous generic interface not recognised +! +! Contributed by martin <mscfd@gmx.net> + +module mod + + type :: t + end type t + + interface sub + module procedure s1 + module procedure s2 + end interface + +contains + + subroutine s1(x) ! { dg-error "Ambiguous interfaces in generic interface" } + type(t) :: x + end subroutine + + subroutine s2(x) ! { dg-error "Ambiguous interfaces in generic interface" } + class(*), allocatable :: x + end subroutine + +end diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_50.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_50.f90 new file mode 100644 index 00000000000..14f0c0a7935 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_50.f90 @@ -0,0 +1,68 @@ +! { dg-do compile } +! +! Test the fix for PR86242, in which the procedure pointer in 'tester' +! was being copied as if it were an allocatable class component. +! +! Contributed by <cfd@mnet-mail.de> +! +module test + + implicit none + + private + public :: tester + + type :: wrapper + integer(4) :: n + end type wrapper + + type :: output + real(8) :: dummy + end type output + + type :: tester + class(wrapper), allocatable :: wrap + procedure(proc1), pointer :: ptr => null() + end type tester + + abstract interface + function proc1(self) result(uc) + import :: tester, output + class(tester), intent(in) :: self + class(output), allocatable :: uc + end function proc1 + end interface + +end module test + +! Comment #2 from Janus Weil <janus@gcc.gnu.org> +module test1 + + implicit none + + type :: output + end type + + type :: tester + integer, allocatable :: wrap + procedure(proc1), pointer, nopass :: ptr + end type + + interface ! Originally abstract + function proc1() result(uc) + import :: output + class(output), allocatable :: uc ! Works if a pointer + end function + end interface + +! PR82969 from Gerhard Steinmetz <gscfq@t-online.de> + type t + real, allocatable :: x(:) + procedure(f), nopass, pointer :: g + end type +contains + function f() result(z) + class(t), allocatable :: z + end + +end module test1 diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index c6f68bea697..7f00b308d48 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1927,8 +1927,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, && id->call_stmt && (decl = gimple_call_fndecl (stmt)) && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL - && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN - && ! gimple_call_va_arg_pack_p (id->call_stmt)) + && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN) { /* __builtin_va_arg_pack_len () should be replaced by the number of anonymous arguments. */ @@ -1946,10 +1945,32 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, if (POINTER_BOUNDS_P (gimple_call_arg (id->call_stmt, i))) nargs--; - count = build_int_cst (integer_type_node, nargs); - new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count); - gsi_replace (©_gsi, new_stmt, false); - stmt = new_stmt; + if (!gimple_call_lhs (stmt)) + { + /* Drop unused calls. */ + gsi_remove (©_gsi, false); + continue; + } + else if (!gimple_call_va_arg_pack_p (id->call_stmt)) + { + count = build_int_cst (integer_type_node, nargs); + new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count); + gsi_replace (©_gsi, new_stmt, false); + stmt = new_stmt; + } + else if (nargs != 0) + { + tree newlhs; + if (gimple_in_ssa_p (cfun)) + newlhs = make_ssa_name (integer_type_node, NULL); + else + newlhs = create_tmp_reg (integer_type_node); + count = build_int_cst (integer_type_node, nargs); + new_stmt = gimple_build_assign (gimple_call_lhs (stmt), + PLUS_EXPR, newlhs, count); + gimple_call_set_lhs (stmt, newlhs); + gsi_insert_after (©_gsi, new_stmt, GSI_NEW_STMT); + } } else if (call_stmt && id->call_stmt diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index a51b1b81740..57ae47420e3 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -298,7 +298,15 @@ stmt_local_def (gimple *stmt) if (gimple_vdef (stmt) != NULL_TREE || gimple_has_side_effects (stmt) || gimple_could_trap_p_1 (stmt, false, false) - || gimple_vuse (stmt) != NULL_TREE) + || gimple_vuse (stmt) != NULL_TREE + /* Copied from tree-ssa-ifcombine.c:bb_no_side_effects_p(): + const calls don't match any of the above, yet they could + still have some side-effects - they could contain + gimple_could_trap_p statements, like floating point + exceptions or integer division by zero. See PR70586. + FIXME: perhaps gimple_has_side_effects or gimple_could_trap_p + should handle this. */ + || is_gimple_call (stmt)) return false; def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index 1b2d82b6f67..e8b75d7e1a0 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/gotools/ChangeLog b/gotools/ChangeLog index 87edf9aeff0..dce92ae7263 100644 --- a/gotools/ChangeLog +++ b/gotools/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/include/ChangeLog b/include/ChangeLog index e4bc41bdba3..e62e56276dd 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/intl/ChangeLog b/intl/ChangeLog index 898e8fc2d0d..d37b5bd3fb5 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libada/ChangeLog b/libada/ChangeLog index e52d7382370..41b22cb4d2d 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index e8f3a342324..f32aed408a9 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index bfaac1c9a21..f0939550970 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index 98b9b3a6a0d..cbbd1d417cc 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog index cbcc1f33eac..d9468a5b6f5 100644 --- a/libcilkrts/ChangeLog +++ b/libcilkrts/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index a63abb04f5e..dff5764e0e1 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2018-06-15 Martin Liska <mliska@suse.cz> PR bootstrap/86162 diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index deebb727fb9..a1238d12828 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index 31af9724bdb..d286b3a2663 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libffi/ChangeLog b/libffi/ChangeLog index ff8c1536bce..ce276a14d38 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index df5e7a44659..5deae4005b5 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,22 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-08-17 John David Anglin <danglin@gcc.gnu.org> + + Backport from mainline + 2018-08-11 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/linux-atomic.c: Update comment. + (FETCH_AND_OP_2, OP_AND_FETCH_2, FETCH_AND_OP_WORD, OP_AND_FETCH_WORD, + COMPARE_AND_SWAP_2, __sync_val_compare_and_swap_4, + SYNC_LOCK_TEST_AND_SET_2, __sync_lock_test_and_set_4): Use + __ATOMIC_RELAXED for atomic loads. + (SYNC_LOCK_RELEASE_1): New define. Use __sync_synchronize() and + unordered store to release lock. + (__sync_lock_release_8): Likewise. + (SYNC_LOCK_RELEASE_2): Remove define. + 2018-04-02 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline diff --git a/libgcc/config/libbid/ChangeLog b/libgcc/config/libbid/ChangeLog index fbc0257bdf3..f1c8bd09b84 100644 --- a/libgcc/config/libbid/ChangeLog +++ b/libgcc/config/libbid/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libgcc/config/pa/linux-atomic.c b/libgcc/config/pa/linux-atomic.c index 1fe34866a52..67a9c59ea2c 100644 --- a/libgcc/config/pa/linux-atomic.c +++ b/libgcc/config/pa/linux-atomic.c @@ -28,14 +28,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define EBUSY 16 #define ENOSYS 251 -/* All PA-RISC implementations supported by linux have strongly - ordered loads and stores. Only cache flushes and purges can be - delayed. The data cache implementations are all globally - coherent. Thus, there is no need to synchonize memory accesses. - - GCC automatically issues a asm memory barrier when it encounters - a __sync_synchronize builtin. Thus, we do not need to define this - builtin. +/* PA-RISC 2.0 supports out-of-order execution for loads and stores. + Thus, we need to synchonize memory accesses. For more info, see: + "Advanced Performance Features of the 64-bit PA-8000" by Doug Hunt. We implement byte, short and int versions of each atomic operation using the kernel helper defined below. There is no support for @@ -119,7 +114,7 @@ __kernel_cmpxchg2 (void *mem, const void *oldval, const void *newval, long failure; \ \ do { \ - tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ + tmp = __atomic_load_n (ptr, __ATOMIC_RELAXED); \ newval = PFX_OP (tmp INF_OP val); \ failure = __kernel_cmpxchg2 (ptr, &tmp, &newval, INDEX); \ } while (failure != 0); \ @@ -156,7 +151,7 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0) long failure; \ \ do { \ - tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ + tmp = __atomic_load_n (ptr, __ATOMIC_RELAXED); \ newval = PFX_OP (tmp INF_OP val); \ failure = __kernel_cmpxchg2 (ptr, &tmp, &newval, INDEX); \ } while (failure != 0); \ @@ -193,7 +188,7 @@ OP_AND_FETCH_2 (nand, ~, &, signed char, 1, 0) long failure; \ \ do { \ - tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ + tmp = __atomic_load_n (ptr, __ATOMIC_RELAXED); \ failure = __kernel_cmpxchg (ptr, tmp, PFX_OP (tmp INF_OP val)); \ } while (failure != 0); \ \ @@ -215,7 +210,7 @@ FETCH_AND_OP_WORD (nand, ~, &) long failure; \ \ do { \ - tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ + tmp = __atomic_load_n (ptr, __ATOMIC_RELAXED); \ failure = __kernel_cmpxchg (ptr, tmp, PFX_OP (tmp INF_OP val)); \ } while (failure != 0); \ \ @@ -241,7 +236,7 @@ typedef unsigned char bool; \ while (1) \ { \ - actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ + actual_oldval = __atomic_load_n (ptr, __ATOMIC_RELAXED); \ \ if (__builtin_expect (oldval != actual_oldval, 0)) \ return actual_oldval; \ @@ -273,7 +268,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval) while (1) { - actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); + actual_oldval = __atomic_load_n (ptr, __ATOMIC_RELAXED); if (__builtin_expect (oldval != actual_oldval, 0)) return actual_oldval; @@ -300,7 +295,7 @@ TYPE HIDDEN \ long failure; \ \ do { \ - oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ + oldval = __atomic_load_n (ptr, __ATOMIC_RELAXED); \ failure = __kernel_cmpxchg2 (ptr, &oldval, &val, INDEX); \ } while (failure != 0); \ \ @@ -318,38 +313,31 @@ __sync_lock_test_and_set_4 (int *ptr, int val) int oldval; do { - oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); + oldval = __atomic_load_n (ptr, __ATOMIC_RELAXED); failure = __kernel_cmpxchg (ptr, oldval, val); } while (failure != 0); return oldval; } -#define SYNC_LOCK_RELEASE_2(TYPE, WIDTH, INDEX) \ +void HIDDEN +__sync_lock_release_8 (long long *ptr) +{ + /* All accesses must be complete before we release the lock. */ + __sync_synchronize (); + *(double *)ptr = 0; +} + +#define SYNC_LOCK_RELEASE_1(TYPE, WIDTH) \ void HIDDEN \ __sync_lock_release_##WIDTH (TYPE *ptr) \ { \ - TYPE oldval, zero = 0; \ - long failure; \ - \ - do { \ - oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \ - failure = __kernel_cmpxchg2 (ptr, &oldval, &zero, INDEX); \ - } while (failure != 0); \ + /* All accesses must be complete before we release \ + the lock. */ \ + __sync_synchronize (); \ + *ptr = 0; \ } -SYNC_LOCK_RELEASE_2 (long long, 8, 3) -SYNC_LOCK_RELEASE_2 (short, 2, 1) -SYNC_LOCK_RELEASE_2 (signed char, 1, 0) - -void HIDDEN -__sync_lock_release_4 (int *ptr) -{ - long failure; - int oldval; - - do { - oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); - failure = __kernel_cmpxchg (ptr, oldval, 0); - } while (failure != 0); -} +SYNC_LOCK_RELEASE_1 (int, 4) +SYNC_LOCK_RELEASE_1 (short, 2) +SYNC_LOCK_RELEASE_1 (signed char, 1) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 2bb43830478..47674e2ca98 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-16 Gerald Pfeifer <gerald@pfeifer.com> + + Backport from trunk + * io/close.c [!HAVE_UNLINK_OPEN_FILE]: Include <string.h>. + 2018-01-03 Janne Blomqvist <jb@gcc.gnu.org> Backport from trunk diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index c29c125b10c..db45f6ce4e1 100644 --- a/libgfortran/io/close.c +++ b/libgfortran/io/close.c @@ -25,6 +25,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "io.h" #include "unix.h" #include <limits.h> +#if !HAVE_UNLINK_OPEN_FILE +#include <string.h> +#endif typedef enum { CLOSE_DELETE, CLOSE_KEEP, CLOSE_UNSPECIFIED } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index a1e2a3cb179..721c75352dd 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,23 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-12 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2018-07-17 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/86542 + * testsuite/libgomp.c++/pr86542.C: New test. + + PR middle-end/86539 + * testsuite/libgomp.c++/pr86539.C: New test. + + 2018-07-26 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/86660 + * testsuite/libgomp.c/pr86660.c: New test. + 2018-06-26 Jakub Jelinek <jakub@redhat.com> PR c++/86291 diff --git a/libgomp/testsuite/libgomp.c++/pr86539.C b/libgomp/testsuite/libgomp.c++/pr86539.C new file mode 100644 index 00000000000..ed0d63e4b76 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr86539.C @@ -0,0 +1,28 @@ +// PR middle-end/86539 + +int a[384]; + +__attribute__((noinline, noclone)) void +foo (int &b, int &c) +{ + #pragma omp taskloop shared (a) collapse(3) + for (int i = 0; i < 1; i++) + for (int *p = &b; p < &c; p++) + for (int j = 0; j < 1; j++) + if (p < &a[128] || p >= &a[256]) + __builtin_abort (); + else + p[0]++; +} + +int +main () +{ + #pragma omp parallel + #pragma omp single + foo (a[128], a[256]); + for (int i = 0; i < 384; i++) + if (a[i] != (i >= 128 && i < 256)) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c++/pr86542.C b/libgomp/testsuite/libgomp.c++/pr86542.C new file mode 100644 index 00000000000..a8ebe574012 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr86542.C @@ -0,0 +1,37 @@ +// PR middle-end/86542 + +struct S { int s; S (); ~S (); S (const S &); }; +S s; + +S::S () +{ +} + +S::~S () +{ +} + +S::S (const S &x) +{ + s = x.s; +} + +__attribute__((noinline, noclone)) void +foo (int i, int j, int k, S s) +{ + if (i != 0 || j != 0 || k != 0 || s.s != 12) + __builtin_abort (); +} + +int +main () +{ + volatile int inc = 16, jnc = 16, knc = 16; + s.s = 12; + #pragma omp taskloop collapse (3) firstprivate (s) + for (int i = 0; i < 16; i += inc) + for (int j = 0; j < 16; j += jnc) + for (int k = 0; k < 16; k += knc) + foo (i, j, k, s); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr86660.c b/libgomp/testsuite/libgomp.c/pr86660.c new file mode 100644 index 00000000000..bea6b15270b --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr86660.c @@ -0,0 +1,28 @@ +/* PR middle-end/86660 */ + +#pragma omp declare target +int v[20]; + +void +foo (void) +{ + if (v[7] != 2) + __builtin_abort (); + v[7] = 1; +} +#pragma omp end declare target + +int +main () +{ + v[5] = 8; + v[7] = 2; + #pragma omp target map (always, tofrom: v) + { + foo (); + v[5] = 3; + } + if (v[7] != 1 || v[5] != 3) + __builtin_abort (); + return 0; +} diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index a084905c47a..d0a46b2edf4 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 11a1ca11c74..1f8bbc695e9 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 15e89178440..2e0da7d4e50 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-09-07 Matthias Klose <doko@ubuntu.com> * include/x86_64-signal.h (HANDLE_DIVIDE_OVERFLOW): Replace diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index 7388762cf4b..b292472a94a 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog index 8eea9365ab4..b0ce075c327 100644 --- a/libjava/libltdl/ChangeLog +++ b/libjava/libltdl/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog index 21a249178cd..34d88cb1a7f 100644 --- a/libmpx/ChangeLog +++ b/libmpx/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index a12911c86d9..1036c1937b8 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog index 4132e3a9d86..07740853b45 100644 --- a/liboffloadmic/ChangeLog +++ b/liboffloadmic/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog index e0354f07a3b..e6777f13709 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-09-15 Jakub Jelinek <jakub@redhat.com> PR libquadmath/65757 diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index d988b28cbb1..178f69e6ec8 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,41 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-15 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2018-03-19 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/84761 + * sanitizer_common/sanitizer_linux_libcdep.cc (__GLIBC_PREREQ): + Define if not defined. + (DL_INTERNAL_FUNCTION): Don't define. + (InitTlsSize): For __i386__ if not compiled against glibc 2.27+ + determine at runtime whether to use regparm(3), stdcall calling + convention for older glibcs or normal calling convention for + newer glibcs for call to _dl_get_tls_static_info. + +2017-09-23 Matthias Klose <doko@ubuntu.com> + + Backported from the gcc-7-branch: + 2018-05-31 Matthias Klose <doko@ubuntu.com> + + PR sanitizer/86012 + * sanitizer_common/sanitizer_platform_limits_posix.cc: Define + SIZEOF_STRUCT_USTAT for 32bit sparc. + +2017-09-21 Matthias Klose <doko@ubuntu.com> + + Backported from the gcc-7-branch: + 2018-05-24 H.J. Lu <hongjiu.lu@intel.com> + + PR sanitizer/85835 + * sanitizer_common/sanitizer_platform_limits_posix.cc: Don't + include <sys/ustat.h> for Linux. + (SIZEOF_STRUCT_USTAT): New. + (struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux. + 2017-09-07 Matthias Klose <doko@ubuntu.com> Backported from mainline diff --git a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc index ff69664e7b9..5fb75d638b8 100644 --- a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc @@ -154,14 +154,12 @@ bool SanitizerGetThreadName(char *name, int max_len) { #endif } -#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO -static uptr g_tls_size; +#ifndef __GLIBC_PREREQ +#define __GLIBC_PREREQ(x, y) 0 #endif -#ifdef __i386__ -# define DL_INTERNAL_FUNCTION __attribute__((regparm(3), stdcall)) -#else -# define DL_INTERNAL_FUNCTION +#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO +static uptr g_tls_size; #endif #if defined(__mips__) || defined(__powerpc64__) @@ -186,16 +184,33 @@ void InitTlsSize() { #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO // all current supported platforms have 16 bytes stack alignment const size_t kStackAlign = 16; - typedef void (*get_tls_func)(size_t*, size_t*) DL_INTERNAL_FUNCTION; - get_tls_func get_tls; - void *get_tls_static_info_ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info"); - CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr)); - internal_memcpy(&get_tls, &get_tls_static_info_ptr, - sizeof(get_tls_static_info_ptr)); - CHECK_NE(get_tls, 0); size_t tls_size = 0; size_t tls_align = 0; - get_tls(&tls_size, &tls_align); + void *get_tls_static_info_ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info"); +#if defined(__i386__) && !__GLIBC_PREREQ(2, 27) + /* On i?86, _dl_get_tls_static_info used to be internal_function, i.e. + __attribute__((regparm(3), stdcall)) before glibc 2.27 and is normal + function in 2.27 and later. */ + if (!dlvsym(RTLD_NEXT, "glob", "GLIBC_2.27")) { + typedef void (*get_tls_func)(size_t*, size_t*) + __attribute__((regparm(3), stdcall)); + get_tls_func get_tls; + CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr)); + internal_memcpy(&get_tls, &get_tls_static_info_ptr, + sizeof(get_tls_static_info_ptr)); + CHECK_NE(get_tls, 0); + get_tls(&tls_size, &tls_align); + } else +#endif + { + typedef void (*get_tls_func)(size_t*, size_t*); + get_tls_func get_tls; + CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr)); + internal_memcpy(&get_tls, &get_tls_static_info_ptr, + sizeof(get_tls_static_info_ptr)); + CHECK_NE(get_tls, 0); + get_tls(&tls_size, &tls_align); + } if (tls_align < kStackAlign) tls_align = kStackAlign; g_tls_size = RoundUpTo(tls_size, tls_align); diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index 6992f2cd8ac..069d8d557de 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -150,7 +150,6 @@ typedef struct user_fpregs elf_fpregset_t; # include <sys/procfs.h> #endif #include <sys/user.h> -#include <sys/ustat.h> #include <linux/cyclades.h> #include <linux/if_eql.h> #include <linux/if_plip.h> @@ -243,7 +242,19 @@ namespace __sanitizer { #endif // SANITIZER_LINUX || SANITIZER_FREEBSD #if SANITIZER_LINUX && !SANITIZER_ANDROID - unsigned struct_ustat_sz = sizeof(struct ustat); + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which + // has been removed from glibc 2.28. +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ + || defined(__x86_64__) +#define SIZEOF_STRUCT_USTAT 32 +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ + || defined(__powerpc__) || defined(__s390__) || defined(__sparc__) +#define SIZEOF_STRUCT_USTAT 20 +#else +#error Unknown size of struct ustat +#endif + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; unsigned struct_rlimit64_sz = sizeof(struct rlimit64); unsigned struct_statvfs64_sz = sizeof(struct statvfs64); #endif // SANITIZER_LINUX && !SANITIZER_ANDROID diff --git a/libssp/ChangeLog b/libssp/ChangeLog index 22ef3d8d042..0f008f2577a 100644 --- a/libssp/ChangeLog +++ b/libssp/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6ecaada6df6..2e5a0253495 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,336 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + +2018-10-25 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/87749 + * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] + (basic_string::operator=(basic_string&&)): For short strings copy the + buffer inline. Only fall back to using assign(const basic_string&) to + do a deep copy when reallocation is needed. + * testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc: + New test. + * testsuite/21_strings/basic_string/modifiers/assign/char/ + move_assign_optim.cc: New test. + * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc: + New test. + * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/ + move_assign_optim.cc: New test. + +2018-10-25 Jonathan Wakely <jwakely@redhat.com> + + + Backport from mainline + 2018-10-23 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/87704 + * include/bits/unique_ptr.h (unique_ptr::unique_ptr(nullptr_t)): Do + not delegate to default constructor. + (unique_ptr<T[], D>::unique_ptr(nullptr_t)): Likewise. + * testsuite/20_util/unique_ptr/cons/incomplete.cc: New test. + * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error. + * testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise. + +2018-10-18 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-10-18 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/87641 + * include/bits/valarray_array.h (__valarray_sum): Use first element + to initialize accumulator instead of value-initializing it. + * testsuite/26_numerics/valarray/87641.cc: New test. + +2018-10-15 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/22_locale/numpunct/members/char/3.cc: Adjust test to + account for change to glibc it_IT localedata (glibc bz#10797). + +2018-10-15 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-07-31 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/86751 + * include/bits/stl_pair.h (__pair_base): New class with deleted copy + assignment operator. + (pair): Derive from __pair_base. + (pair::operator=): Remove deleted overload. + * python/libstdcxx/v6/printers.py (StdPairPrinter): New pretty printer + so that new base class isn't shown in GDB. + * testsuite/20_util/pair/86751.cc: New test. + * testsuite/20_util/pair/ref_assign.cc: New test. + +2018-10-12 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-08-30 Jonathan Wakely <jwakely@redhat.com> + + * include/ext/pointer.h (_Pointer_adapter): Define operators for + pointer arithmetic using long long offsets. + * testsuite/ext/ext_pointer/1.cc: Test pointer arithmetic using + long long values. + +2018-10-12 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-08-22 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/87061 + * include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI] + (experimental::pmr::match_results, experimental::pmr::cmatch) + (experimental::pmr::smatch, experimental::pmr::wcmatch) + (experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI, + because COW strings don't support C++11 allocator model. + * include/experimental/string [!_GLIBCXX_USE_CXX11_ABI] + (experimental::pmr::basic_string, experimental::pmr::string) + (experimental::pmr::u16string, experimental::pmr::u32string) + (experimental::pmr::wstring): Likewise. + + Backport from mainline + 2018-08-15 Jonathan Wakely <jwakely@redhat.com> + + * include/experimental/regex: Remove begin/end macros for namespace. + * include/experimental/string: Likewise. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc: + New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_forward_list.cc: New test. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc: + New test. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc: + New test. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc: + New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_multimap.cc: New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_multiset.cc: New test. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc: + New test. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc: + New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_unordered_map.cc: New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_unordered_multimap.cc: New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_unordered_multiset.cc: New test. + * testsuite/experimental/polymorphic_allocator/ + pmr_typedefs_unordered_set.cc: New test. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc: + New test. + +2018-10-12 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-07-24 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/70966 + * include/experimental/memory_resource (__get_default_resource): Use + placement new to create an object with dynamic storage duration. + + Backport from mainline + 2018-06-20 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/70966 + * include/experimental/memory_resource (__resource_adaptor_imp): Add + static assertions to enforce requirements on pointer types. + (__resource_adaptor_imp::get_allocator()): Add noexcept. + (new_delete_resource, null_memory_resource): Return address of an + object with dynamic storage duration. + (__null_memory_resource): Remove. + * testsuite/experimental/memory_resource/70966.cc: New. + +2018-10-12 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/77854 + * doc/xml/manual/status_cxx1998.xml: Document size_type and + difference_type for containers. + * doc/html/*: Regenerate. + +2018-10-12 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-05-18 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/85098 + * include/bits/regex.h [__cplusplus < 201703L] (basic_regex::icase) + (basic_regex::nosubs, basic_regex::optimize, basic_regex::collate) + (basic_regex::ECMAScript, basic_regex::basic, basic_regex::extended) + (basic_regex::awk, basic_regex::grep, basic_regex::egrep): Add + definitions. + * include/bits/regex_automaton.h (_NFA::_M_insert_state): Adjust + whitespace. + * testsuite/28_regex/basic_regex/85098.cc: New + +2018-10-08 Joseph Myers <joseph@codesourcery.com> + + Backport from mainline + 2018-10-02 Joseph Myers <joseph@codesourcery.com> + + * testsuite/lib/libstdc++.exp (libstdc++_init): Use + -fno-show-column in default cxxflags. + +2018-08-08 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-06-14 Daniel Trebbien <dtrebbien@gmail.com> + Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/83982 + * include/bits/vector.tcc (vector::_M_default_append(size_type)): + Default-construct new elements before moving existing ones. + * testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc: + New. + + Backport from mainline + 2017-12-01 Jonathan Wakely <jwakely@redhat.com> + + * include/std/type_traits (integral_constant): Make member functions + noexcept (LWG 2346). + * include/std/utility (integer_sequence): Likewise. + + Backport from mainline + 2018-06-18 Jonathan Wakely <jwakely@redhat.com> + + LWG 3050 Fix cv-qualification of convertibility constraints + * include/std/chrono (duration, operator*, operator/, operator%): Use + const-qualified type as source type in is_convertible constraints. + * testsuite/20_util/duration/arithmetic/dr3050.cc: New. + * testsuite/20_util/duration/cons/dr3050.cc: New. + * testsuite/20_util/duration/literals/range.cc: Rename to... + * testsuite/20_util/duration/literals/range_neg.cc: Here. Adjust + dg-error lineno. + + Backport from mainline + 2017-11-16 Jonathan Wakely <jwakely@redhat.com> + + * include/std/future (shared_future): Add noexcept to copy constructor + and copy-assignment operator (LWG 2799). + + Backport from mainline + 2017-06-17 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/80893 + * testsuite/23_containers/vector/bool/80893.cc: Add { target c++11 }. + + Backport from mainline + 2017-05-31 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/80893 + * include/bits/stl_bvector.h (vector<bool>::_M_initialize): Avoid + null pointer dereference when size is zero. + * testsuite/23_containers/vector/bool/80893.cc: New. + * testsuite/util/testsuite_allocator.h (PointerBase::PointerBase): + Add non-explicit constructor from nullptr. + (PointerBase::derived() const): Add const-qualified overload. + + Backport from mainline + 2017-12-14 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/68519 + * include/std/condition_variable (condition_variable::wait_for): + Convert duration to native clock's duration before addition. + * testsuite/30_threads/condition_variable/members/68519.cc: New test. + + Backport from mainline + 2018-06-25 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/86292 + * include/bits/stl_vector.h (vector::_M_range_initialize<InputIter>): + Add try-catch block. + * testsuite/23_containers/vector/cons/86292.cc: New. + + Backport from mainline + 2018-07-31 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/using.xml: Document all headers for C++11 and later. + * doc/html/*: Regenerate. + + Backport from mainline + 2018-08-03 Jonathan Wakely <jwakely@redhat.com> + + * src/c++11/system_error.cc + (system_error_category::default_error_condition): Add workaround for + ENOTEMPTY and EEXIST having the same value on AIX. + * testsuite/19_diagnostics/error_category/system_category.cc: Add + extra testcases for EDOM, EILSEQ, ERANGE, EEXIST and ENOTEMPTY. + + Backport from mainline + 2018-08-01 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/60555 + * src/c++11/system_error.cc + (system_error_category::default_error_condition): New override to + check for POSIX errno values. + * testsuite/19_diagnostics/error_category/generic_category.cc: New + * testsuite/19_diagnostics/error_category/system_category.cc: New + test. + + Backport from mainline + 2018-07-30 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/86734 + * include/bits/stl_iterator.h (reverse_iterator::operator->): Use + addressof (LWG 2188). + * testsuite/24_iterators/reverse_iterator/dr2188.cc: New test. + + Backport from mainline + 2018-05-19 Jonathan Wakely <jwakely@redhat.com> + + * src/c++11/codecvt.cc (__codecvt_utf8_base<wchar_t>::do_in) + [__SIZEOF_WCHAR_T__==2 && __BYTE_ORDER__!=__ORDER_BIG_ENDIAN__]: Set + little_endian element in bitmask. + * testsuite/22_locale/codecvt/codecvt_utf8/69703.cc: Run all tests. + * testsuite/22_locale/codecvt/codecvt_utf8/wchar_t/1.cc: New. + + PR libstdc++/66145 + Backport from mainline + 2018-04-10 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/85222 + * src/c++11/cxx11-ios_failure.cc (__construct_ios_failure) + (__destroy_ios_failure, is_ios_failure_handler): New functions. + * src/c++11/ios.cc (__throw_ios_failure): Remove definition. + (_GLIBCXX_USE_CXX11_ABI): Don't define here. + * src/c++98/Makefile.am [ENABLE_DUAL_ABI]: Add special rules for + ios_failure.cc to rewrite type info for __ios_failure. + * src/c++98/Makefile.in: Regenerate. + * src/c++98/ios_failure.cc [_GLIBCXX_USE_DUAL_ABI] + (__iosfailure, __iosfailure_type_info): New types. + (__throw_ios_failure): Define here. + * testsuite/27_io/ios_base/failure/dual_abi.cc: New. + * testsuite/27_io/basic_ios/copyfmt/char/1.cc: Revert changes to + add -D_GLIBCXX_USE_CXX11_ABI=0 to dg-options. + * testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise. + * testsuite/27_io/basic_istream/extractors_arithmetic/char/ + exceptions_failbit.cc: Likewise. + * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/ + exceptions_failbit.cc: Likewise. + * testsuite/27_io/basic_istream/extractors_other/char/ + exceptions_null.cc: Likewise. + * testsuite/27_io/basic_istream/extractors_other/wchar_t/ + exceptions_null.cc: Likewise. + * testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise. + * testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise. + * testsuite/27_io/basic_ostream/inserters_other/char/ + exceptions_null.cc: Likewise. + * testsuite/27_io/basic_ostream/inserters_other/wchar_t/ + exceptions_null.cc: Likewise. + * testsuite/27_io/ios_base/storage/2.cc: Likewise. + +2018-07-05 François Dumont <fdumont@gcc.gnu.org> + + Backport from mainline + 2018-07-04 François Dumont <fdumont@gcc.gnu.org> + + PR libstdc++/86272 + * include/debug/string + (__gnu_debug::basic_string<>::insert<_Ite>(const_iterator, _Ite, _Ite)): + Use __glibcxx_check_insert_range. + 2018-05-14 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/67554 diff --git a/libstdc++-v3/doc/html/manual/index.html b/libstdc++-v3/doc/html/manual/index.html index 3a098d9445f..427f3f063d0 100644 --- a/libstdc++-v3/doc/html/manual/index.html +++ b/libstdc++-v3/doc/html/manual/index.html @@ -149,7 +149,7 @@ Support for C++11 dialect. </a></dt><dt>22.10. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.3.3.23">Non-unique Mapping Containers</a></dt><dt>22.11. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.4.3.5">Point Iterator Hierarchy</a></dt><dt>22.12. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.4.4.5">Invalidation Guarantee Tags Hierarchy</a></dt><dt>22.13. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.5.7.4">Container Tag Hierarchy</a></dt><dt>22.14. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.2.3">Hash functions, ranged-hash functions, and range-hashing functions</a></dt><dt>22.15. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.5.3.4">Insert hash sequence diagram</a></dt><dt>22.16. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.5.3.6">Insert hash sequence diagram with a null policy</a></dt><dt>22.17. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.5.5.5">Hash policy class diagram</a></dt><dt>22.18. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.4.7">Balls and bins</a></dt><dt>22.19. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.5.3.6">Insert resize sequence diagram</a></dt><dt>22.20. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.5.3.9">Standard resize policy trigger sequence diagram</a></dt><dt>22.21. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.5.3.10">Standard resize policy size sequence - diagram</a></dt><dt>22.22. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.5">Tree node invariants</a></dt><dt>22.23. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.8">Tree node invalidation</a></dt><dt>22.24. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.3">A tree and its update policy</a></dt><dt>22.25. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.8">Restoring node invariants</a></dt><dt>22.26. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.10">Insert update sequence</a></dt><dt>22.27. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.20">Useless update path</a></dt><dt>22.28. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.2.10">A PATRICIA trie</a></dt><dt>22.29. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.3.5">A trie and its update policy</a></dt><dt>22.30. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.3">A simple list</a></dt><dt>22.31. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.6">The counter algorithm</a></dt><dt>22.32. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.3.3">Underlying Priority-Queue Data-Structures.</a></dt><dt>22.33. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.4.4">Priority-Queue Data-Structure Tags.</a></dt><dt>B.1. <a href="appendix_porting.html#fig.build_hacking.deps">Configure and Build File Dependencies</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1.1. <a href="status.html#table.cxx98_status">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#table.cxx11_status">C++ 2011 Implementation Status</a></dt><dt>1.3. <a href="status.html#table.cxx14_status">C++ 2014 Implementation Status</a></dt><dt>1.4. <a href="status.html#table.ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.5. <a href="status.html#table.cxx1z_status">C++ 201z Implementation Status</a></dt><dt>1.6. <a href="status.html#table.cxx1z_ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.7. <a href="status.html#table.tr1_status">C++ TR1 Implementation Status</a></dt><dt>1.8. <a href="status.html#table.decfp_status">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#table.cmd_options">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#table.cxx98_headers">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#table.cxx98_cheaders">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#table.cxx11_headers">C++ 2011 Library Headers</a></dt><dt>3.5. <a href="using_headers.html#table.cxx11_cheaders">C++ 2011 Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#table.tr1_headers">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#table.tr1_cheaders">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#table.decfp_headers">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#table.abi_headers">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#table.ext_headers">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#table.debug_headers">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#table.profile_headers">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#table.parallel_headers">Extension Parallel Headers</a></dt><dt>17.1. <a href="debug_mode_using.html#table.debug_mode_containers">Debugging Containers</a></dt><dt>17.2. <a href="debug_mode_using.html#table.debug_mode_containers_cxx11">Debugging Containers C++11</a></dt><dt>18.1. <a href="parallel_mode_using.html#table.parallel_algos">Parallel Algorithms</a></dt><dt>19.1. <a href="profile_mode_design.html#table.profile_code_loc">Profile Code Location</a></dt><dt>19.2. <a href="profile_mode_diagnostics.html#table.profile_diagnostics">Profile Diagnostics</a></dt><dt>21.1. <a href="bitmap_allocator_impl.html#table.bitmap_alloc">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="documentation_hacking.html#table.doxygen_prereq">Doxygen Prerequisites</a></dt><dt>B.2. <a href="documentation_hacking.html#table.doxygen_cmp">HTML to Doxygen Markup Comparison</a></dt><dt>B.3. <a href="documentation_hacking.html#table.docbook_prereq">Docbook Prerequisites</a></dt><dt>B.4. <a href="documentation_hacking.html#table.docbook_cmp">HTML to Docbook XML Markup Comparison</a></dt><dt>B.5. <a href="documentation_hacking.html#table.docbook_elem">Docbook XML Element Use</a></dt><dt>B.6. <a href="api.html#table.extension_allocators">Extension Allocators</a></dt><dt>B.7. <a href="api.html#table.extension_allocators2">Extension Allocators Continued</a></dt></dl></div><div class="list-of-equations"><p><strong>List of Equations</strong></p><dl><dt>22.1. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.2.15">Ranged Hash Function</a></dt><dt>22.2. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.3">Range-Hashing, Division Method</a></dt><dt>22.3. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.9">Division via Prime Modulo</a></dt><dt>22.4. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.11">Division via Bit Mask</a></dt><dt>22.5. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.4.7"> + diagram</a></dt><dt>22.22. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.5">Tree node invariants</a></dt><dt>22.23. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.8">Tree node invalidation</a></dt><dt>22.24. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.3">A tree and its update policy</a></dt><dt>22.25. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.8">Restoring node invariants</a></dt><dt>22.26. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.10">Insert update sequence</a></dt><dt>22.27. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.20">Useless update path</a></dt><dt>22.28. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.2.10">A PATRICIA trie</a></dt><dt>22.29. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.3.5">A trie and its update policy</a></dt><dt>22.30. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.3">A simple list</a></dt><dt>22.31. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.6">The counter algorithm</a></dt><dt>22.32. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.3.3">Underlying Priority-Queue Data-Structures.</a></dt><dt>22.33. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.4.4">Priority-Queue Data-Structure Tags.</a></dt><dt>B.1. <a href="appendix_porting.html#fig.build_hacking.deps">Configure and Build File Dependencies</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1.1. <a href="status.html#table.cxx98_status">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#table.cxx11_status">C++ 2011 Implementation Status</a></dt><dt>1.3. <a href="status.html#table.cxx14_status">C++ 2014 Implementation Status</a></dt><dt>1.4. <a href="status.html#table.ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.5. <a href="status.html#table.cxx1z_status">C++ 201z Implementation Status</a></dt><dt>1.6. <a href="status.html#table.cxx1z_ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.7. <a href="status.html#table.tr1_status">C++ TR1 Implementation Status</a></dt><dt>1.8. <a href="status.html#table.decfp_status">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#table.cmd_options">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#table.cxx98_headers">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#table.cxx98_cheaders">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#table.cxx98_deprheaders">C++ 1998 Deprecated Library Header</a></dt><dt>3.5. <a href="using_headers.html#table.cxx11_headers">C++ 2011 Library Headers</a></dt><dt>3.6. <a href="using_headers.html#table.cxx11_cheaders">C++ 2011 Library Headers for C Library Facilities</a></dt><dt>3.7. <a href="using_headers.html#table.cxx14_headers">C++ 2014 Library Header</a></dt><dt>3.8. <a href="using_headers.html#table.filesystemts_headers">File System TS Header</a></dt><dt>3.9. <a href="using_headers.html#table.libfundts_headers">Library Fundamentals TS Headers</a></dt><dt>3.10. <a href="using_headers.html#table.tr1_headers">C++ TR 1 Library Headers</a></dt><dt>3.11. <a href="using_headers.html#table.tr1_cheaders">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.12. <a href="using_headers.html#table.decfp_headers">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.13. <a href="using_headers.html#table.abi_headers">C++ ABI Headers</a></dt><dt>3.14. <a href="using_headers.html#table.ext_headers">Extension Headers</a></dt><dt>3.15. <a href="using_headers.html#table.debug_headers">Extension Debug Headers</a></dt><dt>3.16. <a href="using_headers.html#table.profile_headers">Extension Profile Headers</a></dt><dt>3.17. <a href="using_headers.html#table.parallel_headers">Extension Parallel Headers</a></dt><dt>17.1. <a href="debug_mode_using.html#table.debug_mode_containers">Debugging Containers</a></dt><dt>17.2. <a href="debug_mode_using.html#table.debug_mode_containers_cxx11">Debugging Containers C++11</a></dt><dt>18.1. <a href="parallel_mode_using.html#table.parallel_algos">Parallel Algorithms</a></dt><dt>19.1. <a href="profile_mode_design.html#table.profile_code_loc">Profile Code Location</a></dt><dt>19.2. <a href="profile_mode_diagnostics.html#table.profile_diagnostics">Profile Diagnostics</a></dt><dt>21.1. <a href="bitmap_allocator_impl.html#table.bitmap_alloc">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="documentation_hacking.html#table.doxygen_prereq">Doxygen Prerequisites</a></dt><dt>B.2. <a href="documentation_hacking.html#table.doxygen_cmp">HTML to Doxygen Markup Comparison</a></dt><dt>B.3. <a href="documentation_hacking.html#table.docbook_prereq">Docbook Prerequisites</a></dt><dt>B.4. <a href="documentation_hacking.html#table.docbook_cmp">HTML to Docbook XML Markup Comparison</a></dt><dt>B.5. <a href="documentation_hacking.html#table.docbook_elem">Docbook XML Element Use</a></dt><dt>B.6. <a href="api.html#table.extension_allocators">Extension Allocators</a></dt><dt>B.7. <a href="api.html#table.extension_allocators2">Extension Allocators Continued</a></dt></dl></div><div class="list-of-equations"><p><strong>List of Equations</strong></p><dl><dt>22.1. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.2.15">Ranged Hash Function</a></dt><dt>22.2. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.3">Range-Hashing, Division Method</a></dt><dt>22.3. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.9">Division via Prime Modulo</a></dt><dt>22.4. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.11">Division via Bit Mask</a></dt><dt>22.5. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.4.7"> A Standard String Hash Function </a></dt><dt>22.6. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.4.12"> Only k String DNA Hash diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index 33b423bf8fe..ab8255edd62 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -121,6 +121,9 @@ This page describes the C++ support in the GCC 6 series. </p><p><span class="emphasis"><em>[22.*]</em></span> Anything and everything we have on locale implementation will be described under <a class="link" href="localization.html#std.localization.locales.locale" title="locale">Localization</a>. + </p><p><span class="emphasis"><em>[23.*]</em></span> All of the containers in this clause + define <span class="type">size_type</span> as <span class="type">std::size_t</span> and + <span class="type">difference_type</span> as <span class="type">std::ptrdiff_t</span>. </p><p><span class="emphasis"><em>[26.2.8]/9</em></span> I have no idea what <code class="code">complex<T></code>'s <code class="code">pow(0,0)</code> returns. </p><p><span class="emphasis"><em>[27.4.2.4]/2</em></span> Calling diff --git a/libstdc++-v3/doc/html/manual/using_headers.html b/libstdc++-v3/doc/html/manual/using_headers.html index a25323d40ec..e2088925caf 100644 --- a/libstdc++-v3/doc/html/manual/using_headers.html +++ b/libstdc++-v3/doc/html/manual/using_headers.html @@ -4,7 +4,7 @@ must be available to all hosted implementations. Actually, the word "files" is a misnomer, since the contents of the headers don't necessarily have to be in any kind of external - file. The only rule is that when one <code class="code">#include</code>'s a + file. The only rule is that when one <code class="code">#include</code>s a header, the contents of that header become available, no matter how. </p><p> @@ -12,25 +12,63 @@ </p><p> There are two main types of include files: header files related to a specific version of the ISO C++ standard (called Standard - Headers), and all others (TR1, C++ ABI, and Extensions). + Headers), and all others (TS, TR1, C++ ABI, and Extensions). </p><p> - Two dialects of standard headers are supported, corresponding to - the 1998 standard as updated for 2003, and the current 2011 standard. + Multiple dialects of standard headers are supported, corresponding to + the 1998 standard as updated for 2003, the 2011 standard, the 2014 + standard, and so on. </p><p> - C++98/03 include files. These are available in the default compilation mode, i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>. - </p><div class="table"><a id="table.cxx98_headers"></a><p class="title"><strong>Table 3.2. C++ 1998 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.cxx98_cheaders"></a><p class="title"><strong>Table 3.3. C++ 1998 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p> -C++11 include files. These are only available in C++11 compilation + <a class="xref" href="using_headers.html#table.cxx98_headers" title="Table 3.2. C++ 1998 Library Headers">Table 3.2, “C++ 1998 Library Headers”</a> and + <a class="xref" href="using_headers.html#table.cxx98_cheaders" title="Table 3.3. C++ 1998 Library Headers for C Library Facilities">Table 3.3, “C++ 1998 Library Headers for C Library Facilities”</a> and + <a class="xref" href="using_headers.html#table.cxx98_deprheaders" title="Table 3.4. C++ 1998 Deprecated Library Header">Table 3.4, “C++ 1998 Deprecated Library Header”</a> + show the C++98/03 include files. + These are available in the C++98 compilation mode, + i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>. + Unless specified otherwise below, they are also available in later modes + (C++11, C++14 etc). + </p><div class="table"><a id="table.cxx98_headers"></a><p class="title"><strong>Table 3.2. C++ 1998 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td colspan="3" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.cxx98_cheaders"></a><p class="title"><strong>Table 3.3. C++ 1998 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td colspan="2" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> + The following header is deprecated + and might be removed from a future C++ standard. +</p><div class="table"><a id="table.cxx98_deprheaders"></a><p class="title"><strong>Table 3.4. C++ 1998 Deprecated Library Header</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Deprecated Library Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">strstream</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +<a class="xref" href="using_headers.html#table.cxx11_headers" title="Table 3.5. C++ 2011 Library Headers">Table 3.5, “C++ 2011 Library Headers”</a> and +<a class="xref" href="using_headers.html#table.cxx11_cheaders" title="Table 3.6. C++ 2011 Library Headers for C Library Facilities">Table 3.6, “C++ 2011 Library Headers for C Library Facilities”</a> show the C++11 include files. +These are available in C++11 compilation mode, i.e. <code class="literal">-std=c++11</code> or <code class="literal">-std=gnu++11</code>. -</p><p></p><div class="table"><a id="table.cxx11_headers"></a><p class="title"><strong>Table 3.4. C++ 2011 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 2011 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td></tr><tr><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td></tr><tr><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td></tr><tr><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.cxx11_cheaders"></a><p class="title"><strong>Table 3.5. C++ 2011 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ 2011 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +Including these headers in C++98/03 mode may result in compilation errors. +Unless specified otherwise below, they are also available in later modes +(C++14 etc). +</p><p></p><div class="table"><a id="table.cxx11_headers"></a><p class="title"><strong>Table 3.5. C++ 2011 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 2011 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">atomic</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">codecvt</code></td><td align="left"><code class="filename">condition_variable</code></td></tr><tr><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">mutex</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">scoped_allocator</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">typeindex</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.cxx11_cheaders"></a><p class="title"><strong>Table 3.6. C++ 2011 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ 2011 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cfenv</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">cstdalign</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">cuchar</code></td><td colspan="2" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> +<a class="xref" href="using_headers.html#table.cxx14_headers" title="Table 3.7. C++ 2014 Library Header">Table 3.7, “C++ 2014 Library Header”</a> shows the C++14 include file. +This is available in C++14 compilation +mode, i.e. <code class="literal">-std=c++14</code> or <code class="literal">-std=gnu++14</code>. +Including this header in C++98/03 mode or C++11 will not result in +compilation errors, but will not define anything. +Unless specified otherwise below, it is also available in later modes +(C++17 etc). +</p><p></p><div class="table"><a id="table.cxx14_headers"></a><p class="title"><strong>Table 3.7. C++ 2014 Library Header</strong></p><div class="table-contents"><table class="table" summary="C++ 2014 Library Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">shared_mutex</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +<a class="xref" href="using_headers.html#table.filesystemts_headers" title="Table 3.8. File System TS Header">Table 3.8, “File System TS Header”</a>, +shows the additional include file define by the +File System Technical Specification, ISO/IEC TS 18822. +This is available in C++11 and later compilation modes. +Including this header in earlier modes will not result in +compilation errors, but will not define anything. +</p><p></p><div class="table"><a id="table.filesystemts_headers"></a><p class="title"><strong>Table 3.8. File System TS Header</strong></p><div class="table-contents"><table class="table" summary="File System TS Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">experimental/filesystem</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +<a class="xref" href="using_headers.html#table.libfundts_headers" title="Table 3.9. Library Fundamentals TS Headers">Table 3.9, “Library Fundamentals TS Headers”</a>, +shows the additional include files define by the C++ Extensions for +Library Fundamentals Technical Specification, ISO/IEC TS 19568. +These are available in C++14 and later compilation modes. +Including these headers in earlier modes will not result in +compilation errors, but will not define anything. +</p><p></p><div class="table"><a id="table.libfundts_headers"></a><p class="title"><strong>Table 3.9. Library Fundamentals TS Headers</strong></p><div class="table-contents"><table class="table" summary="Library Fundamentals TS Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">experimental/algorithm</code></td><td align="left"><code class="filename">experimental/any</code></td><td align="left"><code class="filename">experimental/array</code></td><td align="left"><code class="filename">experimental/chrono</code></td><td align="left"><code class="filename">experimental/deque</code></td></tr><tr><td align="left"><code class="filename">experimental/forward_list</code></td><td align="left"><code class="filename">experimental/functional</code></td><td align="left"><code class="filename">experimental/iterator</code></td><td align="left"><code class="filename">experimental/list</code></td><td align="left"><code class="filename">experimental/map</code></td></tr><tr><td align="left"><code class="filename">experimental/memory</code></td><td align="left"><code class="filename">experimental/memory_resource</code></td><td align="left"><code class="filename">experimental/numeric</code></td><td align="left"><code class="filename">experimental/optional</code></td><td align="left"><code class="filename">experimental/propagate_const</code></td></tr><tr><td align="left"><code class="filename">experimental/random</code></td><td align="left"><code class="filename">experimental/ratio</code></td><td align="left"><code class="filename">experimental/regex</code></td><td align="left"><code class="filename">experimental/set</code></td><td align="left"><code class="filename">experimental/string</code></td></tr><tr><td align="left"><code class="filename">experimental/string_view</code></td><td align="left"><code class="filename">experimental/system_error</code></td><td align="left"><code class="filename">experimental/tuple</code></td><td align="left"><code class="filename">experimental/type_traits</code></td><td align="left"><code class="filename">experimental/unordered_map</code></td></tr><tr><td align="left"><code class="filename">experimental/unordered_set</code></td><td align="left"><code class="filename">experimental/utility</code></td><td align="left"><code class="filename">experimental/vector</code></td><td colspan="2" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> In addition, TR1 includes as: -</p><div class="table"><a id="table.tr1_headers"></a><p class="title"><strong>Table 3.6. C++ TR 1 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.tr1_cheaders"></a><p class="title"><strong>Table 3.7. C++ TR 1 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++ +</p><div class="table"><a id="table.tr1_headers"></a><p class="title"><strong>Table 3.10. C++ TR 1 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td colspan="4" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.tr1_cheaders"></a><p class="title"><strong>Table 3.11. C++ TR 1 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++ compiler supports scalar decimal floating-point types defined via <code class="code">__attribute__((mode(SD|DD|LD)))</code>. -</p><div class="table"><a id="table.decfp_headers"></a><p class="title"><strong>Table 3.8. C++ TR 24733 Decimal Floating-Point Header</strong></p><div class="table-contents"><table class="table" summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +</p><div class="table"><a id="table.decfp_headers"></a><p class="title"><strong>Table 3.12. C++ TR 24733 Decimal Floating-Point Header</strong></p><div class="table-contents"><table class="table" summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p> Also included are files for the C++ ABI interface: -</p><div class="table"><a id="table.abi_headers"></a><p class="title"><strong>Table 3.9. C++ ABI Headers</strong></p><div class="table-contents"><table class="table" summary="C++ ABI Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +</p><div class="table"><a id="table.abi_headers"></a><p class="title"><strong>Table 3.13. C++ ABI Headers</strong></p><div class="table-contents"><table class="table" summary="C++ ABI Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p> And a large variety of extensions. -</p><div class="table"><a id="table.ext_headers"></a><p class="title"><strong>Table 3.10. Extension Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.debug_headers"></a><p class="title"><strong>Table 3.11. Extension Debug Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Debug Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.profile_headers"></a><p class="title"><strong>Table 3.12. Extension Profile Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Profile Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.parallel_headers"></a><p class="title"><strong>Table 3.13. Extension Parallel Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Parallel Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules. +</p><div class="table"><a id="table.ext_headers"></a><p class="title"><strong>Table 3.14. Extension Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td colspan="4" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.debug_headers"></a><p class="title"><strong>Table 3.15. Extension Debug Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Debug Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/array</code></td><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/forward_list</code></td><td align="left"><code class="filename">debug/list</code></td></tr><tr><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td></tr><tr><td align="left"><code class="filename">debug/vector</code></td><td colspan="4" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.profile_headers"></a><p class="title"><strong>Table 3.16. Extension Profile Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Profile Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.parallel_headers"></a><p class="title"><strong>Table 3.17. Extension Parallel Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Parallel Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules. </p><p>First, mixing different dialects of the standard headers is not possible. It's an all-or-nothing affair. Thus, code like </p><pre class="programlisting"> diff --git a/libstdc++-v3/doc/xml/manual/status_cxx1998.xml b/libstdc++-v3/doc/xml/manual/status_cxx1998.xml index 5dceecf4547..4d8a62f8c00 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx1998.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx1998.xml @@ -1129,6 +1129,10 @@ This page describes the C++ support in the GCC 6 series. implementation will be described under <link linkend="std.localization.locales.locale">Localization</link>. </para> + <para><emphasis>[23.*]</emphasis> All of the containers in this clause + define <type>size_type</type> as <type>std::size_t</type> and + <type>difference_type</type> as <type>std::ptrdiff_t</type>. + </para> <para><emphasis>[26.2.8]/9</emphasis> I have no idea what <code>complex<T></code>'s <code>pow(0,0)</code> returns. </para> diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 6822655119e..64aba6904ee 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -126,7 +126,7 @@ must be available to all hosted implementations. Actually, the word "files" is a misnomer, since the contents of the headers don't necessarily have to be in any kind of external - file. The only rule is that when one <code>#include</code>'s a + file. The only rule is that when one <code>#include</code>s a header, the contents of that header become available, no matter how. </para> @@ -138,16 +138,24 @@ <para> There are two main types of include files: header files related to a specific version of the ISO C++ standard (called Standard - Headers), and all others (TR1, C++ ABI, and Extensions). + Headers), and all others (TS, TR1, C++ ABI, and Extensions). </para> <para> - Two dialects of standard headers are supported, corresponding to - the 1998 standard as updated for 2003, and the current 2011 standard. + Multiple dialects of standard headers are supported, corresponding to + the 1998 standard as updated for 2003, the 2011 standard, the 2014 + standard, and so on. </para> <para> - C++98/03 include files. These are available in the default compilation mode, i.e. <code>-std=c++98</code> or <code>-std=gnu++98</code>. + <xref linkend="table.cxx98_headers"/> and + <xref linkend="table.cxx98_cheaders"/> and + <xref linkend="table.cxx98_deprheaders"/> + show the C++98/03 include files. + These are available in the C++98 compilation mode, + i.e. <code>-std=c++98</code> or <code>-std=gnu++98</code>. + Unless specified otherwise below, they are also available in later modes + (C++11, C++14 etc). </para> <table frame="all" xml:id="table.cxx98_headers"> @@ -205,6 +213,7 @@ <row> <entry><filename class="headerfile">valarray</filename></entry> <entry><filename class="headerfile">vector</filename></entry> +<entry namest="c3" nameend="c5"/> </row> </tbody> </tgroup> @@ -246,14 +255,38 @@ <entry><filename class="headerfile">ctime</filename></entry> <entry><filename class="headerfile">cwchar</filename></entry> <entry><filename class="headerfile">cwctype</filename></entry> +<entry namest="c4" nameend="c5"/> </row> </tbody> </tgroup> </table> <para> -C++11 include files. These are only available in C++11 compilation + The following header is deprecated + and might be removed from a future C++ standard. +</para> + +<table frame="all" xml:id="table.cxx98_deprheaders"> +<title>C++ 1998 Deprecated Library Header</title> + +<tgroup cols="1" align="left" colsep="1" rowsep="1"> +<colspec colname="c1"/> +<tbody> +<row> +<entry><filename class="headerfile">strstream</filename></entry> +</row> +</tbody> +</tgroup> +</table> + +<para> +<xref linkend="table.cxx11_headers"/> and +<xref linkend="table.cxx11_cheaders"/> show the C++11 include files. +These are available in C++11 compilation mode, i.e. <literal>-std=c++11</literal> or <literal>-std=gnu++11</literal>. +Including these headers in C++98/03 mode may result in compilation errors. +Unless specified otherwise below, they are also available in later modes +(C++14 etc). </para> <para/> @@ -269,73 +302,33 @@ mode, i.e. <literal>-std=c++11</literal> or <literal>-std=gnu++11</literal>. <tbody> <row> -<entry><filename class="headerfile">algorithm</filename></entry> <entry><filename class="headerfile">array</filename></entry> -<entry><filename class="headerfile">bitset</filename></entry> +<entry><filename class="headerfile">atomic</filename></entry> <entry><filename class="headerfile">chrono</filename></entry> -<entry><filename class="headerfile">complex</filename></entry> -</row> -<row> +<entry><filename class="headerfile">codecvt</filename></entry> <entry><filename class="headerfile">condition_variable</filename></entry> -<entry><filename class="headerfile">deque</filename></entry> -<entry><filename class="headerfile">exception</filename></entry> -<entry><filename class="headerfile">forward_list</filename></entry> -<entry><filename class="headerfile">fstream</filename></entry> </row> <row> -<entry><filename class="headerfile">functional</filename></entry> +<entry><filename class="headerfile">forward_list</filename></entry> <entry><filename class="headerfile">future</filename></entry> <entry><filename class="headerfile">initalizer_list</filename></entry> -<entry><filename class="headerfile">iomanip</filename></entry> -<entry><filename class="headerfile">ios</filename></entry> -</row> -<row> -<entry><filename class="headerfile">iosfwd</filename></entry> -<entry><filename class="headerfile">iostream</filename></entry> -<entry><filename class="headerfile">istream</filename></entry> -<entry><filename class="headerfile">iterator</filename></entry> -<entry><filename class="headerfile">limits</filename></entry> -</row> -<row> -<entry><filename class="headerfile">list</filename></entry> -<entry><filename class="headerfile">locale</filename></entry> -<entry><filename class="headerfile">map</filename></entry> -<entry><filename class="headerfile">memory</filename></entry> <entry><filename class="headerfile">mutex</filename></entry> -</row> -<row> -<entry><filename class="headerfile">new</filename></entry> -<entry><filename class="headerfile">numeric</filename></entry> -<entry><filename class="headerfile">ostream</filename></entry> -<entry><filename class="headerfile">queue</filename></entry> <entry><filename class="headerfile">random</filename></entry> </row> <row> <entry><filename class="headerfile">ratio</filename></entry> <entry><filename class="headerfile">regex</filename></entry> -<entry><filename class="headerfile">set</filename></entry> -<entry><filename class="headerfile">sstream</filename></entry> -<entry><filename class="headerfile">stack</filename></entry> -</row> -<row> -<entry><filename class="headerfile">stdexcept</filename></entry> -<entry><filename class="headerfile">streambuf</filename></entry> -<entry><filename class="headerfile">string</filename></entry> +<entry><filename class="headerfile">scoped_allocator</filename></entry> <entry><filename class="headerfile">system_error</filename></entry> <entry><filename class="headerfile">thread</filename></entry> </row> <row> <entry><filename class="headerfile">tuple</filename></entry> +<entry><filename class="headerfile">typeindex</filename></entry> <entry><filename class="headerfile">type_traits</filename></entry> -<entry><filename class="headerfile">typeinfo</filename></entry> <entry><filename class="headerfile">unordered_map</filename></entry> <entry><filename class="headerfile">unordered_set</filename></entry> </row> -<row> -<entry><filename class="headerfile">utility</filename></entry> -<entry><filename class="headerfile">valarray</filename></entry> -<entry><filename class="headerfile">vector</filename></entry> -</row> </tbody> </tgroup> @@ -354,39 +347,130 @@ mode, i.e. <literal>-std=c++11</literal> or <literal>-std=gnu++11</literal>. <colspec colname="c5"/> <tbody> <row> -<entry><filename class="headerfile">cassert</filename></entry> <entry><filename class="headerfile">ccomplex</filename></entry> -<entry><filename class="headerfile">cctype</filename></entry> -<entry><filename class="headerfile">cerrno</filename></entry> <entry><filename class="headerfile">cfenv</filename></entry> +<entry><filename class="headerfile">cinttypes</filename></entry> +<entry><filename class="headerfile">cstdalign</filename></entry> +<entry><filename class="headerfile">cstdbool</filename></entry> </row> <row> -<entry><filename class="headerfile">cfloat</filename></entry> -<entry><filename class="headerfile">cinttypes</filename></entry> -<entry><filename class="headerfile">ciso646</filename></entry> -<entry><filename class="headerfile">climits</filename></entry> -<entry><filename class="headerfile">clocale</filename></entry> +<entry><filename class="headerfile">cstdint</filename></entry> +<entry><filename class="headerfile">ctgmath</filename></entry> +<entry><filename class="headerfile">cuchar</filename></entry> +<entry namest="c4" nameend="c5"/> </row> +</tbody> +</tgroup> +</table> + +<para> +<xref linkend="table.cxx14_headers"/> shows the C++14 include file. +This is available in C++14 compilation +mode, i.e. <literal>-std=c++14</literal> or <literal>-std=gnu++14</literal>. +Including this header in C++98/03 mode or C++11 will not result in +compilation errors, but will not define anything. +Unless specified otherwise below, it is also available in later modes +(C++17 etc). +</para> + +<para/> +<table frame="all" xml:id="table.cxx14_headers"> +<title>C++ 2014 Library Header</title> + +<tgroup cols="1" align="left" colsep="1" rowsep="1"> +<colspec colname="c1"/> +<tbody> <row> -<entry><filename class="headerfile">cmath</filename></entry> -<entry><filename class="headerfile">csetjmp</filename></entry> -<entry><filename class="headerfile">csignal</filename></entry> -<entry><filename class="headerfile">cstdarg</filename></entry> -<entry><filename class="headerfile">cstdbool</filename></entry> +<entry><filename class="headerfile">shared_mutex</filename></entry> </row> +</tbody> +</tgroup> +</table> + +<para> +<xref linkend="table.filesystemts_headers"/>, +shows the additional include file define by the +File System Technical Specification, ISO/IEC TS 18822. +This is available in C++11 and later compilation modes. +Including this header in earlier modes will not result in +compilation errors, but will not define anything. +</para> + +<para/> +<table frame="all" xml:id="table.filesystemts_headers"> +<title>File System TS Header</title> + +<tgroup cols="1" align="left" colsep="1" rowsep="1"> +<colspec colname="c1"/> +<tbody> <row> -<entry><filename class="headerfile">cstddef</filename></entry> -<entry><filename class="headerfile">cstdint</filename></entry> -<entry><filename class="headerfile">cstdlib</filename></entry> -<entry><filename class="headerfile">cstdio</filename></entry> -<entry><filename class="headerfile">cstring</filename></entry> +<entry><filename class="headerfile">experimental/filesystem</filename></entry> +</row> +</tbody> +</tgroup> +</table> + + +<para> +<xref linkend="table.libfundts_headers"/>, +shows the additional include files define by the C++ Extensions for +Library Fundamentals Technical Specification, ISO/IEC TS 19568. +These are available in C++14 and later compilation modes. +Including these headers in earlier modes will not result in +compilation errors, but will not define anything. +</para> + +<para/> +<table frame="all" xml:id="table.libfundts_headers"> +<title>Library Fundamentals TS Headers</title> + +<tgroup cols="5" align="left" colsep="1" rowsep="1"> +<colspec colname="c1"/> +<colspec colname="c2"/> +<colspec colname="c3"/> +<colspec colname="c4"/> +<colspec colname="c5"/> +<tbody> +<row> +<entry><filename class="headerfile">experimental/algorithm</filename></entry> +<entry><filename class="headerfile">experimental/any</filename></entry> +<entry><filename class="headerfile">experimental/array</filename></entry> +<entry><filename class="headerfile">experimental/chrono</filename></entry> +<entry><filename class="headerfile">experimental/deque</filename></entry> </row> <row> -<entry><filename class="headerfile">ctgmath</filename></entry> -<entry><filename class="headerfile">ctime</filename></entry> -<entry><filename class="headerfile">cuchar</filename></entry> -<entry><filename class="headerfile">cwchar</filename></entry> -<entry><filename class="headerfile">cwctype</filename></entry> +<entry><filename class="headerfile">experimental/forward_list</filename></entry> +<entry><filename class="headerfile">experimental/functional</filename></entry> +<entry><filename class="headerfile">experimental/iterator</filename></entry> +<entry><filename class="headerfile">experimental/list</filename></entry> +<entry><filename class="headerfile">experimental/map</filename></entry> +</row> +<row> +<entry><filename class="headerfile">experimental/memory</filename></entry> +<entry><filename class="headerfile">experimental/memory_resource</filename></entry> +<entry><filename class="headerfile">experimental/numeric</filename></entry> +<entry><filename class="headerfile">experimental/optional</filename></entry> +<entry><filename class="headerfile">experimental/propagate_const</filename></entry> +</row> +<row> +<entry><filename class="headerfile">experimental/random</filename></entry> +<entry><filename class="headerfile">experimental/ratio</filename></entry> +<entry><filename class="headerfile">experimental/regex</filename></entry> +<entry><filename class="headerfile">experimental/set</filename></entry> +<entry><filename class="headerfile">experimental/string</filename></entry> +</row> +<row> +<entry><filename class="headerfile">experimental/string_view</filename></entry> +<entry><filename class="headerfile">experimental/system_error</filename></entry> +<entry><filename class="headerfile">experimental/tuple</filename></entry> +<entry><filename class="headerfile">experimental/type_traits</filename></entry> +<entry><filename class="headerfile">experimental/unordered_map</filename></entry> +</row> +<row> +<entry><filename class="headerfile">experimental/unordered_set</filename></entry> +<entry><filename class="headerfile">experimental/utility</filename></entry> +<entry><filename class="headerfile">experimental/vector</filename></entry> +<entry namest="c4" nameend="c5"/> </row> </tbody> </tgroup> @@ -424,6 +508,7 @@ mode, i.e. <literal>-std=c++11</literal> or <literal>-std=gnu++11</literal>. </row> <row> <entry><filename class="headerfile">tr1/utility</filename></entry> +<entry namest="c2" nameend="c5"/> </row> </tbody> @@ -564,6 +649,7 @@ compiler supports scalar decimal floating-point types defined via </row> <row> <entry><filename class="headerfile">ext/vstring.h</filename></entry> +<entry namest="c2" nameend="c5"/> </row> </tbody> @@ -584,18 +670,22 @@ compiler supports scalar decimal floating-point types defined via <tbody> <row> +<entry><filename class="headerfile">debug/array</filename></entry> <entry><filename class="headerfile">debug/bitset</filename></entry> <entry><filename class="headerfile">debug/deque</filename></entry> +<entry><filename class="headerfile">debug/forward_list</filename></entry> <entry><filename class="headerfile">debug/list</filename></entry> -<entry><filename class="headerfile">debug/map</filename></entry> -<entry><filename class="headerfile">debug/set</filename></entry> </row> - <row> +<entry><filename class="headerfile">debug/map</filename></entry> +<entry><filename class="headerfile">debug/set</filename></entry> <entry><filename class="headerfile">debug/string</filename></entry> <entry><filename class="headerfile">debug/unordered_map</filename></entry> <entry><filename class="headerfile">debug/unordered_set</filename></entry> +</row> +<row> <entry><filename class="headerfile">debug/vector</filename></entry> +<entry namest="c2" nameend="c5"/> </row> </tbody> diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 42443e4190a..5a2b1064ce4 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -645,20 +645,29 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // Replace allocator if POCMA is true. std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator()); - if (!__str._M_is_local() - && (_Alloc_traits::_S_propagate_on_move_assign() - || _Alloc_traits::_S_always_equal())) + if (__str._M_is_local()) + { + // We've always got room for a short string, just copy it. + if (__str.size()) + this->_S_copy(_M_data(), __str._M_data(), __str.size()); + _M_set_length(__str.size()); + } + else if (_Alloc_traits::_S_propagate_on_move_assign() + || _Alloc_traits::_S_always_equal() + || _M_get_allocator() == __str._M_get_allocator()) { + // Just move the allocated pointer, our allocator can free it. pointer __data = nullptr; size_type __capacity; if (!_M_is_local()) { if (_Alloc_traits::_S_always_equal()) { + // __str can reuse our existing storage. __data = _M_data(); __capacity = _M_allocated_capacity; } - else + else // __str can't use it, so free it. _M_destroy(_M_allocated_capacity); } @@ -673,8 +682,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 else __str._M_data(__str._M_local_buf); } - else - assign(__str); + else // Need to do a deep copy + assign(__str); __str.clear(); return *this; } diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index cf7aa3ee4bf..262c76e45f1 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -785,6 +785,46 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _AutomatonPtr _M_automaton; }; + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::icase; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::nosubs; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::optimize; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::collate; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::ECMAScript; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::basic; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::extended; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::awk; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::grep; + + template<typename _Ch, typename _Tr> + constexpr regex_constants::syntax_option_type + basic_regex<_Ch, _Tr>::egrep; + /** @brief Standard regular expressions. */ typedef basic_regex<char> regex; diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h index 07158c4926b..ab2de45324b 100644 --- a/libstdc++-v3/include/bits/regex_automaton.h +++ b/libstdc++-v3/include/bits/regex_automaton.h @@ -332,7 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "Number of NFA states exceeds limit. Please use shorter regex " "string, or use smaller brace expression, or make " "_GLIBCXX_REGEX_STATE_LIMIT larger."); - return this->size()-1; + return this->size() - 1; } // Eliminate dummy node in this NFA to make it compact. diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 629fe4dd902..e672a4f6b0e 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -1078,9 +1078,17 @@ template<typename _Alloc> void _M_initialize(size_type __n) { - _Bit_pointer __q = this->_M_allocate(__n); - this->_M_impl._M_end_of_storage = __q + _S_nword(__n); - this->_M_impl._M_start = iterator(std::__addressof(*__q), 0); + if (__n) + { + _Bit_pointer __q = this->_M_allocate(__n); + this->_M_impl._M_end_of_storage = __q + _S_nword(__n); + this->_M_impl._M_start = iterator(std::__addressof(*__q), 0); + } + else + { + this->_M_impl._M_end_of_storage = _Bit_pointer(); + this->_M_impl._M_start = iterator(0, 0); + } this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n); } diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 17e6ff0691a..6e69a7b105d 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -118,6 +118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ // _GLIBCXX_RESOLVE_LIB_DEFECTS // 235 No specification of default ctor for reverse_iterator + // 1012. reverse_iterator default ctor should value initialize reverse_iterator() : current() { } /** @@ -169,9 +170,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * * This requires that @c --current is dereferenceable. */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2188. Reverse iterator does not fully support targets that overload & pointer operator->() const - { return &(operator*()); } + { return std::__addressof(operator*()); } /** * @return @c *this diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 0d9d0c37b7c..a30b630b4fd 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -181,8 +181,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __wrap_nonesuch : std::__nonesuch { explicit __wrap_nonesuch(const __nonesuch&) = delete; }; - -#endif +#endif // C++11 + + class __pair_base + { +#if __cplusplus >= 201103L + template<typename _T1, typename _T2> friend struct pair; + __pair_base() = default; + ~__pair_base() = default; + __pair_base(const __pair_base&) = default; + __pair_base& operator=(const __pair_base&) = delete; +#endif // C++11 + }; /** * @brief Struct holding two objects of arbitrary type. @@ -192,6 +202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template<typename _T1, typename _T2> struct pair + : private __pair_base { typedef _T1 first_type; /// @c first_type is the first bound type typedef _T2 second_type; /// @c second_type is the second bound type @@ -372,17 +383,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pair& operator=(typename conditional< - __not_<__and_<is_copy_assignable<_T1>, - is_copy_assignable<_T2>>>::value, - const pair&, const __wrap_nonesuch&>::type __p) = delete; - - pair& - operator=(typename conditional< __and_<is_move_assignable<_T1>, is_move_assignable<_T2>>::value, pair&&, __wrap_nonesuch&&>::type __p) noexcept(__and_<is_nothrow_move_assignable<_T1>, - is_nothrow_move_assignable<_T2>>::value) + is_nothrow_move_assignable<_T2>>::value) { first = std::forward<first_type>(__p.first); second = std::forward<second_type>(__p.second); diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 9b6d258f6ca..5534a4a9b43 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -1263,24 +1263,29 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // Called by the second initialize_dispatch above template<typename _InputIterator> - void - _M_range_initialize(_InputIterator __first, - _InputIterator __last, std::input_iterator_tag) - { - for (; __first != __last; ++__first) + void + _M_range_initialize(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + __try { + for (; __first != __last; ++__first) #if __cplusplus >= 201103L - emplace_back(*__first); + emplace_back(*__first); #else - push_back(*__first); + push_back(*__first); #endif + } __catch(...) { + clear(); + __throw_exception_again; + } } // Called by the second initialize_dispatch above template<typename _ForwardIterator> - void - _M_range_initialize(_ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag) - { + void + _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { const size_type __n = std::distance(__first, __last); this->_M_impl._M_start = this->_M_allocate(__n); this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index 8e302877f78..93c579788b6 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -201,7 +201,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "rvalue deleter bound to reference"); } /// Creates a unique_ptr that owns nothing. - constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } + constexpr unique_ptr(nullptr_t) noexcept : _M_t() + { static_assert(!is_pointer<deleter_type>::value, + "constructed with null function pointer deleter"); } // Move constructors. @@ -491,7 +493,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { } /// Creates a unique_ptr that owns nothing. - constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } + constexpr unique_ptr(nullptr_t) noexcept : _M_t() + { static_assert(!is_pointer<deleter_type>::value, + "constructed with null function pointer deleter"); } template<typename _Up, typename _Ep, typename = _Require<__safe_conversion_up<_Up, _Ep>>> diff --git a/libstdc++-v3/include/bits/valarray_array.h b/libstdc++-v3/include/bits/valarray_array.h index 4df1181600e..1f8f1b7d8b0 100644 --- a/libstdc++-v3/include/bits/valarray_array.h +++ b/libstdc++-v3/include/bits/valarray_array.h @@ -341,17 +341,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // - // Compute the sum of elements in range [__f, __l) + // Compute the sum of elements in range [__f, __l) which must not be empty. // This is a naive algorithm. It suffers from cancelling. - // In the future try to specialize - // for _Tp = float, double, long double using a more accurate - // algorithm. + // In the future try to specialize for _Tp = float, double, long double + // using a more accurate algorithm. // template<typename _Tp> inline _Tp __valarray_sum(const _Tp* __f, const _Tp* __l) { - _Tp __r = _Tp(); + _Tp __r = *__f++; while (__f != __l) __r += *__f++; return __r; diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc index 715b83eb679..3a9a8e2e033 100644 --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -553,23 +553,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { const size_type __len = _M_check_len(__n, "vector::_M_default_append"); - const size_type __old_size = this->size(); + const size_type __size = this->size(); pointer __new_start(this->_M_allocate(__len)); - pointer __new_finish(__new_start); + pointer __destroy_from = pointer(); __try { - __new_finish - = std::__uninitialized_move_if_noexcept_a - (this->_M_impl._M_start, this->_M_impl._M_finish, - __new_start, _M_get_Tp_allocator()); - __new_finish = - std::__uninitialized_default_n_a(__new_finish, __n, - _M_get_Tp_allocator()); + std::__uninitialized_default_n_a(__new_start + __size, + __n, _M_get_Tp_allocator()); + __destroy_from = __new_start + __size; + std::__uninitialized_move_if_noexcept_a( + this->_M_impl._M_start, this->_M_impl._M_finish, + __new_start, _M_get_Tp_allocator()); } __catch(...) { - std::_Destroy(__new_start, __new_finish, - _M_get_Tp_allocator()); + if (__destroy_from) + std::_Destroy(__destroy_from, __destroy_from + __n, + _M_get_Tp_allocator()); _M_deallocate(__new_start, __len); __throw_exception_again; } @@ -579,7 +579,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __new_start; - this->_M_impl._M_finish = __new_finish; + this->_M_impl._M_finish = __new_start + __size + __n; this->_M_impl._M_end_of_storage = __new_start + __len; } } diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string index 7edc6658c0c..61d033e85bc 100644 --- a/libstdc++-v3/include/debug/string +++ b/libstdc++-v3/include/debug/string @@ -563,7 +563,7 @@ template<typename _CharT, typename _Traits = std::char_traits<_CharT>, insert(iterator __p, _InputIterator __first, _InputIterator __last) { typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; - __glibcxx_check_insert_range2(__p, __first, __last, __dist); + __glibcxx_check_insert_range(__p, __first, __last, __dist); if (__dist.second >= __dp_sign) _Base::insert(__p.base(), __gnu_debug::__unsafe(__first), diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource index 52e0b031653..d2d51bf6fd0 100644 --- a/libstdc++-v3/include/experimental/memory_resource +++ b/libstdc++-v3/include/experimental/memory_resource @@ -33,7 +33,6 @@ #include <new> #include <atomic> #include <cstddef> -#include <bits/alloc_traits.h> #include <experimental/bits/lfts_config.h> namespace std { @@ -256,6 +255,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template <typename _Alloc> class __resource_adaptor_imp : public memory_resource { + static_assert(is_same<char, + typename allocator_traits<_Alloc>::value_type>::value, + "Allocator's value_type is char"); + static_assert(is_same<char*, + typename allocator_traits<_Alloc>::pointer>::value, + "Allocator's pointer type is value_type*"); + static_assert(is_same<const char*, + typename allocator_traits<_Alloc>::const_pointer>::value, + "Allocator's const_pointer type is value_type const*"); + static_assert(is_same<void*, + typename allocator_traits<_Alloc>::void_pointer>::value, + "Allocator's void_pointer type is void*"); + static_assert(is_same<const void*, + typename allocator_traits<_Alloc>::const_void_pointer>::value, + "Allocator's const_void_pointer type is void const*"); + public: using allocator_type = _Alloc; @@ -274,7 +289,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __resource_adaptor_imp& operator=(const __resource_adaptor_imp&) = default; - allocator_type get_allocator() const { return _M_alloc; } + allocator_type get_allocator() const noexcept { return _M_alloc; } protected: virtual void* @@ -309,13 +324,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: // Calculate Aligned Size // Returns a size that is larger than or equal to __size and divisible - // by __alignment, where __alignment is required to be the power of 2. + // by __alignment, where __alignment is required to be a power of 2. static size_t _S_aligned_size(size_t __size, size_t __alignment) { return ((__size - 1)|(__alignment - 1)) + 1; } // Determine whether alignment meets one of those preconditions: - // 1. Equals to Zero + // 1. Equal to Zero // 2. Is power of two static bool _S_supported (size_t __x) @@ -325,47 +340,50 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; // Global memory resources - inline std::atomic<memory_resource*>& - __get_default_resource() - { - static atomic<memory_resource*> _S_default_resource(new_delete_resource()); - return _S_default_resource; - } inline memory_resource* new_delete_resource() noexcept { - static resource_adaptor<std::allocator<char>> __r; - return static_cast<memory_resource*>(&__r); + using type = resource_adaptor<std::allocator<char>>; + alignas(type) static unsigned char __buf[sizeof(type)]; + static type* __r = new(__buf) type; + return __r; } - template <typename _Alloc> - class __null_memory_resource : private memory_resource + inline memory_resource* + null_memory_resource() noexcept + { + class type final : public memory_resource { - protected: void* - do_allocate(size_t, size_t) + do_allocate(size_t, size_t) override { std::__throw_bad_alloc(); } void - do_deallocate(void*, size_t, size_t) noexcept + do_deallocate(void*, size_t, size_t) noexcept override { } bool - do_is_equal(const memory_resource& __other) const noexcept + do_is_equal(const memory_resource& __other) const noexcept override { return this == &__other; } - - friend memory_resource* null_memory_resource() noexcept; }; - inline memory_resource* - null_memory_resource() noexcept - { - static __null_memory_resource<void> __r; - return static_cast<memory_resource*>(&__r); + alignas(type) static unsigned char __buf[sizeof(type)]; + static type* __r = new(__buf) type; + return __r; } // The default memory resource + + inline std::atomic<memory_resource*>& + __get_default_resource() + { + using type = atomic<memory_resource*>; + alignas(type) static unsigned char __buf[sizeof(type)]; + static type* __r = new(__buf) type(new_delete_resource()); + return *__r; + } + inline memory_resource* get_default_resource() noexcept { return __get_default_resource().load(); } diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex index 1feab780e7b..a0f2e063189 100644 --- a/libstdc++-v3/include/experimental/regex +++ b/libstdc++-v3/include/experimental/regex @@ -44,10 +44,10 @@ namespace experimental { inline namespace fundamentals_v2 { +#if _GLIBCXX_USE_CXX11_ABI namespace pmr { _GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CXX11 template<typename _BidirectionalIterator> using match_results @@ -59,10 +59,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 typedef match_results<string::const_iterator> smatch; typedef match_results<wstring::const_iterator> wsmatch; -_GLIBCXX_END_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace pmr - +#endif } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string index 3bd00d5dbc2..cd4d0642989 100644 --- a/libstdc++-v3/include/experimental/string +++ b/libstdc++-v3/include/experimental/string @@ -66,9 +66,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION +#if _GLIBCXX_USE_CXX11_ABI namespace pmr { _GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CXX11 // basic_string using polymorphic allocator in namespace pmr template<typename _CharT, typename _Traits = char_traits<_CharT>> @@ -82,10 +82,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 typedef basic_string<char32_t> u32string; typedef basic_string<wchar_t> wstring; -_GLIBCXX_END_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace pmr - +#endif } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h index 75c8fbeae45..9c638477f0f 100644 --- a/libstdc++-v3/include/ext/pointer.h +++ b/libstdc++-v3/include/ext/pointer.h @@ -437,6 +437,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _CXX_POINTER_ARITH_OPERATOR_SET(unsigned int); _CXX_POINTER_ARITH_OPERATOR_SET(long); _CXX_POINTER_ARITH_OPERATOR_SET(unsigned long); +#ifdef _GLIBCXX_USE_LONG_LONG + _CXX_POINTER_ARITH_OPERATOR_SET(long long); + _CXX_POINTER_ARITH_OPERATOR_SET(unsigned long long); +#endif // Mathematical Manipulators inline _Pointer_adapter& diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index b4f5f10a164..76f5d087363 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -256,8 +256,10 @@ _GLIBCXX_END_NAMESPACE_VERSION // constexpr copy constructor will be ill-formed. duration(const duration&) = default; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3050. Conversion specification problem in chrono::duration template<typename _Rep2, typename = typename - enable_if<is_convertible<_Rep2, rep>::value + enable_if<is_convertible<const _Rep2&, rep>::value && (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value)>::type> constexpr explicit duration(const _Rep2& __rep) @@ -399,8 +401,12 @@ _GLIBCXX_END_NAMESPACE_VERSION return __cd(__cd(__lhs).count() - __cd(__rhs).count()); } + // SFINAE helper to obtain common_type<_Rep1, _Rep2> only if _Rep2 + // is implicitly convertible to it. + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3050. Conversion specification problem in chrono::duration constructor template<typename _Rep1, typename _Rep2, bool = - is_convertible<_Rep2, + is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value> struct __common_rep_type { }; diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index 62a7ee14519..8b3b6bc7aaa 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -135,14 +135,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION cv_status wait_for(unique_lock<mutex>& __lock, const chrono::duration<_Rep, _Period>& __rtime) - { return wait_until(__lock, __clock_t::now() + __rtime); } + { + using __dur = typename __clock_t::duration; + auto __reltime = chrono::duration_cast<__dur>(__rtime); + if (__reltime < __rtime) + ++__reltime; + return wait_until(__lock, __clock_t::now() + __reltime); + } template<typename _Rep, typename _Period, typename _Predicate> bool wait_for(unique_lock<mutex>& __lock, const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p) - { return wait_until(__lock, __clock_t::now() + __rtime, std::move(__p)); } + { + using __dur = typename __clock_t::duration; + auto __reltime = chrono::duration_cast<__dur>(__rtime); + if (__reltime < __rtime) + ++__reltime; + return wait_until(__lock, __clock_t::now() + __reltime, std::move(__p)); + } native_handle_type native_handle() diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 830494f1904..17bd821318a 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -885,7 +885,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr shared_future() noexcept : _Base_type() { } /// Copy constructor - shared_future(const shared_future& __sf) : _Base_type(__sf) { } + shared_future(const shared_future& __sf) noexcept : _Base_type(__sf) { } /// Construct from a future rvalue shared_future(future<_Res>&& __uf) noexcept @@ -897,7 +897,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _Base_type(std::move(__sf)) { } - shared_future& operator=(const shared_future& __sf) + shared_future& operator=(const shared_future& __sf) noexcept { shared_future(__sf)._M_swap(*this); return *this; diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 15deb90b2ef..21bef15ed4a 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -71,12 +71,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static constexpr _Tp value = __v; typedef _Tp value_type; typedef integral_constant<_Tp, __v> type; - constexpr operator value_type() const { return value; } + constexpr operator value_type() const noexcept { return value; } #if __cplusplus > 201103L #define __cpp_lib_integral_constant_callable 201304 - constexpr value_type operator()() const { return value; } + constexpr value_type operator()() const noexcept { return value; } #endif }; diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 480bd5d18ea..e72a10407a7 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -296,7 +296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct integer_sequence { typedef _Tp value_type; - static constexpr size_t size() { return sizeof...(_Idx); } + static constexpr size_t size() noexcept { return sizeof...(_Idx); } }; template<typename _Tp, _Tp _Num, diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index ec3feafc5de..729eedb4431 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1062,6 +1062,39 @@ class StdExpPathPrinter: return self._iterator(self.val['_M_cmpts']) +class StdPairPrinter: + "Print a std::pair object, with 'first' and 'second' as children" + + def __init__(self, typename, val): + self.val = val + + class _iter(Iterator): + "An iterator for std::pair types. Returns 'first' then 'second'." + + def __init__(self, val): + self.val = val + self.which = 'first' + + def __iter__(self): + return self + + def __next__(self): + if self.which is None: + raise StopIteration + which = self.which + if which == 'first': + self.which = 'second' + else: + self.which = None + return (which, self.val[which]) + + def children(self): + return self._iter(self.val) + + def to_string(self): + return None + + # A "regular expression" printer which conforms to the # "SubPrettyPrinter" protocol from gdb.printing. class RxPrinter(object): @@ -1377,6 +1410,7 @@ def build_libstdcxx_dictionary (): libstdcxx_printer.add_container('std::', 'map', StdMapPrinter) libstdcxx_printer.add_container('std::', 'multimap', StdMapPrinter) libstdcxx_printer.add_container('std::', 'multiset', StdSetPrinter) + libstdcxx_printer.add_version('std::', 'pair', StdPairPrinter) libstdcxx_printer.add_version('std::', 'priority_queue', StdStackOrQueuePrinter) libstdcxx_printer.add_version('std::', 'queue', StdStackOrQueuePrinter) diff --git a/libstdc++-v3/src/c++11/codecvt.cc b/libstdc++-v3/src/c++11/codecvt.cc index 11873397341..00ccb6afd4d 100644 --- a/libstdc++-v3/src/c++11/codecvt.cc +++ b/libstdc++-v3/src/c++11/codecvt.cc @@ -1086,7 +1086,12 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end, reinterpret_cast<char16_t*>(__to), reinterpret_cast<char16_t*>(__to_end) }; - auto res = ucs2_in(from, to, _M_maxcode, _M_mode); +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + codecvt_mode mode = {}; +#else + codecvt_mode mode = little_endian; +#endif + auto res = ucs2_in(from, to, _M_maxcode, mode); #elif __SIZEOF_WCHAR_T__ == 4 range<char32_t> to{ reinterpret_cast<char32_t*>(__to), diff --git a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc index b102e24eb28..9c819423cd0 100644 --- a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc +++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc @@ -28,6 +28,8 @@ #define _GLIBCXX_USE_CXX11_ABI 1 #include <ios> +#include <typeinfo> +#include <cxxabi.h> #if ! _GLIBCXX_USE_DUAL_ABI # error This file should not be compiled for this configuration. @@ -91,5 +93,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ios_base::failure::what() const throw() { return runtime_error::what(); } + // __throw_ios_failure() is defined in src/c++98/ios_failure.cc + +#if __cpp_rtti + // If RTTI is enabled the exception type thrown will use these functions to + // construct/destroy a ios::failure[abi:cxx11] object in a buffer, + // and to catch that object via a handler of the [abi:cxx11] type. + void + __construct_ios_failure(void* buf, const char* msg) + { ::new(buf) ios_base::failure(msg); } + + void + __destroy_ios_failure(void* buf) + { static_cast<ios_base::failure*>(buf)->~failure(); } + + bool + __is_ios_failure_handler(const __cxxabiv1::__class_type_info* type) + { return *type == typeid(ios::failure); } + + // static assertions to ensure ios::failure fits in a buffer + // with the same size and alignment as system_error: + static_assert(sizeof(ios::failure) <= sizeof(system_error), ""); + static_assert(__alignof(ios::failure) <= __alignof(system_error), ""); +#endif // __cpp_rtti + _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc index f65f7e35a50..e0c14ecf8e1 100644 --- a/libstdc++-v3/src/c++11/ios.cc +++ b/libstdc++-v3/src/c++11/ios.cc @@ -26,29 +26,13 @@ // ISO C++ 14882: 27.4 Iostreams base classes // -// Determines the version of ios_base::failure thrown by __throw_ios_failure. -// If !_GLIBCXX_USE_DUAL_ABI this will get undefined automatically. -#define _GLIBCXX_USE_CXX11_ABI 0 - #include <ios> #include <limits> -#include <bits/functexcept.h> - -#ifdef _GLIBCXX_USE_NLS -# include <libintl.h> -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - void - __throw_ios_failure(const char* __s __attribute__((unused))) - { _GLIBCXX_THROW_OR_ABORT(ios_base::failure(_(__s))); } - // Definitions for static const members of ios_base. const ios_base::fmtflags ios_base::boolalpha; const ios_base::fmtflags ios_base::dec; diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc index 41726e483ac..9bbec58bdc5 100644 --- a/libstdc++-v3/src/c++11/system_error.cc +++ b/libstdc++-v3/src/c++11/system_error.cc @@ -29,6 +29,7 @@ #include <system_error> #include <bits/functexcept.h> #include <limits> +#include <errno.h> #undef __sso_string namespace @@ -65,6 +66,261 @@ namespace // _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc) return string(strerror(i)); } + + virtual std::error_condition + default_error_condition(int ev) const noexcept + { + switch (ev) + { + // List of errno macros from [cerrno.syn]. + // C11 only defines EDOM, EILSEQ and ERANGE, the rest are from POSIX. + // They expand to integer constant expressions with type int, + // and distinct positive values, suitable for use in #if directives. + // POSIX adds more macros (but they're not defined on all targets, + // see config/os/*/error_constants.h), and POSIX allows + // EAGAIN == EWOULDBLOCK and ENOTSUP == EOPNOTSUPP. + +#ifdef E2BIG + case E2BIG: +#endif +#ifdef EACCES + case EACCES: +#endif +#ifdef EADDRINUSE + case EADDRINUSE: +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: +#endif +#ifdef EAGAIN + case EAGAIN: +#endif +#ifdef EALREADY + case EALREADY: +#endif +#ifdef EBADF + case EBADF: +#endif +#ifdef EBADMSG + case EBADMSG: +#endif +#ifdef EBUSY + case EBUSY: +#endif +#ifdef ECANCELED + case ECANCELED: +#endif +#ifdef ECHILD + case ECHILD: +#endif +#ifdef ECONNABORTED + case ECONNABORTED: +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: +#endif +#ifdef ECONNRESET + case ECONNRESET: +#endif +#ifdef EDEADLK + case EDEADLK: +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: +#endif + case EDOM: +#ifdef EEXIST + case EEXIST: +#endif +#ifdef EFAULT + case EFAULT: +#endif +#ifdef EFBIG + case EFBIG: +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: +#endif +#ifdef EIDRM + case EIDRM: +#endif + case EILSEQ: +#ifdef EINPROGRESS + case EINPROGRESS: +#endif +#ifdef EINTR + case EINTR: +#endif +#ifdef EINVAL + case EINVAL: +#endif +#ifdef EIO + case EIO: +#endif +#ifdef EISCONN + case EISCONN: +#endif +#ifdef EISDIR + case EISDIR: +#endif +#ifdef ELOOP + case ELOOP: +#endif +#ifdef EMFILE + case EMFILE: +#endif +#ifdef EMLINK + case EMLINK: +#endif +#ifdef EMSGSIZE + case EMSGSIZE: +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: +#endif +#ifdef ENETDOWN + case ENETDOWN: +#endif +#ifdef ENETRESET + case ENETRESET: +#endif +#ifdef ENETUNREACH + case ENETUNREACH: +#endif +#ifdef ENFILE + case ENFILE: +#endif +#ifdef ENOBUFS + case ENOBUFS: +#endif +#ifdef ENODATA + case ENODATA: +#endif +#ifdef ENODEV + case ENODEV: +#endif +#ifdef ENOENT + case ENOENT: +#endif +#ifdef ENOEXEC + case ENOEXEC: +#endif +#ifdef ENOLCK + case ENOLCK: +#endif +#ifdef ENOLINK + case ENOLINK: +#endif +#ifdef ENOMEM + case ENOMEM: +#endif +#ifdef ENOMSG + case ENOMSG: +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: +#endif +#ifdef ENOSPC + case ENOSPC: +#endif +#ifdef ENOSR + case ENOSR: +#endif +#ifdef ENOSTR + case ENOSTR: +#endif +#ifdef ENOSYS + case ENOSYS: +#endif +#ifdef ENOTCONN + case ENOTCONN: +#endif +#ifdef ENOTDIR + case ENOTDIR: +#endif +#if defined ENOTEMPTY && (!defined EEXIST || ENOTEMPTY != EEXIST) + // AIX sometimes uses the same value for EEXIST and ENOTEMPTY + case ENOTEMPTY: +#endif +#ifdef ENOTRECOVERABLE + case ENOTRECOVERABLE: +#endif +#ifdef ENOTSOCK + case ENOTSOCK: +#endif +#ifdef ENOTSUP + case ENOTSUP: +#endif +#ifdef ENOTTY + case ENOTTY: +#endif +#ifdef ENXIO + case ENXIO: +#endif +#if defined EOPNOTSUPP && (!defined ENOTSUP || EOPNOTSUPP != ENOTSUP) + case EOPNOTSUPP: +#endif +#ifdef EOVERFLOW + case EOVERFLOW: +#endif +#ifdef EOWNERDEAD + case EOWNERDEAD: +#endif +#ifdef EPERM + case EPERM: +#endif +#ifdef EPIPE + case EPIPE: +#endif +#ifdef EPROTO + case EPROTO: +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: +#endif + case ERANGE: +#ifdef EROFS + case EROFS: +#endif +#ifdef ESPIPE + case ESPIPE: +#endif +#ifdef ESRCH + case ESRCH: +#endif +#ifdef ETIME + case ETIME: +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: +#endif +#ifdef ETXTBSY + case ETXTBSY: +#endif +#if defined EWOULDBLOCK && (!defined EAGAIN || EWOULDBLOCK != EAGAIN) + case EWOULDBLOCK: +#endif +#ifdef EXDEV + case EXDEV: +#endif + return std::error_condition(ev, std::generic_category()); + + /* Additional system-dependent mappings from non-standard error codes + * to one of the POSIX values above would go here, e.g. + case EBLAH: + return std::error_condition(EINVAL, std::generic_category()); + */ + + default: + return std::error_condition(ev, std::system_category()); + } + } }; const generic_error_category generic_category_instance{}; diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am index 21a1343daeb..0b95c247a80 100644 --- a/libstdc++-v3/src/c++98/Makefile.am +++ b/libstdc++-v3/src/c++98/Makefile.am @@ -215,6 +215,26 @@ parallel_settings.lo: parallel_settings.cc parallel_settings.o: parallel_settings.cc $(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< +if ENABLE_DUAL_ABI +# Rewrite the type info for __iosfailure. +rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt12__iosfailure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt22__iosfailure_type_info/' + +ios_failure-lt.s: ios_failure.cc + $(LTCXXCOMPILE) -S $< -o tmp-ios_failure-lt.s + -test -f tmp-ios_failure-lt.o && mv -f tmp-ios_failure-lt.o tmp-ios_failure-lt.s + $(rewrite_ios_failure_typeinfo) tmp-$@ > $@ + -rm -f tmp-$@ +ios_failure.s: ios_failure.cc + $(CXXCOMPILE) -S $< -o tmp-$@ + $(rewrite_ios_failure_typeinfo) tmp-$@ > $@ + -rm -f tmp-$@ + +ios_failure.lo: ios_failure-lt.s + $(LTCXXCOMPILE) -g0 -c $< -o $@ +ios_failure.o: ios_failure.s + $(CXXCOMPILE) -g0 -c $< +endif + # AM_CXXFLAGS needs to be in each subdirectory so that it can be # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in index 3c3bbbd17f7..ab7464fddea 100644 --- a/libstdc++-v3/src/c++98/Makefile.in +++ b/libstdc++-v3/src/c++98/Makefile.in @@ -437,6 +437,9 @@ GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include # Use special rules for parallel mode compilation. PARALLEL_FLAGS = -D_GLIBCXX_PARALLEL +# Rewrite the type info for __iosfailure. +@ENABLE_DUAL_ABI_TRUE@rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt12__iosfailure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt22__iosfailure_type_info/' + # AM_CXXFLAGS needs to be in each subdirectory so that it can be # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after @@ -826,6 +829,21 @@ parallel_settings.lo: parallel_settings.cc parallel_settings.o: parallel_settings.cc $(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< +@ENABLE_DUAL_ABI_TRUE@ios_failure-lt.s: ios_failure.cc +@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) -S $< -o tmp-ios_failure-lt.s +@ENABLE_DUAL_ABI_TRUE@ -test -f tmp-ios_failure-lt.o && mv -f tmp-ios_failure-lt.o tmp-ios_failure-lt.s +@ENABLE_DUAL_ABI_TRUE@ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@ +@ENABLE_DUAL_ABI_TRUE@ -rm -f tmp-$@ +@ENABLE_DUAL_ABI_TRUE@ios_failure.s: ios_failure.cc +@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) -S $< -o tmp-$@ +@ENABLE_DUAL_ABI_TRUE@ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@ +@ENABLE_DUAL_ABI_TRUE@ -rm -f tmp-$@ + +@ENABLE_DUAL_ABI_TRUE@ios_failure.lo: ios_failure-lt.s +@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) -c $< -o $@ +@ENABLE_DUAL_ABI_TRUE@ios_failure.o: ios_failure.s +@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) -c $< + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/libstdc++-v3/src/c++98/ios_failure.cc b/libstdc++-v3/src/c++98/ios_failure.cc index ac90525279c..b7bd66348fc 100644 --- a/libstdc++-v3/src/c++98/ios_failure.cc +++ b/libstdc++-v3/src/c++98/ios_failure.cc @@ -29,6 +29,18 @@ #define _GLIBCXX_USE_CXX11_ABI 0 #include <ios> +#if _GLIBCXX_USE_DUAL_ABI && __cpp_rtti +#include <cxxabi.h> +#include <typeinfo> +#endif + +#ifdef _GLIBCXX_USE_NLS +# include <libintl.h> +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -43,5 +55,80 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ios_base::failure::what() const throw() { return _M_msg.c_str(); } +#if _GLIBCXX_USE_DUAL_ABI && __cpp_rtti + // These functions are defined in src/c++11/cxx11-ios_failure.cc + extern void __construct_ios_failure(void*, const char*); + extern void __destroy_ios_failure(void*); + extern bool __is_ios_failure_handler(const __cxxabiv1::__class_type_info*); + + // The type thrown to report errors during stream buffer operations. + // In addition to the gcc4-compatible ios::failure base class it also has a + // member of the ios::failure[abi:cxx11] type (in an opaque buffer). + struct __iosfailure : std::ios::failure + { + __iosfailure(const char* s) : failure(s) + { __construct_ios_failure(buf, failure::what()); } + + ~__iosfailure() throw() + { __destroy_ios_failure(buf); } + + // Type that is layout-compatible with std::system_error + struct __system_error : std::runtime_error + { + // Type that is layout-compatible with std::error_code + struct error_code + { + error_code() { } + private: + int _M_value; + const void* _M_cat; + } _M_code; + }; + + // Use __system_error as a proxy for the ios::failure[abi:cxx11] + // (which can't be declared here because _GLIBCXX_USE_CXX11_ABI == 0). + // There are assertions in src/c++11/cxx11-ios_failure.cc to ensure the + // size and alignment assumptions are valid. + __attribute__((aligned(__alignof(__system_error)))) + unsigned char buf[sizeof(__system_error)]; + }; + + // Custom type info for __ios_failure. + class __iosfailure_type_info : __cxxabiv1::__si_class_type_info + { + ~__iosfailure_type_info(); + + bool + __do_upcast (const __class_type_info *dst_type, + void **obj_ptr) const; + }; + + __iosfailure_type_info::~__iosfailure_type_info() { } + + // This function gets called to see if an exception of type + // __ios_failure can be upcast to the type in a catch handler. + bool + __iosfailure_type_info::__do_upcast(const __class_type_info *dst_type, + void **obj_ptr) const + { + // If the handler is for the ios::failure[abi:cxx11] type then + // catch the object stored in __ios_failure::buf instead of + // the __ios_failure exception object itself. + if (__is_ios_failure_handler(dst_type)) + { + *obj_ptr = static_cast<__iosfailure*>(*obj_ptr)->buf; + return true; + } + // Otherwise proceeed as normal to see if the handler matches. + return __class_type_info::__do_upcast(dst_type, obj_ptr); + } +#else // _GLIBCXX_USE_DUAL_ABI && __cpp_rtti + using __iosfailure = ios::failure; +#endif + + void + __throw_ios_failure(const char* __s __attribute__((unused))) + { _GLIBCXX_THROW_OR_ABORT(__iosfailure(_(__s))); } + _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/generic_category.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/generic_category.cc new file mode 100644 index 00000000000..64881f44ca0 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/generic_category.cc @@ -0,0 +1,69 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +#include <system_error> +#include <locale> +#include <testsuite_hooks.h> + +void +test01() +{ + const char* name = std::generic_category().name(); + VERIFY( name == std::string("generic") ); +} + +void +test02() +{ + const std::error_category& cat = std::generic_category(); + std::error_condition cond; + + cond = cat.default_error_condition(EBADF); + VERIFY( cond.value() == EBADF ); + VERIFY( cond == std::errc::bad_file_descriptor ); + VERIFY( cond.category() == std::generic_category() ); + cond = cat.default_error_condition(EACCES); + VERIFY( cond.value() == EACCES ); + VERIFY( cond == std::errc::permission_denied ); + VERIFY( cond.category() == std::generic_category() ); + + // PR libstdc++/60555 + VERIFY( std::error_code(EBADF, cat) == std::errc::bad_file_descriptor ); + VERIFY( std::error_code(EACCES, cat) == std::errc::permission_denied ); +} + +void +test03() +{ + // set "C" locale to get expected message + auto loc = std::locale::global(std::locale::classic()); + + std::string msg = std::generic_category().message(EBADF); + VERIFY( msg.find("file") != std::string::npos ); + + std::locale::global(loc); +} + +int +main() +{ + test01(); + test02(); + test03(); +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/system_category.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/system_category.cc new file mode 100644 index 00000000000..77cd9c5df83 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/system_category.cc @@ -0,0 +1,114 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +#include <system_error> +#include <locale> +#include <testsuite_hooks.h> + +void +test01() +{ + const char* name = std::system_category().name(); + VERIFY( name == std::string("system") ); +} + +void +test02() +{ + const std::error_category& cat = std::system_category(); + std::error_condition cond; + + // As of 2011, ISO C only defines EDOM, EILSEQ and ERANGE: + cond = cat.default_error_condition(EDOM); + VERIFY( cond.value() == EDOM ); + VERIFY( cond == std::errc::argument_out_of_domain ); + VERIFY( cond.category() == std::generic_category() ); + cond = cat.default_error_condition(EILSEQ); + VERIFY( cond.value() == EILSEQ ); + VERIFY( cond == std::errc::illegal_byte_sequence ); + VERIFY( cond.category() == std::generic_category() ); + cond = cat.default_error_condition(ERANGE); + VERIFY( cond.value() == ERANGE ); + VERIFY( cond == std::errc::result_out_of_range ); + VERIFY( cond.category() == std::generic_category() ); + + // EBADF and EACCES are defined on all targets, + // according to config/os/*/error_constants.h + cond = cat.default_error_condition(EBADF); + VERIFY( cond.value() == EBADF ); + VERIFY( cond == std::errc::bad_file_descriptor ); + VERIFY( cond.category() == std::generic_category() ); + cond = cat.default_error_condition(EACCES); + VERIFY( cond.value() == EACCES ); + VERIFY( cond == std::errc::permission_denied ); + VERIFY( cond.category() == std::generic_category() ); + + // All POSIX errno values are positive: + cond = cat.default_error_condition(-1); + VERIFY( cond.value() == -1 ); + VERIFY( cond.category() == cat ); + cond = cat.default_error_condition(-99); + VERIFY( cond.value() == -99 ); + VERIFY( cond.category() == cat ); + + // PR libstdc++/60555 + VERIFY( std::error_code(EDOM, cat) == std::errc::argument_out_of_domain ); + VERIFY( std::error_code(EILSEQ, cat) == std::errc::illegal_byte_sequence ); + VERIFY( std::error_code(ERANGE, cat) == std::errc::result_out_of_range ); + VERIFY( std::error_code(EBADF, cat) == std::errc::bad_file_descriptor ); + VERIFY( std::error_code(EACCES, cat) == std::errc::permission_denied ); + + // As shown at https://gcc.gnu.org/ml/libstdc++/2018-08/msg00018.html + // these two error codes might have the same value on AIX, but we still + // expect both to be matched by system_category and so use generic_category: +#ifdef EEXIST + cond = cat.default_error_condition(EEXIST); + VERIFY( cond.value() == EEXIST ); + VERIFY( cond == std::errc::file_exists ); + VERIFY( cond.category() == std::generic_category() ); + VERIFY( std::error_code(EEXIST, cat) == std::errc::file_exists ); +#endif +#ifdef ENOTEMPTY + cond = cat.default_error_condition(ENOTEMPTY); + VERIFY( cond.value() == ENOTEMPTY ); + VERIFY( cond == std::errc::directory_not_empty ); + VERIFY( cond.category() == std::generic_category() ); + VERIFY( std::error_code(ENOTEMPTY, cat) == std::errc::directory_not_empty ); +#endif +} + +void +test03() +{ + // set "C" locale to get expected message + auto loc = std::locale::global(std::locale::classic()); + + std::string msg = std::system_category().message(EBADF); + VERIFY( msg.find("file") != std::string::npos ); + + std::locale::global(loc); +} + +int +main() +{ + test01(); + test02(); + test03(); +} diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/dr3050.cc b/libstdc++-v3/testsuite/20_util/duration/cons/dr3050.cc new file mode 100644 index 00000000000..a4f57a38c30 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/duration/cons/dr3050.cc @@ -0,0 +1,24 @@ +// Copyright (C) 2018 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-do compile { target c++11 } } + +#include <chrono> + +struct X { operator int64_t() /* not const */; }; +static_assert(!std::is_constructible<std::chrono::seconds, X>::value, + "LWG 3050"); diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc b/libstdc++-v3/testsuite/20_util/duration/literals/range_neg.cc index acbfab00992..cb83186c9e6 100644 --- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc +++ b/libstdc++-v3/testsuite/20_util/duration/literals/range_neg.cc @@ -27,5 +27,5 @@ test01() // std::numeric_limits<int64_t>::max() == 9223372036854775807; auto h = 9223372036854775808h; - // { dg-error "cannot be represented" "" { target *-*-* } 798 } + // { dg-error "cannot be represented" "" { target *-*-* } 804 } } diff --git a/libstdc++-v3/testsuite/20_util/pair/86751.cc b/libstdc++-v3/testsuite/20_util/pair/86751.cc new file mode 100644 index 00000000000..76a76c0d656 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/86751.cc @@ -0,0 +1,33 @@ +// Copyright (C) 2018 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-do compile { target c++11 } } + +#include <utility> + +struct X { + template<typename T> operator T() const; +}; + + +void +test01() +{ + std::pair<int, int> p; + X x; + p = x; // PR libstdc++/86751 +} diff --git a/libstdc++-v3/testsuite/20_util/pair/ref_assign.cc b/libstdc++-v3/testsuite/20_util/pair/ref_assign.cc new file mode 100644 index 00000000000..ea37fcfcf52 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/ref_assign.cc @@ -0,0 +1,74 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +#include <utility> +#include <testsuite_hooks.h> + +void +test01() +{ + typedef std::pair<int&, int> pair_type; + int i = 1; + int j = 2; + pair_type p(i, 3); + const pair_type q(j, 4); + p = q; + VERIFY( p.first == q.first ); + VERIFY( p.second == q.second ); + VERIFY( i == j ); +} + +void +test02() +{ + typedef std::pair<int, int&> pair_type; + int i = 1; + int j = 2; + pair_type p(3, i); + const pair_type q(4, j); + p = q; + VERIFY( p.first == q.first ); + VERIFY( p.second == q.second ); + VERIFY( i == j ); +} + +void +test03() +{ + typedef std::pair<int&, int&> pair_type; + int i = 1; + int j = 2; + int k = 3; + int l = 4; + pair_type p(i, j); + const pair_type q(k, l); + p = q; + VERIFY( p.first == q.first ); + VERIFY( p.second == q.second ); + VERIFY( i == k ); + VERIFY( j == l ); +} + +int +main() +{ + test01(); + test02(); + test03(); +} diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc index 785f9ad4cfd..e64b4535345 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc @@ -43,10 +43,10 @@ void f() std::unique_ptr<int, D&> ud(nullptr, d); ub = std::move(ud); // { dg-error "no match" } ub2 = ud; // { dg-error "no match" } -// { dg-error "no type" "" { target *-*-* } 272 } +// { dg-error "no type" "" { target *-*-* } 274 } std::unique_ptr<int[], B&> uba(nullptr, b); std::unique_ptr<int[], D&> uda(nullptr, d); uba = std::move(uda); // { dg-error "no match" } -// { dg-error "no type" "" { target *-*-* } 540 } +// { dg-error "no type" "" { target *-*-* } 544 } } diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc index 285a0b994c9..9b8cba45a57 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc @@ -40,7 +40,7 @@ test07() std::unique_ptr<const A[]> cA3(p); // { dg-error "no matching function" } std::unique_ptr<volatile A[]> vA3(p); // { dg-error "no matching function" } std::unique_ptr<const volatile A[]> cvA3(p); // { dg-error "no matching function" } - // { dg-error "no type" "" { target *-*-* } 448 } + // { dg-error "no type" "" { target *-*-* } 450 } } template<typename T> diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/incomplete.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/incomplete.cc new file mode 100644 index 00000000000..1a8f28838a1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/incomplete.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2018 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-do compile { target c++11 } } + +#include <memory> + +struct Incomplete; + +void f(void** p) +{ + ::new (p[0]) std::unique_ptr<Incomplete>(); + ::new (p[1]) std::unique_ptr<Incomplete[]>(); + + // PR libstdc++/87704 + ::new (p[2]) std::unique_ptr<Incomplete>(nullptr); + ::new (p[3]) std::unique_ptr<Incomplete[]>(nullptr); +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc new file mode 100644 index 00000000000..ef5f1e708ac --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc @@ -0,0 +1,78 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +// PR libstdc++/87749 + +#include <string> +#include <testsuite_hooks.h> + +bool oom = false; + +template<typename T> +struct alloc +{ + using value_type = T; + +#if !_GLIBCXX_USE_CXX11_ABI + using size_type = unsigned long; + using difference_type = long; + using reference = T&; + using const_reference = T&; + using pointer = T*; + using const_pointer = const T*; + template<typename U> + struct rebind { using other = alloc<U>; }; +#endif + + int not_empty = 0; // this makes is_always_equal false + + alloc() = default; + template<typename U> + alloc(const alloc<U>&) { } + + T* allocate(unsigned long n) + { + if (oom) + throw std::bad_alloc(); + return std::allocator<T>().allocate(n); + } + + void deallocate(T* p, unsigned long n) + { + std::allocator<T>().deallocate(p, n); + } +}; + +template<typename T, typename U> +bool operator==(const alloc<T>&, const alloc<U>&) { return true; } + +template<typename T, typename U> +bool operator!=(const alloc<T>&, const alloc<U>&) { return false; } + +int main() +{ + using string = std::basic_string<char, std::char_traits<char>, alloc<char>>; + + string s = "PR libstdc++/87749 a string that is longer than a short string"; + const auto ptr = s.c_str(); + oom = true; + string ss; + ss = std::move(s); // allocators are equal, should not allocate new storage + VERIFY( ss.c_str() == ptr ); +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc new file mode 100644 index 00000000000..b56bc50e1c1 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2018 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 "-O1" } +// { dg-do compile { target c++11 } } +// { dg-final { scan-assembler-not "__throw_length_error" } } +// { dg-final { scan-assembler-not "__throw_bad_alloc" } } + +#include <bits/c++config.h> +#undef _GLIBCXX_EXTERN_TEMPLATE +#include <string> + +void +test01(std::string& target, std::string&& source) +{ + // The move assignment operator should be simple enough that the compiler + // can see that it never results in a length_error or bad_alloc exception + // (which would be turned into std::terminate by the noexcept on the + // assignment operator). + target = std::move(source); +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc new file mode 100644 index 00000000000..d4062a9e637 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc @@ -0,0 +1,79 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +// PR libstdc++/87749 + +#include <string> +#include <testsuite_hooks.h> + +bool oom = false; + +template<typename T> +struct alloc +{ + using value_type = T; + +#if !_GLIBCXX_USE_CXX11_ABI + using size_type = unsigned long; + using difference_type = long; + using reference = T&; + using const_reference = T&; + using pointer = T*; + using const_pointer = const T*; + template<typename U> + struct rebind { using other = alloc<U>; }; +#endif + + int not_empty = 0; // this makes is_always_equal false + + alloc() = default; + template<typename U> + alloc(const alloc<U>&) { } + + T* allocate(unsigned long n) + { + if (oom) + throw std::bad_alloc(); + return std::allocator<T>().allocate(n); + } + + void deallocate(T* p, unsigned long n) + { + std::allocator<T>().deallocate(p, n); + } +}; + +template<typename T, typename U> +bool operator==(const alloc<T>&, const alloc<U>&) { return true; } + +template<typename T, typename U> +bool operator!=(const alloc<T>&, const alloc<U>&) { return false; } + +int main() +{ + using string + = std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc<wchar_t>>; + + string s = L"PR libstdc++/87749 a string that is longer than a short string"; + const auto ptr = s.c_str(); + oom = true; + string ss; + ss = std::move(s); // allocators are equal, should not allocate new storage + VERIFY( ss.c_str() == ptr ); +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc new file mode 100644 index 00000000000..f54ad36a5d0 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2018 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 "-O1" } +// { dg-do compile { target c++11 } } +// { dg-final { scan-assembler-not "__throw_length_error" } } +// { dg-final { scan-assembler-not "__throw_bad_alloc" } } + +#include <bits/c++config.h> +#undef _GLIBCXX_EXTERN_TEMPLATE +#include <string> + +void +test01(std::wstring& target, std::wstring&& source) +{ + // The move assignment operator should be simple enough that the compiler + // can see that it never results in a length_error or bad_alloc exception + // (which would be turned into std::terminate by the noexcept on the + // assignment operator). + target = std::move(source); +} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc index 745d2c27917..dd88cbd0782 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/69703.cc @@ -74,7 +74,6 @@ test03() VERIFY( in[2] == U'c' ); } - void test04() { @@ -98,6 +97,6 @@ main() { test01(); test02(); - test01(); - test02(); + test03(); + test04(); } diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/wchar_t/1.cc new file mode 100644 index 00000000000..c44f91f357e --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/wchar_t/1.cc @@ -0,0 +1,52 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +#include <string> +#include <codecvt> +#include <testsuite_hooks.h> + +void +test01() +{ + const char out[] = u8"\u00A33.50"; + wchar_t in[8] = {}; + std::codecvt_utf8<wchar_t> cvt; + std::mbstate_t st; + const char* no; + wchar_t* ni; + auto res = cvt.in(st, out, out+6, no, in, in+8, ni); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( in[1] == L'3' ); + VERIFY( in[2] == L'.' ); + VERIFY( in[3] == L'5' ); + VERIFY( in[4] == L'0' ); + + char out2[8] = {}; + char* no2; + const wchar_t* ni2; + res = cvt.out(st, in, ni, ni2, out2, out2+8, no2); + VERIFY( res == std::codecvt_base::ok ); + VERIFY( out2 == std::string(out) ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/3.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/3.cc index fc99ec36d68..09623eff3de 100644 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/3.cc +++ b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/3.cc @@ -1,4 +1,4 @@ -// { dg-require-namedlocale "it_IT.ISO8859-15" } +// { dg-require-namedlocale "nl_NL.ISO8859-15" } // 2001-01-24 Benjamin Kosnik <bkoz@redhat.com> @@ -30,12 +30,14 @@ void test02() bool test __attribute__((unused)) = true; - locale loc_it = locale(ISO_8859(15,it_IT)); + // nl_NL chosen because it has no thousands separator (at this time). + locale loc_it = locale(ISO_8859(15,nl_NL)); const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it); string g = nump_it.grouping(); + // Ensure that grouping is empty for locales with empty thousands separator. VERIFY( g == "" ); } diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/80893.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/80893.cc new file mode 100644 index 00000000000..0b0016c9790 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/80893.cc @@ -0,0 +1,76 @@ +// Copyright (C) 2017 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-do run { target c++11 } } + +// libstdc++/80893 + +#include <vector> +#include <testsuite_allocator.h> + +struct DereferencedInvalidPointer { }; + +// User-defined pointer type that throws if a null pointer is dereferenced. +template<typename T> +struct Pointer : __gnu_test::PointerBase<Pointer<T>, T> +{ + using __gnu_test::PointerBase<Pointer<T>, T>::PointerBase; + + T& operator*() const + { + if (!this->value) + throw DereferencedInvalidPointer(); + return *this->value; + } +}; + +// Minimal allocator using Pointer<T> +template<typename T> +struct Alloc +{ + typedef T value_type; + typedef Pointer<T> pointer; + + Alloc() = default; + template<typename U> + Alloc(const Alloc<U>&) { } + + pointer allocate(std::size_t n) + { + if (n) + return pointer(std::allocator<T>().allocate(n)); + return nullptr; + } + + void deallocate(pointer p, std::size_t n) + { + if (n) + std::allocator<T>().deallocate(p.value, n); + } +}; + +template<typename T> +bool operator==(Alloc<T>, Alloc<T>) { return true; } + +template<typename T> +bool operator!=(Alloc<T>, Alloc<T>) { return false; } + +int main() +{ + std::vector<bool, Alloc<bool>> v(0); + std::vector<bool, Alloc<bool>> w(v); +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc new file mode 100644 index 00000000000..b209d76867a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc @@ -0,0 +1,60 @@ +// Copyright (C) 2018 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/>. + +#include <vector> +#include <testsuite_hooks.h> + +struct X +{ + X() : data(1) + { + if (fail) + throw 1; + } + + static bool fail; + + std::vector<int> data; +}; + +bool X::fail = false; + +void +test01() +{ + std::vector<X> v(2); + X* const addr = &v[0]; + bool caught = false; + try { + X::fail = true; + v.resize(v.capacity() + 1); // force reallocation + } catch (int) { + caught = true; + } + VERIFY( caught ); + VERIFY( v.size() == 2 ); + VERIFY( &v[0] == addr ); + // PR libstdc++/83982 + VERIFY( ! v[0].data.empty() ); + VERIFY( ! v[1].data.empty() ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/86292.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/86292.cc new file mode 100644 index 00000000000..7103efb82ff --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/86292.cc @@ -0,0 +1,64 @@ +// Copyright (C) 2018 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-do run } + +#include <vector> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> + +struct X +{ + X() { ++count; } + X(const X&) { if (++copies >= max_copies) throw 1; ++count; } + ~X() { --count; } + + static int count; + static int copies; + static int max_copies; +}; + +int X::count = 0; +int X::copies = 0; +int X::max_copies = 0; + +void +test01() +{ + X x[3]; + const int count = X::count; + X::max_copies = 2; + __gnu_test::test_container<const X, __gnu_test::input_iterator_wrapper> + x_input(x, x+3); + bool caught = false; + try + { + std::vector<X> v(x_input.begin(), x_input.end()); + } + catch(int) + { + caught = true; + } + VERIFY( caught ); + VERIFY( X::count == count ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/dr2188.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/dr2188.cc new file mode 100644 index 00000000000..047334ddf24 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/dr2188.cc @@ -0,0 +1,47 @@ +// Copyright (C) 2018 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-do run { target c++11 } } + +// PR libstdc++/86734 + +#include <iterator> +#include <testsuite_hooks.h> + +void +test01() +{ + // LWG DR 2188 + // Reverse iterator does not fully support targets that overload operator& + struct X { + int val; + int* operator&() { return &val; } + const int* operator&() const { return &val; } + }; + + X x[2] = { {1}, {2} }; + std::reverse_iterator<X*> rev(x+2); + VERIFY( rev->val == 2 ); + ++rev; + VERIFY( rev->val == 1 ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc b/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc new file mode 100644 index 00000000000..eae5440e60b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc @@ -0,0 +1,75 @@ +// Copyright (C) 2018 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/>. + +#include <valarray> +#include <testsuite_hooks.h> + +void +test01() +{ + // PR libstdc++/87641 + std::valarray<int> v1(3); + v1[0] = 1; + v1[1] = 2; + v1[2] = 3; + std::valarray< std::valarray<int> > v2(v1, 3); + std::valarray<int> v3 = v2.sum(); + VERIFY( v3.size() == v1.size() ); + VERIFY( v3[0] == 3 ); + VERIFY( v3[1] == 6 ); + VERIFY( v3[2] == 9 ); +} + +struct X +{ + X() : val(1) { } + + X& operator+=(const X& x) { val += x.val; return *this; } + bool operator==(const X& x) { return val == x.val; } + + int val; +}; + +void +test02() +{ + std::valarray<X> v1(1); + VERIFY( v1.sum() == v1[0] ); + + std::valarray<X> v2(2); + VERIFY( v2.sum().val == 2 ); +} + +struct Y +{ + X& operator+=(const Y&) { throw 1; } +}; + +void +test03() +{ + std::valarray<Y> v1(1); + (void) v1.sum(); // no addition performed for a single element +} + +int +main() +{ + test01(); + test02(); + test03(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc index df4cf43598a..9e23f568fbe 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc @@ -17,9 +17,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - // 27.4.4.2 basic_ios member functions // NB: Don't include any other headers in this file. diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc index c2357fcff35..e55b86cbaf7 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc @@ -17,9 +17,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - // 27.4.4.2 basic_ios member functions // NB: Don't include any other headers in this file. diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc index 91e2fea9d42..1ea715e0655 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <sstream> #include <testsuite_hooks.h> @@ -30,7 +27,7 @@ void test_failbit() istringstream stream("jaylib - champion sound"); stream.exceptions(ios_base::failbit); - + try { T i; diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc index 088b2ca846d..4c5f402a006 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <sstream> #include <testsuite_hooks.h> @@ -30,7 +27,7 @@ void test_failbit() wistringstream stream(L"jaylib - champion sound"); stream.exceptions(ios_base::failbit); - + try { T i; diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc index f6842fbea7e..7fdc9598ab6 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <istream> #include <ostream> #include <streambuf> diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc index 7ca929febfa..fffed0d987d 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <istream> #include <ostream> #include <streambuf> diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc index 6ffbc06ae00..cefb7df5483 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc @@ -18,9 +18,6 @@ // 27.6.1.1.2 class basic_istream::sentry -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <sstream> #include <testsuite_hooks.h> @@ -29,7 +26,7 @@ int main() using namespace std; istringstream stream; stream.exceptions(ios_base::eofbit); - + try { istream::sentry sentry(stream, false); diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc index ccc519e0b28..29a4b94f1eb 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - // 27.6.1.1.2 class basic_istream::sentry #include <sstream> @@ -28,7 +25,7 @@ int main() using namespace std; wistringstream stream; stream.exceptions(ios_base::eofbit); - + try { wistream::sentry sentry(stream, false); diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc index 6eac572969f..a0213b1d6bd 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <istream> #include <ostream> #include <streambuf> @@ -41,7 +38,7 @@ void test3() ostringstream stream; stream.exceptions(ios_base::badbit); - + try { stream << static_cast<streambuf*>(0); diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc index 1de18ede7f3..095b1ae7824 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <istream> #include <ostream> #include <streambuf> @@ -41,7 +38,7 @@ void test3() wostringstream stream; stream.exceptions(ios_base::badbit); - + try { stream << static_cast<wstreambuf*>(0); diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc new file mode 100644 index 00000000000..4d19f40e78c --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc @@ -0,0 +1,98 @@ +// Copyright (C) 2018 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 "-D_GLIBCXX_USE_CXX11_ABI=1" } +// { dg-do run } + +#include <fstream> +#include <testsuite_hooks.h> + +void +test01() +{ + using std::ios; + bool caught_ios_failure = false; + bool rethrown = false; + bool caught_exception = false; + try { + std::ifstream f; + f.exceptions(ios::failbit | ios::badbit | ios::eofbit); + try { + f.get(); + } + catch (const ios::failure&) // catch as new ABI type + { + caught_ios_failure = true; +#if _GLIBCXX_USE_DUAL_ABI || _GLIBCXX_USE_CXX11_ABI == 1 + rethrown = true; + throw; // re-throw, to catch as old ABI type +#endif + } + } + catch (const std::exception& e) + { + caught_exception = true; + } + + VERIFY( caught_ios_failure ); + if (rethrown) + VERIFY( caught_exception ); +} + +void +test02() +{ + using std::ios; + const std::exception* p = nullptr; + bool caught_ios_failure = false; + bool caught_exception = false; + try { + std::ifstream f; + f.exceptions(ios::failbit | ios::badbit | ios::eofbit); + try { + f.get(); + } + catch (const std::exception& e1) + { + caught_exception = true; + p = &e1; + throw; + } + } + catch (const ios::failure& e2) + { + caught_ios_failure = true; +#if _GLIBCXX_USE_DUAL_ABI + // If the Dual ABI is active the library throws the old type, + // so e1 was an object of that old type and so &e1 != &e2. + VERIFY( p != &e2 ); +#else + // Otherwise there's only one type of ios::failure, so &e1 == &e2. + VERIFY( p == &e2 ); +#endif + } + + VERIFY( caught_exception ); + VERIFY( caught_ios_failure ); +} + +int +main() +{ + test01(); + test02(); +} diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc index 8b33732f098..549e8ee1cb7 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc @@ -28,9 +28,6 @@ // Radar 6467884: 10.X systems are not robust when paging space is exceeded // { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } } -// The library still throws the original definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" } - #include <sstream> #include <iostream> #include <limits> @@ -52,8 +49,8 @@ void test02() // pword ios.pword(1) = v; VERIFY( ios.pword(1) == v ); - - try + + try { v = ios.pword(max); } diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/85098.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/85098.cc new file mode 100644 index 00000000000..173b1901a7c --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/basic_regex/85098.cc @@ -0,0 +1,45 @@ +// Copyright (C) 2018 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 "-O0" } +// { dg-do link { target c++11 } } + +#include <regex> + +void f(const std::regex_constants::syntax_option_type&) { } + +void +test01() +{ + f(std::regex::icase); + f(std::regex::nosubs); + f(std::regex::optimize); + f(std::regex::collate); + f(std::regex::ECMAScript); + f(std::regex::basic); + f(std::regex::extended); + f(std::regex::awk); + f(std::regex::grep); + f(std::regex::egrep); + // f(std::regex::multiline); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/68519.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/68519.cc new file mode 100644 index 00000000000..71c1d29e231 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/68519.cc @@ -0,0 +1,51 @@ +// Copyright (C) 2017 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-do run } +// { dg-options "-pthread" } +// { dg-require-effective-target c++11 } +// { dg-require-effective-target pthread } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } + +#include <condition_variable> +#include <testsuite_hooks.h> + +// PR libstdc++/68519 + +bool val = false; +std::mutex mx; +std::condition_variable cv; + +void +test01() +{ + for (int i = 0; i < 3; ++i) + { + std::unique_lock<std::mutex> l(mx); + auto start = std::chrono::system_clock::now(); + cv.wait_for(l, std::chrono::duration<float>(1), [] { return val; }); + auto t = std::chrono::system_clock::now(); + VERIFY( (t - start) >= std::chrono::seconds(1) ); + } +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/experimental/memory_resource/70966.cc b/libstdc++-v3/testsuite/experimental/memory_resource/70966.cc new file mode 100644 index 00000000000..c0173ffa7a9 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/memory_resource/70966.cc @@ -0,0 +1,56 @@ +// Copyright (C) 2018 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-do run { target c++14 } } + +#include <experimental/memory_resource> + +namespace pmr = std::experimental::pmr; + +struct X +{ + pmr::memory_resource* res = nullptr; + void* ptr = nullptr; + static constexpr std::size_t n = 64; + + constexpr X() { } + + explicit + X(pmr::memory_resource* r) : res(r), ptr(r->allocate(n)) { } + + ~X() { if (ptr) res->deallocate(ptr, n); } +}; + +void +swap(X& lhs, X& rhs) { + std::swap(lhs.res, rhs.res); + std::swap(lhs.ptr, rhs.ptr); +} + +void +test01() +{ + static X x1; + X x2(pmr::new_delete_resource()); + swap(x1, x2); + // Now x1 will deallocate the memory during destruction of static objects. +} + +int main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc new file mode 100644 index 00000000000..2b475791bfa --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/deque> + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same<xpmr::deque<X>, + std::deque<X, xpmr::polymorphic_allocator<X>>>::value, + "pmr::deque"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc new file mode 100644 index 00000000000..ac2dd52dff6 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/forward_list> + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same<xpmr::forward_list<X>, + std::forward_list<X, xpmr::polymorphic_allocator<X>>>::value, + "pmr::forward_list"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc new file mode 100644 index 00000000000..aea5c8061bd --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/list> + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same<xpmr::list<X>, + std::list<X, xpmr::polymorphic_allocator<X>>>::value, + "pmr::list"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc new file mode 100644 index 00000000000..2074022dc2b --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/map> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Y { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same<xpmr::map<X, Y>, + std::map<X, Y, std::less<X>, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::map"); +static_assert(std::is_same<xpmr::map<X, Y, Cmp>, + std::map<X, Y, Cmp, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::map"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc new file mode 100644 index 00000000000..f02d21521fb --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc @@ -0,0 +1,52 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + + +#include <experimental/regex> + +#if _GLIBCXX_USE_CXX11_ABI +namespace xpmr = std::experimental::pmr; + +struct X; +static_assert(std::is_same<xpmr::match_results<X*>, + std::match_results<X*, + xpmr::polymorphic_allocator<std::sub_match<X*>>>>::value, + "pmr::match_results"); + +static_assert(std::is_same<xpmr::cmatch, + std::match_results<const char*, + xpmr::polymorphic_allocator<std::sub_match<const char*>>>>::value, + "pmr::cmatch"); +static_assert(std::is_same<xpmr::smatch, + std::match_results<xpmr::string::const_iterator, + xpmr::polymorphic_allocator< + std::sub_match<xpmr::string::const_iterator>>>>::value, + "pmr::smatch"); +#ifdef _GLIBCXX_USE_WCHAR_T +static_assert(std::is_same<xpmr::wcmatch, + std::match_results<const wchar_t*, + xpmr::polymorphic_allocator<std::sub_match<const wchar_t*>>>>::value, + "pmr::wcmatch"); +static_assert(std::is_same<xpmr::wsmatch, + std::match_results<xpmr::wstring::const_iterator, + xpmr::polymorphic_allocator< + std::sub_match<xpmr::wstring::const_iterator>>>>::value, + "pmr::wsmatch"); +#endif +#endif diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc new file mode 100644 index 00000000000..e6acaf41122 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/map> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Y { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same<xpmr::multimap<X, Y>, + std::multimap<X, Y, std::less<X>, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::multimap"); +static_assert(std::is_same<xpmr::multimap<X, Y, Cmp>, + std::multimap<X, Y, Cmp, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::multimap"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc new file mode 100644 index 00000000000..e98c556c489 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/set> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same<xpmr::multiset<X>, + std::multiset<X, std::less<X>, xpmr::polymorphic_allocator<X>>>::value, + "pmr::multiset"); +static_assert(std::is_same<xpmr::multiset<X, Cmp>, + std::multiset<X, Cmp, xpmr::polymorphic_allocator<X>>>::value, + "pmr::multiset"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc new file mode 100644 index 00000000000..182a11e9701 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/set> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same<xpmr::set<X>, + std::set<X, std::less<X>, xpmr::polymorphic_allocator<X>>>::value, + "pmr::set"); +static_assert(std::is_same<xpmr::set<X, Cmp>, + std::set<X, Cmp, xpmr::polymorphic_allocator<X>>>::value, + "pmr::set"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc new file mode 100644 index 00000000000..62e2147ebfb --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc @@ -0,0 +1,62 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/string> + +#if _GLIBCXX_USE_CXX11_ABI +namespace xpmr = std::experimental::pmr; + +struct T : std::char_traits<char> { }; + +static_assert(std::is_same<xpmr::basic_string<char>, + std::basic_string<char, std::char_traits<char>, + xpmr::polymorphic_allocator<char>>>::value, + "pmr::basic_string"); +static_assert(std::is_same<xpmr::basic_string<char, T>, + std::basic_string<char, T, xpmr::polymorphic_allocator<char>>>::value, + "pmr::basic_string"); + +static_assert(std::is_same<xpmr::string, + std::basic_string<char, std::char_traits<char>, + xpmr::polymorphic_allocator<char>>>::value, + "pmr::string"); +static_assert(std::is_same<xpmr::u16string, + std::basic_string<char16_t, std::char_traits<char16_t>, + xpmr::polymorphic_allocator<char16_t>>>::value, + "pmr::u16string"); +static_assert(std::is_same<xpmr::u32string, + std::basic_string<char32_t, std::char_traits<char32_t>, + xpmr::polymorphic_allocator<char32_t>>>::value, + "pmr::u32string"); + +#ifdef _GLIBCXX_USE_WCHAR_T +static_assert(std::is_same<xpmr::basic_string<wchar_t>, + std::basic_string<wchar_t, std::char_traits<wchar_t>, + xpmr::polymorphic_allocator<wchar_t>>>::value, + "pmr::basic_string<wchar_t>"); +static_assert(std::is_same<xpmr::basic_string<wchar_t, T>, + std::basic_string<wchar_t, T, xpmr::polymorphic_allocator<wchar_t>>>::value, + "pmr::basic_string<wchar_t>"); + +static_assert(std::is_same<xpmr::wstring, + std::basic_string<wchar_t, std::char_traits<wchar_t>, + xpmr::polymorphic_allocator<wchar_t>>>::value, + "pmr::wstring"); +#endif +#endif diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc new file mode 100644 index 00000000000..15e00e7e720 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc @@ -0,0 +1,40 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/unordered_map> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Y { }; +struct Hash { std::size_t operator()(X) const { return 0; } }; +struct Eq { bool operator()(X, X) const { return true; } }; + +static_assert(std::is_same<xpmr::unordered_map<X, Y>, + std::unordered_map<X, Y, std::hash<X>, std::equal_to<X>, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::unordered_map"); +static_assert(std::is_same<xpmr::unordered_map<X, Y, Hash>, + std::unordered_map<X, Y, Hash, std::equal_to<X>, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::unordered_map"); +static_assert(std::is_same<xpmr::unordered_map<X, Y, Hash, Eq>, + std::unordered_map<X, Y, Hash, Eq, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::unordered_map"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc new file mode 100644 index 00000000000..67054ffb4c9 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc @@ -0,0 +1,40 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/unordered_map> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Y { }; +struct Hash { std::size_t operator()(X) const { return 0; } }; +struct Eq { bool operator()(X, X) const { return true; } }; + +static_assert(std::is_same<xpmr::unordered_multimap<X, Y>, + std::unordered_multimap<X, Y, std::hash<X>, std::equal_to<X>, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::unordered_multimap"); +static_assert(std::is_same<xpmr::unordered_multimap<X, Y, Hash>, + std::unordered_multimap<X, Y, Hash, std::equal_to<X>, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::unordered_multimap"); +static_assert(std::is_same<xpmr::unordered_multimap<X, Y, Hash, Eq>, + std::unordered_multimap<X, Y, Hash, Eq, + xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value, + "pmr::unordered_multimap"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc new file mode 100644 index 00000000000..aaba4d3ec47 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/unordered_set> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Hash { std::size_t operator()(X) const { return 0; } }; +struct Eq { bool operator()(X, X) const { return true; } }; + +static_assert(std::is_same<xpmr::unordered_multiset<X>, + std::unordered_multiset<X, std::hash<X>, std::equal_to<X>, + xpmr::polymorphic_allocator<X>>>::value, + "pmr::unordered_multiset"); +static_assert(std::is_same<xpmr::unordered_multiset<X, Hash>, + std::unordered_multiset<X, Hash, std::equal_to<X>, + xpmr::polymorphic_allocator<X>>>::value, + "pmr::unordered_multiset"); +static_assert(std::is_same<xpmr::unordered_multiset<X, Hash, Eq>, + std::unordered_multiset<X, Hash, Eq, + xpmr::polymorphic_allocator<X>>>::value, + "pmr::unordered_multiset"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc new file mode 100644 index 00000000000..b90051ec074 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/unordered_set> + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Hash { std::size_t operator()(X) const { return 0; } }; +struct Eq { bool operator()(X, X) const { return true; } }; + +static_assert(std::is_same<xpmr::unordered_set<X>, + std::unordered_set<X, std::hash<X>, std::equal_to<X>, + xpmr::polymorphic_allocator<X>>>::value, + "pmr::unordered_set"); +static_assert(std::is_same<xpmr::unordered_set<X, Hash>, + std::unordered_set<X, Hash, std::equal_to<X>, + xpmr::polymorphic_allocator<X>>>::value, + "pmr::unordered_set"); +static_assert(std::is_same<xpmr::unordered_set<X, Hash, Eq>, + std::unordered_set<X, Hash, Eq, + xpmr::polymorphic_allocator<X>>>::value, + "pmr::unordered_set"); diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc new file mode 100644 index 00000000000..f780aa5666b --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2018 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-do compile { target c++14 } } + +#include <experimental/vector> + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same<xpmr::vector<X>, + std::vector<X, xpmr::polymorphic_allocator<X>>>::value, + "pmr::vector"); diff --git a/libstdc++-v3/testsuite/ext/ext_pointer/1.cc b/libstdc++-v3/testsuite/ext/ext_pointer/1.cc index 3c61866b978..ebce1979c9b 100644 --- a/libstdc++-v3/testsuite/ext/ext_pointer/1.cc +++ b/libstdc++-v3/testsuite/ext/ext_pointer/1.cc @@ -188,11 +188,25 @@ void test04() { VERIFY(bPtr3 == aPtr); } +// Check that long long values can be used for pointer arithmetic. +void test05() +{ + A a[2] = { 1, 2 }; + A_pointer p = a; + A_pointer q = p + 0ull; + VERIFY( p == q ); + q += 0ll; + VERIFY( p == q ); + q += 1ll; + VERIFY( q->i == p[1ll].i ); +} + int main() { test01(); test02(); test03(); test04(); + test05(); return 0; } diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 18ee31882e1..70ddda93f10 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -235,7 +235,7 @@ proc libstdc++_init { testfile } { # Default settings. set cxx [transform "g++"] - set cxxflags "-D_GLIBCXX_ASSERT -fmessage-length=0" + set cxxflags "-D_GLIBCXX_ASSERT -fmessage-length=0 -fno-show-column" set cxxpchflags "" set cxxvtvflags "" set cxxldflags "" diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index f597a3846ab..cdddf746cda 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -572,6 +572,8 @@ namespace __gnu_test explicit PointerBase(T* p = nullptr) : value(p) { } + PointerBase(std::nullptr_t) : value(nullptr) { } + template<typename D, typename U, typename = decltype(static_cast<T*>(std::declval<U*>()))> PointerBase(const PointerBase<D, U>& p) : value(p.value) { } @@ -605,7 +607,11 @@ namespace __gnu_test } private: - Derived& derived() { return static_cast<Derived&>(*this); } + Derived& + derived() { return static_cast<Derived&>(*this); } + + const Derived& + derived() const { return static_cast<const Derived&>(*this); } }; template<typename D, typename T> diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog index b16e66fba7b..d6ac89bf08f 100644 --- a/libvtv/ChangeLog +++ b/libvtv/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index 0b4627a3a09..db3316ccf67 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-26 Georg-Johann Lay <avr@gjlay.de> Backport from 2017-07-26 gcc-7-branch r250562. diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index 0d8f37c3bfb..f0b0c2b09db 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. diff --git a/zlib/ChangeLog b/zlib/ChangeLog index 2dd1109d888..32eb51c3bb1 100644 --- a/zlib/ChangeLog +++ b/zlib/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Release Manager + + * GCC 6.5.0 released. + 2017-07-04 Release Manager * GCC 6.4.0 released. |