diff -Nru gcc-11-11.3.0/debian/changelog gcc-11-11.3.0/debian/changelog --- gcc-11-11.3.0/debian/changelog 2022-04-25 09:44:06.000000000 +0000 +++ gcc-11-11.3.0/debian/changelog 2022-05-19 11:15:11.000000000 +0000 @@ -1,3 +1,34 @@ +gcc-11 (11.3.0-3ubuntu1) kinetic; urgency=medium + + * Merge with Debian; remaining changes: + - Build from upstream sources. + + -- Matthias Klose Thu, 19 May 2022 13:15:11 +0200 + +gcc-11 (11.3.0-3) unstable; urgency=medium + + * Update to git 20220519 from the gcc-11 branch. + - Fix PR target/105162 (AArch64), PR tree-optimization/105528, + PR target/105292 (SPARC), PR target/105331 (x86), PR sanitizer/105396, + PR rtl-optimization/105333, PR target/105339 (x86), PR target/105257, + PR debug/105203, PR gcov-profile/105282, PR analyzer/105365, + PR analyzer/105366, PR c++/105304, PR c++/101442, PR c++/101698, + PR c++/65211, PR c++/102479, PR c++/102300, PR c++/102629, + PR c++/104646, PR c++/82980, PR c++/105265, PR c++/100838, + PR c++/105245, PR c++/100111, PR c++/104669, PR c++/102071, + PR c++/104142, PR c++/105386, PR c++/105289, PR c++/86193, + PR c++/90107, PR c++/105398, PR c++/105321, PR c++/97296, + PR fortran/105230, PR fortran/104849, PR fortran/105310, + PR target/105162 (AArch64), PR libstdc++/103911, PR libstdc++/105284, + PR libstdc++/104217, PR libstdc++/105502, PR libstdc++/104731, + PR c++/105324, PR libstdc++/99290, PR libstdc++/105375, + PR libstdc++/102994, PR libstdc++/96592, PR c++/102177, + PR libstdc++/101709, PR libstdc++/105324, PR libstdc++/65018, + PR libstdc++/103853, PR libstdc++/103911, PR libstdc++/93602, + PR middle-end/104966, PR libstdc++/103848. + + -- Matthias Klose Thu, 19 May 2022 12:42:20 +0200 + gcc-11 (11.3.0-1ubuntu1) jammy; urgency=medium * Merge with Debian; remaining changes: diff -Nru gcc-11-11.3.0/debian/patches/git-doc-updates.diff gcc-11-11.3.0/debian/patches/git-doc-updates.diff --- gcc-11-11.3.0/debian/patches/git-doc-updates.diff 2022-04-25 09:44:06.000000000 +0000 +++ gcc-11-11.3.0/debian/patches/git-doc-updates.diff 2022-05-19 11:15:04.000000000 +0000 @@ -1,7 +1,7 @@ -# DP: updates from the 11 branch upto 20220425 (documentation). +# DP: updates from the 11 branch upto 20220519 (documentation). LANG=C git diff --no-renames --src-prefix=a/src/ --dst-prefix=b/src/ \ - 2d280e7eafc086e9df85f50ed1a6526d6a3a204d 537dca0ff589bed0c67ecf84b21c837590b7b792 \ + 2d280e7eafc086e9df85f50ed1a6526d6a3a204d 3865647c35d3be502c121bc06351c7fb9ad6b4a5 \ | awk '/^diff .*\.texi/ {skip=0; print; next} /^diff / {skip=1; next} skip==0' \ | grep -v -E '^(diff|index)' diff -Nru gcc-11-11.3.0/debian/patches/git-updates.diff gcc-11-11.3.0/debian/patches/git-updates.diff --- gcc-11-11.3.0/debian/patches/git-updates.diff 2022-04-25 09:44:06.000000000 +0000 +++ gcc-11-11.3.0/debian/patches/git-updates.diff 2022-05-19 11:15:04.000000000 +0000 @@ -1,7 +1,6653 @@ -# DP: updates from the 11 branch upto 20220425 (0da057c7d95). +# DP: updates from the 11 branch upto 20220519 (3865647c35d). LANG=C git diff --no-renames --src-prefix=a/src/ --dst-prefix=b/src/ \ - 2d280e7eafc086e9df85f50ed1a6526d6a3a204d 0da057c7d95e1f133a98b819e154c02c455e4641 \ + 2d280e7eafc086e9df85f50ed1a6526d6a3a204d 3865647c35d3be502c121bc06351c7fb9ad6b4a5 \ | awk '/^diff .*\.texi/ {skip=1; next} /^diff / { skip=0 } skip==0' \ | grep -v -E '^(diff|index)' +--- a/src/gcc/ChangeLog ++++ b/src/gcc/ChangeLog +@@ -1,3 +1,114 @@ ++2022-05-16 Sebastian Pop ++ ++ PR target/105162 ++ * config/aarch64/aarch64-protos.h (atomic_ool_names): Increase dimension ++ of str array. ++ * config/aarch64/aarch64.c (aarch64_atomic_ool_func): Call ++ memmodel_from_int and handle MEMMODEL_SYNC_*. ++ (DEF0): Add __aarch64_*_sync functions. ++ ++2022-05-16 Jan Hubicka ++ ++ Backported from master: ++ 2021-11-10 Jan Hubicka ++ ++ * ipa-modref-tree.h (modref_tree::remap_params): Fix off-by-one error. ++ ++2022-05-10 Jakub Jelinek ++ ++ Backported from master: ++ 2022-05-10 Jakub Jelinek ++ ++ PR tree-optimization/105528 ++ * gimple-isel.cc (gimple_expand_vec_set_expr): After gsi_remove ++ set *gsi to gsi_for_stmt (ass_stmt). Fix up function comment. ++ ++2022-05-10 Eric Botcazou ++ ++ PR target/105292 ++ * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): Return ++ true only for 8-byte vector modes. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-28 Jakub Jelinek ++ ++ PR target/105331 ++ * config/i386/i386.c (ix86_gimplify_va_arg): Mark va_arg_tmp ++ temporary TREE_ADDRESSABLE before trying to gimplify ADDR_EXPR ++ of it. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-27 Jakub Jelinek ++ ++ PR sanitizer/105396 ++ * asan.c (asan_redzone_buffer::emit_redzone_byte): Handle the case ++ where offset is bigger than off but smaller than m_prev_offset + 32 ++ bits by pushing one or more 0 bytes. Sink the ++ m_shadow_bytes.safe_push (value); flush_if_full (); statements from ++ all cases to the end of the function. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-22 Jakub Jelinek ++ ++ PR rtl-optimization/105333 ++ * rtlanal.c (replace_rtx): Use simplify_subreg or ++ simplify_unary_operation if CONST_SCALAR_INT_P rather than just ++ CONST_INT_P. ++ ++2022-04-27 Hongyu Wang ++ ++ Backported from master: ++ 2022-04-25 Hongyu Wang ++ ++ PR target/105339 ++ * config/i386/avx512fintrin.h (_mm512_scalef_round_pd): ++ Add parentheses for parameters and djust format. ++ (_mm512_mask_scalef_round_pd): Ditto. ++ (_mm512_maskz_scalef_round_pd): Ditto. ++ (_mm512_scalef_round_ps): Ditto. ++ (_mm512_mask_scalef_round_ps): Ditto. ++ (_mm512_maskz_scalef_round_ps): Ditto. ++ (_mm_scalef_round_sd): Use _mm_undefined_pd. ++ (_mm_scalef_round_ss): Use _mm_undefined_ps. ++ (_mm_mask_scalef_round_sd): New macro. ++ (_mm_mask_scalef_round_ss): Ditto. ++ (_mm_maskz_scalef_round_sd): Ditto. ++ (_mm_maskz_scalef_round_ss): Ditto. ++ ++2022-04-21 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-19 Jakub Jelinek ++ ++ PR target/105257 ++ * config/sparc/sparc.c (epilogue_renumber): If ORIGINAL_REGNO, ++ use gen_raw_REG instead of gen_rtx_REG and copy over also ++ ORIGINAL_REGNO. Use return 0; instead of /* fallthrough */. ++ ++2022-04-21 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-21 Jakub Jelinek ++ ++ PR debug/105203 ++ * emit-rtl.c (emit_copy_of_insn_after): Don't call mark_jump_label ++ on DEBUG_INSNs. ++ ++2022-04-21 Sergei Trofimovich ++ ++ Backported from master: ++ 2022-04-19 Sergei Trofimovich ++ ++ PR gcov-profile/105282 ++ * value-prof.c (stream_out_histogram_value): Allow negative counts ++ on HIST_TYPE_INDIR_CALL. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/gcc/DATESTAMP ++++ b/src/gcc/DATESTAMP +@@ -1 +1 @@ +-20220421 ++20220519 +--- a/src/gcc/analyzer/ChangeLog ++++ b/src/gcc/analyzer/ChangeLog +@@ -1,3 +1,20 @@ ++2022-04-28 David Malcolm ++ ++ PR analyzer/105365 ++ PR analyzer/105366 ++ * svalue.cc ++ (cmp_cst): Rename to... ++ (cmp_csts_same_type): ...this. Convert all recursive calls to ++ calls to... ++ (cmp_csts_and_types): ....this new function. ++ (svalue::cmp_ptr): Update for renaming of cmp_cst ++ ++2022-04-28 David Malcolm ++ ++ PR analyzer/105252 ++ * svalue.cc (cmp_cst): When comparing VECTOR_CSTs, compare the ++ types of the encoded elements before calling cmp_cst on them. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/gcc/analyzer/svalue.cc ++++ b/src/gcc/analyzer/svalue.cc +@@ -59,6 +59,8 @@ along with GCC; see the file COPYING3. If not see + + namespace ana { + ++static int cmp_csts_and_types (const_tree cst1, const_tree cst2); ++ + /* class svalue and its various subclasses. */ + + /* class svalue. */ +@@ -276,7 +278,7 @@ svalue::implicitly_live_p (const svalue_set *, const region_model *) const + of the same type. */ + + static int +-cmp_cst (const_tree cst1, const_tree cst2) ++cmp_csts_same_type (const_tree cst1, const_tree cst2) + { + gcc_assert (TREE_TYPE (cst1) == TREE_TYPE (cst2)); + gcc_assert (TREE_CODE (cst1) == TREE_CODE (cst2)); +@@ -295,9 +297,10 @@ cmp_cst (const_tree cst1, const_tree cst2) + TREE_REAL_CST_PTR (cst2), + sizeof (real_value)); + case COMPLEX_CST: +- if (int cmp_real = cmp_cst (TREE_REALPART (cst1), TREE_REALPART (cst2))) ++ if (int cmp_real = cmp_csts_and_types (TREE_REALPART (cst1), ++ TREE_REALPART (cst2))) + return cmp_real; +- return cmp_cst (TREE_IMAGPART (cst1), TREE_IMAGPART (cst2)); ++ return cmp_csts_and_types (TREE_IMAGPART (cst1), TREE_IMAGPART (cst2)); + case VECTOR_CST: + if (int cmp_log2_npatterns + = ((int)VECTOR_CST_LOG2_NPATTERNS (cst1) +@@ -309,13 +312,29 @@ cmp_cst (const_tree cst1, const_tree cst2) + return cmp_nelts_per_pattern; + unsigned encoded_nelts = vector_cst_encoded_nelts (cst1); + for (unsigned i = 0; i < encoded_nelts; i++) +- if (int el_cmp = cmp_cst (VECTOR_CST_ENCODED_ELT (cst1, i), +- VECTOR_CST_ENCODED_ELT (cst2, i))) +- return el_cmp; ++ { ++ const_tree elt1 = VECTOR_CST_ENCODED_ELT (cst1, i); ++ const_tree elt2 = VECTOR_CST_ENCODED_ELT (cst2, i); ++ if (int el_cmp = cmp_csts_and_types (elt1, elt2)) ++ return el_cmp; ++ } + return 0; + } + } + ++/* Comparator for imposing a deterministic order on constants that might ++ not be of the same type. */ ++ ++static int ++cmp_csts_and_types (const_tree cst1, const_tree cst2) ++{ ++ int t1 = TYPE_UID (TREE_TYPE (cst1)); ++ int t2 = TYPE_UID (TREE_TYPE (cst2)); ++ if (int cmp_type = t1 - t2) ++ return cmp_type; ++ return cmp_csts_same_type (cst1, cst2); ++} ++ + /* Comparator for imposing a deterministic order on svalues. */ + + int +@@ -347,7 +366,7 @@ svalue::cmp_ptr (const svalue *sval1, const svalue *sval2) + const constant_svalue *constant_sval2 = (const constant_svalue *)sval2; + const_tree cst1 = constant_sval1->get_constant (); + const_tree cst2 = constant_sval2->get_constant (); +- return cmp_cst (cst1, cst2); ++ return cmp_csts_same_type (cst1, cst2); + } + break; + case SK_UNKNOWN: +--- a/src/gcc/asan.c ++++ b/src/gcc/asan.c +@@ -1497,10 +1497,14 @@ asan_redzone_buffer::emit_redzone_byte (HOST_WIDE_INT offset, + HOST_WIDE_INT off + = m_prev_offset + ASAN_SHADOW_GRANULARITY * m_shadow_bytes.length (); + if (off == offset) ++ /* Consecutive shadow memory byte. */; ++ else if (offset < m_prev_offset + (HOST_WIDE_INT) (ASAN_SHADOW_GRANULARITY ++ * RZ_BUFFER_SIZE) ++ && !m_shadow_bytes.is_empty ()) + { +- /* Consecutive shadow memory byte. */ +- m_shadow_bytes.safe_push (value); +- flush_if_full (); ++ /* Shadow memory byte with a small gap. */ ++ for (; off < offset; off += ASAN_SHADOW_GRANULARITY) ++ m_shadow_bytes.safe_push (0); + } + else + { +@@ -1521,9 +1525,9 @@ asan_redzone_buffer::emit_redzone_byte (HOST_WIDE_INT offset, + m_shadow_mem = adjust_address (m_shadow_mem, VOIDmode, + diff >> ASAN_SHADOW_SHIFT); + m_prev_offset = offset; +- m_shadow_bytes.safe_push (value); +- flush_if_full (); + } ++ m_shadow_bytes.safe_push (value); ++ flush_if_full (); + } + + /* Emit RTX emission of the content of the buffer. */ +--- a/src/gcc/c-family/ChangeLog ++++ b/src/gcc/c-family/ChangeLog +@@ -1,3 +1,12 @@ ++2022-04-28 Patrick Palka ++ ++ Backported from master: ++ 2022-04-26 Patrick Palka ++ ++ PR c++/105304 ++ * c-common.c (verify_tree) [restart]: Move up to before the ++ NULL test. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/gcc/c-family/c-common.c ++++ b/src/gcc/c-family/c-common.c +@@ -1854,12 +1854,12 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp, + enum tree_code code; + enum tree_code_class cl; + ++ restart: + /* X may be NULL if it is the operand of an empty statement expression + ({ }). */ + if (x == NULL) + return; + +- restart: + code = TREE_CODE (x); + cl = TREE_CODE_CLASS (code); + +--- a/src/gcc/config/aarch64/aarch64-protos.h ++++ b/src/gcc/config/aarch64/aarch64-protos.h +@@ -1034,7 +1034,7 @@ bool aarch64_high_bits_all_ones_p (HOST_WIDE_INT); + + struct atomic_ool_names + { +- const char *str[5][4]; ++ const char *str[5][5]; + }; + + rtx aarch64_atomic_ool_func(machine_mode mode, rtx model_rtx, +--- a/src/gcc/config/aarch64/aarch64.c ++++ b/src/gcc/config/aarch64/aarch64.c +@@ -21627,14 +21627,14 @@ aarch64_emit_unlikely_jump (rtx insn) + add_reg_br_prob_note (jump, profile_probability::very_unlikely ()); + } + +-/* We store the names of the various atomic helpers in a 5x4 array. ++/* We store the names of the various atomic helpers in a 5x5 array. + Return the libcall function given MODE, MODEL and NAMES. */ + + rtx + aarch64_atomic_ool_func(machine_mode mode, rtx model_rtx, + const atomic_ool_names *names) + { +- memmodel model = memmodel_base (INTVAL (model_rtx)); ++ memmodel model = memmodel_from_int (INTVAL (model_rtx)); + int mode_idx, model_idx; + + switch (mode) +@@ -21674,6 +21674,11 @@ aarch64_atomic_ool_func(machine_mode mode, rtx model_rtx, + case MEMMODEL_SEQ_CST: + model_idx = 3; + break; ++ case MEMMODEL_SYNC_ACQUIRE: ++ case MEMMODEL_SYNC_RELEASE: ++ case MEMMODEL_SYNC_SEQ_CST: ++ model_idx = 4; ++ break; + default: + gcc_unreachable (); + } +@@ -21686,7 +21691,8 @@ aarch64_atomic_ool_func(machine_mode mode, rtx model_rtx, + { "__aarch64_" #B #N "_relax", \ + "__aarch64_" #B #N "_acq", \ + "__aarch64_" #B #N "_rel", \ +- "__aarch64_" #B #N "_acq_rel" } ++ "__aarch64_" #B #N "_acq_rel", \ ++ "__aarch64_" #B #N "_sync" } + + #define DEF4(B) DEF0(B, 1), DEF0(B, 2), DEF0(B, 4), DEF0(B, 8), \ + { NULL, NULL, NULL, NULL } +--- a/src/gcc/config/i386/avx512fintrin.h ++++ b/src/gcc/config/i386/avx512fintrin.h +@@ -3244,31 +3244,67 @@ _mm_maskz_scalef_round_ss (__mmask8 __U, __m128 __A, __m128 __B, const int __R) + (__mmask8) __U, __R); + } + #else +-#define _mm512_scalef_round_pd(A, B, C) \ +- (__m512d)__builtin_ia32_scalefpd512_mask(A, B, (__v8df)_mm512_undefined_pd(), -1, C) +- +-#define _mm512_mask_scalef_round_pd(W, U, A, B, C) \ +- (__m512d)__builtin_ia32_scalefpd512_mask(A, B, W, U, C) +- +-#define _mm512_maskz_scalef_round_pd(U, A, B, C) \ +- (__m512d)__builtin_ia32_scalefpd512_mask(A, B, (__v8df)_mm512_setzero_pd(), U, C) ++#define _mm512_scalef_round_pd(A, B, C) \ ++ ((__m512d) \ ++ __builtin_ia32_scalefpd512_mask((A), (B), \ ++ (__v8df) _mm512_undefined_pd(), \ ++ -1, (C))) ++ ++#define _mm512_mask_scalef_round_pd(W, U, A, B, C) \ ++ ((__m512d) __builtin_ia32_scalefpd512_mask((A), (B), (W), (U), (C))) ++ ++#define _mm512_maskz_scalef_round_pd(U, A, B, C) \ ++ ((__m512d) \ ++ __builtin_ia32_scalefpd512_mask((A), (B), \ ++ (__v8df) _mm512_setzero_pd(), \ ++ (U), (C))) ++ ++#define _mm512_scalef_round_ps(A, B, C) \ ++ ((__m512) \ ++ __builtin_ia32_scalefps512_mask((A), (B), \ ++ (__v16sf) _mm512_undefined_ps(), \ ++ -1, (C))) ++ ++#define _mm512_mask_scalef_round_ps(W, U, A, B, C) \ ++ ((__m512) __builtin_ia32_scalefps512_mask((A), (B), (W), (U), (C))) ++ ++#define _mm512_maskz_scalef_round_ps(U, A, B, C) \ ++ ((__m512) \ ++ __builtin_ia32_scalefps512_mask((A), (B), \ ++ (__v16sf) _mm512_setzero_ps(), \ ++ (U), (C))) ++ ++#define _mm_scalef_round_sd(A, B, C) \ ++ ((__m128d) \ ++ __builtin_ia32_scalefsd_mask_round ((A), (B), \ ++ (__v2df) _mm_undefined_pd (), \ ++ -1, (C))) + +-#define _mm512_scalef_round_ps(A, B, C) \ +- (__m512)__builtin_ia32_scalefps512_mask(A, B, (__v16sf)_mm512_undefined_ps(), -1, C) ++#define _mm_scalef_round_ss(A, B, C) \ ++ ((__m128) \ ++ __builtin_ia32_scalefss_mask_round ((A), (B), \ ++ (__v4sf) _mm_undefined_ps (), \ ++ -1, (C))) + +-#define _mm512_mask_scalef_round_ps(W, U, A, B, C) \ +- (__m512)__builtin_ia32_scalefps512_mask(A, B, W, U, C) ++#define _mm_mask_scalef_round_sd(W, U, A, B, C) \ ++ ((__m128d) \ ++ __builtin_ia32_scalefsd_mask_round ((A), (B), (W), (U), (C))) + +-#define _mm512_maskz_scalef_round_ps(U, A, B, C) \ +- (__m512)__builtin_ia32_scalefps512_mask(A, B, (__v16sf)_mm512_setzero_ps(), U, C) ++#define _mm_mask_scalef_round_ss(W, U, A, B, C) \ ++ ((__m128) \ ++ __builtin_ia32_scalefss_mask_round ((A), (B), (W), (U), (C))) + +-#define _mm_scalef_round_sd(A, B, C) \ +- (__m128d)__builtin_ia32_scalefsd_mask_round (A, B, \ +- (__v2df)_mm_setzero_pd (), -1, C) ++#define _mm_maskz_scalef_round_sd(U, A, B, C) \ ++ ((__m128d) \ ++ __builtin_ia32_scalefsd_mask_round ((A), (B), \ ++ (__v2df) _mm_setzero_pd (), \ ++ (U), (C))) + +-#define _mm_scalef_round_ss(A, B, C) \ +- (__m128)__builtin_ia32_scalefss_mask_round (A, B, \ +- (__v4sf)_mm_setzero_ps (), -1, C) ++#define _mm_maskz_scalef_round_ss(U, A, B, C) \ ++ ((__m128) \ ++ __builtin_ia32_scalefss_mask_round ((A), (B), \ ++ (__v4sf) _mm_setzero_ps (), \ ++ (U), (C))) + #endif + + #define _mm_mask_scalef_sd(W, U, A, B) \ +--- a/src/gcc/config/i386/i386.c ++++ b/src/gcc/config/i386/i386.c +@@ -4754,6 +4754,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + { + int i, prev_size = 0; + tree temp = create_tmp_var (type, "va_arg_tmp"); ++ TREE_ADDRESSABLE (temp) = 1; + + /* addr = &temp; */ + t = build1 (ADDR_EXPR, build_pointer_type (type), temp); +--- a/src/gcc/config/sparc/sparc.c ++++ b/src/gcc/config/sparc/sparc.c +@@ -8956,8 +8956,20 @@ epilogue_renumber (rtx *where, int test) + if (REGNO (*where) >= 8 && REGNO (*where) < 24) /* oX or lX */ + return 1; + if (! test && REGNO (*where) >= 24 && REGNO (*where) < 32) +- *where = gen_rtx_REG (GET_MODE (*where), OUTGOING_REGNO (REGNO(*where))); +- /* fallthrough */ ++ { ++ if (ORIGINAL_REGNO (*where)) ++ { ++ rtx n = gen_raw_REG (GET_MODE (*where), ++ OUTGOING_REGNO (REGNO (*where))); ++ ORIGINAL_REGNO (n) = ORIGINAL_REGNO (*where); ++ *where = n; ++ } ++ else ++ *where = gen_rtx_REG (GET_MODE (*where), ++ OUTGOING_REGNO (REGNO (*where))); ++ } ++ return 0; ++ + case SCRATCH: + case CC0: + case PC: +@@ -13074,9 +13086,9 @@ sparc_vectorize_vec_perm_const (machine_mode vmode, rtx target, rtx op0, + if (!TARGET_VIS2) + return false; + +- /* All permutes are supported. */ ++ /* All 8-byte permutes are supported. */ + if (!target) +- return true; ++ return GET_MODE_SIZE (vmode) == 8; + + /* Force target-independent code to convert constant permutations on other + modes down to V8QI. Rely on this to avoid the complexity of the byte +--- a/src/gcc/cp/ChangeLog ++++ b/src/gcc/cp/ChangeLog +@@ -1,3 +1,162 @@ ++2022-05-13 Jason Merrill ++ ++ PR c++/101442 ++ * decl.c (cp_finish_decl): Don't pass decl to push_cleanup. ++ * init.c (perform_member_init): Likewise. ++ * semantics.c (push_cleanup): Adjust comment. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/101698 ++ * pt.c (tsubst_baselink): Also check dependent optype. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/65211 ++ * pt.c (tsubst_decl) [TYPE_DECL]: Copy TYPE_ALIGN. ++ ++2022-05-13 Patrick Palka ++ ++ Backported from master: ++ 2021-09-27 Patrick Palka ++ ++ PR c++/102479 ++ * pt.c (rewrite_template_parm): Handle single-level tsubst_args. ++ Avoid a tree cycle when assigning the DECL_TEMPLATE_PARMS for a ++ rewritten ttp. ++ (alias_ctad_tweaks): Set current_template_parms accordingly. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/102300 ++ * parser.c (cp_parser_template_name): Use dependent_scope_p. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/102629 ++ * pt.c (gen_elem_of_pack_expansion_instantiation): Clear ++ TEMPLATE_TYPE_PARAMETER_PACK on auto. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/104646 ++ * constexpr.c (maybe_save_constexpr_fundef): Don't do extra ++ checks for defaulted ctors. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/82980 ++ * lambda.c (type_deducible_expression_p): New. ++ (lambda_capture_field_type): Check it. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/105265 ++ PR c++/100838 ++ * call.c (build_user_type_conversion_1): Drop ++ flag_elide_constructors check. ++ (convert_like_internal): Likewise. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/105245 ++ PR c++/100111 ++ * constexpr.c (cxx_eval_store_expression): Build a CONSTRUCTOR ++ as needed in empty base handling. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/104669 ++ * decl.c (decls_match): Compare versions even if not recording. ++ (duplicate_decls): Propagate attributes to alias. ++ * decl2.c (find_last_decl): Give up if versioned. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/102071 ++ * init.c (build_new_1): Include cookie in alignment. Omit ++ constexpr wrapper from alloc_call. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/104142 ++ * decl.c (check_initializer): Check TREE_SIDE_EFFECTS. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-05-04 Jakub Jelinek ++ ++ * lambda.c: Include decl.h. ++ (maybe_add_lambda_conv_op): Temporarily override deprecated_state to ++ DEPRECATED_SUPPRESS. ++ ++2022-04-28 Patrick Palka ++ ++ Backported from master: ++ 2022-04-26 Patrick Palka ++ ++ PR c++/105386 ++ * semantics.c (finish_decltype_type): Pass tf_decltype to ++ instantiate_non_dependent_expr_sfinae. ++ ++2022-04-28 Patrick Palka ++ ++ Backported from master: ++ 2022-04-26 Patrick Palka ++ ++ PR c++/105289 ++ PR c++/86193 ++ * pt.c (process_partial_specialization): Downgrade "partial ++ specialization isn't more specialized" diagnostic from permerror ++ to an on-by-default pedwarn. ++ (unify) : When substituting into the ++ NTTP type a second time, use the original type not the ++ substituted type. ++ ++2022-04-28 Marek Polacek ++ ++ Backported from master: ++ 2022-04-28 Marek Polacek ++ ++ PR c++/90107 ++ * parser.c (cp_parser_class_specifier_1): Accept :: after a class ++ definition. ++ ++2022-04-27 Marek Polacek ++ ++ Backported from master: ++ 2022-04-27 Marek Polacek ++ ++ PR c++/105398 ++ * pt.c (uses_template_parms): Return false for any NAMESPACE_DECL. ++ ++2022-04-22 Marek Polacek ++ ++ Backported from master: ++ 2022-04-21 Marek Polacek ++ ++ PR c++/105321 ++ * constexpr.c (cxx_eval_logical_expression): Always pass false for lval ++ to cxx_eval_constant_expression. ++ ++2022-04-22 Marek Polacek ++ ++ Backported from master: ++ 2022-04-13 Marek Polacek ++ ++ PR c++/97296 ++ * call.c (direct_reference_binding): strip_top_quals when creating ++ a ck_qual. ++ ++2022-04-21 Matthias Kretz ++ ++ Backported from master: ++ 2021-12-19 Matthias Kretz ++ ++ * module.cc (trees_out::get_merge_kind): NAMESPACE_DECLs also ++ cannot have a DECL_TEMPLATE_INFO. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/gcc/cp/call.c ++++ b/src/gcc/cp/call.c +@@ -1683,8 +1683,19 @@ direct_reference_binding (tree type, conversion *conv) + because the types "int *" and "const int *const" are + reference-related and we were binding both directly and they + had the same rank. To break it up, we add a ck_qual under the +- ck_ref_bind so that conversion sequence ranking chooses #1. */ +- conv = build_conv (ck_qual, t, conv); ++ ck_ref_bind so that conversion sequence ranking chooses #1. ++ ++ We strip_top_quals here which is also what standard_conversion ++ does. Failure to do so would confuse comp_cv_qual_signature ++ into thinking that in ++ ++ void f(const int * const &); // #1 ++ void f(const int *); // #2 ++ int *x; ++ f(x); ++ ++ #2 is a better match than #1 even though they're ambiguous (97296). */ ++ conv = build_conv (ck_qual, strip_top_quals (t), conv); + + return build_conv (ck_ref_bind, type, conv); + } +@@ -4117,7 +4128,8 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags, + We represent this in the conversion sequence with an + rvalue conversion, which means a constructor call. */ + if (!TYPE_REF_P (totype) +- && (flag_elide_constructors || (flags & LOOKUP_ONLYCONVERTING)) ++ && cxx_dialect < cxx17 ++ && (flags & LOOKUP_ONLYCONVERTING) + && !(convflags & LOOKUP_NO_TEMP_BIND)) + cand->second_conv + = build_conv (ck_rvalue, totype, cand->second_conv); +@@ -7804,13 +7816,10 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum, + break; + }; + +- tsubst_flags_t sub_complain = complain; +- if (!flag_elide_constructors) +- sub_complain &= ~tf_no_cleanup; + expr = convert_like (next_conversion (convs), expr, fn, argnum, + convs->kind == ck_ref_bind + ? issue_conversion_warnings : false, +- c_cast_p, sub_complain); ++ c_cast_p, complain & ~tf_no_cleanup); + if (expr == error_mark_node) + return error_mark_node; + +--- a/src/gcc/cp/constexpr.c ++++ b/src/gcc/cp/constexpr.c +@@ -890,7 +890,7 @@ maybe_save_constexpr_fundef (tree fun) + if (!potential && !DECL_GENERATED_P (fun)) + require_potential_rvalue_constant_expression (massaged); + +- if (DECL_CONSTRUCTOR_P (fun) ++ if (DECL_CONSTRUCTOR_P (fun) && !DECL_DEFAULTED_FN (fun) + && cx_check_missing_mem_inits (DECL_CONTEXT (fun), + massaged, !DECL_GENERATED_P (fun))) + potential = false; +@@ -4280,19 +4280,18 @@ cxx_eval_bit_cast (const constexpr_ctx *ctx, tree t, bool *non_constant_p, + static tree + cxx_eval_logical_expression (const constexpr_ctx *ctx, tree t, + tree bailout_value, tree continue_value, +- bool lval, +- bool *non_constant_p, bool *overflow_p) ++ bool, bool *non_constant_p, bool *overflow_p) + { + tree r; + tree lhs = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0), +- lval, +- non_constant_p, overflow_p); ++ /*lval*/false, non_constant_p, ++ overflow_p); + VERIFY_CONSTANT (lhs); + if (tree_int_cst_equal (lhs, bailout_value)) + return lhs; + gcc_assert (tree_int_cst_equal (lhs, continue_value)); + r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1), +- lval, non_constant_p, ++ /*lval*/false, non_constant_p, + overflow_p); + VERIFY_CONSTANT (r); + return r; +@@ -5579,6 +5578,12 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, + { + /* See above on initialization of empty bases. */ + gcc_assert (is_empty_class (TREE_TYPE (init)) && !lval); ++ if (!*valp) ++ { ++ /* But do make sure we have something in *valp. */ ++ *valp = build_constructor (type, nullptr); ++ CONSTRUCTOR_NO_CLEARING (*valp) = no_zero_init; ++ } + return init; + } + else +--- a/src/gcc/cp/decl.c ++++ b/src/gcc/cp/decl.c +@@ -1059,11 +1059,14 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */) + if (types_match + && !DECL_EXTERN_C_P (newdecl) + && !DECL_EXTERN_C_P (olddecl) +- && record_versions +- && maybe_version_functions (newdecl, olddecl, +- (!DECL_FUNCTION_VERSIONED (newdecl) +- || !DECL_FUNCTION_VERSIONED (olddecl)))) +- return 0; ++ && targetm.target_option.function_versions (newdecl, olddecl)) ++ { ++ if (record_versions) ++ maybe_version_functions (newdecl, olddecl, ++ (!DECL_FUNCTION_VERSIONED (newdecl) ++ || !DECL_FUNCTION_VERSIONED (olddecl))); ++ return 0; ++ } + } + else if (TREE_CODE (newdecl) == TEMPLATE_DECL) + { +@@ -2523,7 +2526,12 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) + else + { + retrofit_lang_decl (newdecl); +- DECL_LOCAL_DECL_ALIAS (newdecl) = DECL_LOCAL_DECL_ALIAS (olddecl); ++ tree alias = DECL_LOCAL_DECL_ALIAS (newdecl) ++ = DECL_LOCAL_DECL_ALIAS (olddecl); ++ DECL_ATTRIBUTES (alias) ++ = (*targetm.merge_decl_attributes) (alias, newdecl); ++ if (TREE_CODE (newdecl) == FUNCTION_DECL) ++ merge_attribute_bits (newdecl, alias); + } + } + +@@ -7227,6 +7235,10 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) + if (init && init != error_mark_node) + init_code = build2 (INIT_EXPR, type, decl, init); + ++ if (init_code && !TREE_SIDE_EFFECTS (init_code) ++ && init_code != error_mark_node) ++ init_code = NULL_TREE; ++ + if (init_code) + { + /* We might have set these in cp_finish_decl. */ +@@ -8300,7 +8312,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, + { + unsigned i; tree t; + FOR_EACH_VEC_ELT (*cleanups, i, t) +- push_cleanup (decl, t, false); ++ push_cleanup (NULL_TREE, t, false); + release_tree_vector (cleanups); + } + +--- a/src/gcc/cp/decl2.c ++++ b/src/gcc/cp/decl2.c +@@ -1531,8 +1531,16 @@ find_last_decl (tree decl) + if (TREE_CODE (*iter) == OVERLOAD) + continue; + +- if (decls_match (decl, *iter, /*record_decls=*/false)) +- return *iter; ++ tree d = *iter; ++ ++ /* We can't compare versions in the middle of processing the ++ attribute that has the version. */ ++ if (TREE_CODE (d) == FUNCTION_DECL ++ && DECL_FUNCTION_VERSIONED (d)) ++ return NULL_TREE; ++ ++ if (decls_match (decl, d, /*record_decls=*/false)) ++ return d; + } + return NULL_TREE; + } +--- a/src/gcc/cp/init.c ++++ b/src/gcc/cp/init.c +@@ -911,7 +911,7 @@ perform_member_init (tree member, tree init) + init = build2 (INIT_EXPR, type, decl, init); + finish_expr_stmt (init); + FOR_EACH_VEC_ELT (*cleanups, i, t) +- push_cleanup (decl, t, false); ++ push_cleanup (NULL_TREE, t, false); + } + else if (type_build_ctor_call (type) + || (init && CLASS_TYPE_P (strip_array_types (type)))) +@@ -3079,7 +3079,13 @@ build_new_1 (vec **placement, tree type, tree nelts, + + tree align_arg = NULL_TREE; + if (type_has_new_extended_alignment (elt_type)) +- align_arg = build_int_cst (align_type_node, TYPE_ALIGN_UNIT (elt_type)); ++ { ++ unsigned align = TYPE_ALIGN_UNIT (elt_type); ++ /* Also consider the alignment of the cookie, if any. */ ++ if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)) ++ align = MAX (align, TYPE_ALIGN_UNIT (size_type_node)); ++ align_arg = build_int_cst (align_type_node, align); ++ } + + alloc_fn = NULL_TREE; + +@@ -3261,18 +3267,19 @@ build_new_1 (vec **placement, tree type, tree nelts, + } + } + ++ alloc_expr = alloc_call; + if (cookie_size) +- alloc_call = maybe_wrap_new_for_constexpr (alloc_call, type, ++ alloc_expr = maybe_wrap_new_for_constexpr (alloc_call, type, + cookie_size); + + /* In the simple case, we can stop now. */ + pointer_type = build_pointer_type (type); + if (!cookie_size && !is_initialized) +- return build_nop (pointer_type, alloc_call); ++ return build_nop (pointer_type, alloc_expr); + + /* Store the result of the allocation call in a variable so that we can + use it more than once. */ +- alloc_expr = get_target_expr (alloc_call); ++ alloc_expr = get_target_expr (alloc_expr); + alloc_node = TARGET_EXPR_SLOT (alloc_expr); + + /* Strip any COMPOUND_EXPRs from ALLOC_CALL. */ +--- a/src/gcc/cp/lambda.c ++++ b/src/gcc/cp/lambda.c +@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see + #include "toplev.h" + #include "gimplify.h" + #include "target.h" ++#include "decl.h" + + /* Constructor for a lambda expression. */ + +@@ -202,6 +203,24 @@ lambda_function (tree lambda) + return lambda; + } + ++/* True if EXPR is an expression whose type can be used directly in lambda ++ capture. Not to be used for 'auto'. */ ++ ++static bool ++type_deducible_expression_p (tree expr) ++{ ++ if (!type_dependent_expression_p (expr)) ++ return true; ++ if (BRACE_ENCLOSED_INITIALIZER_P (expr) ++ || TREE_CODE (expr) == EXPR_PACK_EXPANSION) ++ return false; ++ tree t = non_reference (TREE_TYPE (expr)); ++ if (!t) return false; ++ while (TREE_CODE (t) == POINTER_TYPE) ++ t = TREE_TYPE (t); ++ return currently_open_class (t); ++} ++ + /* Returns the type to use for the FIELD_DECL corresponding to the + capture of EXPR. EXPLICIT_INIT_P indicates whether this is a + C++14 init capture, and BY_REFERENCE_P indicates whether we're +@@ -228,7 +247,7 @@ lambda_capture_field_type (tree expr, bool explicit_init_p, + else + type = do_auto_deduction (type, expr, auto_node); + } +- else if (!is_this && type_dependent_expression_p (expr)) ++ else if (!is_this && !type_deducible_expression_p (expr)) + { + type = cxx_make_type (DECLTYPE_TYPE); + DECLTYPE_TYPE_EXPR (type) = expr; +@@ -1177,9 +1196,13 @@ maybe_add_lambda_conv_op (tree type) + } + } + else +- call = build_call_a (callop, +- direct_argvec->length (), +- direct_argvec->address ()); ++ { ++ /* Don't warn on deprecated lambda declarations, unless ++ the lambda is actually called. */ ++ auto du = make_temp_override (deprecated_state, DEPRECATED_SUPPRESS); ++ call = build_call_a (callop, direct_argvec->length (), ++ direct_argvec->address ()); ++ } + + CALL_FROM_THUNK_P (call) = 1; + SET_EXPR_LOCATION (call, UNKNOWN_LOCATION); +--- a/src/gcc/cp/module.cc ++++ b/src/gcc/cp/module.cc +@@ -10059,9 +10059,10 @@ trees_out::get_merge_kind (tree decl, depset *dep) + tree ctx = CP_DECL_CONTEXT (decl); + if (TREE_CODE (ctx) == FUNCTION_DECL) + { +- /* USING_DECLs cannot have DECL_TEMPLATE_INFO -- this isn't +- permitting them to have one. */ ++ /* USING_DECLs and NAMESPACE_DECLs cannot have DECL_TEMPLATE_INFO -- ++ this isn't permitting them to have one. */ + gcc_checking_assert (TREE_CODE (decl) == USING_DECL ++ || TREE_CODE (decl) == NAMESPACE_DECL + || !DECL_LANG_SPECIFIC (decl) + || !DECL_TEMPLATE_INFO (decl)); + +--- a/src/gcc/cp/parser.c ++++ b/src/gcc/cp/parser.c +@@ -17728,7 +17728,7 @@ cp_parser_template_name (cp_parser* parser, + : parser->context->object_type); + if (scope && TYPE_P (scope) + && (!CLASS_TYPE_P (scope) +- || (check_dependency_p && dependent_type_p (scope)))) ++ || (check_dependency_p && dependent_scope_p (scope)))) + { + /* We're optimizing away the call to cp_parser_lookup_name, but + we still need to do this. */ +@@ -17739,8 +17739,8 @@ cp_parser_template_name (cp_parser* parser, + } + + /* cp_parser_lookup_name clears OBJECT_TYPE. */ +- const bool scoped_p = ((parser->scope ? parser->scope +- : parser->context->object_type) != NULL_TREE); ++ tree scope = (parser->scope ? parser->scope ++ : parser->context->object_type); + + /* Look up the name. */ + decl = cp_parser_lookup_name (parser, identifier, +@@ -17753,6 +17753,19 @@ cp_parser_template_name (cp_parser* parser, + + decl = strip_using_decl (decl); + ++ /* 13.3 [temp.names] A < is interpreted as the delimiter of a ++ template-argument-list if it follows a name that is not a ++ conversion-function-id and ++ - that follows the keyword template or a ~ after a nested-name-specifier or ++ in a class member access expression, or ++ - for which name lookup finds the injected-class-name of a class template ++ or finds any declaration of a template, or ++ - that is an unqualified name for which name lookup either finds one or ++ more functions or finds nothing, or ++ - that is a terminal name in a using-declarator (9.9), in a declarator-id ++ (9.3.4), or in a type-only context other than a nested-name-specifier ++ (13.8). */ ++ + /* If DECL is a template, then the name was a template-name. */ + if (TREE_CODE (decl) == TEMPLATE_DECL) + { +@@ -17772,11 +17785,7 @@ cp_parser_template_name (cp_parser* parser, + } + else + { +- /* The standard does not explicitly indicate whether a name that +- names a set of overloaded declarations, some of which are +- templates, is a template-name. However, such a name should +- be a template-name; otherwise, there is no way to form a +- template-id for the overloaded templates. */ ++ /* Look through an overload set for any templates. */ + bool found = false; + + for (lkp_iterator iter (MAYBE_BASELINK_FUNCTIONS (decl)); +@@ -17784,16 +17793,14 @@ cp_parser_template_name (cp_parser* parser, + if (TREE_CODE (*iter) == TEMPLATE_DECL) + found = true; + ++ /* "an unqualified name for which name lookup either finds one or more ++ functions or finds nothing". */ + if (!found + && (cxx_dialect > cxx17) +- && !scoped_p ++ && !scope + && cp_lexer_next_token_is (parser->lexer, CPP_LESS) + && tag_type == none_type) + { +- /* [temp.names] says "A name is also considered to refer to a template +- if it is an unqualified-id followed by a < and name lookup finds +- either one or more functions or finds nothing." */ +- + /* The "more functions" case. Just use the OVERLOAD as normally. + We don't use is_overloaded_fn here to avoid considering + BASELINKs. */ +@@ -17806,6 +17813,13 @@ cp_parser_template_name (cp_parser* parser, + return identifier; + } + ++ /* "that follows the keyword template"..."in a type-only context" */ ++ if (!found && scope ++ && (template_keyword_p || tag_type != none_type) ++ && TYPE_P (scope) && dependent_type_p (scope) ++ && cp_parser_nth_token_starts_template_argument_list_p (parser, 1)) ++ return identifier; ++ + if (!found) + { + /* The name does not name a template. */ +@@ -24967,6 +24981,7 @@ cp_parser_class_specifier_1 (cp_parser* parser) + case CPP_OPEN_PAREN: + case CPP_CLOSE_PAREN: + case CPP_COMMA: ++ case CPP_SCOPE: + want_semicolon = false; + break; + +--- a/src/gcc/cp/pt.c ++++ b/src/gcc/cp/pt.c +@@ -5200,8 +5200,9 @@ process_partial_specialization (tree decl) + && !get_partial_spec_bindings (maintmpl, maintmpl, specargs)) + { + auto_diagnostic_group d; +- if (permerror (input_location, "partial specialization %qD is not " +- "more specialized than", decl)) ++ if (pedwarn (input_location, 0, ++ "partial specialization %qD is not more specialized than", ++ decl)) + inform (DECL_SOURCE_LOCATION (maintmpl), "primary template %qD", + maintmpl); + } +@@ -10889,7 +10890,7 @@ uses_template_parms (tree t) + || uses_template_parms (TREE_CHAIN (t))); + else if (TREE_CODE (t) == TYPE_DECL) + dependent_p = dependent_type_p (TREE_TYPE (t)); +- else if (t == error_mark_node) ++ else if (t == error_mark_node || TREE_CODE (t) == NAMESPACE_DECL) + dependent_p = false; + else + dependent_p = instantiation_dependent_expression_p (t); +@@ -12641,7 +12642,13 @@ gen_elem_of_pack_expansion_instantiation (tree pattern, + t = tsubst_expr (pattern, args, complain, in_decl, + /*integral_constant_expression_p=*/false); + else +- t = tsubst (pattern, args, complain, in_decl); ++ { ++ t = tsubst (pattern, args, complain, in_decl); ++ if (is_auto (t) && !ith_elem_is_expansion) ++ /* When expanding the fake auto... pack expansion from add_capture, we ++ need to mark that the expansion is no longer a pack. */ ++ TEMPLATE_TYPE_PARAMETER_PACK (t) = false; ++ } + + /* If the Ith argument pack element is a pack expansion, then + the Ith element resulting from the substituting is going to +@@ -15110,6 +15117,12 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) + { + DECL_ORIGINAL_TYPE (r) = NULL_TREE; + set_underlying_type (r); ++ ++ /* common_handle_aligned_attribute doesn't apply the alignment ++ to DECL_ORIGINAL_TYPE. */ ++ if (TYPE_USER_ALIGN (TREE_TYPE (t))) ++ TREE_TYPE (r) = build_aligned_type (TREE_TYPE (r), ++ TYPE_ALIGN (TREE_TYPE (t))); + } + + layout_decl (r, 0); +@@ -16404,7 +16417,8 @@ tsubst_baselink (tree baselink, tree object_type, + + tree binfo_type = BINFO_TYPE (BASELINK_BINFO (baselink)); + binfo_type = tsubst (binfo_type, args, complain, in_decl); +- bool dependent_p = binfo_type != BINFO_TYPE (BASELINK_BINFO (baselink)); ++ bool dependent_p = (binfo_type != BINFO_TYPE (BASELINK_BINFO (baselink)) ++ || optype != BASELINK_OPTYPE (baselink)); + + if (dependent_p) + { +@@ -23928,7 +23942,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, + /* Now check whether the type of this parameter is still + dependent, and give up if so. */ + ++processing_template_decl; +- tparm = tsubst (tparm, targs, tf_none, NULL_TREE); ++ tparm = tsubst (TREE_TYPE (parm), targs, tf_none, NULL_TREE); + --processing_template_decl; + if (uses_template_parms (tparm)) + return unify_success (explain_p); +@@ -28726,7 +28740,7 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level, + const int depth = TMPL_ARGS_DEPTH (tsubst_args); + tree ttargs = make_tree_vec (depth + 1); + for (int i = 0; i < depth; ++i) +- TREE_VEC_ELT (ttargs, i) = TREE_VEC_ELT (tsubst_args, i); ++ TREE_VEC_ELT (ttargs, i) = TMPL_ARGS_LEVEL (tsubst_args, i + 1); + TREE_VEC_ELT (ttargs, depth) + = template_parms_level_to_args (ttparms); + // Substitute ttargs into ttparms to fix references to +@@ -28739,8 +28753,17 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level, + ttparms = tsubst_template_parms_level (ttparms, ttargs, + complain); + // Finally, tack the adjusted parms onto tparms. +- ttparms = tree_cons (size_int (depth), ttparms, +- current_template_parms); ++ ttparms = tree_cons (size_int (level + 1), ttparms, ++ copy_node (current_template_parms)); ++ // As with all template template parms, the parameter list captured ++ // by this template template parm that corresponds to its own level ++ // should be empty. This avoids infinite recursion when structurally ++ // comparing two such rewritten template template parms (PR102479). ++ gcc_assert (!TREE_VEC_LENGTH ++ (TREE_VALUE (TREE_CHAIN (DECL_TEMPLATE_PARMS (olddecl))))); ++ gcc_assert (TMPL_PARMS_DEPTH (TREE_CHAIN (ttparms)) == level); ++ TREE_VALUE (TREE_CHAIN (ttparms)) = make_tree_vec (0); ++ // All done. + DECL_TEMPLATE_PARMS (newdecl) = ttparms; + } + } +@@ -29238,6 +29261,11 @@ alias_ctad_tweaks (tree tmpl, tree uguides) + ++ndlen; + tree gtparms = make_tree_vec (natparms + ndlen); + ++ /* Set current_template_parms as in build_deduction_guide. */ ++ auto ctp = make_temp_override (current_template_parms); ++ current_template_parms = copy_node (DECL_TEMPLATE_PARMS (tmpl)); ++ TREE_VALUE (current_template_parms) = gtparms; ++ + /* First copy over the parms of A. */ + for (j = 0; j < natparms; ++j) + TREE_VEC_ELT (gtparms, j) = TREE_VEC_ELT (atparms, j); +--- a/src/gcc/cp/semantics.c ++++ b/src/gcc/cp/semantics.c +@@ -655,7 +655,8 @@ do_pushlevel (scope_kind sk) + + /* Queue a cleanup. CLEANUP is an expression/statement to be executed + when the current scope is exited. EH_ONLY is true when this is not +- meant to apply to normal control flow transfer. */ ++ meant to apply to normal control flow transfer. DECL is the VAR_DECL ++ being cleaned up, if any, or null for temporaries or subobjects. */ + + void + push_cleanup (tree decl, tree cleanup, bool eh_only) +@@ -10220,7 +10221,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, + } + else if (processing_template_decl) + { +- expr = instantiate_non_dependent_expr_sfinae (expr, complain); ++ expr = instantiate_non_dependent_expr_sfinae (expr, complain|tf_decltype); + if (expr == error_mark_node) + return error_mark_node; + } +--- a/src/gcc/emit-rtl.c ++++ b/src/gcc/emit-rtl.c +@@ -6465,7 +6465,8 @@ emit_copy_of_insn_after (rtx_insn *insn, rtx_insn *after) + } + + /* Update LABEL_NUSES. */ +- mark_jump_label (PATTERN (new_rtx), new_rtx, 0); ++ if (NONDEBUG_INSN_P (insn)) ++ mark_jump_label (PATTERN (new_rtx), new_rtx, 0); + + INSN_LOCATION (new_rtx) = INSN_LOCATION (insn); + +--- a/src/gcc/fortran/ChangeLog ++++ b/src/gcc/fortran/ChangeLog +@@ -1,3 +1,30 @@ ++2022-05-16 Harald Anlauf ++ ++ Backported from master: ++ 2022-05-11 Harald Anlauf ++ Steven G. Kargl ++ ++ PR fortran/105230 ++ * expr.c (find_array_section): Correct logic to avoid NULL ++ pointer dereference on invalid array section. ++ ++2022-05-16 Harald Anlauf ++ ++ Backported from master: ++ 2022-03-09 Harald Anlauf ++ ++ PR fortran/104849 ++ * expr.c (find_array_section): Avoid NULL pointer dereference on ++ invalid array section. ++ ++2022-04-21 Fritz Reese ++ ++ Backported from master: ++ 2022-04-21 Fritz Reese ++ ++ PR fortran/105310 ++ * trans-expr.c (gfc_conv_union_initializer): Pass vec* by reference. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/gcc/fortran/expr.c ++++ b/src/gcc/fortran/expr.c +@@ -1591,7 +1591,9 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) + { + if ((begin && begin->expr_type != EXPR_CONSTANT) + || (finish && finish->expr_type != EXPR_CONSTANT) +- || (step && step->expr_type != EXPR_CONSTANT)) ++ || (step && step->expr_type != EXPR_CONSTANT) ++ || !lower ++ || !upper) + { + t = false; + goto cleanup; +--- a/src/gcc/fortran/trans-expr.c ++++ b/src/gcc/fortran/trans-expr.c +@@ -8782,8 +8782,8 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray) + return gfc_finish_block (&block); + } + +-void +-gfc_conv_union_initializer (vec *v, ++static void ++gfc_conv_union_initializer (vec *&v, + gfc_component *un, gfc_expr *init) + { + gfc_constructor *ctor; +--- a/src/gcc/gimple-isel.cc ++++ b/src/gcc/gimple-isel.cc +@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see + /* Expand all ARRAY_REF(VIEW_CONVERT_EXPR) gimple assignments into calls to + internal function based on vector type of selected expansion. + i.e.: +- VIEW_CONVERT_EXPR(u)[_1] = = i_4(D); ++ VIEW_CONVERT_EXPR(u)[_1] = i_4(D); + => + _7 = u; + _8 = .VEC_SET (_7, i_4(D), _1); +@@ -100,6 +100,7 @@ gimple_expand_vec_set_expr (gimple_stmt_iterator *gsi) + + gimple_move_vops (ass_stmt, stmt); + gsi_remove (gsi, true); ++ *gsi = gsi_for_stmt (ass_stmt); + } + } + +--- a/src/gcc/ipa-modref-tree.h ++++ b/src/gcc/ipa-modref-tree.h +@@ -560,7 +560,7 @@ struct GTY((user)) modref_tree + size_t k; + modref_access_node *access_node; + FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node) +- if (access_node->parm_index > 0) ++ if (access_node->parm_index >= 0) + { + if (access_node->parm_index < (int)map->length ()) + access_node->parm_index = (*map)[access_node->parm_index]; +--- a/src/gcc/rtlanal.c ++++ b/src/gcc/rtlanal.c +@@ -3405,7 +3405,7 @@ replace_rtx (rtx x, rtx from, rtx to, bool all_regs) + { + rtx new_rtx = replace_rtx (SUBREG_REG (x), from, to, all_regs); + +- if (CONST_INT_P (new_rtx)) ++ if (CONST_SCALAR_INT_P (new_rtx)) + { + x = simplify_subreg (GET_MODE (x), new_rtx, + GET_MODE (SUBREG_REG (x)), +@@ -3421,7 +3421,7 @@ replace_rtx (rtx x, rtx from, rtx to, bool all_regs) + { + rtx new_rtx = replace_rtx (XEXP (x, 0), from, to, all_regs); + +- if (CONST_INT_P (new_rtx)) ++ if (CONST_SCALAR_INT_P (new_rtx)) + { + x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x), + new_rtx, GET_MODE (XEXP (x, 0))); +--- a/src/gcc/testsuite/ChangeLog ++++ b/src/gcc/testsuite/ChangeLog +@@ -1,3 +1,317 @@ ++2022-05-16 Harald Anlauf ++ ++ Backported from master: ++ 2022-05-11 Harald Anlauf ++ Steven G. Kargl ++ ++ PR fortran/105230 ++ * gfortran.dg/pr105230.f90: New test. ++ ++2022-05-16 Harald Anlauf ++ ++ Backported from master: ++ 2022-03-09 Harald Anlauf ++ ++ PR fortran/104849 ++ * gfortran.dg/pr104849.f90: New test. ++ ++2022-05-16 Sebastian Pop ++ ++ PR target/105162 ++ * gcc.target/aarch64/sync-comp-swap-ool.c: New. ++ * gcc.target/aarch64/sync-op-acquire-ool.c: New. ++ * gcc.target/aarch64/sync-op-full-ool.c: New. ++ * gcc.target/aarch64/target_attr_20.c: Update check. ++ * gcc.target/aarch64/target_attr_21.c: Same. ++ ++2022-05-16 Richard Biener ++ ++ Backported from master: ++ 2022-05-16 Richard Biener ++ ++ * gcc.dg/torture/pr105598.c: New testcase. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/101442 ++ * g++.dg/cpp0x/initlist-nrv1.C: New test. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/101698 ++ * g++.dg/template/conv19.C: New test. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/65211 ++ * g++.target/i386/vec-tmpl1.C: New test. ++ ++2022-05-13 Patrick Palka ++ ++ Backported from master: ++ 2021-09-27 Patrick Palka ++ ++ PR c++/102479 ++ * g++.dg/cpp1z/class-deduction12.C: Also test alias CTAD in the ++ same way. ++ * g++.dg/cpp1z/class-deduction99.C: New test. ++ ++2022-05-13 Jason Merrill ++ ++ PR c++/102300 ++ * g++.dg/parse/no-typename1.C: Remove expected error. ++ * g++.dg/template/nested7.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/102629 ++ * g++.dg/cpp2a/lambda-pack-init7.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/104646 ++ * g++.dg/cpp0x/constexpr-fno-elide-ctors1.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/82980 ++ * g++.dg/cpp0x/lambda/lambda-current-inst1.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/105265 ++ PR c++/100838 ++ * g++.dg/cpp0x/initlist-new6.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/105245 ++ PR c++/100111 ++ * g++.dg/cpp1y/constexpr-empty2.C: Add -fno-elide-constructors. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/104669 ++ * g++.target/i386/mv31.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/102071 ++ * g++.dg/cpp1z/aligned-new9.C: New test. ++ ++2022-05-12 Jason Merrill ++ ++ PR c++/104142 ++ * g++.dg/opt/const7.C: New test. ++ ++2022-05-10 H.J. Lu ++ ++ Backported from master: ++ 2022-05-10 H.J. Lu ++ ++ PR target/105472 ++ * gcc.target/i386/iamcu/asm-support.S: Add .note.GNU-stack section ++ only for Linux. ++ * gcc.target/x86_64/abi/asm-support.S: Likewise. ++ * gcc.target/x86_64/abi/avx/asm-support.S: Likewise. ++ * gcc.target/x86_64/abi/avx512f/asm-support.S: Likewise. ++ * gcc.target/x86_64/abi/ms-sysv/do-test.S: Likewise. ++ ++2022-05-10 Jakub Jelinek ++ ++ Backported from master: ++ 2022-05-10 Jakub Jelinek ++ ++ PR tree-optimization/105528 ++ * gcc.dg/pr105528.c: New test. ++ ++2022-05-10 Jeff Law ++ ++ Backported from master: ++ 2022-04-28 Jeff Law ++ ++ * lib/prune.exp (prune_gcc_output): Prune new linker warning. ++ ++2022-05-10 Eric Botcazou ++ ++ * gcc.target/sparc/20220510-1.c: New test. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-05-04 Jakub Jelinek ++ ++ * g++.dg/cpp23/lambda-attr1.C: New test. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-28 Jakub Jelinek ++ ++ PR target/105331 ++ * gcc.dg/pr105331.c: New test. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-27 Jakub Jelinek ++ ++ PR sanitizer/105396 ++ * gcc.dg/asan/pr105396.c: New test. ++ ++2022-05-06 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-22 Jakub Jelinek ++ ++ PR rtl-optimization/105333 ++ * gcc.dg/pr105333.c: New test. ++ ++2022-05-06 H.J. Lu ++ ++ Backported from master: ++ 2022-05-02 H.J. Lu ++ ++ PR testsuite/105433 ++ * gcc.target/i386/iamcu/asm-support.S: Add .note.GNU-stack. ++ * gcc.target/x86_64/abi/asm-support.S: Likewise. ++ * gcc.target/x86_64/abi/avx/asm-support.S: Likewise. ++ * gcc.target/x86_64/abi/avx512f/asm-support.S: Likewise. ++ * gcc.target/x86_64/abi/ms-sysv/do-test.S: Likewise. ++ ++2022-05-03 Alexandre Oliva ++ ++ Backported from master: ++ 2022-05-03 Alexandre Oliva ++ ++ * gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c: Update ++ the expected message for the case in which unaligned accesses ++ are not allowed. ++ ++2022-04-28 David Malcolm ++ ++ PR analyzer/105365 ++ PR analyzer/105366 ++ * gcc.dg/analyzer/pr105365.c: New test. ++ * gcc.dg/analyzer/pr105366.c: New test. ++ ++2022-04-28 David Malcolm ++ ++ PR analyzer/105252 ++ * gcc.dg/analyzer/pr105252.c: New test. ++ ++2022-04-28 Patrick Palka ++ ++ Backported from master: ++ 2022-04-26 Patrick Palka ++ ++ PR c++/105386 ++ * g++.dg/cpp0x/decltype81.C: New test. ++ ++2022-04-28 Patrick Palka ++ ++ Backported from master: ++ 2022-04-26 Patrick Palka ++ ++ PR c++/105304 ++ * g++.dg/cpp2a/concepts-requires30.C: New test. ++ ++2022-04-28 Patrick Palka ++ ++ Backported from master: ++ 2022-04-26 Patrick Palka ++ ++ PR c++/105289 ++ PR c++/86193 ++ * g++.dg/template/partial-specialization11.C: New test. ++ * g++.dg/template/partial-specialization12.C: New test. ++ ++2022-04-28 Marek Polacek ++ ++ Backported from master: ++ 2022-04-28 Marek Polacek ++ ++ PR c++/90107 ++ * g++.dg/parse/qualified6.C: New test. ++ ++2022-04-28 Tamar Christina ++ ++ PR testsuite/105095 ++ * gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c: Update for ++ codegen. ++ * gcc.dg/vect/complex/fast-math-complex-add-double.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-add-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-add-half-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c: ++ Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mla-half-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mls-double.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mls-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mls-half-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mul-double.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mul-float.c: Likewise. ++ * gcc.dg/vect/complex/fast-math-complex-mul-half-float.c: Likewise. ++ * gcc.dg/vect/vect.exp: Add extra letter to filter. ++ ++2022-04-27 Marek Polacek ++ ++ Backported from master: ++ 2022-04-27 Marek Polacek ++ ++ PR c++/105398 ++ * g++.dg/cpp1y/lambda-generic-enum2.C: New test. ++ ++2022-04-27 Hongyu Wang ++ ++ Backported from master: ++ 2022-04-25 Hongyu Wang ++ ++ PR target/105339 ++ * gcc.target/i386/sse-14.c: Add tests for new macro. ++ ++2022-04-22 Marek Polacek ++ ++ Backported from master: ++ 2022-04-21 Marek Polacek ++ ++ PR c++/105321 ++ * g++.dg/cpp0x/constexpr-105321.C: New test. ++ ++2022-04-22 Marek Polacek ++ ++ Backported from master: ++ 2022-04-13 Marek Polacek ++ ++ PR c++/97296 ++ * g++.dg/cpp0x/ref-bind4.C: Add dg-error. ++ * g++.dg/cpp0x/ref-bind8.C: New test. ++ ++2022-04-21 Fritz Reese ++ ++ Backported from master: ++ 2022-04-21 Fritz Reese ++ ++ PR fortran/105310 ++ * gfortran.dg/dec_union_12.f90: New test. ++ ++2022-04-21 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-19 Jakub Jelinek ++ ++ PR target/105257 ++ * gcc.dg/pr105257.c: New test. ++ ++2022-04-21 Jakub Jelinek ++ ++ Backported from master: ++ 2022-04-21 Jakub Jelinek ++ ++ PR debug/105203 ++ * gfortran.dg/g77/pr105203.f: New test. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-105321.C +@@ -0,0 +1,18 @@ ++// PR c++/105321 ++// { dg-do compile { target c++11 } } ++ ++bool handle_error(); ++ ++constexpr int echo(int value, bool yes = true) noexcept ++{ ++ return (yes || handle_error()), value; ++} ++ ++static_assert(echo(10) == 10, ""); ++ ++constexpr int echo2(int value, bool no = false) noexcept ++{ ++ return (!no || handle_error()), value; ++} ++ ++static_assert(echo2(10) == 10, ""); +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-fno-elide-ctors1.C +@@ -0,0 +1,89 @@ ++// PR c++/104646 ++// { dg-do compile { target c++11 } } ++// { dg-additional-options -fno-elide-constructors } ++ ++template struct pair { ++ _T1 first; ++ int second; ++}; ++template class __normal_iterator { ++ _Iterator __traits_type; ++ ++public: ++ constexpr __normal_iterator() {} ++}; ++template class allocator; ++template struct allocator_traits; ++template struct allocator_traits> { ++ using value_type = _Tp; ++ template using rebind_alloc = allocator<_Up>; ++}; ++template struct __alloc_traits { ++ typedef allocator_traits<_Alloc> _Base_type; ++ typedef typename _Base_type::value_type &const_reference; ++ template struct rebind { ++ typedef typename _Base_type::template rebind_alloc<_Tp> other; ++ }; ++}; ++template struct _Vector_base { ++ typedef typename __alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; ++}; ++template > class vector { ++public: ++ typename __alloc_traits< ++ typename _Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_reference ++ operator[](long); ++}; ++enum match_flag_type {}; ++template class Trans_NS___cxx11_basic_regex; ++class Trans_NS___cxx11_match_results; ++enum _RegexExecutorPolicy { _S_auto }; ++template ++bool __regex_algo_impl(Trans_NS___cxx11_match_results &, ++ const Trans_NS___cxx11_basic_regex<_CharT, _TraitsT> &); ++template class _Executor; ++template ++class Trans_NS___cxx11_basic_regex {}; ++class Trans_NS___cxx11_match_results : vector { ++ template ++ friend bool __regex_algo_impl(Trans_NS___cxx11_match_results &, ++ const Trans_NS___cxx11_basic_regex<_Cp, _Rp> &); ++}; ++template ++void regex_search(_Bi_iter, _Alloc, ++ Trans_NS___cxx11_basic_regex<_Ch_type, _Rx_traits>) { ++ __regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, _S_auto, false>; ++} ++match_flag_type __regex_algo_impl___flags; ++template ++bool __regex_algo_impl( ++ Trans_NS___cxx11_match_results &__m, ++ const Trans_NS___cxx11_basic_regex<_CharT, _TraitsT> &__re) { ++ __normal_iterator __e, __s; ++ _Executor __executor(__s, __e, __m, __re, ++ __regex_algo_impl___flags); ++ __executor._M_match(); ++ return false; ++} ++template class _Executor { ++public: ++ _Executor(__normal_iterator, __normal_iterator, ++ vector, Trans_NS___cxx11_basic_regex, match_flag_type); ++ void _M_match() { _M_dfs(); } ++ void _M_dfs(); ++ vector>> _M_rep_count; ++}; ++long _M_rep_once_more___i; ++template ++void _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>::_M_dfs() { ++ auto __rep_count = _M_rep_count[_M_rep_once_more___i]; ++} ++char main___trans_tmp_1; ++void main___trans_tmp_2() { ++ Trans_NS___cxx11_basic_regex re; ++ regex_search(main___trans_tmp_1, main___trans_tmp_2, re); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/decltype81.C +@@ -0,0 +1,15 @@ ++// PR c++/105386 ++// { dg-do compile { target c++11 } } ++ ++template struct NoInst { ++ static_assert(sizeof(T) == 9999, "NoInst instantiated"); ++}; ++ ++template NoInst f(T); ++ ++template ++struct A { ++ using type = decltype(f(0)); ++}; ++ ++A a; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C +@@ -0,0 +1,39 @@ ++// PR c++/105265 ++// { dg-do run { target c++11 } } ++ ++int c; ++ ++class Block ++{ ++public: ++ Block(int n) : data{new char[n]}, size{n} ++ { ++ ++c; ++ } ++ ++ ~Block() ++ { ++ --c; ++ delete[] data; ++ } ++ ++private: ++ char* data; ++ int size; ++}; ++ ++struct Cargo ++{ ++ Block const& block; ++}; ++ ++int main() ++{ ++ { ++ Cargo* c = new Cargo{{4000}}; ++ delete c; ++ } ++ if (c != 0) ++ __builtin_abort (); ++ return 0; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/initlist-nrv1.C +@@ -0,0 +1,34 @@ ++// PR c++/101442 ++// { dg-do run { target c++11 } } ++ ++bool destroyed = false; ++ ++struct A ++{ ++ A() {} ++ A(const A &) = delete; ++ A &operator=(const A &) = delete; ++ ~A() {destroyed = true;} ++}; ++ ++struct B ++{ ++ const A &a; ++ struct string { ++ string(const char*) { } ++ ~string() { } ++ } s; ++}; ++ ++B foo() ++{ ++ B ret{ A{}, "" }; ++ return ret; ++} ++ ++int main() ++{ ++ B b = foo(); ++ if (!destroyed) ++ __builtin_abort(); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-current-inst1.C +@@ -0,0 +1,18 @@ ++// PR c++/82980 ++// { dg-do compile { target c++11 } } ++ ++template ++struct Outer ++{ ++ template ++ void f(); ++ ++ void bar(Outer outer) { ++ [outer](){ outer.f(); }; ++ } ++ void baz(Outer *p) { ++ [&](){ p->f(); }; ++ } ++}; ++ ++int main() { } +--- a/src/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C ++++ b/src/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C +@@ -51,6 +51,6 @@ g (int *p, const int *pc, const int **q) + similar types T1 and T2 (_conv.qual_), respectively, and the cv- + qualification signature of type T1 is a proper subset of the cv- + qualification signature of type T2 */ +- f8 (q); ++ f8 (q); // { dg-error "call of overloaded" } + f9 (q); + } +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp0x/ref-bind8.C +@@ -0,0 +1,10 @@ ++// PR c++/97296 ++// { dg-do compile } ++ ++void f(const int * const &); ++void f(const int *); ++int *x; ++int main() ++{ ++ f(x); // { dg-error "call of overloaded" } ++} +--- a/src/gcc/testsuite/g++.dg/cpp1y/constexpr-empty2.C ++++ b/src/gcc/testsuite/g++.dg/cpp1y/constexpr-empty2.C +@@ -1,4 +1,5 @@ + // { dg-do compile { target c++14 } } ++// { dg-additional-options -fno-elide-constructors } + + struct A + { +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum2.C +@@ -0,0 +1,15 @@ ++// PR c++/105398 ++// { dg-do compile { target c++14 } } ++ ++auto f = [](auto &&m) { ++ enum E { _,e3,e2,e1,C4,C3,C2,C1 }; ++ static constexpr int x_coeffs[3][4] = { ++ {e1,C2,C3,C4}, ++ {e2,C1,C3,C4}, ++ {e3,C1,C2,C4}, ++ }; ++}; ++ ++int main() { ++ f(0); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C +@@ -0,0 +1,30 @@ ++// PR c++/102071 ++// { dg-do run { target c++17 } } ++// { dg-additional-options -faligned-new=2 } ++ ++#include ++ ++int nalign; ++void *operator new (std::size_t s, std::align_val_t a) ++{ ++ nalign = (int)a; ++ return operator new (s); ++} ++ ++struct X { ~X(); int c; }; ++ ++int align = (alignof (X) > alignof (std::size_t) ++ ? alignof (X) : alignof (std::size_t)); ++ ++int n = 4; ++ ++int main() ++{ ++ X *p = new X[n]; ++ if (nalign != align) ++ __builtin_abort (); ++ ++ X *p2 = new X; ++ if (nalign != alignof (X)) ++ __builtin_abort (); ++} +--- a/src/gcc/testsuite/g++.dg/cpp1z/class-deduction12.C ++++ b/src/gcc/testsuite/g++.dg/cpp1z/class-deduction12.C +@@ -15,3 +15,9 @@ A a(&i,2,B<42>()); + template class same; + template class same {}; + same> s; ++ ++#if __cpp_deduction_guides >= 201907 ++template using C = A; ++ ++same())), A> t; ++#endif +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp1z/class-deduction99.C +@@ -0,0 +1,35 @@ ++// PR c++/102479 ++// { dg-do compile { target c++17 } } ++ ++template struct A; ++ ++template ++struct tuple { ++ tuple(T); ++ ++ template class Tmpl> ++ tuple(Tmpl); ++ ++ template class Tmpl, typename A>::type = 0> ++ tuple(Tmpl); ++ ++ template class Tmpl, typename A>::type = 0> ++ tuple(Tmpl); ++}; ++ ++template struct B { }; ++ ++using ty1 = tuple; ++using ty1 = decltype(tuple(0)); ++using ty1 = decltype(tuple(B{})); ++ ++#if __cpp_deduction_guides >= 201907 ++template using const_tuple = tuple; ++ ++using ty2 = const_tuple; ++using ty2 = decltype(const_tuple(0)); ++using ty2 = decltype(const_tuple(B{})); ++ ++using ty3 = const_tuple>; ++using ty3 = decltype(const_tuple(B{})); ++#endif +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp23/lambda-attr1.C +@@ -0,0 +1,29 @@ ++// P2173R1 - Attributes on Lambda-Expressions ++// { dg-do compile { target c++11 } } ++ ++void ++foo (bool x, bool y) ++{ ++ auto a = [][[noreturn]] () {}; // { dg-warning "'noreturn' function does return" } ++ if (x) ++ a (); ++ auto b = [][[noreturn]] {}; // { dg-warning "'noreturn' function does return" } ++ if (y) ++ b (); ++ auto c = [] [[ deprecated ]] () {}; // { dg-bogus "is deprecated" } ++ c (); // { dg-warning "'foo\\\(bool, bool\\\)::' is deprecated" } ++ auto d = [][[deprecated]] {}; // { dg-bogus "is deprecated" } ++ d (); // { dg-warning "'foo\\\(bool, bool\\\)::' is deprecated" } ++#if __cpp_generic_lambdas >= 201304 ++ auto e = [] [[deprecated]] (auto x) {}; // { dg-bogus "is deprecated" } ++ e (0.0); // { dg-warning "'foo\\\(bool, bool\\\)::\[^\n\r]*' is deprecated" "" { target c++14 } } ++#endif ++#if __cpp_generic_lambdas >= 201707 ++ auto f = [] [[deprecated]] (T) {}; // { dg-bogus "is deprecated" } ++ f (1); // { dg-warning "'foo\\\(bool, bool\\\)::\[^\n\r]*' is deprecated" "" { target c++20 } } ++#endif ++ auto g = [][[nodiscard]](int) { return 1; }; ++ g (1); // { dg-warning "ignoring return value of 'foo\\\(bool, bool\\\)::', declared with attribute 'nodiscard'" } ++ auto h = [] [[nodiscard]] { return 0; }; ++ h (); // { dg-warning "ignoring return value of 'foo\\\(bool, bool\\\)::', declared with attribute 'nodiscard'" } ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C +@@ -0,0 +1,10 @@ ++// PR c++/105304 ++// { dg-do compile { target c++20 } } ++// { dg-additional-options "-Wall -Wsequence-point" } ++ ++struct A { }; ++ ++int main() { ++ if (requires { A(); }) ++ ; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C +@@ -0,0 +1,18 @@ ++// PR c++/102629 ++// { dg-do compile { target c++20 } } ++ ++template T&& forward(T&); ++template T&& forward(T&&); ++ ++struct S {}; ++ ++template ++void foo(Args&&... args) { ++ [...args = forward /*(args)*/] { // { dg-error "" } ++ [](auto...) { } (forward(args)...); ++ }; ++} ++ ++void bar( ) { ++ foo(S{}); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/opt/const7.C +@@ -0,0 +1,7 @@ ++// PR c++/104142 ++// { dg-do compile { target c++11 } } ++// { dg-additional-options -Wunused-variable } ++ ++struct B { B()=default; }; ++static const B b_var; // { dg-bogus "" } ++// { dg-final { scan-assembler-symbol-section {b_var} {^\.(const|rodata)|\[RO\]} } } +--- a/src/gcc/testsuite/g++.dg/parse/no-typename1.C ++++ b/src/gcc/testsuite/g++.dg/parse/no-typename1.C +@@ -6,6 +6,6 @@ template struct A + { + template struct B + { +- A::template B foo(); // { dg-error "" "" { target c++17_down } } ++ A::template B foo(); + }; + }; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/parse/qualified6.C +@@ -0,0 +1,10 @@ ++// PR c++/90107 ++// { dg-do compile } ++ ++struct A; ++namespace N { extern A a; } ++struct A {} ::N::a; ++ ++struct A1; ++struct B { static A1 a1; }; ++struct A1 {} ::B::a1; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/template/conv19.C +@@ -0,0 +1,34 @@ ++// PR c++/101698 ++// { dg-do compile { target c++11 } } ++ ++class Base { ++ public: ++ template ++ operator const T&() const = delete; ++ ++ virtual operator const int&() const { ++ static int res; ++ return res; ++ } ++}; ++ ++template ++class Derive : public Base { ++ public: ++ operator const T&() const override { ++ using Y = int; ++ //static_assert(__is_same_as(T,Y), ""); ++ ++ static int res; ++ ++ res = Base::operator const Y&(); // OK ++ res = Base::operator const T&(); // { dg-bogus "deleted" } ++ return res; ++ } ++}; ++ ++int main() { ++ Derive a; ++ const int& b = a; ++ (void)b; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/template/nested7.C +@@ -0,0 +1,12 @@ ++// PR c++/102300 ++ ++template ++struct holder ++{ ++ template struct fn {}; ++ ++ struct t1 : fn {}; // pass ++ struct t2 : holder::fn {}; // fail ++ struct t3 : holder::template fn {}; // fail ++ struct t4 : holder::template fn {}; // pass ++}; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/template/partial-specialization11.C +@@ -0,0 +1,11 @@ ++// PR c++/86193 ++// CWG 455 (active) ++// { dg-options "" } // clear -pedantic-errors ++ ++template struct value_type; ++ ++template::type V> ++struct A; ++ ++template ++struct A { }; // { dg-warning "not more specialized" } +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.dg/template/partial-specialization12.C +@@ -0,0 +1,12 @@ ++// PR c++/105289 ++// CWG 455 (active) ++// { dg-do compile { target c++11 } } ++ ++template ++struct value_type; ++ ++template::type Element> ++struct push_front_vlist; ++ ++template class XList, class T, T Arg, T... Vs> ++struct push_front_vlist, Arg> { }; // { dg-error "not more specialized" } +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.target/i386/mv31.C +@@ -0,0 +1,10 @@ ++// PR c++/104669 ++ ++void bar() ++{ ++ int foo(void); ++ int foo(void) __attribute__((target("sse"))); ++ int foo(void) __attribute__((target("default"))); ++ int (*p)(void) = &foo; ++ return; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/g++.target/i386/vec-tmpl1.C +@@ -0,0 +1,17 @@ ++// PR c++/65211 ++// { dg-additional-options "-Wno-psabi" } ++// { dg-final { scan-assembler-not "movdqa" } } ++ ++typedef unsigned v4ui __attribute__ ((vector_size(16), aligned (16))); ++ ++template ++static v4ui t1(unsigned *dest_data) ++{ ++ typedef unsigned v4ui_1 __attribute__ ((vector_size (16), aligned (4))); ++ return ((const v4ui_1*)dest_data)[0]; ++} ++ ++v4ui f(unsigned int *array) ++{ ++ return t1<1>(array+7); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/analyzer/pr105252.c +@@ -0,0 +1,20 @@ ++/* { dg-additional-options "-fnon-call-exceptions -O" } */ ++ ++typedef unsigned char C; ++typedef unsigned char __attribute__((__vector_size__ (4))) V; ++ ++C m; ++ ++static inline void ++bar (C c, V v, V *r) ++{ ++ v %= (c | v) % m; ++ *r = v; ++} ++ ++void ++foo (void) ++{ ++ V x; ++ bar (0, (V){2}, &x); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/analyzer/pr105365.c +@@ -0,0 +1,17 @@ ++/* { dg-require-effective-target int128 } */ ++ ++typedef _Float32 f32; ++typedef _Complex _Float32 cf32; ++_Float32 g; ++__int128 i; ++ ++extern void bar(int); ++ ++void ++foo(_Float32 k) { ++ f32 f = 0; ++ f /= (_Complex char)__builtin_llround(g); ++ k /= (cf32)__builtin_copysignf(0, i); ++ bar(f + k); ++ foo(0); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/analyzer/pr105366.c +@@ -0,0 +1,19 @@ ++/* { dg-require-effective-target int128 } */ ++/* { dg-additional-options "-O" } */ ++ ++extern void bar(int); ++extern void baz(void); ++ ++typedef unsigned u32; ++ ++void ++foo(u32 u, __int128 i) { ++ baz(); ++ _Complex int c = i; ++ c /= (u32)(__UINTPTR_TYPE__)foo; ++ short s = (short)(__UINTPTR_TYPE__)foo; ++ u /= (_Complex short)s; ++ u32 r = u + c; ++ bar(r); ++ foo(0, 0); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/asan/pr105396.c +@@ -0,0 +1,19 @@ ++/* PR sanitizer/105396 */ ++/* { dg-do run } */ ++/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ ++/* { dg-shouldfail "asan" } */ ++ ++int ++main () ++{ ++ int a; ++ int *b[1]; ++ int c[10]; ++ int d[1][1]; ++ for (a = 0; a < 1; a++) ++ d[1][a] = 0; ++ return 0; ++} ++ ++/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" } */ ++/* { dg-output "WRITE of size.*" } */ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr105257.c +@@ -0,0 +1,16 @@ ++/* PR target/105257 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++/* { dg-additional-options "-fpic" { target fpic } } */ ++ ++extern int sigsetjmp (void **, int); ++void *buf[32]; ++void (*fn) (void); ++ ++const char * ++bar (void) ++{ ++ sigsetjmp (buf, 0); ++ fn (); ++ return ""; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr105331.c +@@ -0,0 +1,11 @@ ++/* PR target/105331 */ ++/* { dg-do compile } */ ++/* { dg-options "-O -Wuninitialized" } */ ++ ++#include ++ ++int ++foo (va_list *va) ++{ ++ return va_arg (*va, double _Complex); /* { dg-bogus "may be used uninitialized" } */ ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr105333.c +@@ -0,0 +1,21 @@ ++/* PR rtl-optimization/105333 */ ++/* { dg-do compile { target int128 } } */ ++/* { dg-options "-Og -fno-tree-coalesce-vars -fno-tree-fre" } */ ++ ++int g; ++short s; ++ ++static inline unsigned short ++bar (short a, __int128 b) ++{ ++ b ^= (unsigned long) -a; ++ __builtin_strncpy ((void *) &s, (void *) &a, 1); ++ b *= 14; ++ return b; ++} ++ ++void ++foo (void) ++{ ++ g *= (__int128) bar (1, 1); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr105528.c +@@ -0,0 +1,23 @@ ++/* PR tree-optimization/105528 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -Wno-psabi -fcompare-debug" } */ ++/* { dg-additional-options "-mavx512f" { target i?86-*-* x86_64-*-* } } */ ++ ++typedef unsigned V __attribute__((__vector_size__ (64))); ++V g; ++ ++V ++bar (V v) ++{ ++ V w; ++ v <<= (V){(V){}[53]} >= v & 5; ++ w[w[5]] -= ~0; ++ v %= ~0; ++ return v + w; ++} ++ ++void ++foo (void) ++{ ++ g -= (V){bar((V){~0})[3]}; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/torture/pr105598.c +@@ -0,0 +1,32 @@ ++/* { dg-do run } */ ++ ++typedef struct { unsigned int num; } info_t; ++typedef struct { unsigned int flag, type; } block_t; ++info_t info; ++block_t blocks[] = { {2,0}, {3,0}, {1,0}, {1,0} }; ++ ++static block_t * ++f (info_t *i, block_t *b) ++{ ++ while (1) { ++ unsigned int is_last = b->flag & 0x01; ++ i->num++; ++ if (b->flag & 0x02) { ++ if (b->type != 0x1) b->type = b->type; ++ b = f (i, b+1); ++ } ++ if (is_last) ++ break; ++ b++; ++ } ++ return b; ++} ++ ++int ++main () ++{ ++ f(&info, &blocks[0]); ++ if (info.num != 4) ++ __builtin_abort (); ++ return 0; ++} +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c +@@ -1,10 +1,11 @@ + /* { dg-do compile } */ + /* { dg-require-effective-target vect_complex_add_float } */ ++/* { dg-additional-options "-fno-tree-loop-vectorize" } */ + /* { dg-add-options arm_v8_3a_complex_neon } */ + + #define TYPE float + #define N 16 + #include "complex-mul-template.c" + +-/* { dg-final { scan-tree-dump "Found COMPLEX_MUL_CONJ" "vect" } } */ +-/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "vect" } } */ ++/* { dg-final { scan-tree-dump "Found COMPLEX_MUL_CONJ" "slp1" { xfail *-*-* } } } */ ++/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "slp1" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-double.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-double.c +@@ -6,7 +6,7 @@ + #define N 200 + #include "complex-add-template.c" + +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 2 "vect" { target { vect_complex_add_double } } } } */ +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" { target { vect_complex_add_double } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_double } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_double } } } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-float.c +@@ -6,7 +6,7 @@ + #define N 200 + #include "complex-add-template.c" + +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 2 "vect" { target { vect_complex_add_float } } } } */ +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" { target { vect_complex_add_float } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_float } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_float } } } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-half-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-half-float.c +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_half } */ + /* { dg-require-effective-target float16 } */ + /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ + +@@ -6,5 +7,7 @@ + #define N 200 + #include "complex-add-template.c" + +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 2 "vect" { target { vect_complex_add_half } } } } */ +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" { target { vect_complex_add_half } } } } */ ++/* Vectorization is failing for these cases. They should work but for now ignore. */ ++ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { xfail *-*-* } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { xfail *-*-* } } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c +@@ -6,8 +6,7 @@ + #define N 200 + #include "complex-add-pattern-template.c" + +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 4 "vect" { target { vect_complex_add_double } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_double } } } } */ + /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_double } } } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ +-/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "slp1" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c +@@ -6,8 +6,7 @@ + #define N 200 + #include "complex-add-pattern-template.c" + +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 4 "vect" { target { vect_complex_add_float } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_float } } } } */ + /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_float } } } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ +-/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "slp1" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-require-effective-target vect_float } */ ++/* { dg-require-effective-target vect_complex_add_half } */ + /* { dg-require-effective-target float16 } */ + /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ + +@@ -7,10 +7,8 @@ + #define N 200 + #include "complex-add-pattern-template.c" + +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 4 "vect" { target { vect_complex_add_half } } } } */ +-/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_half } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_half } } } } */ ++/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_half } && ! target { arm*-*-* } } } } */ + +-/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "slp1" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ +-/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "slp1" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mla-half-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mla-half-float.c +@@ -1,5 +1,7 @@ + /* { dg-do compile } */ + /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ ++/* { dg-require-effective-target vect_complex_add_half } */ ++/* { dg-require-effective-target float16 } */ + + #define TYPE _Float16 + #define N 200 +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-double.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-double.c +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_double } */ + /* { dg-add-options arm_v8_3a_complex_neon } */ + + #define TYPE double +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-float.c +@@ -1,10 +1,10 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_float } */ + /* { dg-add-options arm_v8_3a_complex_neon } */ + + #define TYPE float + #define N 200 + #include "complex-mls-template.c" +-/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_FMA" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_FMS_CONJ" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-half-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-half-float.c +@@ -1,9 +1,10 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_half } */ ++/* { dg-require-effective-target float16 } */ + /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ + + #define TYPE _Float16 + #define N 200 + #include "complex-mls-template.c" +-/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_FMS_CONJ" "vect" } } */ + /* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "vect" } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-double.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-double.c +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_double } */ + /* { dg-add-options arm_v8_3a_complex_neon } */ + + #define TYPE double +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-float.c +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_float } */ + /* { dg-add-options arm_v8_3a_complex_neon } */ + + #define TYPE float +--- a/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-half-float.c ++++ b/src/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-half-float.c +@@ -1,4 +1,6 @@ + /* { dg-do compile } */ ++/* { dg-require-effective-target vect_complex_add_half } */ ++/* { dg-require-effective-target float16 } */ + /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ + + #define TYPE _Float16 +--- a/src/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c ++++ b/src/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c +@@ -46,5 +46,5 @@ int main (void) + return main1 (); + } + +-/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 1 "vect" { target { ! vect_hw_misalign } } } } */ ++/* { dg-final { scan-tree-dump-times "unsupported unaligned access" 1 "vect" { target { ! vect_hw_misalign } } } } */ + /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_hw_misalign } } } } */ +--- a/src/gcc/testsuite/gcc.dg/vect/vect.exp ++++ b/src/gcc/testsuite/gcc.dg/vect/vect.exp +@@ -118,7 +118,7 @@ et-dg-runtest dg-runtest [lsort \ + set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS + lappend DEFAULT_VECTCFLAGS "-ffast-math" + et-dg-runtest dg-runtest [lsort \ +- [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]] \ ++ [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsvc\]*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS + + # -ffast-math SLP tests +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/aarch64/sync-comp-swap-ool.c +@@ -0,0 +1,6 @@ ++/* { dg-do compile } */ ++/* { dg-options "-march=armv8-a+nolse -O2 -fno-ipa-icf -moutline-atomics" } */ ++ ++#include "sync-comp-swap.x" ++ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_cas4_sync" 1 } } */ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-acquire-ool.c +@@ -0,0 +1,6 @@ ++/* { dg-do compile } */ ++/* { dg-options "-march=armv8-a+nolse -O2 -moutline-atomics" } */ ++ ++#include "sync-op-acquire.x" ++ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_swp4_sync" 1 } } */ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-full-ool.c +@@ -0,0 +1,9 @@ ++/* { dg-do compile } */ ++/* { dg-options "-march=armv8-a+nolse -O2 -moutline-atomics" } */ ++ ++#include "sync-op-full.x" ++ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_ldadd4_sync" 1 } } */ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_ldclr4_sync" 1 } } */ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_ldeor4_sync" 1 } } */ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_ldset4_sync" 1 } } */ +--- a/src/gcc/testsuite/gcc.target/aarch64/target_attr_20.c ++++ b/src/gcc/testsuite/gcc.target/aarch64/target_attr_20.c +@@ -24,4 +24,4 @@ bar (void) + } + } + +-/* { dg-final { scan-assembler-not "bl.*__aarch64_cas2_acq_rel" } } */ ++/* { dg-final { scan-assembler-not "bl.*__aarch64_cas2_sync" } } */ +--- a/src/gcc/testsuite/gcc.target/aarch64/target_attr_21.c ++++ b/src/gcc/testsuite/gcc.target/aarch64/target_attr_21.c +@@ -24,4 +24,4 @@ bar (void) + } + } + +-/* { dg-final { scan-assembler-times "bl.*__aarch64_cas2_acq_rel" 1 } } */ ++/* { dg-final { scan-assembler-times "bl.*__aarch64_cas2_sync" 1 } } */ +--- a/src/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S ++++ b/src/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S +@@ -300,3 +300,6 @@ iamcu_noprintf: + .align 4 + .LCiamcu_noprintf1: + .long 1132527616 ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +--- a/src/gcc/testsuite/gcc.target/i386/sse-14.c ++++ b/src/gcc/testsuite/gcc.target/i386/sse-14.c +@@ -429,7 +429,9 @@ test_3 (_mm_maskz_mul_round_sd, __m128d, __mmask8, __m128d, __m128d, 9) + test_3 (_mm512_maskz_mul_round_ps, __m512, __mmask16, __m512, __m512, 9) + test_3 (_mm_maskz_mul_round_ss, __m128, __mmask8, __m128, __m128, 9) + test_3 (_mm512_maskz_scalef_round_pd, __m512d, __mmask8, __m512d, __m512d, 9) ++test_3 (_mm_maskz_scalef_round_sd, __m128d, __mmask8, __m128d, __m128d, 9) + test_3 (_mm512_maskz_scalef_round_ps, __m512, __mmask16, __m512, __m512, 9) ++test_3 (_mm_maskz_scalef_round_ss, __m128, __mmask8, __m128, __m128, 9) + test_3 (_mm512_maskz_shuffle_f32x4, __m512, __mmask16, __m512, __m512, 1) + test_3 (_mm512_maskz_shuffle_f64x2, __m512d, __mmask8, __m512d, __m512d, 1) + test_3 (_mm512_maskz_shuffle_i32x4, __m512i, __mmask16, __m512i, __m512i, 1) +@@ -543,7 +545,9 @@ test_4 (_mm_mask_mul_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 9) + test_4 (_mm512_mask_mul_round_ps, __m512, __m512, __mmask16, __m512, __m512, 9) + test_4 (_mm_mask_mul_round_ss, __m128, __m128, __mmask8, __m128, __m128, 9) + test_4 (_mm512_mask_scalef_round_pd, __m512d, __m512d, __mmask8, __m512d, __m512d, 9) ++test_4 (_mm_mask_scalef_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 9) + test_4 (_mm512_mask_scalef_round_ps, __m512, __m512, __mmask16, __m512, __m512, 9) ++test_4 (_mm_mask_scalef_round_ss, __m128, __m128, __mmask8, __m128, __m128, 9) + test_4 (_mm512_mask_shuffle_f32x4, __m512, __m512, __mmask16, __m512, __m512, 1) + test_4 (_mm512_mask_shuffle_f64x2, __m512d, __m512d, __mmask8, __m512d, __m512d, 1) + test_4 (_mm512_mask_shuffle_i32x4, __m512i, __m512i, __mmask16, __m512i, __m512i, 1) +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/sparc/20220510-1.c +@@ -0,0 +1,31 @@ ++/* PR target/105292 */ ++/* Reported by Koakuma */ ++ ++/* { dg-do compile } */ ++/* { dg-options "-O3 -mvis2" } */ ++ ++extern void get_vbytes_v2 (unsigned); ++ ++typedef struct { ++ unsigned ctt_info; ++ unsigned ctt_size; ++} ctf_type_t; ++ ++typedef struct { ++ unsigned short cts_offset; ++ unsigned short cts_bits; ++} ctf_slice_t; ++ ++void flip_types_len (ctf_type_t *t, int bsx1, int bsx2) ++{ ++ const int kind = t->ctt_info; ++ ++ get_vbytes_v2 (t->ctt_size); ++ ++ if (kind == 4) ++ { ++ ctf_slice_t *s = (ctf_slice_t *)t; ++ s->cts_offset = __builtin_bswap16(bsx1); ++ s->cts_bits = __builtin_bswap16(bsx2); ++ } ++} +--- a/src/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S ++++ b/src/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S +@@ -82,3 +82,6 @@ snapshot_ret: + .comm xmm_regs,256,32 + .comm x87_regs,128,32 + .comm volatile_var,8,8 ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +--- a/src/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S ++++ b/src/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S +@@ -79,3 +79,6 @@ snapshot_ret: + .comm ymm_regs,512,32 + .comm x87_regs,128,32 + .comm volatile_var,8,8 ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +--- a/src/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S ++++ b/src/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S +@@ -95,3 +95,6 @@ snapshot_ret: + .comm zmm_regs,2048,64 + .comm x87_regs,128,32 + .comm volatile_var,8,8 ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +--- a/src/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S ++++ b/src/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S +@@ -30,6 +30,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #ifdef __ELF__ + # define FN_TYPE(fn) .type fn,@function + # define FN_SIZE(fn) .size fn,.-fn ++# ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++# endif + #else + # define FN_TYPE(fn) + # define FN_SIZE(fn) +new file mode 100755 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/dec_union_12.f90 +@@ -0,0 +1,43 @@ ++! { dg-do compile } ++! { dg-options "-std=legacy -ffree-form -finit-local-zero -finit-derived -fdec-structure" } ++! ++! PR fortran/105310 ++! ++! Test that gfc_conv_union_initializer does not cause an ICE when called ++! to build the constructor for a field which triggers a vector resize. ++! ++ ++program dec_union_12 ++ implicit none ++STRUCTURE /foo8u/ ++ ! 8 fields ++ INTEGER(4) :: a,b,c,d,e,f,g,h ++ UNION ++ MAP ++ ENDMAP ++ ENDUNION ++ENDSTRUCTURE ++STRUCTURE /foo16u/ ++ ! 16 fields ++ INTEGER(4) :: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p ++ UNION ++ MAP ++ ENDMAP ++ ENDUNION ++ENDSTRUCTURE ++STRUCTURE /foo32u/ ++ ! 32 fields ++ INTEGER(4) :: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p ++ INTEGER(4) :: aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap ++ UNION ++ MAP ++ ENDMAP ++ ENDUNION ++ENDSTRUCTURE ++ record /foo8u/ bar8u ++ record /foo16u/ bar16u ++ record /foo32u/ bar32u ++ bar8u.a = 1 ++ bar16u.a = 1 ++ bar32u.a = 1 ++end +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/g77/pr105203.f +@@ -0,0 +1,20 @@ ++C Test case for PR debug/105203 ++C Origin: kmccarty@princeton.edu ++C ++C { dg-do compile } ++C { dg-options "-O2 -fcompare-debug -ftracer -w" } ++C { dg-additional-options "-fPIC" { target fpic } } ++ SUBROUTINE FOO (B) ++ ++ 10 CALL BAR (A) ++ ASSIGN 20 TO M ++ IF (100.LT.A) GOTO 10 ++ GOTO 40 ++C ++ 20 IF (B.LT.ABS(A)) GOTO 10 ++ ASSIGN 30 TO M ++ GOTO 40 ++C ++ 30 ASSIGN 10 TO M ++ 40 GOTO M,(10,20,30) ++ END +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr104849.f90 +@@ -0,0 +1,9 @@ ++! { dg-do compile } ++! PR fortran/104849 - ICE in find_array_section ++! Contributed by G.Steinmetz ++ ++program p ++ integer, parameter :: a(:) = [1, 2] ! { dg-error "deferred shape" } ++ integer :: x(2) ++ data x /a(:)/ ! { dg-error "Invalid" } ++end +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr105230.f90 +@@ -0,0 +1,8 @@ ++! { dg-do compile } ++! PR fortran/105230 - ICE in find_array_section ++! Contributed by G.Steinmetz ++ ++program p ++ integer, parameter :: a(:) = [1, 2] ! { dg-error "deferred shape" } ++ print *, reshape([3, 4], a(1:2)) ++end +--- a/src/gcc/testsuite/lib/prune.exp ++++ b/src/gcc/testsuite/lib/prune.exp +@@ -76,6 +76,11 @@ proc prune_gcc_output { text } { + regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text + regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text + ++ # Ideally the tests would indicate that executable stacks were needed ++ # to the linker. But the option for that varies and may not even exist ++ # on some targets. So we're stuck pruning the warning. ++ regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*requires executable stack\[^\n\]*\n?)+" $text "\\1" text ++ + # Ignore harmless warnings from Xcode 3.2.x. + regsub -all "(^|\n)\[^\n\]*ld: warning: can't add line info to anonymous symbol\[^\n\]*" $text "" text + regsub -all "(^|\n)\[^\n\]*warning: DWARFDebugInfoEntry::AppendDependants\[^\n\]*AT_\[^\n\]*FORM_ref4\[^\n\]*" $text "" text +--- a/src/gcc/value-prof.c ++++ b/src/gcc/value-prof.c +@@ -336,6 +336,10 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist) + /* Note that the IOR counter tracks pointer values and these can have + sign bit set. */ + ; ++ else if (hist->type == HIST_TYPE_INDIR_CALL && i == 0) ++ /* 'all' counter overflow is stored as a negative value. Individual ++ counters and values are expected to be non-negative. */ ++ ; + else + gcc_assert (value >= 0); + +--- a/src/libgcc/ChangeLog ++++ b/src/libgcc/ChangeLog +@@ -1,3 +1,9 @@ ++2022-05-16 Sebastian Pop ++ ++ PR target/105162 ++ * config/aarch64/lse.S: Define BARRIER and handle memory MODEL 5. ++ * config/aarch64/t-lse: Add a 5th memory model for _sync functions. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/libgcc/config/aarch64/lse.S ++++ b/src/libgcc/config/aarch64/lse.S +@@ -87,24 +87,44 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + # define L + # define M 0x000000 + # define N 0x000000 ++# define BARRIER + #elif MODEL == 2 + # define SUFF _acq + # define A a + # define L + # define M 0x400000 + # define N 0x800000 ++# define BARRIER + #elif MODEL == 3 + # define SUFF _rel + # define A + # define L l + # define M 0x008000 + # define N 0x400000 ++# define BARRIER + #elif MODEL == 4 + # define SUFF _acq_rel + # define A a + # define L l + # define M 0x408000 + # define N 0xc00000 ++# define BARRIER ++#elif MODEL == 5 ++# define SUFF _sync ++#ifdef L_swp ++/* swp has _acq semantics. */ ++# define A a ++# define L ++# define M 0x400000 ++# define N 0x800000 ++#else ++/* All other _sync functions have _seq semantics. */ ++# define A a ++# define L l ++# define M 0x408000 ++# define N 0xc00000 ++#endif ++# define BARRIER dmb ish + #else + # error + #endif +@@ -127,7 +147,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #endif + + #define NAME(BASE) glue4(__aarch64_, BASE, SIZE, SUFF) +-#define LDXR glue4(ld, A, xr, S) ++#if MODEL == 5 ++/* Drop A for _sync functions. */ ++# define LDXR glue3(ld, xr, S) ++#else ++# define LDXR glue4(ld, A, xr, S) ++#endif + #define STXR glue4(st, L, xr, S) + + /* Temporary registers used. Other than these, only the return value +@@ -183,10 +208,16 @@ STARTFN NAME(cas) + bne 1f + STXR w(tmp1), s(1), [x2] + cbnz w(tmp1), 0b +-1: ret ++1: BARRIER ++ ret + + #else +-#define LDXP glue3(ld, A, xp) ++#if MODEL == 5 ++/* Drop A for _sync functions. */ ++# define LDXP glue2(ld, xp) ++#else ++# define LDXP glue3(ld, A, xp) ++#endif + #define STXP glue3(st, L, xp) + #ifdef HAVE_AS_LSE + # define CASP glue3(casp, A, L) x0, x1, x2, x3, [x4] +@@ -205,7 +236,8 @@ STARTFN NAME(cas) + bne 1f + STXP w(tmp2), x2, x3, [x4] + cbnz w(tmp2), 0b +-1: ret ++1: BARRIER ++ ret + + #endif + +@@ -229,6 +261,7 @@ STARTFN NAME(swp) + 0: LDXR s(0), [x1] + STXR w(tmp1), s(tmp0), [x1] + cbnz w(tmp1), 0b ++ BARRIER + ret + + ENDFN NAME(swp) +@@ -273,6 +306,7 @@ STARTFN NAME(LDNM) + OP s(tmp1), s(0), s(tmp0) + STXR w(tmp2), s(tmp1), [x1] + cbnz w(tmp2), 0b ++ BARRIER + ret + + ENDFN NAME(LDNM) +--- a/src/libgcc/config/aarch64/t-lse ++++ b/src/libgcc/config/aarch64/t-lse +@@ -18,13 +18,13 @@ + # along with GCC; see the file COPYING3. If not see + # . + +-# Compare-and-swap has 5 sizes and 4 memory models. ++# Compare-and-swap has 5 sizes and 5 memory models. + S0 := $(foreach s, 1 2 4 8 16, $(addsuffix _$(s), cas)) +-O0 := $(foreach m, 1 2 3 4, $(addsuffix _$(m)$(objext), $(S0))) ++O0 := $(foreach m, 1 2 3 4 5, $(addsuffix _$(m)$(objext), $(S0))) + +-# Swap, Load-and-operate have 4 sizes and 4 memory models ++# Swap, Load-and-operate have 4 sizes and 5 memory models + S1 := $(foreach s, 1 2 4 8, $(addsuffix _$(s), swp ldadd ldclr ldeor ldset)) +-O1 := $(foreach m, 1 2 3 4, $(addsuffix _$(m)$(objext), $(S1))) ++O1 := $(foreach m, 1 2 3 4 5, $(addsuffix _$(m)$(objext), $(S1))) + + LSE_OBJS := $(O0) $(O1) + +--- a/src/libphobos/ChangeLog ++++ b/src/libphobos/ChangeLog +@@ -1,3 +1,19 @@ ++2022-04-26 Iain Buclaw ++ ++ Backported from master: ++ 2021-09-30 Iain Buclaw ++ ++ * libdruntime/gcc/unwind/generic.d (__aligned__): Define. ++ (_Unwind_Exception): Align struct to __aligned__. ++ ++2022-04-26 Iain Buclaw ++ ++ Backported from master: ++ 2022-04-26 Iain Buclaw ++ ++ * libdruntime/gcc/emutls.d (emutlsDestroyThread): Clear the per-thread ++ TLS array, don't call free(). ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/libphobos/libdruntime/gcc/emutls.d ++++ b/src/libphobos/libdruntime/gcc/emutls.d +@@ -222,9 +222,9 @@ void** emutlsAlloc(shared __emutls_object* obj) nothrow @nogc + } + + /* +- * When a thread has finished, remove the TLS array from the GC +- * scan list emutlsArrays, free all allocated TLS variables and +- * finally free the array. ++ * When a thread has finished, free all allocated TLS variables and empty the ++ * array. The pointer is not free'd as it is stil referenced by the GC scan ++ * list emutlsArrays, which gets destroyed when druntime is unloaded. + */ + extern (C) void emutlsDestroyThread(void* ptr) nothrow @nogc + { +@@ -236,7 +236,7 @@ extern (C) void emutlsDestroyThread(void* ptr) nothrow @nogc + free(entry[-1]); + } + +- free(arr); ++ arr.length = 0; + } + + /* +--- a/src/libphobos/libdruntime/gcc/unwind/generic.d ++++ b/src/libphobos/libdruntime/gcc/unwind/generic.d +@@ -123,7 +123,27 @@ enum : _Unwind_Reason_Code + // @@@ The IA-64 ABI says that this structure must be double-word aligned. + // Taking that literally does not make much sense generically. Instead we + // provide the maximum alignment required by any type for the machine. +-struct _Unwind_Exception ++ version (ARM) private enum __aligned__ = 8; ++else version (AArch64) private enum __aligned__ = 16; ++else version (HPPA) private enum __aligned__ = 8; ++else version (HPPA64) private enum __aligned__ = 16; ++else version (MIPS_N32) private enum __aligned__ = 16; ++else version (MIPS_N64) private enum __aligned__ = 16; ++else version (MIPS32) private enum __aligned__ = 8; ++else version (MIPS64) private enum __aligned__ = 8; ++else version (PPC) private enum __aligned__ = 16; ++else version (PPC64) private enum __aligned__ = 16; ++else version (RISCV32) private enum __aligned__ = 16; ++else version (RISCV64) private enum __aligned__ = 16; ++else version (S390) private enum __aligned__ = 8; ++else version (SPARC) private enum __aligned__ = 8; ++else version (SPARC64) private enum __aligned__ = 16; ++else version (SystemZ) private enum __aligned__ = 8; ++else version (X86) private enum __aligned__ = 16; ++else version (X86_64) private enum __aligned__ = 16; ++else static assert( false, "Platform not supported."); ++ ++align(__aligned__) struct _Unwind_Exception + { + _Unwind_Exception_Class exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; +--- a/src/libstdc++-v3/ChangeLog ++++ b/src/libstdc++-v3/ChangeLog +@@ -1,3 +1,440 @@ ++2022-05-16 Jonathan Wakely ++ ++ * doc/xml/manual/status_cxx2023.xml: Update status. ++ * doc/html/manual/status.html: Regenerate. ++ ++2022-05-16 Jonathan Wakely ++ ++ Backported from master: ++ 2022-05-16 Jonathan Wakely ++ ++ * doc/xml/manual/prerequisites.xml: Fix attributes for external ++ hyperlink. ++ * doc/html/manual/setup.html: Regenerate. ++ ++2022-05-16 Jonathan Wakely ++ ++ Backported from master: ++ 2022-05-16 Jonathan Wakely ++ ++ * doc/xml/manual/intro.xml: Include new chapter. ++ * doc/xml/manual/status_cxx2020.xml: Tweak release numbers. ++ * doc/xml/manual/status_cxx2023.xml: New file. ++ * doc/html/*: Regenerate. ++ ++2022-05-16 Jonathan Wakely ++ ++ Backported from master: ++ 2022-05-16 Jonathan Wakely ++ ++ * doc/html/manual/status.html: Regenerate. ++ * doc/xml/manual/status_cxx2020.xml: Fix supported version for ++ C++20 bit operations. ++ ++2022-05-13 Alexandre Oliva ++ ++ Backported from master: ++ 2022-05-06 Alexandre Oliva ++ ++ * include/experimental/bits/simd.h [__ALTIVEC__]: Require VSX ++ for double, long long, and 64-bit long intrinsic types. ++ [__ALTIVEC__] (__intrinsic_type): Mention 128-bit in ++ preexisting long double diagnostic, adjust no-VSX double ++ diagnostic to cover 64-bit long double as well. ++ ++2022-05-11 Patrick Palka ++ ++ Backported from master: ++ 2022-05-02 Patrick Palka ++ ++ PR libstdc++/103911 ++ * src/c++17/floating_from_chars.cc (find_end_of_float): Accept ++ two delimeters for the exponent part in the form of a possibly ++ NULL string of length two. Don't use std::tolower. ++ (pattern): Adjust calls to find_end_of_float accordingly. ++ ++2022-05-10 Jonathan Wakely ++ ++ Backported from master: ++ 2022-05-10 Jonathan Wakely ++ ++ PR libstdc++/105284 ++ * include/std/iosfwd: Add declarations for class ++ templates and typedefs. ++ * include/std/syncstream (basic_syncbuf, basic_osyncstream): ++ Remove default template arguments. ++ * testsuite/27_io/headers/iosfwd/synopsis.cc: New test. ++ * testsuite/27_io/headers/iosfwd/types.cc: New test. ++ ++2022-05-09 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-25 Jonathan Wakely ++ ++ PR libstdc++/104217 ++ * src/c++17/fs_ops.cc (_GNU_SOURCE): Define. ++ * src/filesystem/dir.cc (_GNU_SOURCE): Define. ++ * src/filesystem/ops.cc (_GNU_SOURCE): Define. ++ ++2022-05-09 Jonathan Wakely ++ ++ Backported from master: ++ 2022-05-06 Jonathan Wakely ++ ++ PR libstdc++/105502 ++ * include/bits/random.tcc ++ (operator>>(basic_istream&, normal_distribution&)): ++ Update state when __state_avail is false. ++ * testsuite/26_numerics/random/normal_distribution/operators/serialize.cc: ++ Check that deserialized object equals serialized one. ++ ++2022-05-09 Jonathan Wakely ++ ++ Backported from master: ++ 2022-05-06 Jonathan Wakely ++ ++ PR libstdc++/104731 ++ * testsuite/27_io/filesystem/iterators/error_reporting.cc: ++ Use a trailing char array as storage for dirent::d_name. ++ ++2022-05-06 Alexandre Oliva ++ ++ Backported from master: ++ 2022-05-03 Alexandre Oliva ++ ++ PR c++/105324 ++ * testsuite/20_util/from_chars/pr105324.cc: Guard test body ++ with conditional for floating-point overloads of from_char. ++ ++2022-04-28 Jonathan Wakely ++ ++ Backported from master: ++ 2022-04-28 Jonathan Wakely ++ ++ PR libstdc++/99290 ++ * src/c++17/fs_ops.cc (fs::copy): Pass error_code to ++ directory_iterator constructor, and check on each iteration. ++ * src/filesystem/ops.cc (fs::copy): Likewise. ++ * testsuite/27_io/filesystem/operations/copy.cc: Check for ++ errors during recursion. ++ * testsuite/experimental/filesystem/operations/copy.cc: ++ Likewise. ++ ++2022-04-26 Jonathan Wakely ++ ++ Backported from master: ++ 2022-04-25 Jonathan Wakely ++ ++ PR libstdc++/105375 ++ * include/std/future (packaged_task): Add deduction guides. ++ * testsuite/30_threads/packaged_task/cons/deduction.cc: New test. ++ ++2022-04-22 Thomas W Rodgers ++ ++ Backported from master: ++ 2022-04-22 Thomas W Rodgers ++ ++ PR libstdc++/102994 ++ * include/bits/atomic_base.h (atomic_flag::notify_one, ++ notify_all): Remove const qualification. ++ (__atomic_base::notify_one, notify_all): Likewise. ++ * include/std/atomic (atomic::notify_one, notify_all): ++ Likewise. ++ (atomic::notify_one, notify_all): Likewise. ++ (atomic::notify_one, notify_all): Likewise. ++ (atomic_notify_one, atomic_notify_all): Likewise. ++ * testsuite/29_atomics/atomic/wait_notify/102994.cc: Adjust test ++ to account for change in notify_one/notify_all signature. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-11-26 Jonathan Wakely ++ ++ PR libstdc++/96592 ++ * include/std/tuple (tuple::is_constructible): Remove. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-09-02 Jonathan Wakely ++ ++ PR c++/102177 ++ * include/bits/atomic_base.h (__is_valid_cmpexch_failure_order): ++ New function to check if a memory order is valid for the failure ++ case of compare exchange operations. ++ (__atomic_base::compare_exchange_weak): Simplify assertions ++ by using __is_valid_cmpexch_failure_order. ++ (__atomic_base::compare_exchange_strong): Likewise. ++ (__atomic_base::compare_exchange_weak): Likewise. ++ (__atomic_base::compare_exchange_strong): Likewise. ++ (__atomic_impl::compare_exchange_weak): Add assertion. ++ (__atomic_impl::compare_exchange_strong): Likewise. ++ * include/std/atomic (atomic::compare_exchange_weak): Likewise. ++ (atomic::compare_exchange_strong): Likewise. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-02-11 Jonathan Wakely ++ ++ * testsuite/20_util/monotonic_buffer_resource/allocate.cc: ++ Ignore -Walloc-larger-than warning. ++ * testsuite/20_util/unsynchronized_pool_resource/allocate.cc: ++ Likewise. ++ * testsuite/29_atomics/atomic/cons/user_pod.cc: Compile with -O1 ++ to avoid linker error for __atomic_is_lock_free. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-12-09 Jonathan Wakely ++ ++ * include/bits/stl_iterator.h (operator==, operator<=>): Define ++ overloads for homogeneous specializations of reverse_iterator, ++ __normal_iterator and move_iterator. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-11-26 Jonathan Wakely ++ ++ * testsuite/24_iterators/move_iterator/dr3265.cc: Fix test to ++ account for LWG 3435 resolution. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-08-02 Jonathan Wakely ++ ++ PR libstdc++/101709 ++ * src/filesystem/ops-common.h (get_temp_directory_from_env): ++ Add error_code parameter. ++ * src/c++17/fs_ops.cc (fs::temp_directory_path): Pass error_code ++ argument to get_temp_directory_from_env and check it. ++ * src/filesystem/ops.cc (fs::temp_directory_path): Likewise. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-04-21 Jonathan Wakely ++ ++ PR libstdc++/105324 ++ * src/c++17/floating_from_chars.cc (buffer_resource::do_allocate): ++ Remove assertion. ++ * testsuite/20_util/from_chars/pr105324.cc: New test. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-07-30 Jonathan Wakely ++ ++ PR libstdc++/65018 ++ * configure.ac: Check for secure_getenv. ++ * config.h.in: Regenerate. ++ * configure: Regenerate. ++ * src/filesystem/ops-common.h (get_temp_directory_from_env): New ++ helper function to obtain path from the environment. ++ * src/c++17/fs_ops.cc (fs::temp_directory_path): Use new helper. ++ * src/filesystem/ops.cc (fs::temp_directory_path): Likewise. ++ * testsuite/27_io/filesystem/operations/temp_directory_path.cc: ++ Print messages if test cannot be run. ++ * testsuite/experimental/filesystem/operations/temp_directory_path.cc: ++ Likewise. Fix incorrect condition. Use "TMP" to work with ++ Windows as well as POSIX. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-11-30 Jonathan Wakely ++ ++ * src/c++20/sstream-inst.cc (_GLIBCXX_USE_CXX11_ABI): Define to ++ select new ABI. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-11-30 Jonathan Wakely ++ ++ * testsuite/21_strings/basic_string/cons/char/moveable.cc: Allow ++ moved-from string to be non-empty. ++ * testsuite/21_strings/basic_string/cons/char/moveable2.cc: ++ Likewise. ++ * testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: ++ Likewise. ++ * testsuite/21_strings/basic_string/cons/wchar_t/moveable.cc: ++ Likewise. ++ * testsuite/21_strings/basic_string/cons/wchar_t/moveable2.cc: ++ Likewise. ++ * testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc: ++ Likewise. ++ * testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc: ++ Construct empty string before setting oom flag. ++ * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc: ++ Likewise. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-12-14 Jonathan Wakely ++ ++ * include/bits/regex_compiler.tcc (_Compiler::_M_match_token): ++ Use reserved name for parameter. ++ * testsuite/17_intro/names.cc: Check "token". ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-08-25 Jonathan Wakely ++ ++ * testsuite/17_intro/names.cc: Check 'sz'. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-11 Jonathan Wakely ++ ++ * include/std/ranges (ranges::lazy_split_view::_InnerIter::end()): ++ Add neoxcept (LWG 3593). ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-11-17 Jonathan Wakely ++ ++ * include/experimental/internet (address): Use std::_Construct ++ to initialize union members. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-05 Jonathan Wakely ++ ++ * src/c++11/cxx11-ios_failure.cc (io_error_category): Define ++ class and virtual functions as 'final'. ++ (io_category_instance): Use constinit union to make the object ++ immortal. ++ * src/c++11/future.cc (future_error_category): Define class and ++ virtual functions as 'final'. ++ (future_category_instance): Use constinit union. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-11-01 Jonathan Wakely ++ ++ * include/std/span (span(Range&&)): Reorder constraints. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2021-12-01 Jonathan Wakely ++ ++ * src/c++17/fs_path.cc (path::_M_split_cmpts()): Remove ++ micro-optimization for "/" path. ++ * src/filesystem/path.cc (path::_M_split_cmpts()): Only access ++ the contents of _M_pathname using const member functions. ++ ++2022-04-21 Pavel I. Kryukov ++ ++ Backported from master: ++ 2022-01-06 Pavel I. Kryukov ++ Jonathan Wakely ++ ++ PR libstdc++/103853 ++ * include/bits/forward_list.tcc (forward_list::merge): Check for ++ self-merge. ++ * testsuite/23_containers/forward_list/operations/merge.cc: New test. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-14 Jonathan Wakely ++ ++ * include/bits/stl_construct.h (_Construct, _Construct_novalue): ++ Also cast away cv-qualifiers when converting pointer to void. ++ * testsuite/20_util/allocator/void.cc: Test construct function ++ with cv-qualified types. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-06 Jonathan Wakely ++ ++ PR libstdc++/103911 ++ * include/std/charconv (__from_chars_alpha_to_num): Return ++ char instead of unsigned char. Change invalid return value to ++ 127 instead of using numeric trait. ++ (__from_chars_alnum): Fix comment. Do not use std::isdigit. ++ Change type of variable to char. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-27 Jonathan Wakely ++ ++ * include/bits/ranges_base.h (ranges::advance): Avoid signed ++ overflow. Do nothing if already equal to desired result. ++ * testsuite/24_iterators/range_operations/advance_overflow.cc: ++ New test. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-06 Jonathan Wakely ++ ++ * testsuite/ext/rope/pthread7-rope.cc: Add dg-timeout-factor. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-03-03 Jonathan Wakely ++ ++ * testsuite/17_intro/names.cc (func): Undef on AIX. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-04-20 Jonathan Wakely ++ ++ PR libstdc++/93602 ++ * doc/xml/manual/prerequisites.xml: Document libiconv ++ workarounds. ++ * doc/html/manual/setup.html: Regenerate. ++ * src/Makefile.am (CXXLINK): Add $(LTLIBICONV). ++ * src/Makefile.in: Regenerate. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-04-14 Jonathan Wakely ++ ++ * doc/xml/manual/intro.xml: Fix comment. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-04-20 Jonathan Wakely ++ ++ * testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc: ++ Check correct feature test macro. ++ ++2022-04-21 Jonathan Wakely ++ ++ PR middle-end/104966 ++ * include/bits/locale_facets_nonio.tcc ++ (__moneypunct_cache::_M_cache): Store string sizes in local ++ variable that doesn't escape. ++ ++2022-04-21 Jonathan Wakely ++ ++ Backported from master: ++ 2022-01-05 Jonathan Wakely ++ ++ PR libstdc++/103848 ++ * include/bits/stl_deque.h (operator-): Do not use 0 as null ++ pointer constant. ++ + 2022-04-21 Release Manager + + * GCC 11.3.0 released. +--- a/src/libstdc++-v3/config.h.in ++++ b/src/libstdc++-v3/config.h.in +@@ -310,6 +310,9 @@ + /* Define if readlink is available in . */ + #undef HAVE_READLINK + ++/* Define to 1 if you have the `secure_getenv' function. */ ++#undef HAVE_SECURE_GETENV ++ + /* Define to 1 if you have the `setenv' function. */ + #undef HAVE_SETENV + +--- a/src/libstdc++-v3/configure ++++ b/src/libstdc++-v3/configure +@@ -28419,6 +28419,17 @@ if test "x$ac_cv_func__wfopen" = xyes; then : + #define HAVE__WFOPEN 1 + _ACEOF + ++fi ++done ++ ++ for ac_func in secure_getenv ++do : ++ ac_fn_c_check_func "$LINENO" "secure_getenv" "ac_cv_func_secure_getenv" ++if test "x$ac_cv_func_secure_getenv" = xyes; then : ++ cat >>confdefs.h <<_ACEOF ++#define HAVE_SECURE_GETENV 1 ++_ACEOF ++ + fi + done + +--- a/src/libstdc++-v3/configure.ac ++++ b/src/libstdc++-v3/configure.ac +@@ -276,6 +276,7 @@ if $GLIBCXX_IS_NATIVE; then + AC_CHECK_FUNCS(__cxa_thread_atexit_impl __cxa_thread_atexit) + AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) + AC_CHECK_FUNCS(_wfopen) ++ AC_CHECK_FUNCS(secure_getenv) + + # C11 functions for C++17 library + AC_CHECK_FUNCS(timespec_get) +--- a/src/libstdc++-v3/doc/html/index.html ++++ b/src/libstdc++-v3/doc/html/index.html +@@ -23,7 +23,7 @@ +


Table of Contents

The GNU C++ Library Manual
I. + Introduction + +-
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
Implementation Specific Behavior
Filesystem TS
C++ 2017
Implementation Specific Behavior
Parallelism 2 TS
C++ 2020
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Non-memory leaks in Pool and MT allocators
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
II. ++
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
Implementation Specific Behavior
Filesystem TS
C++ 2017
Implementation Specific Behavior
Parallelism 2 TS
C++ 2020
C++ 2023
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Non-memory leaks in Pool and MT allocators
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
II. + Standard Contents +
4. + Support +--- a/src/libstdc++-v3/doc/html/manual/index.html ++++ b/src/libstdc++-v3/doc/html/manual/index.html +@@ -4,7 +4,7 @@ +


Table of Contents

I. + Introduction + +-
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
Implementation Specific Behavior
Filesystem TS
C++ 2017
Implementation Specific Behavior
Parallelism 2 TS
C++ 2020
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Non-memory leaks in Pool and MT allocators
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
II. ++
1. Status
Implementation Status
C++ 1998/2003
Implementation Status
Implementation Specific Behavior
C++ 2011
Implementation Specific Behavior
C++ 2014
Implementation Specific Behavior
Filesystem TS
C++ 2017
Implementation Specific Behavior
Parallelism 2 TS
C++ 2020
C++ 2023
C++ TR1
Implementation Specific Behavior
C++ TR 24733
C++ IS 29124
Implementation Specific Behavior
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Dual ABI
Troubleshooting
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Experimental Library Extensions
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Structure
Defaults
Future
Alternatives
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
With C
With POSIX thread cancellation
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Non-memory leaks in Pool and MT allocators
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
II. + Standard Contents +
4. + Support +@@ -145,7 +145,7 @@ Support for C++11 dialect. +
21.10. Non-unique Mapping Containers
21.11. Point Iterator Hierarchy
21.12. Invalidation Guarantee Tags Hierarchy
21.13. Container Tag Hierarchy
21.14. Hash functions, ranged-hash functions, and + range-hashing functions
21.15. Insert hash sequence diagram
21.16. Insert hash sequence diagram with a null policy
21.17. Hash policy class diagram
21.18. Balls and bins
21.19. Insert resize sequence diagram
21.20. Standard resize policy trigger sequence + diagram
21.21. Standard resize policy size sequence +- diagram
21.22. Tree node invariants
21.23. Tree node invalidation
21.24. A tree and its update policy
21.25. Restoring node invariants
21.26. Insert update sequence
21.27. Useless update path
21.28. A PATRICIA trie
21.29. A trie and its update policy
21.30. A simple list
21.31. The counter algorithm
21.32. Underlying Priority-Queue Data-Structures.
21.33. Priority-Queue Data-Structure Tags.
B.1. Configure and Build File Dependencies

List of Tables

1.1. C++ 1998/2003 Implementation Status
1.2. C++ 2011 Implementation Status
1.3. C++ 2014 Implementation Status
1.4. C++ Technical Specifications Implementation Status
1.5. C++ 2017 Library Features
1.6. C++ 2017 Implementation Status
1.7. C++ Technical Specifications Implementation Status
1.8. Support for Extended ABI Tags
1.9. C++ 2020 Library Features
1.10. C++ 2023 Library Features
1.11. C++ TR1 Implementation Status
1.12. C++ TR 24733 Implementation Status
1.13. C++ Special Functions Implementation Status
3.1. C++ Command Options
3.2. C++ 1998 Library Headers
3.3. C++ 1998 Library Headers for C Library Facilities
3.4. C++ 1998 Deprecated Library Header
3.5. C++ 2011 Library Headers
3.6. C++ 2011 Library Headers for C Library Facilities
3.7. C++ 2014 Library Header
3.8. C++ 2017 Library Headers
3.9. C++ 2020 Library Headers
3.10. C++ 2020 Obsolete Headers
3.11. File System TS Header
3.12. Library Fundamentals TS Headers
3.13. C++ TR 1 Library Headers
3.14. C++ TR 1 Library Headers for C Library Facilities
3.15. C++ TR 24733 Decimal Floating-Point Header
3.16. C++ ABI Headers
3.17. Extension Headers
3.18. Extension Debug Headers
3.19. Extension Parallel Headers
17.1. Debugging Containers
17.2. Debugging Containers C++11
18.1. Parallel Algorithms
20.1. Bitmap Allocator Memory Map
B.1. Doxygen Prerequisites
B.2. HTML to Doxygen Markup Comparison
B.3. Docbook Prerequisites
B.4. HTML to Docbook XML Markup Comparison
B.5. Docbook XML Element Use
B.6. Extension Allocators
B.7. Extension Allocators Continued
+\ No newline at end of file ++ +\ No newline at end of file +--- a/src/libstdc++-v3/doc/html/manual/setup.html ++++ b/src/libstdc++-v3/doc/html/manual/setup.html +@@ -42,6 +42,39 @@ +

+ Finally, a few system-specific requirements: +

linux

++ The 'gnu' locale model makes use of iconv ++ for character set conversions. The relevant functions are provided ++ by Glibc and so are always available, however they can also be ++ provided by the separate GNU libiconv library. If GNU libiconv is ++ found when GCC is built (e.g., because its headers are installed ++ in /usr/local/include) ++ then the libstdc++.so.6 library will have a ++ run-time dependency on libiconv.so.2. ++ If you do not want that run-time dependency then you should do ++ one of the following: ++

  • ++ Uninstall the libiconv headers before building GCC. ++ Glibc already provides iconv so you should ++ not need libiconv anyway. ++

  • ++ ++ Download the libiconv sources and extract them into the ++ top level of the GCC source tree, e.g., ++

    ++wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
    ++tar xf libiconv-1.16.tar.gz
    ++ln -s libiconv-1.16 libiconv
    ++

    ++ This will build libiconv as part of building GCC and link to ++ it statically, so there is no libiconv.so.2 ++ dependency. ++

  • ++ Configure GCC with --with-libiconv-type=static. ++ This requires the static libiconv.a library, ++ which is not installed by default. You might need to reinstall ++ libiconv using the --enable-static configure ++ option to get the static library. ++

+ If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt + will be made to use "C" library functionality necessary for + C++ named locale support. For GCC 4.6.0 and later, this +--- a/src/libstdc++-v3/doc/html/manual/status.html ++++ b/src/libstdc++-v3/doc/html/manual/status.html +@@ -2,7 +2,7 @@ + Chapter 1. Status

Chapter 1. Status

Implementation Status

C++ 1998/2003

Implementation Status

++ Next


Chapter 1. Status

Implementation Status

C++ 1998/2003

Implementation Status

+ This status table is based on the table of contents of ISO/IEC 14882:2003. +

+ This section describes the C++ support in the GCC 11 release series. +@@ -1242,8 +1242,8 @@ presence of the required flag. + This section describes the C++20 and library TS support in the GCC 11 + release series. +

+-The following table lists new library features that have been accepted into +-the C++20 working draft. The "Proposal" column provides a link to the ++The following table lists new library features that are included in ++the C++20 standard. The "Proposal" column provides a link to the + ISO C++ committee proposal that describes the feature, while the "Status" + column indicates the first version of GCC that contains an implementation of + this feature (if it has been implemented). +@@ -1344,10 +1344,10 @@ or any notes about the implementation. + 10.1 __cpp_lib_atomic_float >= 201711L C++ Synchronized Buffered Ostream + + P0053R7 +- 11 __cpp_lib_syncbuf >= 201711L Manipulators for C++ Synchronized Buffered Ostream ++ 11.1 __cpp_lib_syncbuf >= 201711L Manipulators for C++ Synchronized Buffered Ostream + + P0753R2 +- 11 __cpp_lib_syncbuf >= 201803L Make std::memory_order a scoped enumeration ++ 11.1 __cpp_lib_syncbuf >= 201803L Make std::memory_order a scoped enumeration + + P0439R0 + 9.1   The Curious Case of Padding Bits, Featuring Atomic Compare-and-Exchange +@@ -1428,7 +1428,7 @@ or any notes about the implementation. + string::reserve Should Not Shrink + + P0966R1 +- 11   char8_t: A type for UTF-8 characters and strings ++ 11.1   char8_t: A type for UTF-8 characters and strings + + P0482R6 + 9.1 __cpp_lib_char8_t >= 201811L char8_t backward compatibility remediation +@@ -1555,7 +1555,7 @@ or any notes about the implementation. +   Bit-casting object representations + + P0476R2 +- 11 __cpp_lib_bit_cast >= 201806L Integral power-of-2 operations ++ 11.1 __cpp_lib_bit_cast >= 201806L Integral power-of-2 operations + + P0556R3 + 9.1 __cpp_lib_int_pow2 >= 201806L (since 9.4, see Note 1) On the names of low-level bit manipulation functions +@@ -1675,7 +1675,7 @@ or any notes about the implementation. + 8.1 __cpp_lib_endian >= 201907L Bit operations + + P0553R4 +- 10.1 __cpp_lib_bitops >= 201907L (since 9.4, see Note 1) Well-behaved interpolation for numbers and pointers ++ 9.1 __cpp_lib_bitops >= 201907L (since 9.4, see Note 1) Well-behaved interpolation for numbers and pointers + + P0811R3 + 9.1 __cpp_lib_interpolate >= 201902L Mathematical constants +@@ -1684,16 +1684,105 @@ or any notes about the implementation. + 10.1 __cpp_lib_math_constants >= 201907L std::source_location + + P1208R6 +- 11 ++ 11.1 + __cpp_lib_source_location >= 201907L + Efficient access to std::basic_stringbuf's Buffer + + P0408R7 +- 11  


++ 11.1  


+ Note 1: This feature is supported in older releases but the + __cpp_lib macro is not defined to the right value + (or not defined at all) until the version shown in parentheses. +-

C++ TR1

++

C++ 2023

++In this implementation the -std=gnu++23 or ++-std=c++23 flag must be used to enable language ++and library ++features. See dialect ++options. The pre-defined symbol ++__cplusplus is used to check for the ++presence of the required flag. ++

++This section describes the C++23 and library TS support in mainline GCC, ++not in any particular release. ++

++The following table lists new library features that have been accepted into ++the C++23 working draft. The "Proposal" column provides a link to the ++ISO C++ committee proposal that describes the feature, while the "Status" ++column indicates the first version of GCC that contains an implementation of ++this feature (if it has been implemented). ++A dash (—) in the status column indicates that the changes in the proposal ++either do not affect the code in libstdc++, or the changes are not required for conformance. ++The "SD-6 Feature Test / Notes" column shows the corresponding macro or header from ++SD-6: ++Feature-testing recommendations for C++ (where applicable) ++or any notes about the implementation. ++

Table 1.10. C++ 2023 Library Features

Library FeatureProposalStatusSD-6 Feature Test / Notes
++ Ranges and Views ++
Range constructor for std::string_view ++ ++ P1989R2 ++ ++ 11.1  
join_view should join all views of ranges ++ ++ P2328R1 ++ ++ 11.2  
Clarifying range adaptor objects ++ ++ P2281R1 ++ ++ 11.1  
Views should not be required to be default constructible ++ ++ P2325R3 ++ ++ 11.3 __cpp_lib_ranges >= 202106L
Conditionally borrowed ranges ++ ++ P2017R1 ++ ++ 11.1  
Require span & basic_string_view to be Trivially Copyable ++ ++ P2251R1 ++ ++ Yes  
++ Compile-time programming ++
A proposal for a type trait to detect scoped enumerations ++ ++ P1048R1 ++ ++ 11.1 __cpp_lib_is_scoped_enum >= 202011L
std::to_underlying for enumerations ++ ++ P1682R3 ++ ++ 11.1 __cpp_lib_to_underlying >= 202102L
Missing constexpr in std::optional and std::variant ++ ++ P2231R1 ++ ++ 11.3 (optional only) ++
__cpp_lib_constexpr_optional >= 202106L
__cpp_lib_variant >= 202106L
++
++ Strings and text ++
string contains function ++ ++ P1679R3 ++ ++ 11.1 __cpp_lib_string_contains >= 202011L
++ Miscellaneous ++
Inheriting from std::variant ++ ++ P2162R2 ++ ++ 11.3 __cpp_lib_variant >= 202102L
Printing volatile Pointers ++ ++ P1147R1 ++ ++ 11.3  
Clarifying the status of the "C headers" ++ ++ P2340R1 ++ ++ Yes  
Relax Requirements for time_point::clock ++ ++ P2212R2 ++ ++ Yes  

C++ TR1

+ This table is based on the table of contents of ISO/IEC DTR 19768 + Doc No: N1836=05-0096 Date: 2005-06-24 + Draft Technical Report on C++ Library Extensions +@@ -1703,7 +1792,7 @@ In this implementation the header names are prefixed by + <tr1/memory>, and so on. +

+ This page describes the TR1 support in the GCC 11 release series. +-

Table 1.10. C++ TR1 Implementation Status

SectionDescriptionStatusComments
2General Utilities
2.1Reference wrappers  
2.1.1Additions to header <functional> synopsisY 
2.1.2Class template reference_wrapper  
2.1.2.1reference_wrapper construct/copy/destroyY 
2.1.2.2reference_wrapper assignmentY 
2.1.2.3reference_wrapper accessY 
2.1.2.4reference_wrapper invocationY 
2.1.2.5reference_wrapper helper functionsY 
2.2Smart pointers  
2.2.1Additions to header <memory> synopsisY 
2.2.2Class bad_weak_ptrY 
2.2.3Class template shared_ptr  ++

Table 1.11. C++ TR1 Implementation Status

SectionDescriptionStatusComments
2General Utilities
2.1Reference wrappers  
2.1.1Additions to header <functional> synopsisY 
2.1.2Class template reference_wrapper  
2.1.2.1reference_wrapper construct/copy/destroyY 
2.1.2.2reference_wrapper assignmentY 
2.1.2.3reference_wrapper accessY 
2.1.2.4reference_wrapper invocationY 
2.1.2.5reference_wrapper helper functionsY 
2.2Smart pointers  
2.2.1Additions to header <memory> synopsisY 
2.2.2Class bad_weak_ptrY 
2.2.3Class template shared_ptr  +

+ Uses code from + boost::shared_ptr. +@@ -1723,7 +1812,7 @@ Extension for the programming language C++ to support + decimal floating-point arithmetic +

+ This page describes the TR 24733 support in the GCC 11 release series. +-

Table 1.11. C++ TR 24733 Implementation Status

SectionDescriptionStatusComments
++

Table 1.12. C++ TR 24733 Implementation Status

SectionDescriptionStatusComments
+ 0 + + Introduction +@@ -1763,7 +1852,7 @@ non-strict modes (i.e. -std=gnu++NN modes) the + hypergeometric functions and confluent hypergeometric functions + from TR1 are also provided, defined in namespace + __gnu_cxx. +-

Table 1.12. C++ Special Functions Implementation Status

SectionDescriptionStatusComments
7Macro namesPartialNo diagnostic for inconsistent definitions of ++

Table 1.13. C++ Special Functions Implementation Status

SectionDescriptionStatusComments
7Macro namesPartialNo diagnostic for inconsistent definitions of + __STDCPP_WANT_MATH_SPEC_FUNCS__
8Mathematical special functionsY 
8.1Additions to header <cmath> synopsisY 
8.1.1associated Laguerre polynomialsY 
8.1.2associated Legendre functionsY 
8.1.3beta functionY 
8.1.4(complete) elliptic integral of the first kindY 
8.1.5(complete) elliptic integral of the second kindY 
8.1.6(complete) elliptic integral of the third kindY 
8.1.7regular modified cylindrical Bessel functionsY 
8.1.8cylindrical Bessel functions (of the first kind)Y 
8.1.9irregular modified cylindrical Bessel functionsY 
8.1.10cylindrical Neumann functionsY 
8.1.11(incomplete) elliptic integral of the first kindY 
8.1.12(incomplete) elliptic integral of the second kindY 
8.1.13(incomplete) elliptic integral of the third kindY 
8.1.14exponential integralY 
8.1.15Hermite polynomialsY 
8.1.16Laguerre polynomialsY 
8.1.17Legendre polynomialsY 
8.1.18Riemann zeta functionY 
8.1.19spherical Bessel functions (of the first kind)Y 
8.1.20spherical associated Legendre functionsY 
8.1.21spherical Neumann functionsY 
8.2Additions to header <math.h>Y 
8.3The header <ctgmath>PartialConflicts with C++ 2011 requirements.
8.4The header <tgmath.h>NConflicts with C++ 2011 requirements.

Implementation Specific Behavior

For behaviour which is specified by the 2011 standard, + see C++ 2011 Implementation + Specific Behavior. This section documents behaviour which +--- a/src/libstdc++-v3/doc/xml/manual/intro.xml ++++ b/src/libstdc++-v3/doc/xml/manual/intro.xml +@@ -47,15 +47,19 @@ + + + +- ++ ++ ++ ++ ++ + + + +- ++ + + + +- ++ + + + +--- a/src/libstdc++-v3/doc/xml/manual/prerequisites.xml ++++ b/src/libstdc++-v3/doc/xml/manual/prerequisites.xml +@@ -48,6 +48,57 @@ + + linux + ++ ++ ++ The 'gnu' locale model makes use of iconv ++ for character set conversions. The relevant functions are provided ++ by Glibc and so are always available, however they can also be ++ provided by the separate GNU libiconv library. If GNU libiconv is ++ found when GCC is built (e.g., because its headers are installed ++ in /usr/local/include) ++ then the libstdc++.so.6 library will have a ++ run-time dependency on libiconv.so.2. ++ If you do not want that run-time dependency then you should do ++ one of the following: ++ ++ ++ ++ ++ Uninstall the libiconv headers before building GCC. ++ Glibc already provides iconv so you should ++ not need libiconv anyway. ++ ++ ++ ++ ++ ++ Download the libiconv sources and extract them into the ++ top level of the GCC source tree, e.g., ++ ++ ++wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz ++tar xf libiconv-1.16.tar.gz ++ln -s libiconv-1.16 libiconv ++ ++ ++ This will build libiconv as part of building GCC and link to ++ it statically, so there is no libiconv.so.2 ++ dependency. ++ ++ ++ ++ ++ Configure GCC with . ++ This requires the static libiconv.a library, ++ which is not installed by default. You might need to reinstall ++ libiconv using the configure ++ option to get the static library. ++ ++ ++ ++ ++ + + + If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt +--- a/src/libstdc++-v3/doc/xml/manual/status_cxx2020.xml ++++ b/src/libstdc++-v3/doc/xml/manual/status_cxx2020.xml +@@ -25,8 +25,8 @@ release series. + + + +-The following table lists new library features that have been accepted into +-the C++20 working draft. The "Proposal" column provides a link to the ++The following table lists new library features that are included in ++the C++20 standard. The "Proposal" column provides a link to the + ISO C++ committee proposal that describes the feature, while the "Status" + column indicates the first version of GCC that contains an implementation of + this feature (if it has been implemented). +@@ -362,7 +362,7 @@ or any notes about the implementation. + + P0053R7 + +- 11 ++ 11.1 + __cpp_lib_syncbuf >= 201711L + + +@@ -372,7 +372,7 @@ or any notes about the implementation. + + P0753R2 + +- 11 ++ 11.1 + __cpp_lib_syncbuf >= 201803L + + +@@ -647,7 +647,7 @@ or any notes about the implementation. + + P0966R1 + +- 11 ++ 11.1 + + + +@@ -1045,7 +1045,7 @@ or any notes about the implementation. + + P0476R2 + +- 11 ++ 11.1 + __cpp_lib_bit_cast >= 201806L + + +@@ -1401,7 +1401,7 @@ or any notes about the implementation. + + P0553R4 + +- 10.1 ++ 9.1 + __cpp_lib_bitops >= 201907L (since 9.4, see Note 1) + + +@@ -1431,7 +1431,7 @@ or any notes about the implementation. + + P1208R6 + +- 11 ++ 11.1 + + __cpp_lib_source_location >= 201907L + +@@ -1443,7 +1443,7 @@ or any notes about the implementation. + + P0408R7 + +- 11 ++ 11.1 + + + +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/doc/xml/manual/status_cxx2023.xml +@@ -0,0 +1,249 @@ ++

++ ++ ++C++ 2023 ++ ++ ISO C++ ++ 2023 ++ ++ ++ ++ ++In this implementation the -std=gnu++23 or ++-std=c++23 flag must be used to enable language ++and library ++features. See dialect ++options. The pre-defined symbol ++__cplusplus is used to check for the ++presence of the required flag. ++ ++ ++ ++This section describes the C++23 and library TS support in mainline GCC, ++not in any particular release. ++ ++ ++ ++The following table lists new library features that have been accepted into ++the C++23 working draft. The "Proposal" column provides a link to the ++ISO C++ committee proposal that describes the feature, while the "Status" ++column indicates the first version of GCC that contains an implementation of ++this feature (if it has been implemented). ++A dash (—) in the status column indicates that the changes in the proposal ++either do not affect the code in libstdc++, or the changes are not required for conformance. ++The "SD-6 Feature Test / Notes" column shows the corresponding macro or header from ++SD-6: ++Feature-testing recommendations for C++ (where applicable) ++or any notes about the implementation. ++ ++ ++ ++C++ 2023 Library Features ++ ++ ++ ++ ++ ++ ++ ++ ++ Library Feature ++ Proposal ++ Status ++ SD-6 Feature Test / Notes ++ ++ ++ ++ ++ ++ ++ ++ Ranges and Views ++ ++ ++ ++ ++ Range constructor for std::string_view ++ ++ ++ P1989R2 ++ ++ ++ 11.1 ++ ++ ++ ++ ++ join_view should join all views of ranges ++ ++ ++ P2328R1 ++ ++ ++ 11.2 ++ ++ ++ ++ ++ ++ Clarifying range adaptor objects ++ ++ ++ P2281R1 ++ ++ ++ 11.1 ++ ++ ++ ++ ++ Views should not be required to be default constructible ++ ++ ++ P2325R3 ++ ++ ++ 11.3 ++ __cpp_lib_ranges >= 202106L ++ ++ ++ ++ Conditionally borrowed ranges ++ ++ ++ P2017R1 ++ ++ ++ 11.1 ++ ++ ++ ++ ++ Require span & basic_string_view to be Trivially Copyable ++ ++ ++ P2251R1 ++ ++ ++ Yes ++ ++ ++ ++ ++ ++ Compile-time programming ++ ++ ++ ++ ++ A proposal for a type trait to detect scoped enumerations ++ ++ ++ P1048R1 ++ ++ ++ 11.1 ++ __cpp_lib_is_scoped_enum >= 202011L ++ ++ ++ ++ std::to_underlying for enumerations ++ ++ ++ P1682R3 ++ ++ ++ 11.1 ++ __cpp_lib_to_underlying >= 202102L ++ ++ ++ ++ ++ Missing constexpr in std::optional and std::variant ++ ++ ++ P2231R1 ++ ++ ++ 11.3 (optional only) ++ ++ ++ __cpp_lib_constexpr_optional >= 202106L ++ __cpp_lib_variant >= 202106L ++ ++ ++ ++ ++ ++ ++ Strings and text ++ ++ ++ ++ ++ string contains function ++ ++ ++ P1679R3 ++ ++ ++ 11.1 ++ __cpp_lib_string_contains >= 202011L ++ ++ ++ ++ ++ Miscellaneous ++ ++ ++ ++ ++ Inheriting from std::variant ++ ++ ++ P2162R2 ++ ++ ++ 11.3 ++ __cpp_lib_variant >= 202102L ++ ++ ++ ++ Printing volatile Pointers ++ ++ ++ P1147R1 ++ ++ ++ 11.3 ++ ++ ++ ++ ++ Clarifying the status of the "C headers" ++ ++ ++ P2340R1 ++ ++ ++ Yes ++ ++ ++ ++ ++ Relax Requirements for time_point::clock ++ ++ ++ P2212R2 ++ ++ ++ Yes ++ ++ ++ ++ ++ ++
++ ++
+--- a/src/libstdc++-v3/include/bits/atomic_base.h ++++ b/src/libstdc++-v3/include/bits/atomic_base.h +@@ -121,6 +121,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + | __memory_order_modifier(__m & __memory_order_modifier_mask)); + } + ++ constexpr bool ++ __is_valid_cmpexch_failure_order(memory_order __m) noexcept ++ { ++ return (__m & __memory_order_mask) != memory_order_release ++ && (__m & __memory_order_mask) != memory_order_acq_rel; ++ } ++ + _GLIBCXX_ALWAYS_INLINE void + atomic_thread_fence(memory_order __m) noexcept + { __atomic_thread_fence(int(__m)); } +@@ -245,13 +252,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + // TODO add const volatile overload + + _GLIBCXX_ALWAYS_INLINE void +- notify_one() const noexcept ++ notify_one() noexcept + { std::__atomic_notify_address(&_M_i, false); } + + // TODO add const volatile overload + + _GLIBCXX_ALWAYS_INLINE void +- notify_all() const noexcept ++ notify_all() noexcept + { std::__atomic_notify_address(&_M_i, true); } + + // TODO add const volatile overload +@@ -511,13 +518,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + compare_exchange_weak(__int_type& __i1, __int_type __i2, + memory_order __m1, memory_order __m2) noexcept + { +- memory_order __b2 __attribute__ ((__unused__)) +- = __m2 & __memory_order_mask; +- memory_order __b1 __attribute__ ((__unused__)) +- = __m1 & __memory_order_mask; +- __glibcxx_assert(__b2 != memory_order_release); +- __glibcxx_assert(__b2 != memory_order_acq_rel); +- __glibcxx_assert(__b2 <= __b1); ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__m2)); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, + int(__m1), int(__m2)); +@@ -528,13 +529,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + memory_order __m1, + memory_order __m2) volatile noexcept + { +- memory_order __b2 __attribute__ ((__unused__)) +- = __m2 & __memory_order_mask; +- memory_order __b1 __attribute__ ((__unused__)) +- = __m1 & __memory_order_mask; +- __glibcxx_assert(__b2 != memory_order_release); +- __glibcxx_assert(__b2 != memory_order_acq_rel); +- __glibcxx_assert(__b2 <= __b1); ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__m2)); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, + int(__m1), int(__m2)); +@@ -560,13 +555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + compare_exchange_strong(__int_type& __i1, __int_type __i2, + memory_order __m1, memory_order __m2) noexcept + { +- memory_order __b2 __attribute__ ((__unused__)) +- = __m2 & __memory_order_mask; +- memory_order __b1 __attribute__ ((__unused__)) +- = __m1 & __memory_order_mask; +- __glibcxx_assert(__b2 != memory_order_release); +- __glibcxx_assert(__b2 != memory_order_acq_rel); +- __glibcxx_assert(__b2 <= __b1); ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__m2)); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, + int(__m1), int(__m2)); +@@ -577,14 +566,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + memory_order __m1, + memory_order __m2) volatile noexcept + { +- memory_order __b2 __attribute__ ((__unused__)) +- = __m2 & __memory_order_mask; +- memory_order __b1 __attribute__ ((__unused__)) +- = __m1 & __memory_order_mask; +- +- __glibcxx_assert(__b2 != memory_order_release); +- __glibcxx_assert(__b2 != memory_order_acq_rel); +- __glibcxx_assert(__b2 <= __b1); ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__m2)); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, + int(__m1), int(__m2)); +@@ -618,13 +600,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + // TODO add const volatile overload + + _GLIBCXX_ALWAYS_INLINE void +- notify_one() const noexcept ++ notify_one() noexcept + { std::__atomic_notify_address(&_M_i, false); } + + // TODO add const volatile overload + + _GLIBCXX_ALWAYS_INLINE void +- notify_all() const noexcept ++ notify_all() noexcept + { std::__atomic_notify_address(&_M_i, true); } + + // TODO add const volatile overload +@@ -869,13 +851,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + memory_order __m1, + memory_order __m2) noexcept + { +- memory_order __b2 __attribute__ ((__unused__)) +- = __m2 & __memory_order_mask; +- memory_order __b1 __attribute__ ((__unused__)) +- = __m1 & __memory_order_mask; +- __glibcxx_assert(__b2 != memory_order_release); +- __glibcxx_assert(__b2 != memory_order_acq_rel); +- __glibcxx_assert(__b2 <= __b1); ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__m2)); + + return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, + int(__m1), int(__m2)); +@@ -886,14 +862,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + memory_order __m1, + memory_order __m2) volatile noexcept + { +- memory_order __b2 __attribute__ ((__unused__)) +- = __m2 & __memory_order_mask; +- memory_order __b1 __attribute__ ((__unused__)) +- = __m1 & __memory_order_mask; +- +- __glibcxx_assert(__b2 != memory_order_release); +- __glibcxx_assert(__b2 != memory_order_acq_rel); +- __glibcxx_assert(__b2 <= __b1); ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__m2)); + + return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, + int(__m1), int(__m2)); +@@ -996,6 +965,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + _Val<_Tp> __desired, memory_order __success, + memory_order __failure) noexcept + { ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__failure)); ++ + return __atomic_compare_exchange(__ptr, std::__addressof(__expected), + std::__addressof(__desired), true, + int(__success), int(__failure)); +@@ -1007,6 +978,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + _Val<_Tp> __desired, memory_order __success, + memory_order __failure) noexcept + { ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__failure)); ++ + return __atomic_compare_exchange(__ptr, std::__addressof(__expected), + std::__addressof(__desired), false, + int(__success), int(__failure)); +--- a/src/libstdc++-v3/include/bits/forward_list.tcc ++++ b/src/libstdc++-v3/include/bits/forward_list.tcc +@@ -367,6 +367,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER + forward_list<_Tp, _Alloc>:: + merge(forward_list&& __list, _Comp __comp) + { ++ // _GLIBCXX_RESOLVE_LIB_DEFECTS ++ // 3088. forward_list::merge behavior unclear when passed *this ++ if (std::__addressof(__list) == this) ++ return; ++ + _Node_base* __node = &this->_M_impl._M_head; + while (__node->_M_next && __list._M_impl._M_head._M_next) + { +--- a/src/libstdc++-v3/include/bits/locale_facets_nonio.tcc ++++ b/src/libstdc++-v3/include/bits/locale_facets_nonio.tcc +@@ -78,32 +78,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + char* __grouping = 0; + _CharT* __curr_symbol = 0; + _CharT* __positive_sign = 0; +- _CharT* __negative_sign = 0; ++ _CharT* __negative_sign = 0; ++ size_t __sz; + __try + { + const string& __g = __mp.grouping(); +- _M_grouping_size = __g.size(); +- __grouping = new char[_M_grouping_size]; +- __g.copy(__grouping, _M_grouping_size); ++ __sz = _M_grouping_size = __g.size(); ++ __grouping = new char[__sz]; ++ __g.copy(__grouping, __sz); + _M_use_grouping = (_M_grouping_size + && static_cast(__grouping[0]) > 0 + && (__grouping[0] + != __gnu_cxx::__numeric_traits::__max)); + + const basic_string<_CharT>& __cs = __mp.curr_symbol(); +- _M_curr_symbol_size = __cs.size(); +- __curr_symbol = new _CharT[_M_curr_symbol_size]; +- __cs.copy(__curr_symbol, _M_curr_symbol_size); ++ __sz = _M_curr_symbol_size = __cs.size(); ++ __curr_symbol = new _CharT[__sz]; ++ __cs.copy(__curr_symbol, __sz); + + const basic_string<_CharT>& __ps = __mp.positive_sign(); +- _M_positive_sign_size = __ps.size(); +- __positive_sign = new _CharT[_M_positive_sign_size]; +- __ps.copy(__positive_sign, _M_positive_sign_size); ++ __sz = _M_positive_sign_size = __ps.size(); ++ __positive_sign = new _CharT[__sz]; ++ __ps.copy(__positive_sign, __sz); + + const basic_string<_CharT>& __ns = __mp.negative_sign(); +- _M_negative_sign_size = __ns.size(); +- __negative_sign = new _CharT[_M_negative_sign_size]; +- __ns.copy(__negative_sign, _M_negative_sign_size); ++ __sz = _M_negative_sign_size = __ns.size(); ++ __negative_sign = new _CharT[__sz]; ++ __ns.copy(__negative_sign, __sz); + + _M_pos_format = __mp.pos_format(); + _M_neg_format = __mp.neg_format(); +--- a/src/libstdc++-v3/include/bits/random.tcc ++++ b/src/libstdc++-v3/include/bits/random.tcc +@@ -1955,7 +1955,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + bool __saved_avail; + if (__is >> __mean >> __stddev >> __saved_avail) + { +- if (__saved_avail && (__is >> __x._M_saved)) ++ if (!__saved_avail || (__is >> __x._M_saved)) + { + __x._M_saved_available = __saved_avail; + __x.param(param_type(__mean, __stddev)); +--- a/src/libstdc++-v3/include/bits/ranges_base.h ++++ b/src/libstdc++-v3/include/bits/ranges_base.h +@@ -728,20 +728,23 @@ namespace ranges + { + const auto __diff = __bound - __it; + +- // n and bound must not lead in opposite directions: +- __glibcxx_assert(__n == 0 || __diff == 0 || (__n < 0 == __diff < 0)); +- const auto __absdiff = __diff < 0 ? -__diff : __diff; +- const auto __absn = __n < 0 ? -__n : __n;; +- if (__absn >= __absdiff) ++ if (__diff == 0) ++ return __n; ++ else if (__diff > 0 ? __n >= __diff : __n <= __diff) + { + (*this)(__it, __bound); + return __n - __diff; + } +- else ++ else if (__n != 0) [[likely]] + { ++ // n and bound must not lead in opposite directions: ++ __glibcxx_assert(__n < 0 == __diff < 0); ++ + (*this)(__it, __n); + return 0; + } ++ else ++ return 0; + } + else if (__it == __bound || __n == 0) + return __n; +--- a/src/libstdc++-v3/include/bits/regex_compiler.tcc ++++ b/src/libstdc++-v3/include/bits/regex_compiler.tcc +@@ -586,9 +586,9 @@ namespace __detail + template + bool + _Compiler<_TraitsT>:: +- _M_match_token(_TokenT token) ++ _M_match_token(_TokenT __token) + { +- if (token == _M_scanner._M_get_token()) ++ if (__token == _M_scanner._M_get_token()) + { + _M_value = _M_scanner._M_get_value(); + _M_scanner._M_advance(); +--- a/src/libstdc++-v3/include/bits/stl_construct.h ++++ b/src/libstdc++-v3/include/bits/stl_construct.h +@@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + return; + } + #endif +- ::new(static_cast(__p)) _Tp(std::forward<_Args>(__args)...); ++ ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); + } + #else + template +@@ -132,7 +132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + template + inline void + _Construct_novalue(_T1* __p) +- { ::new(static_cast(__p)) _T1; } ++ { ::new((void*)__p) _T1; } + + template + _GLIBCXX20_CONSTEXPR void +--- a/src/libstdc++-v3/include/bits/stl_deque.h ++++ b/src/libstdc++-v3/include/bits/stl_deque.h +@@ -353,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER + operator-(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT + { + return difference_type(_S_buffer_size()) +- * (__x._M_node - __y._M_node - int(__x._M_node != 0)) ++ * (__x._M_node - __y._M_node - bool(__x._M_node)) + + (__x._M_cur - __x._M_first) + + (__y._M_last - __y._M_cur); + } +@@ -365,10 +365,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER + template + friend difference_type + operator-(const _Self& __x, +- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT ++ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) ++ _GLIBCXX_NOEXCEPT + { + return difference_type(_S_buffer_size()) +- * (__x._M_node - __y._M_node - int(__x._M_node != 0)) ++ * (__x._M_node - __y._M_node - bool(__x._M_node)) + + (__x._M_cur - __x._M_first) + + (__y._M_last - __y._M_cur); + } +--- a/src/libstdc++-v3/include/bits/stl_iterator.h ++++ b/src/libstdc++-v3/include/bits/stl_iterator.h +@@ -537,6 +537,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + operator<=>(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __y.base() <=> __x.base(); } ++ ++ // Additional, non-standard overloads to avoid ambiguities with greedy, ++ // unconstrained overloads in associated namespaces. ++ ++ template ++ constexpr bool ++ operator==(const reverse_iterator<_Iterator>& __x, ++ const reverse_iterator<_Iterator>& __y) ++ requires requires { { __x.base() == __y.base() } -> convertible_to; } ++ { return __x.base() == __y.base(); } ++ ++ template ++ constexpr compare_three_way_result_t<_Iterator, _Iterator> ++ operator<=>(const reverse_iterator<_Iterator>& __x, ++ const reverse_iterator<_Iterator>& __y) ++ { return __y.base() <=> __x.base(); } + #endif // C++20 + ///@} + +@@ -1113,6 +1129,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + const __normal_iterator<_IteratorR, _Container>& __rhs) + noexcept(noexcept(std::__detail::__synth3way(__lhs.base(), __rhs.base()))) + { return std::__detail::__synth3way(__lhs.base(), __rhs.base()); } ++ ++ template ++ constexpr bool ++ operator==(const __normal_iterator<_Iterator, _Container>& __lhs, ++ const __normal_iterator<_Iterator, _Container>& __rhs) ++ noexcept(noexcept(__lhs.base() == __rhs.base())) ++ requires requires { ++ { __lhs.base() == __rhs.base() } -> std::convertible_to; ++ } ++ { return __lhs.base() == __rhs.base(); } ++ ++ template ++ constexpr std::__detail::__synth3way_t<_Iterator> ++ operator<=>(const __normal_iterator<_Iterator, _Container>& __lhs, ++ const __normal_iterator<_Iterator, _Container>& __rhs) ++ noexcept(noexcept(std::__detail::__synth3way(__lhs.base(), __rhs.base()))) ++ { return std::__detail::__synth3way(__lhs.base(), __rhs.base()); } + #else + // Forward iterator requirements + template +@@ -1588,20 +1621,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + #endif + { return !(__x < __y); } + +-#if ! (__cplusplus > 201703L && __cpp_lib_concepts) + // Note: See __normal_iterator operators note from Gaby to understand + // why we have these extra overloads for some move_iterator operators. + +- // These extra overloads are not needed in C++20, because the ones above +- // are constrained with a requires-clause and so overload resolution will +- // prefer them to greedy unconstrained function templates. +- + template + inline _GLIBCXX17_CONSTEXPR bool + operator==(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __x.base() == __y.base(); } + ++#if __cpp_lib_three_way_comparison ++ template ++ constexpr compare_three_way_result_t<_Iterator> ++ operator<=>(const move_iterator<_Iterator>& __x, ++ const move_iterator<_Iterator>& __y) ++ { return __x.base() <=> __y.base(); } ++#else + template + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const move_iterator<_Iterator>& __x, +--- a/src/libstdc++-v3/include/experimental/bits/simd.h ++++ b/src/libstdc++-v3/include/experimental/bits/simd.h +@@ -2303,17 +2303,23 @@ template + template <> \ + struct __intrinsic_type_impl<_Tp> { using type = __vector _Tp; } + _GLIBCXX_SIMD_PPC_INTRIN(float); ++#ifdef __VSX__ + _GLIBCXX_SIMD_PPC_INTRIN(double); ++#endif + _GLIBCXX_SIMD_PPC_INTRIN(signed char); + _GLIBCXX_SIMD_PPC_INTRIN(unsigned char); + _GLIBCXX_SIMD_PPC_INTRIN(signed short); + _GLIBCXX_SIMD_PPC_INTRIN(unsigned short); + _GLIBCXX_SIMD_PPC_INTRIN(signed int); + _GLIBCXX_SIMD_PPC_INTRIN(unsigned int); ++#if defined __VSX__ || __SIZEOF_LONG__ == 4 + _GLIBCXX_SIMD_PPC_INTRIN(signed long); + _GLIBCXX_SIMD_PPC_INTRIN(unsigned long); ++#endif ++#ifdef __VSX__ + _GLIBCXX_SIMD_PPC_INTRIN(signed long long); + _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long); ++#endif + #undef _GLIBCXX_SIMD_PPC_INTRIN + + template +@@ -2323,10 +2329,11 @@ template + static constexpr bool _S_is_ldouble = is_same_v<_Tp, long double>; + // allow _Tp == long double with -mlong-double-64 + static_assert(!(_S_is_ldouble && sizeof(long double) > sizeof(double)), +- "no __intrinsic_type support for long double on PPC"); ++ "no __intrinsic_type support for 128-bit floating point on PowerPC"); + #ifndef __VSX__ +- static_assert(!is_same_v<_Tp, double>, +- "no __intrinsic_type support for double on PPC w/o VSX"); ++ static_assert(!(is_same_v<_Tp, double> ++ || (_S_is_ldouble && sizeof(long double) == sizeof(double))), ++ "no __intrinsic_type support for 64-bit floating point on PowerPC w/o VSX"); + #endif + using type = + typename __intrinsic_type_impl< +--- a/src/libstdc++-v3/include/experimental/internet ++++ b/src/libstdc++-v3/include/experimental/internet +@@ -441,13 +441,15 @@ namespace ip + // constructors: + constexpr address() noexcept : _M_v4(), _M_is_v4(true) { } + ++#if __cpp_constexpr_dynamic_alloc + constexpr ++#endif + address(const address& __a) noexcept : _M_uninit(), _M_is_v4(__a._M_is_v4) + { + if (_M_is_v4) +- ::new (std::addressof(_M_v4)) address_v4(__a.to_v4()); ++ std::_Construct(std::addressof(_M_v4), __a.to_v4()); + else +- ::new (std::addressof(_M_v6)) address_v6(__a.to_v6()); ++ std::_Construct(std::addressof(_M_v6), __a.to_v6()); + } + + constexpr +@@ -470,7 +472,7 @@ namespace ip + address& + operator=(const address_v4& __a) noexcept + { +- ::new (std::addressof(_M_v4)) address_v4(__a); ++ std::_Construct(std::addressof(_M_v4), __a); + _M_is_v4 = true; + return *this; + } +@@ -478,7 +480,7 @@ namespace ip + address& + operator=(const address_v6& __a) noexcept + { +- ::new (std::addressof(_M_v6)) address_v6(__a); ++ std::_Construct(std::addressof(_M_v6), __a); + _M_is_v4 = false; + return *this; + } +--- a/src/libstdc++-v3/include/std/atomic ++++ b/src/libstdc++-v3/include/std/atomic +@@ -172,11 +172,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + // TODO add const volatile overload + + void +- notify_one() const noexcept ++ notify_one() noexcept + { _M_base.notify_one(); } + + void +- notify_all() const noexcept ++ notify_all() noexcept + { _M_base.notify_all(); } + #endif // __cpp_lib_atomic_wait + }; +@@ -320,6 +320,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s, + memory_order __f) noexcept + { ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__f)); ++ + return __atomic_compare_exchange(std::__addressof(_M_i), + std::__addressof(__e), + std::__addressof(__i), +@@ -330,6 +332,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s, + memory_order __f) volatile noexcept + { ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__f)); ++ + return __atomic_compare_exchange(std::__addressof(_M_i), + std::__addressof(__e), + std::__addressof(__i), +@@ -352,6 +356,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s, + memory_order __f) noexcept + { ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__f)); ++ + return __atomic_compare_exchange(std::__addressof(_M_i), + std::__addressof(__e), + std::__addressof(__i), +@@ -362,6 +368,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s, + memory_order __f) volatile noexcept + { ++ __glibcxx_assert(__is_valid_cmpexch_failure_order(__f)); ++ + return __atomic_compare_exchange(std::__addressof(_M_i), + std::__addressof(__e), + std::__addressof(__i), +@@ -391,11 +399,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + // TODO add const volatile overload + + void +- notify_one() const noexcept ++ notify_one() noexcept + { std::__atomic_notify_address(&_M_i, false); } + + void +- notify_all() const noexcept ++ notify_all() noexcept + { std::__atomic_notify_address(&_M_i, true); } + #endif // __cpp_lib_atomic_wait + +@@ -645,11 +653,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + // TODO add const volatile overload + + void +- notify_one() const noexcept ++ notify_one() noexcept + { _M_b.notify_one(); } + + void +- notify_all() const noexcept ++ notify_all() noexcept + { _M_b.notify_all(); } + #endif // __cpp_lib_atomic_wait + __pointer_type +@@ -1421,12 +1429,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + inline void +- atomic_notify_one(const atomic<_Tp>* __a) noexcept ++ atomic_notify_one(atomic<_Tp>* __a) noexcept + { __a->notify_one(); } + + template + inline void +- atomic_notify_all(const atomic<_Tp>* __a) noexcept ++ atomic_notify_all(atomic<_Tp>* __a) noexcept + { __a->notify_all(); } + #endif // __cpp_lib_atomic_wait + +--- a/src/libstdc++-v3/include/std/charconv ++++ b/src/libstdc++-v3/include/std/charconv +@@ -39,7 +39,6 @@ + + #include + #include // for __bit_width +-#include // for isdigit + #include // for __to_chars_len, __to_chars_10_impl + #include // for std::errc + #include +@@ -466,7 +465,7 @@ namespace __detail + return true; + } + +- constexpr unsigned char ++ constexpr char + __from_chars_alpha_to_num(char __c) + { + switch (__c) +@@ -550,10 +549,10 @@ namespace __detail + case 'Z': + return 35; + } +- return __gnu_cxx::__int_traits::__max; ++ return 127; + } + +- /// std::from_chars implementation for integers in bases 11 to 26. ++ /// std::from_chars implementation for integers in bases 11 to 36. + template + bool + __from_chars_alnum(const char*& __first, const char* __last, _Tp& __val, +@@ -562,8 +561,8 @@ namespace __detail + bool __valid = true; + while (__first != __last) + { +- unsigned char __c = *__first; +- if (std::isdigit(__c)) ++ char __c = *__first; ++ if ('0' <= __c && __c <= '9') // isdigit + __c -= '0'; + else + { +--- a/src/libstdc++-v3/include/std/future ++++ b/src/libstdc++-v3/include/std/future +@@ -1621,6 +1621,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + } + }; + ++ // _GLIBCXX_RESOLVE_LIB_DEFECTS ++ // 3117. Missing packaged_task deduction guides ++#if __cpp_deduction_guides >= 201606 ++ template ++ packaged_task(_Res(*)(_ArgTypes...)) -> packaged_task<_Res(_ArgTypes...)>; ++ ++ template::type> ++ packaged_task(_Fun) -> packaged_task<_Signature>; ++#endif ++ + /// swap + template + inline void +--- a/src/libstdc++-v3/include/std/iosfwd ++++ b/src/libstdc++-v3/include/std/iosfwd +@@ -207,6 +207,24 @@ _GLIBCXX_END_NAMESPACE_CXX11 + /// Class for @c wchar_t mixed input and output file streams. + typedef basic_fstream wfstream; + #endif ++ ++#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI ++ template, ++ typename _Allocator = allocator<_CharT>> ++ class basic_syncbuf; ++ template, ++ typename _Allocator = allocator<_CharT>> ++ class basic_osyncstream; ++ ++ using syncbuf = basic_syncbuf; ++ using osyncstream = basic_osyncstream; ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ using wsyncbuf = basic_syncbuf; ++ using wosyncstream = basic_osyncstream; ++#endif ++#endif // C++20 && CXX11_ABI ++ + /** @} */ + + _GLIBCXX_END_NAMESPACE_VERSION +--- a/src/libstdc++-v3/include/std/ranges ++++ b/src/libstdc++-v3/include/std/ranges +@@ -2916,7 +2916,7 @@ namespace views::__adaptor + { return _InnerIter<_Const>{_M_i}; } + + constexpr default_sentinel_t +- end() const ++ end() const noexcept + { return default_sentinel; } + }; + +--- a/src/libstdc++-v3/include/std/span ++++ b/src/libstdc++-v3/include/std/span +@@ -201,11 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + { } + + template +- requires ranges::contiguous_range<_Range> && ranges::sized_range<_Range> +- && (ranges::borrowed_range<_Range> || is_const_v) +- && (!__detail::__is_std_span>::value) ++ requires (!__detail::__is_std_span>::value) + && (!__detail::__is_std_array>::value) + && (!is_array_v>) ++ && ranges::contiguous_range<_Range> && ranges::sized_range<_Range> ++ && (ranges::borrowed_range<_Range> || is_const_v) + && __is_compatible_ref>::value + constexpr explicit(extent != dynamic_extent) + span(_Range&& __range) +--- a/src/libstdc++-v3/include/std/syncstream ++++ b/src/libstdc++-v3/include/std/syncstream +@@ -50,8 +50,7 @@ namespace std _GLIBCXX_VISIBILITY(default) + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + +- template, +- typename _Alloc = allocator<_CharT>> ++ template + class basic_syncbuf : public __syncbuf_base<_CharT, _Traits> + { + public: +@@ -241,8 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + __mutex _M_mtx; + }; + +- template , +- typename _Alloc = allocator<_CharT>> ++ template + class basic_osyncstream : public basic_ostream<_CharT, _Traits> + { + using __ostream_type = basic_ostream<_CharT, _Traits>; +--- a/src/libstdc++-v3/include/std/tuple ++++ b/src/libstdc++-v3/include/std/tuple +@@ -553,10 +553,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + template + struct _TupleConstraints + { +- template // Workaround for PR 96592 +- using is_constructible +- = __bool_constant<__is_constructible(_Tp, _Up)>; +- + // Constraint for a non-explicit constructor. + // True iff each Ti in _Types... can be constructed from Ui in _UTypes... + // and every Ui is implicitly convertible to Ti. +--- a/src/libstdc++-v3/src/Makefile.am ++++ b/src/libstdc++-v3/src/Makefile.am +@@ -267,7 +267,9 @@ CXXLINK = \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ +- $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ ++ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \ ++ $(LTLDFLAGS) $(LTLIBICONV) \ ++ -o $@ + + # Symbol versioning for shared libraries. + if ENABLE_SYMVERS +--- a/src/libstdc++-v3/src/Makefile.in ++++ b/src/libstdc++-v3/src/Makefile.in +@@ -631,7 +631,9 @@ CXXLINK = \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ +- $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ ++ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \ ++ $(LTLDFLAGS) $(LTLIBICONV) \ ++ -o $@ + + @ENABLE_SYMVERS_TRUE@CLEANFILES = libstdc++-symbols.ver $(version_dep) + @ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist +--- a/src/libstdc++-v3/src/c++11/cxx11-ios_failure.cc ++++ b/src/libstdc++-v3/src/c++11/cxx11-ios_failure.cc +@@ -44,14 +44,15 @@ + + namespace + { +- struct io_error_category : std::error_category ++ struct io_error_category final : std::error_category + { +- virtual const char* +- name() const noexcept ++ const char* ++ name() const noexcept final + { return "iostream"; } + + _GLIBCXX_DEFAULT_ABI_TAG +- virtual std::string message(int __ec) const ++ std::string ++ message(int __ec) const final + { + std::string __msg; + switch (std::io_errc(__ec)) +@@ -67,13 +68,17 @@ namespace + } + }; + +- const io_error_category& +- __io_category_instance() noexcept ++ struct constant_init + { +- static const io_error_category __ec{}; +- return __ec; +- } ++ union { ++ unsigned char unused; ++ io_error_category cat; ++ }; ++ constexpr constant_init() : cat() { } ++ ~constant_init() { /* do nothing, union member is not destroyed */ } ++ }; + ++ __constinit constant_init io_category_instance{}; + } // namespace + + namespace std _GLIBCXX_VISIBILITY(default) +@@ -82,7 +87,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + + const error_category& + iostream_category() noexcept +- { return __io_category_instance(); } ++ { return io_category_instance.cat; } + + ios_base::failure::failure(const string& __str) + : system_error(io_errc::stream, __str) { } +--- a/src/libstdc++-v3/src/c++11/future.cc ++++ b/src/libstdc++-v3/src/c++11/future.cc +@@ -27,14 +27,15 @@ + + namespace + { +- struct future_error_category : public std::error_category ++ struct future_error_category final : public std::error_category + { +- virtual const char* +- name() const noexcept ++ const char* ++ name() const noexcept final + { return "future"; } + + _GLIBCXX_DEFAULT_ABI_TAG +- virtual std::string message(int __ec) const ++ std::string ++ message(int __ec) const final + { + std::string __msg; + switch (std::future_errc(__ec)) +@@ -59,12 +60,17 @@ namespace + } + }; + +- const future_error_category& +- __future_category_instance() noexcept ++ struct constant_init + { +- static const future_error_category __fec{}; +- return __fec; +- } ++ union { ++ unsigned char unused; ++ future_error_category cat; ++ }; ++ constexpr constant_init() : cat() { } ++ ~constant_init() { /* do nothing, union member is not destroyed */ } ++ }; ++ ++ __constinit constant_init future_category_instance{}; + } + + namespace std _GLIBCXX_VISIBILITY(default) +@@ -76,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + { _GLIBCXX_THROW_OR_ABORT(future_error(make_error_code(future_errc(__i)))); } + + const error_category& future_category() noexcept +- { return __future_category_instance(); } ++ { return future_category_instance.cat; } + + future_error::~future_error() noexcept { } + +--- a/src/libstdc++-v3/src/c++17/floating_from_chars.cc ++++ b/src/libstdc++-v3/src/c++17/floating_from_chars.cc +@@ -37,7 +37,6 @@ + #include + #include + #include +-#include + #include + #include + #if _GLIBCXX_HAVE_XLOCALE_H +@@ -75,7 +74,6 @@ namespace + return m_buf + std::__exchange(m_bytes, m_bytes + bytes); + + __glibcxx_assert(m_ptr == nullptr); +- __glibcxx_assert(alignment != 1); + + m_ptr = operator new(bytes); + m_bytes = bytes; +@@ -116,10 +114,10 @@ namespace + + // Find initial portion of [first, last) containing a floating-point number. + // The string `digits` is either `dec_digits` or `hex_digits` +- // and `exp` is 'e' or 'p' or '\0'. ++ // and `exp` is "eE", "pP" or NULL. + const char* + find_end_of_float(const char* first, const char* last, const char* digits, +- char exp) ++ const char *exp) + { + while (first < last && strchr(digits, *first) != nullptr) + ++first; +@@ -129,7 +127,7 @@ namespace + while (first < last && strchr(digits, *first)) + ++first; + } +- if (first < last && exp != 0 && std::tolower((unsigned char)*first) == exp) ++ if (first < last && exp != nullptr && (*first == exp[0] || *first == exp[1])) + { + ++first; + if (first < last && (*first == '-' || *first == '+')) +@@ -211,7 +209,7 @@ namespace + + if ((last - first + 2) > buffer_resource::guaranteed_capacity()) + { +- last = find_end_of_float(first + neg, last, digits, 'p'); ++ last = find_end_of_float(first + neg, last, digits, "pP"); + #ifndef __cpp_exceptions + if ((last - first + 2) > buffer_resource::guaranteed_capacity()) + { +@@ -235,7 +233,7 @@ namespace + if ((last - first) > buffer_resource::guaranteed_capacity()) + { + last = find_end_of_float(first + neg, last, digits, +- "e"[fmt == chars_format::fixed]); ++ fmt == chars_format::fixed ? nullptr : "eE"); + #ifndef __cpp_exceptions + if ((last - first) > buffer_resource::guaranteed_capacity()) + { +--- a/src/libstdc++-v3/src/c++17/fs_ops.cc ++++ b/src/libstdc++-v3/src/c++17/fs_ops.cc +@@ -27,6 +27,10 @@ + # define NEED_DO_COPY_FILE + # define NEED_DO_SPACE + #endif ++#ifndef _GNU_SOURCE ++// Cygwin needs this for secure_getenv ++# define _GNU_SOURCE 1 ++#endif + + #include + #include +@@ -404,8 +408,12 @@ fs::copy(const path& from, const path& to, copy_options options, + // set an unused bit in options to disable further recursion + if (!is_set(options, copy_options::recursive)) + options |= static_cast(4096); +- for (const directory_entry& x : directory_iterator(from)) +- copy(x.path(), to/x.path().filename(), options, ec); ++ for (const directory_entry& x : directory_iterator(from, ec)) ++ { ++ copy(x.path(), to/x.path().filename(), options, ec); ++ if (ec) ++ return; ++ } + } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2683. filesystem::copy() says "no effects" +@@ -1584,7 +1592,8 @@ fs::symlink_status(const fs::path& p) + return result; + } + +-fs::path fs::temp_directory_path() ++fs::path ++fs::temp_directory_path() + { + error_code ec; + path tmp = temp_directory_path(ec); +@@ -1593,32 +1602,12 @@ fs::path fs::temp_directory_path() + return tmp; + } + +-fs::path fs::temp_directory_path(error_code& ec) ++fs::path ++fs::temp_directory_path(error_code& ec) + { +- path p; +-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS +- unsigned len = 1024; +- std::wstring buf; +- do +- { +- buf.resize(len); +- len = GetTempPathW(buf.size(), buf.data()); +- } while (len > buf.size()); +- +- if (len == 0) +- { +- ec.assign((int)GetLastError(), std::system_category()); +- return p; +- } +- buf.resize(len); +- p = std::move(buf); +-#else +- const char* tmpdir = nullptr; +- const char* env[] = { "TMPDIR", "TMP", "TEMP", "TEMPDIR", nullptr }; +- for (auto e = env; tmpdir == nullptr && *e != nullptr; ++e) +- tmpdir = ::getenv(*e); +- p = tmpdir ? tmpdir : "/tmp"; +-#endif ++ path p = fs::get_temp_directory_from_env(ec); ++ if (ec) ++ return p; + auto st = status(p, ec); + if (ec) + p.clear(); +--- a/src/libstdc++-v3/src/c++17/fs_path.cc ++++ b/src/libstdc++-v3/src/c++17/fs_path.cc +@@ -1872,11 +1872,6 @@ path::_M_split_cmpts() + _M_cmpts.type(_Type::_Filename); + return; + } +- if (_M_pathname.length() == 1 && _M_pathname[0] == preferred_separator) +- { +- _M_cmpts.type(_Type::_Root_dir); +- return; +- } + + _Parser parser(_M_pathname); + +--- a/src/libstdc++-v3/src/c++20/sstream-inst.cc ++++ b/src/libstdc++-v3/src/c++20/sstream-inst.cc +@@ -26,7 +26,9 @@ + // ISO C++ 14882: + // + +-// Instantiations in this file are only for the new SSO std::string ABI ++// Instantiations in this file are only for the new SSO std::string ABI. ++#define _GLIBCXX_USE_CXX11_ABI 1 ++ + #include + + #if _GLIBCXX_USE_CXX11_ABI +--- a/src/libstdc++-v3/src/filesystem/dir.cc ++++ b/src/libstdc++-v3/src/filesystem/dir.cc +@@ -25,6 +25,10 @@ + #ifndef _GLIBCXX_USE_CXX11_ABI + # define _GLIBCXX_USE_CXX11_ABI 1 + #endif ++#ifndef _GNU_SOURCE ++// Cygwin needs this for secure_getenv ++# define _GNU_SOURCE 1 ++#endif + + #include + #include +--- a/src/libstdc++-v3/src/filesystem/ops-common.h ++++ b/src/libstdc++-v3/src/filesystem/ops-common.h +@@ -567,6 +567,47 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM + + #endif // _GLIBCXX_HAVE_SYS_STAT_H + ++ // Find OS-specific name of temporary directory from the environment, ++ // Caller must check that the path is an accessible directory. ++#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS ++ inline wstring ++ get_temp_directory_from_env(error_code& ec) ++ { ++ unsigned len = 1024; ++ std::wstring buf; ++ do ++ { ++ buf.resize(len); ++ len = GetTempPathW(buf.size(), buf.data()); ++ } while (len > buf.size()); ++ ++ if (len == 0) ++ ec.assign((int)GetLastError(), std::system_category()); ++ else ++ ec.clear(); ++ ++ buf.resize(len); ++ return buf; ++ } ++#else ++ inline const char* ++ get_temp_directory_from_env(error_code& ec) noexcept ++ { ++ ec.clear(); ++ for (auto env : { "TMPDIR", "TMP", "TEMP", "TEMPDIR" }) ++ { ++#if _GLIBCXX_HAVE_SECURE_GETENV ++ auto tmpdir = ::secure_getenv(env); ++#else ++ auto tmpdir = ::getenv(env); ++#endif ++ if (tmpdir) ++ return tmpdir; ++ } ++ return "/tmp"; ++ } ++#endif ++ + _GLIBCXX_END_NAMESPACE_FILESYSTEM + + _GLIBCXX_END_NAMESPACE_VERSION +--- a/src/libstdc++-v3/src/filesystem/ops.cc ++++ b/src/libstdc++-v3/src/filesystem/ops.cc +@@ -27,6 +27,10 @@ + # define NEED_DO_COPY_FILE + # define NEED_DO_SPACE + #endif ++#ifndef _GNU_SOURCE ++// Cygwin needs this for secure_getenv ++# define _GNU_SOURCE 1 ++#endif + + #include + #include +@@ -344,8 +348,12 @@ fs::copy(const path& from, const path& to, copy_options options, + // set an unused bit in options to disable further recursion + if (!is_set(options, copy_options::recursive)) + options |= static_cast(4096); +- for (const directory_entry& x : directory_iterator(from)) +- copy(x.path(), to/x.path().filename(), options, ec); ++ for (const directory_entry& x : directory_iterator(from, ec)) ++ { ++ copy(x.path(), to/x.path().filename(), options, ec); ++ if (ec) ++ return; ++ } + } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2683. filesystem::copy() says "no effects" +@@ -1289,7 +1297,8 @@ fs::system_complete(const path& p, error_code& ec) + #endif + } + +-fs::path fs::temp_directory_path() ++fs::path ++fs::temp_directory_path() + { + error_code ec; + path tmp = temp_directory_path(ec); +@@ -1298,31 +1307,12 @@ fs::path fs::temp_directory_path() + return tmp; + } + +-fs::path fs::temp_directory_path(error_code& ec) ++fs::path ++fs::temp_directory_path(error_code& ec) + { +- path p; +-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS +- unsigned len = 1024; +- std::wstring buf; +- do +- { +- buf.resize(len); +- len = GetTempPathW(buf.size(), buf.data()); +- } while (len > buf.size()); +- +- if (len == 0) +- { +- ec.assign((int)GetLastError(), std::system_category()); +- return p; +- } +- buf.resize(len); +- p = std::move(buf); +-#else +- const char* tmpdir = nullptr; +- const char* env[] = { "TMPDIR", "TMP", "TEMP", "TEMPDIR", nullptr }; +- for (auto e = env; tmpdir == nullptr && *e != nullptr; ++e) +- tmpdir = ::getenv(*e); +- p = tmpdir ? tmpdir : "/tmp"; ++ path p = fs::get_temp_directory_from_env(ec); ++ if (ec) ++ return p; + auto st = status(p, ec); + if (ec) + p.clear(); +@@ -1331,7 +1321,5 @@ fs::path fs::temp_directory_path(error_code& ec) + p.clear(); + ec = std::make_error_code(std::errc::not_a_directory); + } +-#endif + return p; + } +- +--- a/src/libstdc++-v3/src/filesystem/path.cc ++++ b/src/libstdc++-v3/src/filesystem/path.cc +@@ -337,15 +337,18 @@ path::_M_split_cmpts() + _M_type = _Type::_Multi; + _M_cmpts.clear(); + +- if (_M_pathname.empty()) ++ // Use const-reference to access _M_pathname, to avoid "leaking" COW string. ++ const auto& pathname = _M_pathname; ++ ++ if (pathname.empty()) + return; + + { + // Approximate count of components, to reserve space in _M_cmpts vector: + int count = 1; +- bool saw_sep_last = _S_is_dir_sep(_M_pathname[0]); ++ bool saw_sep_last = _S_is_dir_sep(pathname[0]); + bool saw_non_sep = !saw_sep_last; +- for (value_type c : _M_pathname) ++ for (value_type c : pathname) + { + if (_S_is_dir_sep(c)) + saw_sep_last = true; +@@ -363,13 +366,13 @@ path::_M_split_cmpts() + } + + size_t pos = 0; +- const size_t len = _M_pathname.size(); ++ const size_t len = pathname.size(); + + // look for root name or root directory +- if (_S_is_dir_sep(_M_pathname[0])) ++ if (_S_is_dir_sep(pathname[0])) + { + // look for root name, such as "//" or "//foo" +- if (len > 1 && _M_pathname[1] == _M_pathname[0]) ++ if (len > 1 && pathname[1] == pathname[0]) + { + if (len == 2) + { +@@ -378,11 +381,11 @@ path::_M_split_cmpts() + return; + } + +- if (!_S_is_dir_sep(_M_pathname[2])) ++ if (!_S_is_dir_sep(pathname[2])) + { + // got root name, find its end + pos = 3; +- while (pos < len && !_S_is_dir_sep(_M_pathname[pos])) ++ while (pos < len && !_S_is_dir_sep(pathname[pos])) + ++pos; + if (pos == len) + { +@@ -409,7 +412,7 @@ path::_M_split_cmpts() + ++pos; + } + #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS +- else if (len > 1 && _M_pathname[1] == L':') ++ else if (len > 1 && pathname[1] == L':') + { + // got disk designator + if (len == 2) +@@ -418,7 +421,7 @@ path::_M_split_cmpts() + return; + } + _M_add_root_name(2); +- if (len > 2 && _S_is_dir_sep(_M_pathname[2])) ++ if (len > 2 && _S_is_dir_sep(pathname[2])) + _M_add_root_dir(2); + pos = 2; + } +@@ -426,9 +429,9 @@ path::_M_split_cmpts() + else + { + size_t n = 1; +- for (; n < _M_pathname.size() && !_S_is_dir_sep(_M_pathname[n]); ++n) ++ for (; n < pathname.size() && !_S_is_dir_sep(pathname[n]); ++n) + { } +- if (n == _M_pathname.size()) ++ if (n == pathname.size()) + { + _M_type = _Type::_Filename; + return; +@@ -438,7 +441,7 @@ path::_M_split_cmpts() + size_t back = pos; + while (pos < len) + { +- if (_S_is_dir_sep(_M_pathname[pos])) ++ if (_S_is_dir_sep(pathname[pos])) + { + if (back != pos) + _M_add_filename(back, pos - back); +@@ -450,7 +453,7 @@ path::_M_split_cmpts() + + if (back != pos) + _M_add_filename(back, pos - back); +- else if (_S_is_dir_sep(_M_pathname.back())) ++ else if (_S_is_dir_sep(pathname.back())) + { + // [path.itr]/8 + // "Dot, if one or more trailing non-root slash characters are present." +--- a/src/libstdc++-v3/testsuite/17_intro/names.cc ++++ b/src/libstdc++-v3/testsuite/17_intro/names.cc +@@ -106,6 +106,8 @@ + #define z ( + + #define tmp ( ++#define sz ( ++#define token ( + + #if __cplusplus < 201103L + #define uses_allocator ( +@@ -195,6 +197,8 @@ + #undef y + // defines vario::v + #undef v ++// defines trb::func and cputime_tmr::func ++#undef func + #endif + + #ifdef __APPLE__ +--- a/src/libstdc++-v3/testsuite/20_util/allocator/void.cc ++++ b/src/libstdc++-v3/testsuite/20_util/allocator/void.cc +@@ -87,8 +87,23 @@ static_assert( std::is_same::const_pointer, const void*>(), + "const_pointer is const void*" ); + #endif // C++20 + ++void ++test02() ++{ ++ std::allocator av; ++ int* p = std::allocator().allocate(1); ++ const int* c = p; ++ std::allocator_traits>::construct(av, c, 0); ++ volatile int* v = p; ++ std::allocator_traits>::construct(av, v, 0); ++ const volatile int* cv = p; ++ std::allocator_traits>::construct(av, cv, 0); ++ std::allocator().deallocate(p, 1); ++} ++ + int + main() + { + test01(); ++ test02(); + } +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc +@@ -0,0 +1,16 @@ ++// { dg-do run { target c++17 } } ++ ++#include ++#include ++ ++int main() ++{ ++#if __cpp_lib_to_chars >= 201611L // FP from_char not available otherwise. ++ // PR libstdc++/105324 ++ // std::from_chars() assertion at floating_from_chars.cc:78 ++ std::string s(512, '1'); ++ s[1] = '.'; ++ long double d; ++ std::from_chars(s.data(), s.data() + s.size(), d); ++#endif ++} +--- a/src/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc ++++ b/src/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc +@@ -238,8 +238,11 @@ test07() + std::pmr::monotonic_buffer_resource mbr(&cr); + try + { ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Walloc-size-larger-than=" + // Try to allocate a ridiculous size: + void* p = mbr.allocate(std::size_t(-2), 1); ++#pragma GCC diagnostic pop + // Should not reach here! + VERIFY( !"attempt to allocate SIZE_MAX-1 should not have succeeded" ); + throw p; +--- a/src/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc ++++ b/src/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc +@@ -281,10 +281,13 @@ test07() + std::pmr::unsynchronized_pool_resource upr(&cr); + try + { ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Walloc-size-larger-than=" + // Try to allocate a ridiculous size (and use a large extended alignment + // so that careful_resource::do_allocate can distinguish this allocation + // from any required for the pool resource's internal data structures): + void* p = upr.allocate(std::size_t(-2), 1024); ++#pragma GCC diagnostic pop + // Should not reach here! + VERIFY( !"attempt to allocate SIZE_MAX-1 should not have succeeded" ); + throw p; +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable.cc +@@ -35,7 +35,9 @@ void test01() + + std::string c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == '1' ); +- VERIFY( b.size() == 0 ); ++#if ! _GLIBCXX_FULLY_DYNAMIC_STRING ++ VERIFY( b.size() == 0 ); // not guaranteed by the standard ++#endif + } + + int main() +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2.cc +@@ -44,7 +44,9 @@ void test01() + + tstring c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == '1' ); +- VERIFY( b.size() == 0 ); ++#if ! _GLIBCXX_FULLY_DYNAMIC_STRING ++ VERIFY( b.size() == 0 ); // not guaranteed by the standard ++#endif + } + + int main() +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc +@@ -42,7 +42,9 @@ void test01() + + tstring c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == '1' ); +- VERIFY( b.size() == 0 ); ++#if ! _GLIBCXX_FULLY_DYNAMIC_STRING ++ VERIFY( b.size() == 0 ); // not guaranteed by the standard ++#endif + } + + int main() +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable.cc +@@ -35,7 +35,9 @@ void test01() + + std::wstring c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == L'1' ); +- VERIFY( b.size() == 0 ); ++#if ! _GLIBCXX_FULLY_DYNAMIC_STRING ++ VERIFY( b.size() == 0 ); // not guaranteed by the standard ++#endif + } + + int main() +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2.cc +@@ -44,7 +44,9 @@ void test01() + + twstring c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == L'1' ); +- VERIFY( b.size() == 0 ); ++#if ! _GLIBCXX_FULLY_DYNAMIC_STRING ++ VERIFY( b.size() == 0 ); // not guaranteed by the standard ++#endif + } + + int main() +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc +@@ -42,7 +42,9 @@ void test01() + + tstring c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == L'1' ); +- VERIFY( b.size() == 0 ); ++#if ! _GLIBCXX_FULLY_DYNAMIC_STRING ++ VERIFY( b.size() == 0 ); // not guaranteed by the standard ++#endif + } + + int main() +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc +@@ -71,8 +71,8 @@ int main() + + string s = "PR libstdc++/87749 a string that is longer than a short string"; + const auto ptr = s.c_str(); +- oom = true; + string ss; ++ oom = true; + ss = std::move(s); // allocators are equal, should not allocate new storage + VERIFY( ss.c_str() == ptr ); + } +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc +@@ -72,8 +72,8 @@ int main() + + 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; ++ oom = true; + ss = std::move(s); // allocators are equal, should not allocate new storage + VERIFY( ss.c_str() == ptr ); + } +--- a/src/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc ++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc +@@ -22,7 +22,7 @@ + + #ifndef __cpp_lib_constexpr_string_view + # error "Feature test macro for constexpr copy is missing in " +-#elif __cpp_lib_constexpr_iterator < 201811L ++#elif __cpp_lib_constexpr_string_view < 201811L + # error "Feature test macro for constexpr copy has wrong value in " + #endif + +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/23_containers/forward_list/operations/merge.cc +@@ -0,0 +1,48 @@ ++// { dg-do run { target c++11 } } ++// C++11 23.3.4.6 Operations [forwardlist.ops] ++ ++#include ++#include ++ ++void ++test_stable() ++{ ++ std::forward_list a{1.5, 2.0, 3.5, 4.1}; ++ std::forward_list b{1.0, 2.5, 3.0, 4.3, 4.2, 5.0}; ++ ++ a.merge(b, std::less{}); ++ ++ // result is sorted with respect to std::less, so 1.0 and 1.5 are ++ // equivalent, and stability guarantee means the element from a comes first. ++ const std::forward_list r { 1.5, 1.0, ++ 2.0, 2.5, ++ 3.5, 3.0, ++ 4.1, 4.3, 4.2, ++ 5.0}; ++ ++ VERIFY(a == r); ++} ++ ++void ++test_lwg3088() ++{ ++ // LWG 3088: forward_list::merge behavior unclear when passed *this ++ // PR libstdc++/103853 ++ std::forward_list c1{ 1, 2, 3 }; ++ const std::forward_list c2 = c1; ++ c1.merge(c1); ++ VERIFY( c1 == c2 ); ++ c1.merge(c1, std::less{}); ++ VERIFY( c1 == c2 ); ++ c1.merge(std::move(c1)); ++ VERIFY( c1 == c2 ); ++ c1.merge(std::move(c1), std::less{}); ++ VERIFY( c1 == c2 ); ++} ++ ++int ++main() ++{ ++ test_stable(); ++ test_lwg3088(); ++} +--- a/src/libstdc++-v3/testsuite/24_iterators/move_iterator/dr3265.cc ++++ b/src/libstdc++-v3/testsuite/24_iterators/move_iterator/dr3265.cc +@@ -15,7 +15,7 @@ + // with this library; see the file COPYING3. If not see + // . + +-// { dg-do compile { target c++11 } } ++// { dg-do run { target c++11 } } + + #include + +@@ -27,18 +27,18 @@ struct Iter + using reference = int&; + using difference_type = std::ptrdiff_t; + +- Iter(); ++ Iter() { } + +- // Construction from int* is not valid: +- Iter(int*) = delete; ++ // Construction from int* should not be used: ++ Iter(int*) { throw 1; } + +- // Assignment from int* is valid: +- Iter& operator=(int*); ++ // Assignment from int* is OK: ++ Iter& operator=(int*) { return *this; } + +- Iter& operator++(); +- Iter operator++(int); +- int& operator*() const; +- int* operator->() const; ++ Iter& operator++() { return *this; } ++ Iter operator++(int) { return *this; } ++ int& operator*() const { static int i; return i; } ++ int* operator->() const { return &**this; } + + template friend bool operator==(Iter, Iter); + }; +@@ -49,3 +49,8 @@ void test01() + int i = 0; + m = std::make_move_iterator(&i); // Should use assignment not construction + } ++ ++int main() ++{ ++ test01(); ++} +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/24_iterators/range_operations/advance_overflow.cc +@@ -0,0 +1,37 @@ ++// { dg-options "-std=gnu++20" } ++// { dg-do compile { target c++20 } } ++ ++// Public domain testcase from Casey Carter, send to LWG list on 2021-07-24. ++// ++// Here's a compile-only test case for which n is INT_MIN, which will overflow ++// if simply negated to get |n|: https://godbolt.org/z/M7Wz1nW58. ++ ++#include ++#include ++#include ++ ++struct I { ++ using difference_type = int; ++ using value_type = int; ++ ++ int x; ++ ++ constexpr int operator*() const { return x; } ++ constexpr I& operator++() { ++x; return *this; } ++ constexpr I operator++(int) { ++x; return {x - 1}; } ++ constexpr bool operator==(const I&) const = default; ++ ++ constexpr int operator-(const I& that) const { return x - that.x; } ++ ++ constexpr I& operator--() { --x; return *this; } ++ constexpr I operator--(int) { --x; return {x - 1}; } ++}; ++static_assert(std::bidirectional_iterator); ++static_assert(std::sized_sentinel_for); ++ ++constexpr bool test() { ++ using L = std::numeric_limits; ++ I i{-2}; ++ return std::ranges::advance(i, L::min(), I{-4}) == L::min() + 2; ++} ++static_assert(test()); +--- a/src/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc ++++ b/src/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc +@@ -25,6 +25,7 @@ + + #include + #include ++#include + + void + test01() +@@ -37,10 +38,43 @@ test01() + str << u; + + str >> v; ++ VERIFY( u == v ); ++} ++ ++void ++test_pr105502() ++{ ++ // PR libstdc++/105502 std::normal_distribution deserialization issue ++ std::stringstream str; ++ std::normal_distribution<> d{1, 2}, d2; ++ std::minstd_rand0 g; ++ str << d; ++ VERIFY( str ); ++ str >> d2; ++ VERIFY( str ); ++ VERIFY( d == d2 ); ++ ++ (void) d(g); // sets d._M_saved_available = true ++ str.str(""); ++ str.clear(); ++ str << d; ++ VERIFY( str ); ++ str >> d2; ++ VERIFY( str ); ++ VERIFY( d == d2 ); ++ ++ (void) d(g); // sets d._M_saved_available = false ++ str.str(""); ++ str.clear(); ++ str << d; ++ VERIFY( str ); ++ str >> d2; ++ VERIFY( str ); ++ VERIFY( d == d2 ); + } + + int main() + { + test01(); +- return 0; ++ test_pr105502(); + } +--- a/src/libstdc++-v3/testsuite/27_io/filesystem/iterators/error_reporting.cc ++++ b/src/libstdc++-v3/testsuite/27_io/filesystem/iterators/error_reporting.cc +@@ -28,35 +28,44 @@ + + int choice; + +-struct dirent global_dirent; +- + extern "C" struct dirent* readdir(DIR*) + { ++ // On some targets dirent::d_name is very small, but the OS allocates ++ // a trailing char array after the dirent struct. Emulate that here. ++ union State ++ { ++ struct dirent d; ++ char buf[sizeof(struct dirent) + 16] = {}; ++ }; ++ ++ static State state; ++ char* d_name = state.buf + offsetof(struct dirent, d_name); ++ + switch (choice) + { + case 1: +- global_dirent.d_ino = 999; ++ state.d.d_ino = 999; + #if defined _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE && defined DT_REG +- global_dirent.d_type = DT_REG; ++ state.d.d_type = DT_REG; + #endif +- global_dirent.d_reclen = 0; +- std::char_traits::copy(global_dirent.d_name, "file", 5); ++ state.d.d_reclen = 0; ++ std::char_traits::copy(d_name, "file", 5); + choice = 0; +- return &global_dirent; ++ return &state.d; + case 2: +- global_dirent.d_ino = 111; ++ state.d.d_ino = 111; + #if defined _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE && defined DT_DIR +- global_dirent.d_type = DT_DIR; ++ state.d.d_type = DT_DIR; + #endif +- global_dirent.d_reclen = 60; +- std::char_traits::copy(global_dirent.d_name, "subdir", 7); ++ state.d.d_reclen = 60; ++ std::char_traits::copy(d_name, "subdir", 7); + choice = 1; +- return &global_dirent; ++ return &state.d; + default: + errno = EIO; + return nullptr; + } +- return &global_dirent; ++ return &state.d; + } + + void +--- a/src/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc ++++ b/src/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc +@@ -193,6 +193,34 @@ test05() + VERIFY( !ec ); // Previous value should be cleared (LWG 2683) + } + ++void ++test_pr99290() ++{ ++ auto dir = __gnu_test::nonexistent_path(); ++ auto source = dir/"source"; ++ auto dest = dir/"dest"; ++ create_directories(source/"emptydir"); ++ create_directories(dest/"emptydir"); ++ std::ofstream{source/"file"} << 'a'; ++ std::ofstream{dest/"file"} << 'b'; ++ // PR libstdc++/99290 ++ // std::filesystem::copy does not always report errors for recursion ++ std::error_code ec; ++ copy(source, dest, ec); ++ VERIFY( ec == std::errc::file_exists ); ++ ++#if __cpp_exceptions ++ try { ++ copy(source, dest); ++ VERIFY( false ); ++ } catch (const fs::filesystem_error& e) { ++ VERIFY( e.code() == std::errc::file_exists ); ++ } ++#endif ++ ++ remove_all(dir); ++} ++ + int + main() + { +@@ -201,4 +229,5 @@ main() + test03(); + test04(); + test05(); ++ test_pr99290(); + } +--- a/src/libstdc++-v3/testsuite/27_io/filesystem/operations/temp_directory_path.cc ++++ b/src/libstdc++-v3/testsuite/27_io/filesystem/operations/temp_directory_path.cc +@@ -20,6 +20,7 @@ + + #include + #include ++#include + #include + #include + +@@ -58,7 +59,10 @@ test01() + clean_env(); + + if (!fs::exists("/tmp")) ++ { ++ puts("/tmp doesn't exist, not testing it for temp_directory_path"); + return; // just give up ++ } + + std::error_code ec = make_error_code(std::errc::invalid_argument); + fs::path p1 = fs::temp_directory_path(ec); +@@ -75,7 +79,10 @@ test02() + clean_env(); + + if (!set_env("TMP", __gnu_test::nonexistent_path().string())) ++ { ++ puts("Cannot set environment variables, not testing temp_directory_path"); + return; // just give up ++ } + + std::error_code ec; + fs::path p = fs::temp_directory_path(ec); +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc +@@ -0,0 +1,119 @@ ++// { dg-do compile } ++ ++#include ++ ++namespace std ++{ ++ // [iosfwd.syn] ++ ++ template struct char_traits; ++ template<> struct char_traits; ++#if __cplusplus >= 202002L ++ template<> struct char_traits; ++#endif ++#if __cplusplus >= 201103L ++ template<> struct char_traits; ++ template<> struct char_traits; ++#endif ++ template<> struct char_traits; ++ ++ template class allocator; ++ ++ template ++ class basic_ios; ++ template ++ class basic_streambuf; ++ template ++ class basic_istream; ++ template ++ class basic_ostream; ++ template ++ class basic_iostream; ++ ++_GLIBCXX_BEGIN_NAMESPACE_CXX11 ++ template ++ class basic_stringbuf; ++ template ++ class basic_istringstream; ++ template ++ class basic_ostringstream; ++ template ++ class basic_stringstream; ++_GLIBCXX_END_NAMESPACE_CXX11 ++ ++ template ++ class basic_filebuf; ++ template ++ class basic_ifstream; ++ template ++ class basic_ofstream; ++ template ++ class basic_fstream; ++ ++#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI ++ template ++ class basic_syncbuf; ++ template ++ class basic_osyncstream; ++#endif ++ ++ template ++ class istreambuf_iterator; ++ template ++ class ostreambuf_iterator; ++ ++ typedef basic_ios ios; ++ typedef basic_ios wios; ++ ++ typedef basic_streambuf streambuf; ++ typedef basic_istream istream; ++ typedef basic_ostream ostream; ++ typedef basic_iostream iostream; ++ ++ typedef basic_stringbuf stringbuf; ++ typedef basic_istringstream istringstream; ++ typedef basic_ostringstream ostringstream; ++ typedef basic_stringstream stringstream; ++ ++ ++ typedef basic_filebuf filebuf; ++ typedef basic_ifstream ifstream; ++ typedef basic_ofstream ofstream; ++ typedef basic_fstream fstream; ++ ++#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI ++ typedef basic_syncbuf syncbuf; ++ typedef basic_osyncstream osyncstream; ++#endif ++ ++ typedef basic_streambuf wstreambuf; ++ typedef basic_istream wistream; ++ typedef basic_ostream wostream; ++ typedef basic_iostream wiostream; ++ ++ typedef basic_stringbuf wstringbuf; ++ typedef basic_istringstream wistringstream; ++ typedef basic_ostringstream wostringstream; ++ typedef basic_stringstream wstringstream; ++ ++ typedef basic_filebuf wfilebuf; ++ typedef basic_ifstream wifstream; ++ typedef basic_ofstream wofstream; ++ typedef basic_fstream wfstream; ++ ++#if __cplusplus >= 202002L ++ typedef basic_syncbuf wsyncbuf; ++ typedef basic_osyncstream wosyncstream; ++#endif ++ ++ template class fpos; ++ typedef fpos streampos; ++ typedef fpos wstreampos; ++#if __cplusplus >= 202002L ++ typedef fpos u8streampos; ++#endif ++#if __cplusplus >= 201103L ++ typedef fpos u16streampos; ++ typedef fpos u32streampos; ++#endif ++} +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc +@@ -0,0 +1,214 @@ ++// { dg-do compile { target c++11 } } ++ ++#include ++ ++template struct Same { static constexpr bool value = false; }; ++template struct Same { static constexpr bool value = true; }; ++ ++template using Traits = std::char_traits; ++template using Alloc = std::allocator; ++ ++using std::basic_ios; ++ ++static_assert(Same, ++ basic_ios> ++ >::value, ++ "std::basic_ios has the correct default template argument"); ++ ++static_assert(Same, ++ basic_ios> ++ >::value, ++ "std::basic_ios has the correct default template argument"); ++ ++using std::basic_streambuf; ++ ++static_assert(Same, ++ basic_streambuf> ++ >::value, ++ "std::basic_streambuf has the correct default template argument"); ++ ++static_assert(Same, ++ basic_streambuf> ++ >::value, ++ "std::basic_streambuf has the correct default template argument"); ++ ++using std::basic_istream; ++ ++static_assert(Same, ++ basic_istream> ++ >::value, ++ "std::basic_istream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_istream> ++ >::value, ++ "std::basic_istream has the correct default template argument"); ++ ++using std::basic_ostream; ++ ++static_assert(Same, ++ basic_ostream> ++ >::value, ++ "std::basic_ostream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_ostream> ++ >::value, ++ "std::basic_ostream has the correct default template argument"); ++ ++using std::basic_iostream; ++ ++static_assert(Same, ++ basic_iostream>>::value, ++ "std::basic_iostream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_iostream> ++ >::value, ++ "std::basic_iostream has the correct default template argument"); ++ ++using std::basic_stringbuf; ++ ++static_assert(Same, ++ basic_stringbuf, Alloc> ++ >::value, ++ "std::basic_stringbuf has the correct default template argument"); ++ ++static_assert(Same, ++ basic_stringbuf, Alloc> ++ >::value, ++ "std::basic_stringbuf has the correct default template argument"); ++ ++using std::basic_istringstream; ++ ++static_assert(Same, ++ basic_istringstream, Alloc> ++ >::value, ++ "std::basic_istringstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_istringstream, Alloc> ++ >::value, ++ "std::basic_istringstream has the correct default template argument"); ++ ++using std::basic_ostringstream; ++ ++static_assert(Same, ++ basic_ostringstream, Alloc> ++ >::value, ++ "std::basic_ostringstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_ostringstream, Alloc> ++ >::value, ++ "std::basic_ostringstream has the correct default template argument"); ++ ++using std::basic_stringstream; ++ ++static_assert(Same, ++ basic_stringstream, Alloc> ++ >::value, ++ "std::basic_stringstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_stringstream, Alloc> ++ >::value, ++ "std::basic_stringstream has the correct default template argument"); ++ ++using std::basic_filebuf; ++ ++static_assert(Same, ++ basic_filebuf> ++ >::value, ++ "std::basic_filebuf has the correct default template argument"); ++ ++static_assert(Same, ++ basic_filebuf> ++ >::value, ++ "std::basic_filebuf has the correct default template argument"); ++ ++using std::basic_ifstream; ++ ++static_assert(Same, ++ basic_ifstream> ++ >::value, ++ "std::basic_ifstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_ifstream> ++ >::value, ++ "std::basic_ifstream has the correct default template argument"); ++ ++using std::basic_ofstream; ++ ++static_assert(Same, ++ basic_ofstream> ++ >::value, ++ "std::basic_ofstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_ofstream> ++ >::value, ++ "std::basic_ofstream has the correct default template argument"); ++ ++using std::basic_fstream; ++ ++static_assert(Same, ++ basic_fstream> ++ >::value, ++ "std::basic_fstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_fstream> ++ >::value, ++ "std::basic_fstream has the correct default template argument"); ++ ++#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI ++using std::basic_syncbuf; ++ ++static_assert(Same, ++ basic_syncbuf, Alloc> ++ >::value, ++ "std::basic_syncbuf has the correct default template argument"); ++ ++static_assert(Same, ++ basic_syncbuf, Alloc> ++ >::value, ++ "std::basic_syncbuf has the correct default template argument"); ++ ++using std::basic_osyncstream; ++ ++static_assert(Same, ++ basic_osyncstream, Alloc> ++ >::value, ++ "std::basic_osyncstream has the correct default template argument"); ++ ++static_assert(Same, ++ basic_osyncstream, Alloc> ++ >::value, ++ "std::basic_osyncstream has the correct default template argument"); ++#endif ++ ++using std::istreambuf_iterator; ++ ++static_assert(Same, ++ istreambuf_iterator> ++ >::value, ++ "std::istreambuf_iterator has the correct default template argument"); ++ ++static_assert(Same, ++ istreambuf_iterator> ++ >::value, ++ "std::istreambuf_iterator has the correct default template argument"); ++ ++using std::ostreambuf_iterator; ++ ++static_assert(Same, ++ ostreambuf_iterator> ++ >::value, ++ "std::ostreambuf_iterator has the correct default template argument"); ++ ++static_assert(Same, ++ ostreambuf_iterator> ++ >::value, ++ "std::ostreambuf_iterator has the correct default template argument"); +--- a/src/libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc ++++ b/src/libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc +@@ -1,3 +1,4 @@ ++// { dg-options "-O1" } + // { dg-do link { target c++11 } } + + // Copyright (C) 2009-2021 Free Software Foundation, Inc. +--- a/src/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/102994.cc ++++ b/src/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/102994.cc +@@ -5,13 +5,13 @@ + #include + + void +-test1(const std::atomic& a, char* p) ++test1(std::atomic& a, char* p) + { + a.wait(p); + } + + void +-test2(const std::atomic* a, int v) ++test2(std::atomic* a, int v) + { + std::atomic_wait(a, v); + std::atomic_notify_one(a); +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/deduction.cc +@@ -0,0 +1,85 @@ ++// // Copyright (C) 2017-2022 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 ++// . ++ ++// { dg-do compile { target c++17 } } ++ ++#include ++ ++template struct require_same; ++template struct require_same { using type = void; }; ++ ++template ++ typename require_same::type ++ check_type(U&) { } ++ ++void f0v(); ++void f0vn() noexcept; ++int f0i(); ++int f0in() noexcept; ++long f1l(int&); ++long f1ln(double*) noexcept; ++ ++void ++test01() ++{ ++ std::packaged_task task1{f0v}; ++ check_type>(task1); ++ ++ std::packaged_task task2{f0vn}; ++ check_type>(task2); ++ ++ std::packaged_task task3{f0i}; ++ check_type>(task3); ++ ++ std::packaged_task task4{f0in}; ++ check_type>(task4); ++ ++ std::packaged_task task5{f1l}; ++ check_type>(task5); ++ ++ std::packaged_task task6{f1ln}; ++ check_type>(task6); ++ ++ std::packaged_task task5a{std::move(task5)}; ++ check_type>(task5a); ++ ++ std::packaged_task task6a{std::move(task6)}; ++ check_type>(task6a); ++} ++ ++struct X { ++ int operator()(const short&, void*); ++}; ++ ++struct Y { ++ void operator()(int) const & noexcept; ++}; ++ ++void ++test02() ++{ ++ X x; ++ std::packaged_task task1{x}; ++ check_type>(task1); ++ ++ Y y; ++ std::packaged_task task2{y}; ++ check_type>(task2); ++ ++ std::packaged_task task3{[&x](float) -> X& { return x; }}; ++ check_type>(task3); ++} +--- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc ++++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc +@@ -190,6 +190,34 @@ test05() + VERIFY( !ec ); // Previous value should be cleared (LWG 2683) + } + ++void ++test_pr99290() ++{ ++ auto dir = __gnu_test::nonexistent_path(); ++ auto source = dir/"source"; ++ auto dest = dir/"dest"; ++ create_directories(source/"emptydir"); ++ create_directories(dest/"emptydir"); ++ std::ofstream{source/"file"} << 'a'; ++ std::ofstream{dest/"file"} << 'b'; ++ // PR libstdc++/99290 ++ // std::filesystem::copy does not always report errors for recursion ++ std::error_code ec; ++ copy(source, dest, ec); ++ VERIFY( ec == std::errc::file_exists ); ++ ++#if __cpp_exceptions ++ try { ++ copy(source, dest); ++ VERIFY( false ); ++ } catch (const fs::filesystem_error& e) { ++ VERIFY( e.code() == std::errc::file_exists ); ++ } ++#endif ++ ++ remove_all(dir); ++} ++ + int + main() + { +@@ -198,4 +226,5 @@ main() + test03(); + test04(); + test05(); ++ test_pr99290(); + } +--- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc ++++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc +@@ -21,6 +21,7 @@ + + #include + #include ++#include + #include + #include + +@@ -59,7 +60,10 @@ test01() + clean_env(); + + if (!fs::exists("/tmp")) ++ { ++ puts("/tmp doesn't exist, not testing it for temp_directory_path"); + return; // just give up ++ } + + std::error_code ec = make_error_code(std::errc::invalid_argument); + fs::path p1 = fs::temp_directory_path(ec); +@@ -75,8 +79,11 @@ test02() + { + clean_env(); + +- if (set_env("TMPDIR", __gnu_test::nonexistent_path().string())) ++ if (!set_env("TMP", __gnu_test::nonexistent_path().string())) ++ { ++ puts("Cannot set environment variables, not testing temp_directory_path"); + return; // just give up ++ } + + std::error_code ec; + fs::path p = fs::temp_directory_path(ec); +--- a/src/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc ++++ b/src/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc +@@ -20,6 +20,7 @@ + // { dg-do run } + // { dg-options "-pthread" } + // { dg-require-effective-target pthread } ++// { dg-timeout-factor 2 } + + #include + #include +@@ -33,7 +34,7 @@ typedef __gnu_cxx::rope > rope_type; + rope_type foo2; + rope_type foo4; + +-void* thread_main(void *) ++void* thread_main(void *) + { + // To see a problem with gcc 3.3 and before, set a break point here. + // Single step through c_str implementation, call sched_yield after diff -Nru gcc-11-11.3.0/debian/rules.parameters gcc-11-11.3.0/debian/rules.parameters --- gcc-11-11.3.0/debian/rules.parameters 2022-04-25 09:44:06.000000000 +0000 +++ gcc-11-11.3.0/debian/rules.parameters 2022-05-19 11:15:11.000000000 +0000 @@ -2,14 +2,14 @@ GCC_VERSION := 11.3.0 NEXT_GCC_VERSION := 11.3.1 BASE_VERSION := 11 -SOURCE_VERSION := 11.3.0-1ubuntu1 -DEB_VERSION := 11.3.0-1ubuntu1 -DEB_EVERSION := 1:11.3.0-1ubuntu1 -DEB_GDC_VERSION := 11.3.0-1ubuntu1 +SOURCE_VERSION := 11.3.0-3ubuntu1 +DEB_VERSION := 11.3.0-3ubuntu1 +DEB_EVERSION := 1:11.3.0-3ubuntu1 +DEB_GDC_VERSION := 11.3.0-3ubuntu1 DEB_SOVERSION := 5 DEB_SOEVERSION := 1:5 DEB_LIBGCC_SOVERSION := -DEB_LIBGCC_VERSION := 11.3.0-1ubuntu1 +DEB_LIBGCC_VERSION := 11.3.0-3ubuntu1 DEB_STDCXX_SOVERSION := 5 DEB_GOMP_SOVERSION := 5 GCC_SONAME := 1 diff -Nru gcc-11-11.3.0/debian/rules.patch gcc-11-11.3.0/debian/rules.patch --- gcc-11-11.3.0/debian/rules.patch 2022-04-25 09:44:06.000000000 +0000 +++ gcc-11-11.3.0/debian/rules.patch 2022-05-19 11:15:04.000000000 +0000 @@ -13,6 +13,7 @@ # which patches should be applied? debian_patches = \ + git-updates \ # git-updates \