commit 98fb37efba1160c84c5de3b9989ecb73f5bcdbc3 Author: GCC Administrator Date: Tue Sep 6 00:20:21 2022 +0000 Daily bump. commit c1ba36ec779cccf6b54883d676d083df627f6d64 Author: José Rui Faustino de Sousa Date: Sun Sep 4 21:53:09 2022 +0200 Fortran: Fix ICE with -fcheck=pointer [PR100136] gcc/fortran/ChangeLog: PR fortran/100136 * trans-expr.cc (gfc_conv_procedure_call): Add handling of pointer expressions. gcc/testsuite/ChangeLog: PR fortran/100136 * gfortran.dg/PR100136.f90: New test. (cherry picked from commit 20d30e737ad79dc36817e59f1676aa8bc0c6b325) commit f4f72a25a9dfb5afbff8853bd51c1a891139dfd0 Author: GCC Administrator Date: Mon Sep 5 00:20:45 2022 +0000 Daily bump. commit 29b456e0676e051720e030ab801be0479554658a Author: GCC Administrator Date: Sun Sep 4 00:20:49 2022 +0000 Daily bump. commit 2d4f60f206cf1100b7484d708f6c913762618676 Author: Peter Bergner Date: Wed Aug 31 21:14:36 2022 -0500 rs6000: Don't ICE when we disassemble an MMA variable [PR101322] When we expand an MMA disassemble built-in with C++ using a pointer that is cast to a valid MMA type, the type isn't passed down to the expand machinery and we end up using the base type of the pointer which leads to an ICE. This patch enforces we always use the correct MMA type regardless of the pointer type being used. 2022-08-31 Peter Bergner gcc/ PR target/101322 * config/rs6000/rs6000-builtin.cc (rs6000_gimple_fold_mma_builtin): Enforce the use of a valid MMA pointer type. gcc/testsuite/ PR target/101322 * g++.target/powerpc/pr101322.C: New test. (cherry picked from commit 2985049049f12b0aa3366ca244d387820385b9e8) commit a1caa427040f9d39e00f05dc81cf05795de5d725 Author: GCC Administrator Date: Sat Sep 3 00:20:51 2022 +0000 Daily bump. commit 3835765ae96d294bb71dd8cb05db543d89725f7b Author: Richard Earnshaw Date: Wed Aug 3 10:01:51 2022 +0100 cselib: add function to check if SET is redundant [PR106187] A SET operation that writes memory may have the same value as an earlier store but if the alias sets of the new and earlier store do not conflict then the set is not truly redundant. This can happen, for example, if objects of different types share a stack slot. To fix this we define a new function in cselib that first checks for equality and if that is successful then finds the earlier store in the value history and checks the alias sets. The routine is used in two places elsewhere in the compiler: cfgcleanup and postreload. gcc/ChangeLog: PR rtl-optimization/106187 * alias.h (mems_same_for_tbaa_p): Declare. * alias.cc (mems_same_for_tbaa_p): New function. * dse.cc (record_store): Use it instead of open-coding alias check. * cselib.h (cselib_redundant_set_p): Declare. * cselib.cc: Include alias.h (cselib_redundant_set_p): New function. * cfgcleanup.cc: (mark_effect): Use cselib_redundant_set_p instead of rtx_equal_for_cselib_p. * postreload.cc (reload_cse_simplify): Use cselib_redundant_set_p. (reload_cse_noop_set_p): Delete. (cherry picked from commit 64ce76d940501cb04d14a0d36752b4f93473531c) commit de1ba234311b935b1a38d512e57329d4b6e8354d Author: Richard Earnshaw Date: Wed May 11 13:08:40 2022 +0100 arm: correctly handle misaligned MEMs on MVE [PR105463] Vector operations in MVE must be aligned to the element size, so if we are asked for a misaligned move in a wider mode we must recast it to a form suitable for the known alignment (larger elements have better address offset ranges, so there is some advantage to using wider element sizes if possible). Whilst fixing this, also rework the predicates used for validating operands - the Neon predicates are not right for MVE. gcc/ChangeLog: PR target/105463 * config/arm/mve.md (*movmisalign_mve_store): Use mve_memory_operand. (*movmisalign_mve_load): Likewise. * config/arm/vec-common.md (movmisalign): Convert to generator form... (@movmisalign): ... thus. Use generic predicates and then rework operands if they are not valid. For MVE rework to a narrower element size if the alignment is not high enough. (cherry picked from commit 6a116728e27c4da65d84483c0e75561a7479d4d5) commit e69134e12551a4289292e3955525f84d99773d31 Author: Tamar Christina Date: Thu Sep 1 22:04:57 2022 +0100 AArch64: Fix bootstrap failure due to dump_printf_loc format attribute uses [PR106782] This fixes the bootstrap failure on AArch64 following -Werror=format by correcting the print format modifiers in the backend. gcc/ChangeLog: PR other/106782 * config/aarch64/aarch64.cc (aarch64_vector_costs::prefer_unrolled_loop): Replace %u with HOST_WIDE_INT_PRINT_UNSIGNED. (cherry picked from commit b98c5262d02c13cdbbf3b985859b436adec94d90) commit a114570e360b1a185b92eab76cf255cb23c928a8 Author: GCC Administrator Date: Fri Sep 2 00:19:58 2022 +0000 Daily bump. commit f9593025a290c68c0916dc6fa569eb38eda00535 Author: Jakub Jelinek Date: Thu Sep 1 11:07:44 2022 +0200 Fix up dump_printf_loc format attribute and adjust uses [PR106782] As discussed on IRC, the r13-2299-g68c61c2daa1f bug only got missed because dump_printf_loc had incorrect format attribute and therefore almost no -Wformat=* checking was performed on it. 3, 0 are suitable for function with (whatever, whatever, const char *, va_list) arguments, not for (whatever, whatever, const char *, ...), that one should use 3, 4. There are 3 spots where the mismatch was worse though, two using %u or %d for unsigned HOST_WIDE_INT argument and one %T for enum argument (promoted to int) and this backport just fixes those spots. 2022-09-01 Jakub Jelinek PR other/106782 * tree-vect-slp.cc (vect_print_slp_tree): Use HOST_WIDE_INT_PRINT_UNSIGNED instead of %u. * tree-vect-loop.cc (vect_estimate_min_profitable_iters): Use HOST_WIDE_INT_PRINT_UNSIGNED instead of %d. * tree-vect-slp-patterns.cc (vect_pattern_validate_optab): Use %G instead of %T and STMT_VINFO_STMT (SLP_TREE_REPRESENTATIVE (node)) instead of SLP_TREE_DEF_TYPE (node). (cherry picked from commit 953e08fde44a596e4ec2491efd15cd645e1ddc48) commit b33602e5b834177f202422b3b4191af9fd79d2d2 Author: GCC Administrator Date: Thu Sep 1 00:20:56 2022 +0000 Daily bump. commit 63997f222380a7b718a9045effa4841c00f30f70 Author: GCC Administrator Date: Wed Aug 31 00:19:54 2022 +0000 Daily bump. commit 962f9ba67b5392d125a65f3d634bafd54c348d51 Author: Joseph Myers Date: Tue Aug 30 22:04:53 2022 +0000 Update gcc sv.po * sv.po: Update. commit bd2bc5f78d5a423a6e0537748b01ca45edbc75e5 Author: Tobias Burnus Date: Thu Aug 25 08:34:03 2022 +0200 Fortran/OpenMP: Fix strictly structured blocks parsing gcc/fortran/ChangeLog: * parse.cc (parse_omp_structured_block): When parsing strictly structured blocks, issue an error if the end-directive comes before the 'end block'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/strictly-structured-block-4.f90: New test. (cherry picked from commit 33f24eb58748e9db7c827662753757c5c2217eb4) commit 29dfe1cacadd2a47b4e5b1cab11bd7263fe211c9 Author: Marek Polacek Date: Mon Aug 29 16:54:05 2022 -0400 c++: __has_builtin gives the wrong answer [PR106759] We've supported __is_nothrow_constructible since r11-4386, but names_builtin_p didn't know about it, so it gave the wrong answer for #if __has_builtin(__is_nothrow_constructible) ... #endif I've tested all C++-only built-ins and only two were missing. PR c++/106759 gcc/cp/ChangeLog: * cp-objcp-common.cc (names_builtin_p): Handle RID_IS_NOTHROW_ASSIGNABLE and RID_IS_NOTHROW_CONSTRUCTIBLE. gcc/testsuite/ChangeLog: * g++.dg/ext/has-builtin-1.C: New test. (cherry picked from commit fe915f35b7d8dc768a2b977c09aa02f933e1d1e9) commit e927d1cf141f221c5a32574bde0913307e140984 Author: Tamar Christina Date: Fri Aug 12 12:28:41 2022 +0100 sve: Fix fcmuo combine patterns [PR106524] There's no encoding for fcmuo with zero. This restricts the combine patterns from accepting zero registers. gcc/ChangeLog: PR target/106524 * config/aarch64/aarch64-sve.md (*fcmuo_nor_combine, *fcmuo_bic_combine): Don't accept comparisons against zero. gcc/testsuite/ChangeLog: PR target/106524 * gcc.target/aarch64/sve/pr106524.c: New test. (cherry picked from commit f4ff20d464f90c85919ce2e7fa63e204dcda4e40) commit f86df0b551cefb799896fc5a6045fc4ee6d41166 Author: GCC Administrator Date: Tue Aug 30 00:20:18 2022 +0000 Daily bump. commit 22ff125247ff5328ad4544aef939d491618d714d Author: Peter Bergner Date: Sat Aug 27 19:44:16 2022 -0500 rs6000: Allow conversions of MMA pointer types [PR106017] GCC incorrectly disables conversions between MMA pointer types, which are allowed with clang. The original intent was to disable conversions between MMA types and other other types, but pointer conversions should have been allowed. The fix is to just remove the MMA pointer conversion handling code altogether. gcc/ PR target/106017 * config/rs6000/rs6000.cc (rs6000_invalid_conversion): Remove handling of MMA pointer conversions. gcc/testsuite/ PR target/106017 * gcc.target/powerpc/pr106017.c: New test. (cherry picked from commit 1ae1325f24cea1698b56e4299d95446a1f7b90a2) commit 511df912133f56dbd460326b5df1e15e06204e4e Author: H.J. Lu Date: Thu Aug 18 14:17:33 2022 -0700 x86: Cast stride to __PTRDIFF_TYPE__ in AMX intrinsics On 64-bit Windows, long is 32 bits and can't be used as stride in memory operand when base is a pointer which is 64 bits. Cast stride to __PTRDIFF_TYPE__, instead of long. PR target/106714 * config/i386/amxtileintrin.h (_tile_loadd_internal): Cast to __PTRDIFF_TYPE__. (_tile_stream_loadd_internal): Likewise. (_tile_stored_internal): Likewise. (cherry picked from commit aeb9b58225916bc84a0cd02c6fc77bbb92167e53) commit 87a07e96dc4e6849ab6ac0b1ceeb5a19aebee9d6 Author: Jakub Jelinek Date: Fri Aug 26 09:56:19 2022 +0200 fortran: Expand ieee_arithmetic module's ieee_value inline [PR106579] The following patch expands IEEE_VALUE function inline in the FE, but only for the powerpc64le-linux IEEE quad real(kind=16) case. 2022-08-26 Jakub Jelinek PR fortran/106579 * trans-intrinsic.cc: Include realmpfr.h. (conv_intrinsic_ieee_value): New function. (gfc_conv_ieee_arithmetic_function): Handle ieee_value. (cherry picked from commit 0c2d6aa1be2ea85e751852834986ae52d58134d3) commit c5d4e67e764fb157404142cfc8d2bc4436fcf0f5 Author: Jakub Jelinek Date: Fri Aug 26 09:52:02 2022 +0200 fortran: Expand ieee_arithmetic module's ieee_class inline [PR106579] The following patch expands IEEE_CLASS inline in the FE but only for the powerpc64le-linux IEEE quad real(kind=16), using the __builtin_fpclassify builtin and explicit check of the MSB mantissa bit in place of missing __builtin_signbit builtin. 2022-08-26 Jakub Jelinek PR fortran/106579 gcc/fortran/ * f95-lang.cc (gfc_init_builtin_functions): Initialize BUILT_IN_FPCLASSIFY. * libgfortran.h (IEEE_OTHER_VALUE, IEEE_SIGNALING_NAN, IEEE_QUIET_NAN, IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL, IEEE_NEGATIVE_DENORMAL, IEEE_NEGATIVE_SUBNORMAL, IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL, IEEE_POSITIVE_SUBNORMAL, IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF): New enum. * trans-intrinsic.cc (conv_intrinsic_ieee_class): New function. (gfc_conv_ieee_arithmetic_function): Handle ieee_class. libgfortran/ * ieee/ieee_helper.c (IEEE_OTHER_VALUE, IEEE_SIGNALING_NAN, IEEE_QUIET_NAN, IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL, IEEE_NEGATIVE_DENORMAL, IEEE_NEGATIVE_SUBNORMAL, IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL, IEEE_POSITIVE_SUBNORMAL, IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF): Move to gcc/fortran/libgfortran.h. (cherry picked from commit db630423a97ec6690a8eb0e5c3cb186c91e3740d) commit 0784ef5e2a7ea72614aa600dccb29e926e46bab6 Author: Jakub Jelinek Date: Wed Aug 24 09:57:09 2022 +0200 i386: Fix up mode iterators that weren't expanded [PR106721] Currently, when md file reader sees and something is valid mode (or code) attribute but which doesn't include case for the current mode (or code), it just keeps the untouched. I went through all cases matching <[a-zA-Z] in tmp-mddump.md after make mddump. One of the cases was related to the V*HF mode additions and there was one typo. 2022-08-24 Jakub Jelinek PR target/106721 * config/i386/sse.md (i128vldq): Add V16HF entry. (avx512er_vmrcp28): Fix typo, mask_opernad3 -> mask_operand3. (cherry picked from commit 846e5c009e360f0c4fe58ff0d3aee03ebe3ca1a9) commit 0ce3c8ea09d08469235c7c91975aab610bcda2c8 Author: Jakub Jelinek Date: Tue Aug 16 13:15:32 2022 +0200 c++: Implement P2327R1 - De-deprecating volatile compound operations From what I can see, this has been voted in as a DR and as it means we warn less often than before in -std={gnu,c}++2{0,3} modes or with -Wvolatile, I wonder if it shouldn't be backported to affected release branches as well. 2022-08-16 Jakub Jelinek * typeck.cc (cp_build_modify_expr): Implement P2327R1 - De-deprecating volatile compound operations. Don't warn for |=, &= or ^= with volatile lhs. * expr.cc (mark_use) : Adjust warning wording, leave out simple. * g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile compound |=, &= and ^= operations. * g++.dg/cpp2a/volatile3.C: Likewise. * g++.dg/cpp2a/volatile5.C: Likewise. (cherry picked from commit 6e790ca4615443fa395ac5cdba1ab6c87810985c) commit 030063c43f30a2335d3c03182df0beb82d003816 Author: Jakub Jelinek Date: Mon Aug 15 13:56:57 2022 +0200 ifcvt: Fix up noce_convert_multiple_sets [PR106590] The following testcase is miscompiled on x86_64-linux. The problem is in the noce_convert_multiple_sets optimization. We essentially have: if (g == 1) { g = 1; f = 23; } else { g = 2; f = 20; } and for each insn try to create a conditional move sequence. There is code to detect overlap with the regs used in the condition and the destinations, so we actually try to construct: tmp_g = g == 1 ? 1 : 2; f = g == 1 ? 23 : 20; g = tmp_g; which is fine. But, we actually try to create two different conditional move sequences in each case, seq1 with the whole (eq (reg/v:HI 82 [ g ]) (const_int 1 [0x1])) condition and seq2 with cc_cmp (eq (reg:CCZ 17 flags) (const_int 0 [0])) to rely on the earlier present comparison. In each case, we compare the rtx costs and choose the cheaper sequence (seq1 if both have the same cost). The problem is that with the skylake tuning, tmp_g = g == 1 ? 1 : 2; is actually expanded as tmp_g = (g == 1) + 1; in seq1 (which clobbers (reg 17 flags)) and as a cmov in seq2 (which doesn't). The tuning says both have the same cost, so we pick seq1. Next we check sequences for f = g == 1 ? 23 : 20; and here the seq2 cmov is cheaper, but it uses (reg 17 flags) which has been clobbered earlier. The following patch fixes that by detecting if we in the chosen sequence clobber some register mentioned in cc_cmp or rev_cc_cmp, and if yes, arranges for only seq1 (i.e. sequences that emit the comparison itself) to be used after that. 2022-08-15 Jakub Jelinek PR rtl-optimization/106590 * ifcvt.cc (check_for_cc_cmp_clobbers): New function. (noce_convert_multiple_sets_1): If SEQ sets or clobbers any regs mentioned in cc_cmp or rev_cc_cmp, don't consider seq2 for any further conditional moves. * gcc.dg/torture/pr106590.c: New test. (cherry picked from commit 3a74a7bf62f47ed0d19866576378724be932ee17) commit 1961ab76b06874c30dc3dc5096816aaef2a055d4 Author: GCC Administrator Date: Mon Aug 29 00:19:40 2022 +0000 Daily bump. commit 006c412a610f68da308657bf9c9d5c5326fb80ba Author: GCC Administrator Date: Sun Aug 28 00:19:37 2022 +0000 Daily bump. commit 9f41e7813ddb2ad22a37f69f2b422d01f04e386d Author: GCC Administrator Date: Sat Aug 27 00:20:00 2022 +0000 Daily bump. commit 1f682c96048456379729d495b41551a00eac5a3f Author: Harald Anlauf Date: Tue Aug 23 22:16:14 2022 +0200 Fortran: improve error recovery while simplifying size of bad array [PR103694] gcc/fortran/ChangeLog: PR fortran/103694 * simplify.cc (simplify_size): The size expression of an array cannot be simplified if an error occurs while resolving the array spec. gcc/testsuite/ChangeLog: PR fortran/103694 * gfortran.dg/pr103694.f90: New test. (cherry picked from commit 55d8c5409325001c89c35c3d04d425dec9127146) commit 9f78e7eb8e064556adf466444197aae8e52a1eb3 Author: liuhongt Date: Mon Aug 22 10:41:16 2022 +0800 Don't gimple fold ymm-version vblendvpd/vblendvps/vpblendvb w/o TARGET_AVX2 Since 256-bit vector integer comparison is under TARGET_AVX2, and gimple folding for vblendvpd/vblendvps/vpblendvb relies on that. Restrict gimple fold condition to TARGET_AVX2. gcc/ChangeLog: PR target/106704 * config/i386/i386-builtin.def (BDESC): Add CODE_FOR_avx_blendvpd256/CODE_FOR_avx_blendvps256 to corresponding builtins. * config/i386/i386.cc (ix86_gimple_fold_builtin): Don't fold IX86_BUILTIN_PBLENDVB256, IX86_BUILTIN_BLENDVPS256, IX86_BUILTIN_BLENDVPD256 w/o TARGET_AVX2. gcc/testsuite/ChangeLog: * gcc.target/i386/pr106704.c: New test. commit 6d5945e374783865c91c2f46de62c461ea3ffeca Author: GCC Administrator Date: Fri Aug 26 00:19:49 2022 +0000 Daily bump. commit ce753c2792363f1b4cfe2ac56b2da562b34151f3 Author: Chenghua Xu Date: Wed Aug 24 15:34:07 2022 +0800 LoongArch: Fix pr106459 by use HWIT instead of 1UL. gcc/ChangeLog: PR target/106459 * config/loongarch/loongarch.cc (loongarch_build_integer): Use HOST_WIDE_INT. * config/loongarch/loongarch.h (IMM_REACH): Likewise. (HWIT_1U): New Defined. (LU12I_OPERAND): Use HOST_WIDE_INT. (LU32I_OPERAND): Likewise. (LU52I_OPERAND): Likewise. (HWIT_UC_0xFFF): Likwise. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr106459.c: New test. (cherry picked from commit b169b67d7dafe2b786f87c31d6b2efc603fd880c) commit cce15df5287dd0a4c3afd3c46ec6cb37f45fde2a Author: GCC Administrator Date: Thu Aug 25 00:19:50 2022 +0000 Daily bump. commit 219d9f61a241d370b7933aecae56ce0905465830 Author: Jonathan Wakely Date: Tue Aug 23 15:46:16 2022 +0100 libstdc++: Fix visit(v) for non-void visitors [PR106589] The optimization for the common case of std::visit forgot to handle the edge case of passing zero variants to a non-void visitor and converting the result to void. libstdc++-v3/ChangeLog: PR libstdc++/106589 * include/std/variant (__do_visit): Handle is_void for zero argument case. * testsuite/20_util/variant/visit_r.cc: Check std::visit(v). (cherry picked from commit e85bb1881e57e53306ede2a15f30d06480d69886) commit 9f532fec01d6651cc3cc136073f044a7953d8560 Author: Kewen Lin Date: Tue Aug 16 00:18:51 2022 -0500 vect: Don't allow vect_emulated_vector_p type in vectorizable_call [PR106322] As PR106322 shows, in some cases for some vector type whose TYPE_MODE is a scalar integral mode instead of a vector mode, it's possible to obtain wrong target support information when querying with the scalar integral mode. For example, for the test case in PR106322, on ppc64 32bit vectorizer gets vector type "vector(2) short unsigned int" for scalar type "short unsigned int", its mode is SImode instead of V2HImode. The target support querying checks umul_highpart optab with SImode and considers it's supported, then vectorizer further generates .MULH IFN call for that vector type. Unfortunately it's wrong to use SImode support for that vector type multiply highpart here. This patch is to teach vectorizable_call analysis not to allow vect_emulated_vector_p type for both vectype_in and vectype_out as Richi suggested. PR tree-optimization/106322 gcc/ChangeLog: * tree-vect-stmts.cc (vectorizable_call): Don't allow vect_emulated_vector_p type for both vectype_in and vectype_out. gcc/testsuite/ChangeLog: * gcc.target/i386/pr106322.c: New test. * gcc.target/powerpc/pr106322.c: New test. (cherry picked from commit 5239e2bd48fb1e6a1d1b06a1bac49bee0a742e98) commit d0d72e0b1ebbac487d70281a56799bf547034ec1 Author: Kewen.Lin Date: Tue Aug 16 00:24:07 2022 -0500 rs6000: Adjust mov optabs for opaque modes [PR103353] As PR103353 shows, we may want to continue to expand built-in function __builtin_vsx_lxvp, even if we have already emitted error messages about some missing required conditions. As shown in that PR, without one explicit mov optab on OOmode provided, it would call emit_move_insn recursively. So this patch is to allow the mov pattern to be generated during expanding phase if compiler has already seen errors. PR target/103353 gcc/ChangeLog: * config/rs6000/mma.md (define_expand movoo): Move TARGET_MMA condition check to preparation statements and add handlings for !TARGET_MMA. (define_expand movxo): Likewise. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr103353.c: New test. (cherry picked from commit 9367e3a65f874dffc8f8a3b6760e77fd9ed67117) commit fdde00a9001c985235a99a122fdfc4e36200b264 Author: GCC Administrator Date: Wed Aug 24 00:20:08 2022 +0000 Daily bump. commit c9c0684ad3092e5aa50453903c09959cb2e83fc7 Author: Jonathan Wakely Date: Mon Aug 22 17:24:27 2022 +0100 libstdc++: Document linker option for C++23 [PR105678] libstdc++-v3/ChangeLog: PR libstdc++/105678 * doc/xml/manual/using.xml: Document -lstdc++_libbacktrace requirement for using std::stacktrace. Also adjust -frtti and -fexceptions to document non-default (i.e. negative) forms. * doc/html/*: Regenerate. (cherry picked from commit cc4fa7a210b638d6a46f14dab17f2361389d18e1) commit 0c338a45453dfd784c6e4312610ad1e2fd5f95d8 Author: Joseph Myers Date: Tue Aug 23 19:19:54 2022 +0000 Update gcc .po files * be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po, ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po, zh_TW.po: Update. commit 4218d3abfde1aa3dadfdacb55893f08489e8a064 Author: Tobias Burnus Date: Tue Aug 23 11:35:01 2022 +0200 gcn/mkoffload: Cleanup temporary dbgobj file The file (suffix ".mkoffload.dbg.o") used to save the dbgobj data data has to be passed to maybe_unlink for cleanup or -v -save-temps stderr diagnostic. That was missed before. This is a partial backport of commit r13-2125, "mkoffload: Cleanup temporary omp_requires_file", only for GCN's mkoffload and its dbgobj file as 'omp requires' is not supported on GCC 12 and, hence, omp_requires_file does not exist on this branch. gcc/ChangeLog: * config/gcn/mkoffload.cc (main): Add dbgobj to files_to_cleanup. (cherry picked from commit 713ec97e593bd4d9915a13bc4047f064fec0e24a) commit 50b7cf395656ccd32d4d5d8e0e338135d28f52f6 Author: Tobias Burnus Date: Tue Aug 23 11:29:23 2022 +0200 Fortran: OpenMP fix declare simd inside modules and absent linear step [PR106566] Partial backport from commit r13-2093, only, as 'OpenMP 5.2 linear clause syntax' is not on GCC 12. gcc/fortran/ChangeLog: PR fortran/106566 * openmp.cc (gfc_match_omp_declare_simd): Accept module procedures. gcc/testsuite/ChangeLog: PR fortran/106566 * gfortran.dg/gomp/declare-simd-6.f90: New test. (cherry picked from commit 1513512ec7d0751cba30c9c8804f2be462acfb9b) commit 2413eed009878c347c65950c649c0da59e759238 Author: Tobias Burnus Date: Wed Aug 17 15:45:56 2022 +0200 OpenMP: Fix var replacement with 'simd' and linear-step vars [PR106548] gcc/ChangeLog: PR middle-end/106548 * omp-low.cc (lower_rec_input_clauses): Use build_outer_var_ref for 'simd' linear-step values that are variable. libgomp/ChangeLog: PR middle-end/106548 * testsuite/libgomp.c/linear-2.c: New test. (cherry picked from commit d9c9424d2c4f7b25acfc00db0076a65882c8a99f) commit 2262af43ba5bafccb3a4d77295d7bb3430d0bd76 Author: GCC Administrator Date: Tue Aug 23 00:19:56 2022 +0000 Daily bump. commit 55b6abd9f27c67754e1ff2549e7ea6d471493082 Author: GCC Administrator Date: Mon Aug 22 00:19:53 2022 +0000 Daily bump. commit 7368f1dd311059fb1bac12d9f4e1016e19fd2964 Author: GCC Administrator Date: Sun Aug 21 00:29:41 2022 +0000 Daily bump. commit a41243a75ff64ab437f427313024cf75cfe678e4 Author: GCC Administrator Date: Sat Aug 20 00:19:56 2022 +0000 Daily bump. commit 2d29d7b240d9ca87cbee5d90c846694125d293af Author: Richard Biener Date: Fri Aug 19 10:24:35 2022 +0200 Bump BASE-VER * BASE-VER: Set to 12.2.1. commit 2ee5e4300186a92ad73f1a1a64cb918dc76c8d67 Author: Richard Biener Date: Fri Aug 19 08:10:15 2022 +0000 Update ChangeLog and version files for release commit 0bdc158d3ee26c61b6b277238944ca5f0409e151 Author: GCC Administrator Date: Fri Aug 19 00:22:38 2022 +0000 Daily bump. commit d66882d3ee422bebc980a37930a99d240697005d Author: GCC Administrator Date: Thu Aug 18 00:20:26 2022 +0000 Daily bump. commit fe2a564b2523c0600c522d21d8c8540e32b9e64b Author: Joseph Myers Date: Wed Aug 17 22:18:48 2022 +0000 Regenerate gcc.pot * gcc.pot: Regenerate. commit 06254d97b8fa3a5d1c8b6b4e091d851700801385 Author: Ilya Leoshkevich Date: Fri Jul 29 16:14:10 2022 +0200 PR106342 - IBM zSystems: Provide vsel for all vector modes dg.exp=pr104612.c fails with an ICE on s390x, because copysignv2sf3 produces an insn that vsel is supposed to recognize, but can't, because it's not defined for V2SF. Fix by defining it for all vector modes supported by copysign3. gcc/ChangeLog: * config/s390/vector.md (V_HW_FT): New iterator. * config/s390/vx-builtins.md (vsel): Use V_HW_FT instead of V_HW. (cherry picked from commit 2f17f489de47d46626ed85804c3b810547ef550e) commit ebf3cd1716139f210ff80ba2e2da42e666d72bec Author: GCC Administrator Date: Wed Aug 17 00:21:08 2022 +0000 Daily bump. commit f6431df36461ba88f462b153fb21f6ca7497a30a Author: Iain Buclaw Date: Tue Aug 16 12:22:10 2022 +0200 d: Update DIP links in gdc documentation to point at upstream repository The wiki links probably worked at some point in the distant past, but now the official location of tracking all D Improvement Proposals is on the upstream dlang/DIPs GitHub repository. PR d/106638 gcc/d/ChangeLog: * gdc.texi: Update DIP links to point at upstream dlang/DIPs repository. (cherry picked from commit e56b695aa3aed3c0c80616bba569bbeb4a06b5e5) commit 62fc5570b9736d2323e56ef484f3a52bfe17f1fd Author: GCC Administrator Date: Tue Aug 16 00:21:58 2022 +0000 Daily bump. commit 91e1219b745adc7110fc3132268eb02ca26c99ae Author: Iain Buclaw Date: Mon Aug 15 19:00:43 2022 +0200 d: Defer compiling inline definitions until after the module has finished. This is to prevent the case of when generating the methods of a struct type, we don't accidentally emit an inline function that references it, as the outer struct itself would still be incomplete. gcc/d/ChangeLog: * d-tree.h (d_defer_declaration): Declare. * decl.cc (function_needs_inline_definition_p): Defer checking DECL_UNINLINABLE and DECL_DECLARED_INLINE_P. (maybe_build_decl_tree): Call d_defer_declaration instead of build_decl_tree. * modules.cc (deferred_inline_declarations): New variable. (build_module_tree): Set deferred_inline_declarations and a handle declarations pushed to it. (d_defer_declaration): New function. (cherry picked from commit 8db5b71e212debcc4f6a17f80191ca187c307fcb) commit dc230a0c690794cd45cc4065fa13303fd6cdfc40 Author: Iain Buclaw Date: Mon Aug 15 17:51:03 2022 +0200 d: Fix internal compiler error: Segmentation fault at gimple-expr.cc:88 Because complex types are deprecated in the language, the new way to expose native complex types is by defining an enum with a basetype of a library-defined struct that is implicitly treated as-if it is native. As casts are not implicitly added by the front-end when downcasting from enum to its underlying type, we must insert an explicit cast during the code generation pass. PR d/106623 gcc/d/ChangeLog: * d-codegen.cc (underlying_complex_expr): New function. (d_build_call): Handle passing native complex objects as the library-defined equivalent. * d-tree.h (underlying_complex_expr): Declare. * expr.cc (ExprVisitor::visit (DotVarExp *)): Call underlying_complex_expr instead of build_vconvert. gcc/testsuite/ChangeLog: * gdc.dg/torture/pr106623.d: New test. (cherry picked from commit e206fecaac29f559f4990312b875604eb1ce3ef3) commit 0dd50365ba1556cc3b9e8b24551e978f9de14eec Author: GCC Administrator Date: Mon Aug 15 00:19:15 2022 +0000 Daily bump. commit a3bd980b9b146633e2fd9a768d017909a6fe2e9b Author: GCC Administrator Date: Sun Aug 14 00:19:37 2022 +0000 Daily bump. commit 7ea6b4e059e68432646a450410562b8ad8b8753d Author: GCC Administrator Date: Sat Aug 13 00:19:43 2022 +0000 Daily bump. commit 6b7d570a5001bb79e34c0d1626a8c7f55386dac7 Author: Jason Merrill Date: Tue Jul 26 11:02:21 2022 -0400 c++: constexpr, empty base after non-empty [PR106369] Here the CONSTRUCTOR we were providing for D{} had an entry for the B base subobject at offset 0 following the entry for the C base, causing output_constructor_regular_field to ICE due to going backwards. It might be nice for that function to be more tolerant of empty fields, but it also seems reasonable for the front end to prune the useless entry. PR c++/106369 gcc/cp/ChangeLog: * constexpr.cc (reduced_constant_expression_p): Return false if a CONSTRUCTOR initializes an empty field. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/constexpr-lambda27.C: New test. (cherry picked from commit 9efe4e153d994974afcbba09c3c683f5f4a19c63) commit 60fed79c1e9a968eaedf292b298d19c9475ad37a Author: Marek Polacek Date: Thu Apr 28 16:50:06 2022 -0400 c++: pedwarn for empty unnamed enum in decl [PR67048] [dcl.dcl]/5 says that enum { }; is ill-formed, and since r197742 we issue a pedwarn. However, the pedwarn also fires for enum { } x; which is well-formed. So only warn when {} is followed by a ;. This should be correct since you can't have "enum {}, " -- that produces "expected unqualified-id before ',' token". PR c++/67048 gcc/cp/ChangeLog: * parser.cc (cp_parser_enum_specifier): Warn about empty unnamed enum only when it's followed by a semicolon. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/enum42.C: New test. (cherry picked from commit fd0d3e9121c5aa65150d242676be6bbdc8d4a92a) commit 6aaaf20ee4ad9c85f3099ef425720547644fb08d Author: Peter Bergner Date: Fri Jun 17 23:43:23 2022 -0500 c: Handle initializations of opaque types [PR106016] The initial commit that added opaque types thought that there couldn't be any valid initializations for variables of these types, but the test case in the bug report shows that isn't true. The solution is to handle OPAQUE_TYPE initializations like the other scalar types. 2022-06-17 Peter Bergner gcc/ PR c/106016 * expr.cc (count_type_elements): Handle OPAQUE_TYPE. gcc/testsuite/ PR c/106016 * gcc.target/powerpc/pr106016.c: New test. (cherry picked from commit 975658b782f36dcf6eb190966d5b705977bfd5eb) commit 7c81a89f205b8ed3315b764740a811ef04d5dadc Author: GCC Administrator Date: Fri Aug 12 00:19:44 2022 +0000 Daily bump. commit 28a7b5df3b6937a4b069150e0abbd28e15f359e2 Author: Andre Simoes Dias Vieira Date: Mon Jul 25 10:27:13 2022 +0100 aarch64: Implement ACLE Data Intrinsics This patch adds support for the ACLE Data Intrinsics to the AArch64 port. gcc/ChangeLog: 2022-07-25 Andre Vieira * config/aarch64/aarch64.md (rbit2): Rename this ... (@aarch64_rbit): ... to this and change it in... (ffs2,ctz2): ... here. (@aarch64_rev16): New. * config/aarch64/aarch64-builtins.cc: (aarch64_builtins): Define the following enum AARCH64_REV16, AARCH64_REV16L, AARCH64_REV16LL, AARCH64_RBIT, AARCH64_RBITL, AARCH64_RBITLL. (aarch64_init_data_intrinsics): New. (aarch64_general_init_builtins): Add call to aarch64_init_data_intrinsics. (aarch64_expand_builtin_data_intrinsic): New. (aarch64_general_expand_builtin): Add call to aarch64_expand_builtin_data_intrinsic. * config/aarch64/arm_acle.h (__clz, __clzl, __clzll, __cls, __clsl, __clsll, __rbit, __rbitl, __rbitll, __rev, __revl, __revll, __rev16, __rev16l, __rev16ll, __ror, __rorl, __rorll, __revsh): New. gcc/testsuite/ChangeLog: 2022-07-25 Andre Vieira * gcc.target/aarch64/acle/data-intrinsics.c: New test. (cherry picked from commit eb966d393dfdfd2c80994e4bfcc0dddf85828a73) commit bc52af48171a56b4eb6e44789344ab89e0803beb Author: GCC Administrator Date: Thu Aug 11 00:19:22 2022 +0000 Daily bump. commit 68b8c55c7e7de8438ea97f600cdccac826b8e67d Author: Tobias Burnus Date: Tue Aug 9 07:57:40 2022 +0200 OpenMP: Fix folding with simd's linear clause [PR106492] gcc/ChangeLog: PR middle-end/106492 * omp-low.cc (lower_rec_input_clauses): Add missing folding to data type of linear-clause list item. gcc/testsuite/ChangeLog: PR middle-end/106492 * g++.dg/gomp/pr106492.C: New test. (cherry picked from commit 8a16b9f983824b6b9a25275cd23b6bba8c98b800) commit ab2ca2dbd528f0564b80fa0e6eda96e0237742bc Author: Richard Biener Date: Wed Aug 10 15:45:22 2022 +0200 tree-optimization/106513 - fix mistake in bswap symbolic number shifts This fixes a mistake in typing a local variable in the symbolic shift routine. PR tree-optimization/106513 * gimple-ssa-store-merging.cc (do_shift_rotate): Use uint64_t for head_marker. * gcc.dg/torture/pr106513.c: New testcase. (cherry picked from commit f675afa4eeac9910a2c085a95aa04d6d9f2fd8d6) commit 4769ac6c5dfde2810a0266fe388211edc644e623 Author: Richard Biener Date: Mon Aug 8 09:07:23 2022 +0200 lto/106540 - fix LTO tree input wrt dwarf2out_register_external_die I've revisited the earlier two workarounds for dwarf2out_register_external_die getting duplicate entries. It turns out that r11-525-g03d90a20a1afcb added dref_queue pruning to lto_input_tree but decl reading uses that to stream in DECL_INITIAL even when in the middle of SCC streaming. When that SCC then gets thrown away we can end up with debug nodes registered which isn't supposed to happen. The following adjusts the DECL_INITIAL streaming to go the in-SCC way, using lto_input_tree_1, since no SCCs are expected at this point, just refs. PR lto/106540 PR lto/106334 * lto-streamer-in.cc (lto_read_tree_1): Use lto_input_tree_1 to input DECL_INITIAL, avoiding to commit drefs. (cherry picked from commit 2a1448f2763a72c83e2ec496f78243a975b0d44e) commit 04e3c9a18b793ec6e36a6015f907d208e9caea80 Author: GCC Administrator Date: Wed Aug 10 00:19:29 2022 +0000 Daily bump. commit 92f2582f3ec7b833a5f6b70ef05af4c7e511b860 Author: Vibhav Pant Date: Tue Aug 9 19:06:43 2022 -0400 libgccjit.h: Uncomment macro definition for testing gcc_jit_context_new_bitcast support (cherry-picked from r13-2004-g9385cd9c74cf66) The macro definition for LIBGCCJIT_HAVE_gcc_jit_context_new_bitcast was earlier located in the documentation comment for gcc_jit_context_new_bitcast, making it unavailable to code that consumed libgccjit.h. This commit moves the definition out of the comment, making it effective. gcc/jit/ChangeLog: * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_context_new_bitcast): Move definition out of comment. Signed-off-by: David Malcolm commit 79a86a608691621659b3ce3a24a72aeea4054668 Author: Iain Buclaw Date: Tue Aug 9 12:48:14 2022 +0200 d: Fix undefined reference to pragma(inline) symbol (PR106563) Functions that are declared `pragma(inline)' should be treated as if they are defined in every translation unit they are referenced from, regardless of visibility protection. Ensure they always get DECL_ONE_ONLY linkage, and start emitting them into other modules that import them. PR d/106563 gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set semanticRun before generating its symbol. (function_defined_in_root_p): New function. (function_needs_inline_definition_p): New function. (maybe_build_decl_tree): New function. (get_symbol_decl): Call maybe_build_decl_tree before returning symbol. (start_function): Use function_defined_in_root_p instead of inline test for locally defined symbols. (set_linkage_for_decl): Check for inline functions before private or protected symbols. gcc/testsuite/ChangeLog: * gdc.dg/torture/torture.exp (srcdir): New proc. * gdc.dg/torture/imports/pr106563math.d: New test. * gdc.dg/torture/imports/pr106563regex.d: New test. * gdc.dg/torture/imports/pr106563uni.d: New test. * gdc.dg/torture/pr106563.d: New test. (cherry picked from commit 04284176d549ff2565406406a6d53ab4ba8e507d) commit e62a644fb3bcc9c67c97ea28a3c441fb144a56a4 Author: GCC Administrator Date: Tue Aug 9 00:19:21 2022 +0000 Daily bump. commit fc7166a7c409bf231d5f243636f30904deea6e6f Author: Iain Buclaw Date: Mon Aug 8 15:17:47 2022 +0200 d: Fix ICE in in add_stack_var, at cfgexpand.cc:476 The type that triggers the ICE never got completed by the semantic analysis pass. Checking for size forces it to be done, or issue a compile-time error. PR d/106555 gcc/d/ChangeLog: * d-target.cc (Target::isReturnOnStack): Check for return type size. gcc/testsuite/ChangeLog: * gdc.dg/imports/pr106555.d: New test. * gdc.dg/pr106555.d: New test. (cherry picked from commit 4b0253b019943abf2cc5f4db0b7ed67caedffe4a) commit 556e5a3b1e4f2cfe53ae2f4c4d106965807ea723 Author: GCC Administrator Date: Mon Aug 8 00:19:17 2022 +0000 Daily bump. commit b8d9acc373cb2b7ffe3ace22f31ec7683e0f2e37 Author: GCC Administrator Date: Sun Aug 7 00:19:25 2022 +0000 Daily bump. commit 4178af1a5f65a9baad5ecbb3f44824861259fba5 Author: GCC Administrator Date: Sat Aug 6 00:19:27 2022 +0000 Daily bump. commit 25b11619a83f424073aca93422c832b1ac4756fb Author: Michael Meissner Date: Fri Aug 5 18:54:33 2022 -0400 Do not enable -mblock-ops-vector-pair. Testing has shown that using the load vector pair and store vector pair instructions for block moves has some performance issues on power10. A patch on June 11th modified the code so that GCC would not set -mblock-ops-vector-pair by default if we are tuning for power10, but it would set the option if we were tuning for a different machine and have load and store vector pair instructions enabled. This patch eliminates the code setting -mblock-ops-vector-pair. If you want to generate load vector pair and store vector pair instructions for block moves, you must use -mblock-ops-vector-pair. 2022-08-05 Michael Meissner gcc/ * config/rs6000/rs6000.cc (rs6000_option_override_internal): Remove code setting -mblock-ops-vector-pair. Back port patch from trunk on 8/3. commit 61076545cb3c3cbc79036eff8bc46b0c2083730c Author: Jonathan Wakely Date: Thu Aug 4 13:08:00 2022 +0100 libstdc++: Make std::string_view(Range&&) constructor explicit The P2499R0 paper was recently approved for C++23. libstdc++-v3/ChangeLog: * include/std/string_view (basic_string_view(Range&&)): Add explicit as per P2499R0. * testsuite/21_strings/basic_string_view/cons/char/range_c++20.cc: Adjust implicit conversions. Check implicit conversions fail. * testsuite/21_strings/basic_string_view/cons/wchar_t/range_c++20.cc: Likewise. (cherry picked from commit 2678386df2cc3505da85e95643327aa928e66a8e) commit 0b4d2f5e7b446477abe6165f7b3a86616cf95ce0 Author: Jonathan Wakely Date: Thu Aug 4 10:20:18 2022 +0100 libstdc++: Rename data members of std::unexpected and std::bad_expected_access The P2549R1 paper was accepted for C++23. I already implemented it for our , but I didn't rename the private daata members, only the public member functions. This renames the data members for consistency with the working draft. libstdc++-v3/ChangeLog: * include/std/expected (unexpected::_M_val): Rename to _M_unex. (bad_expected_access::_M_val): Likewise. (cherry picked from commit 07c7ee4d2d42f4728928556dbbe0700f9a13db90) commit 3a9dcef5c195c053cba0103fe3e60fab1b8905df Author: Jonathan Wakely Date: Thu Aug 4 10:18:23 2022 +0100 libstdc++: Update value of __cpp_lib_ios_noreplace macro My P2467R1 proposal was accepted for C++23 so there's an official value for this macro now. libstdc++-v3/ChangeLog: * include/bits/ios_base.h (__cpp_lib_ios_noreplace): Update value to 202207L. * include/std/version (__cpp_lib_ios_noreplace): Likewise. * testsuite/27_io/basic_ofstream/open/char/noreplace.cc: Check for new value. * testsuite/27_io/basic_ofstream/open/wchar_t/noreplace.cc: Likewise. (cherry picked from commit 3e9bd6b2b1782891639fa5d49b7d2a933b8e85cd) commit 99679c0ff73a1e60963c57758836e6d7feca311d Author: GCC Administrator Date: Fri Aug 5 00:19:14 2022 +0000 Daily bump. commit c749de493767eb0d1535a7da315f12ed86ee6065 Author: GCC Administrator Date: Thu Aug 4 00:19:28 2022 +0000 Daily bump. commit 3df2f035871e913b94a35d4b5c12d37828f313f7 Author: Jonathan Wakely Date: Mon Jun 27 14:43:54 2022 +0100 libstdc++: Improve directory iterator abstractions for openat Currently the _Dir::open_subdir function decides whether to construct a _Dir_base with just a pathname, or a file descriptor and pathname. But that means it is tightly coupled to the implementation of _Dir_base::openat, which is what actually decides whether to use a file descriptor or not. If the derived class passes a file descriptor and filename, but the base class expects a full path and ignores the file descriptor, then recursive_directory_iterator cannot recurse. This change introduces a new type that provides the union of all the information available to the derived class (the full pathname, as well as a file descriptor for a directory and another pathname relative to that directory). This allows the derived class to be agnostic to how the base class will use that information. libstdc++-v3/ChangeLog: * src/c++17/fs_dir.cc (_Dir::dir_and_pathname):: Replace with current() returning _At_path. (_Dir::_Dir, _Dir::open_subdir, _Dir::do_unlink): Adjust. * src/filesystem/dir-common.h (_Dir_base::_At_path): New class. (_Dir_base::_Dir_Base, _Dir_base::openat): Use _At_path. * src/filesystem/dir.cc (_Dir::dir_and_pathname): Replace with current() returning _At_path. (_Dir::_Dir, _Dir::open_subdir): Adjust. (cherry picked from commit 198781144f33b0ef17dd2094580b5c77ad97d6e8) commit 1a9681e60964c7f7ce0892e14745e6dcf6100157 Author: Jonathan Wakely Date: Thu Jul 28 20:55:51 2022 +0100 libstdc++: Tweak common_iterator::operator-> return type [PR104443] This adjusts the return type to match the resolution of LWG 3672. There is no functional difference, because decltype(auto) always deduced a value anyway, but this makes it simpler and consistent with the working draft. libstdc++-v3/ChangeLog: PR libstdc++/104443 * include/bits/stl_iterator.h (common_iterator::operator->): Change return type to just auto. (cherry picked from commit b5f5d1b36edbcd7d923f2e2653e54e52637c715b) commit 7a0ed28d4feb450f1ede5b52b57793a5df5b19fe Author: Jonathan Wakely Date: Tue Jul 12 11:18:47 2022 +0100 libstdc++: Check for EOF if extraction avoids buffer overflow [PR106248] In r11-2581-g17abcc77341584 (for LWG 2499) I added overflow checks to the pre-C++20 operator>>(istream&, char*) overload. Those checks can cause extraction to stop after filling the buffer, where previously it would have tried to extract another character and stopped at EOF. When that happens we no longer set eofbit in the stream state, which is consistent with the behaviour of the new C++20 overload, but is an observable and unexpected change in the C++17 behaviour. What makes it worse is that the behaviour change is dependent on optimization, because __builtin_object_size is used to detect the buffer size and that only works when optimizing. To avoid the unexpected and optimization-dependent change in behaviour, set eofbit manually if we stopped extracting because of the buffer size check, but had reached EOF anyway. If the stream's rdstate() != goodbit or width() is non-zero and smaller than the buffer, there's nothing to do. Otherwise, we filled the buffer and need to check for EOF, and maybe set eofbit. The new check is guarded by #ifdef __OPTIMIZE__ because otherwise __builtin_object_size is useless. There's no point compiling and emitting dead code that can't be eliminated because we're not optimizing. We could add extra checks that the next character in the buffer is not whitespace, to detect the case where we stopped early and prevented a buffer overflow that would have happened otherwise. That would allow us to assert or set badbit in the stream state when undefined behaviour was prevented. However, those extra checks would increase the size of the function, potentially reducing the likelihood of it being inlined, and so making the buffer size detection less reliable. It seems preferable to prevent UB and silently truncate, rather than miss the UB and allow the overflow to happen. libstdc++-v3/ChangeLog: PR libstdc++/106248 * include/std/istream [C++17] (operator>>(istream&, char*)): Set eofbit if we stopped extracting at EOF. * testsuite/27_io/basic_istream/extractors_character/char/pr106248.cc: New test. * testsuite/27_io/basic_istream/extractors_character/wchar_t/pr106248.cc: New test. (cherry picked from commit 5ae74944af1de032d4a27fad4a2287bd3a2163fd) commit cff25d209b3e0f085fe69869617c50048de87e75 Author: Jonathan Wakely Date: Fri Jul 1 11:40:29 2022 +0100 libstdc++: Add nodiscard attribute to filesystem operations Some of these are not truly "pure" because they access the file system, e.g. exists and file_size, but they do not modify anything and are only useful for the return value. If you really want to use one of those functions just to check whether an error is reported (either via an exception or an error_code& argument) you can still do so, but you need to cast the discarded result to void. Several tests need such a change, because they were indeed only calling the functions to check for expected errors. libstdc++-v3/ChangeLog: * include/bits/fs_ops.h: Add nodiscard to all pure functions. * include/experimental/bits/fs_ops.h: Likewise. * testsuite/27_io/filesystem/operations/all.cc: Do not discard results of absolute and canonical. * testsuite/27_io/filesystem/operations/absolute.cc: Cast discarded result to void. * testsuite/27_io/filesystem/operations/canonical.cc: Likewise. * testsuite/27_io/filesystem/operations/exists.cc: Likewise. * testsuite/27_io/filesystem/operations/is_empty.cc: Likewise. * testsuite/27_io/filesystem/operations/read_symlink.cc: Likewise. * testsuite/27_io/filesystem/operations/status.cc: Likewise. * testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise. * testsuite/27_io/filesystem/operations/temp_directory_path.cc: Likewise. * testsuite/experimental/filesystem/operations/canonical.cc: Likewise. * testsuite/experimental/filesystem/operations/exists.cc: Likewise. * testsuite/experimental/filesystem/operations/is_empty.cc: Likewise. * testsuite/experimental/filesystem/operations/read_symlink.cc: Likewise. * testsuite/experimental/filesystem/operations/temp_directory_path.cc: Likewise. (cherry picked from commit f7a148304a71f3d3ad6845b7966fdc3af88c9e45) commit e562236851e06091256593aa0d3fbda60a28e45b Author: Jonathan Wakely Date: Thu Jun 16 14:57:32 2022 +0100 libstdc++: Support constexpr global std::string for size < 15 [PR105995] I don't think this is required by the standard, but it's easy to support. libstdc++-v3/ChangeLog: PR libstdc++/105995 * include/bits/basic_string.h (_M_use_local_data): Initialize the entire SSO buffer. * testsuite/21_strings/basic_string/cons/char/105995.cc: New test. (cherry picked from commit 98a0d72a610a87e8e383d366e50253ddcc9a51dd) commit 2fd16b1c0269e24fc11b0abd188d006d4d9134c2 Author: Jonathan Wakely Date: Tue Jun 14 14:50:49 2022 +0100 libstdc++: Fix indentation in allocator base classes libstdc++-v3/ChangeLog: * include/bits/new_allocator.h: Fix indentation. * include/ext/malloc_allocator.h: Likewise. (cherry picked from commit 29da01709facbcc7efef4fd6767660d417f44531) commit 2ef2de76dae5cac14e0de77ca7205e43be03ab22 Author: Jonathan Wakely Date: Tue Jun 14 14:37:25 2022 +0100 libstdc++: Check for size overflow in constexpr allocation [PR105957] libstdc++-v3/ChangeLog: PR libstdc++/105957 * include/bits/allocator.h (allocator::allocate): Check for overflow in constexpr allocation. * testsuite/20_util/allocator/105975.cc: New test. (cherry picked from commit 0a9af7b4ef1b8aa85cc8820acf54d41d1569fc10) commit 8a57deb926cd660c2eae7ed621d61a301ae0d523 Author: Jonathan Wakely Date: Fri Jun 10 14:39:13 2022 +0100 libstdc++: Make std::lcm and std::gcd detect overflow [PR105844] When I fixed PR libstdc++/92978 I introduced a regression whereby std::lcm(INT_MIN, 1) and std::lcm(50000, 49999) would no longer produce errors during constant evaluation. Those calls are undefined, because they violate the preconditions that |m| and the result can be represented in the return type (which is int in both those cases). The regression occurred because __absu(INT_MIN) is well-formed, due to the explicit casts to unsigned in that new helper function, and the out-of-range multiplication is well-formed, because unsigned arithmetic wraps instead of overflowing. To fix 92978 I made std::gcm and std::lcm calculate |m| and |n| immediately, yielding a common unsigned type that was used to calculate the result. That was partly correct, but there's no need to use an unsigned type. Doing so only suppresses the overflow errors so the compiler can't detect them. This change replaces __absu with __abs_r that returns the common type (not its corresponding unsigned type). This way we can detect overflow in __abs_r when required, while still supporting the most-negative value when it can be represented in the result type. To detect LCM results that are out of range of the result type we still need explicit checks, because neither constant evaluation nor UBsan will complain about unsigned wrapping for cases such as std::lcm(500000u, 499999u). We can detect those overflows efficiently by using __builtin_mul_overflow and asserting. libstdc++-v3/ChangeLog: PR libstdc++/105844 * include/experimental/numeric (experimental::gcd): Simplify assertions. Use __abs_r instead of __absu. (experimental::lcm): Likewise. Remove use of __detail::__lcm so overflow can be detected. * include/std/numeric (__detail::__absu): Rename to __abs_r and change to allow signed result type, so overflow can be detected. (__detail::__lcm): Remove. (gcd): Simplify assertions. Use __abs_r instead of __absu. (lcm): Likewise. Remove use of __detail::__lcm so overflow can be detected. * testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error lines. * testsuite/26_numerics/lcm/lcm_neg.cc: Likewise. * testsuite/26_numerics/gcd/105844.cc: New test. * testsuite/26_numerics/lcm/105844.cc: New test. (cherry picked from commit 671970a5621e18e7079b4ca113e56434c858db66) commit 4e5ca7ff8c9afd3c38245aa6b939cd3ae49bf1fe Author: Jakub Jelinek Date: Mon Aug 1 08:26:03 2022 +0200 libfortran: Fix up boz_15.f90 on powerpc64le with -mabi=ieeelongdouble [PR106079] The boz_15.f90 test FAILs on powerpc64le-linux when -mabi=ieeelongdouble is used (either default through --with-long-double-format=ieee or when used explicitly). The problem is that the read/write transfer routines are called with BT_REAL (or BT_COMPLEX) type and kind 17 which is magic we use to say it is the IEEE quad real(kind=16) rather than the IBM double double real(kind=16). For the floating point input/output we then handle kind 17 specially, but for B/O/Z we just treat the bytes of the floating point value as binary blob and using 17 in that case results in unexpected behavior, for write it means we don't estimate right how many chars we'll need and print ******************** etc. rather than what we should, and even with explicit size we'd print one further byte than intended. For read it would even mean overwriting some unrelated byte after the floating point object. Fixed by using 16 instead of 17 in the read_radix and write_{b,o,z} calls. 2022-08-01 Jakub Jelinek PR libfortran/106079 * io/transfer.c (formatted_transfer_scalar_read, formatted_transfer_scalar_write): For type BT_REAL with kind 17 change kind to 16 before calling read_radix or write_{b,o,z}. (cherry picked from commit 82ac4cd213867be939aedee15347e8fd3f200b6a) commit eb941a6d651b9b87f7da7cc5f39b36e7b7082340 Author: GCC Administrator Date: Wed Aug 3 00:19:18 2022 +0000 Daily bump. commit 5f583aa1c56af983ca8f2b8bc57122c4be5a6e55 Author: Peter Bergner Date: Mon Jul 25 00:51:44 2022 -0500 rs6000: Adjust -mdejagnu-cpu to filter out -mtune [PR106345] As PR106345 shows, when configuring compiler with an explicit option --with-tune=, it would cause some test cases to fail if their test points are sensitive to tune setting, such as: group_ending_nop, loop align etc. It doesn't help that even to specify one explicit -mcpu=. This patch is to adjust the behavior of -mdejagnu-cpu by filtering out all -mcpu= and -mtune= options, then test cases would use as tune as the one specified by -mdejagnu-cpu. 2022-07-25 Peter Bergner Kewen Lin PR testsuite/106345 gcc/ChangeLog: * config/rs6000/rs6000.h (DRIVER_SELF_SPECS): Adjust -mdejagnu-cpu to filter out all -mtune options. (cherry picked from commit 75d20d6c84c12bedd65a904e462f02f0b9eb3f77) commit bd521701c819710a244eae87b097b6acb534756b Author: Kewen Lin Date: Mon Jul 25 21:29:14 2022 -0500 rs6000: Preserve REG_EH_REGION when replacing load/store [PR106091] As test case in PR106091 shows, rs6000 specific pass swaps doesn't preserve the reg_note REG_EH_REGION when replacing some load insn at the end of basic block, it causes the flow info verification to fail unexpectedly. Since memory reference rtx may trap, this patch is to ensure we copy REG_EH_REGION reg_note while replacing swapped aligned load or store. PR target/106091 gcc/ChangeLog: * config/rs6000/rs6000-p8swap.cc (replace_swapped_aligned_store): Copy REG_EH_REGION when replacing one store insn having it. (replace_swapped_aligned_load): Likewise. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr106091.c: New test. (cherry picked from commit f4286601933406142b46693660f7f4b682cb50a5) commit e04785d99d52445fd17357c22a07dd3a62f56de3 Author: GCC Administrator Date: Tue Aug 2 00:19:17 2022 +0000 Daily bump. commit 98e2676558f6f50cfb90610e5a160642a24d1596 Author: Lewis Hyatt Date: Sat Jul 9 16:12:21 2022 -0400 c: Fix location for _Pragma tokens [PR97498] The handling of #pragma GCC diagnostic uses input_location, which is not always as precise as needed; in particular the relative location of some tokens and a _Pragma directive will crucially determine whether a given diagnostic is enabled or suppressed in the desired way. PR97498 shows how the C frontend ends up with input_location pointing to the beginning of the line containing a _Pragma() directive, resulting in the wrong behavior if the diagnostic to be modified pertains to some tokens found earlier on the same line. This patch fixes that by addressing two issues: a) libcpp was not assigning a valid location to the CPP_PRAGMA token generated by the _Pragma directive. b) C frontend was not setting input_location to something reasonable. With this change, the C frontend is able to change input_location to point to the _Pragma token as needed. This is just a two-line fix (one for each of a) and b)), the testsuite changes were needed only because the location on the tested warnings has been somewhat improved, so the tests need to look for the new locations. gcc/c/ChangeLog: PR preprocessor/97498 * c-parser.cc (c_parser_pragma): Set input_location to the location of the pragma, rather than the start of the line. libcpp/ChangeLog: PR preprocessor/97498 * directives.cc (destringize_and_run): Override the location of the CPP_PRAGMA token from a _Pragma directive to the location of the expansion point, as is done for the tokens lexed from it. gcc/testsuite/ChangeLog: PR preprocessor/97498 * c-c++-common/pr97498.c: New test. * c-c++-common/gomp/pragma-3.c: Adapt for improved warning locations. * c-c++-common/gomp/pragma-5.c: Likewise. * gcc.dg/pragma-message.c: Likewise. libgomp/ChangeLog: * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Adapt for improved warning locations. * testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Likewise. (cherry picked from commit 0587cef3d7962a8b0f44779589ba2920dd3d71e5) commit d2bafe190c230fc0aeab1ac961bf7ae9f8b5b19f Author: GCC Administrator Date: Mon Aug 1 00:19:26 2022 +0000 Daily bump. commit caf633624fd994434fd9c4b4333fae3a5f074ae2 Author: GCC Administrator Date: Sun Jul 31 00:19:07 2022 +0000 Daily bump. commit 681c73db9bd156f9b65a73ccc6c4a0a697fe70d6 Author: Jakub Jelinek Date: Fri Jul 29 09:49:11 2022 +0200 openmp: Fix up handling of non-rectangular simd loops with pointer type iterators [PR106449] There were 2 issues visible on this new testcase, one that we didn't have special POINTER_TYPE_P handling in a few spots of expand_omp_simd - for pointers we need to use POINTER_PLUS_EXPR and need to have the non-pointer part in sizetype, for non-rectangular loop on the other side we can rely on multiplication factor 1, pointers can't be multiplied, without those changes we'd ICE. The other issue was that we put n2 expression directly into a comparison in a condition and regimplified that, for the &a[512] case that and with gimplification being destructed that unfortunately meant modification of original fd->loops[?].n2. Fixed by unsharing the expression. This was causing a runtime failure on the testcase. 2022-07-29 Jakub Jelinek PR middle-end/106449 * omp-expand.cc (expand_omp_simd): Fix up handling of pointer iterators in non-rectangular simd loops. Unshare fd->loops[i].n2 or n2 before regimplifying it inside of a condition. * testsuite/libgomp.c-c++-common/pr106449.c: New test. (cherry picked from commit 97d32048c04e9787fccadc4bae1c042754503e34) commit 0062d8491c20eb95411ac0b112e09ec0cee836d1 Author: Jakub Jelinek Date: Wed Jul 27 12:06:22 2022 +0200 cgraphunit: Don't emit asm thunks for -dx [PR106261] When -dx option is used (didn't know we have it and no idea what is it useful for), we just expand functions to RTL and then omit all further RTL passes, so the normal functions aren't actually emitted into assembly, just variables. The following testcase ICEs, because we don't emit the methods, but do emit thunks pointing to that and those thunks have unwind info and rely on at least some real functions to be emitted (which is normally the case, thunks are only emitted for locally defined functions) because otherwise there are no CIEs, only FDEs and dwarf2out is upset about it. The following patch fixes that by not emitting assembly thunks for -dx either. 2022-07-27 Jakub Jelinek PR debug/106261 * cgraphunit.cc (cgraph_node::assemble_thunks_and_aliases): Don't output asm thunks for -dx. * g++.dg/debug/pr106261.C: New test. (cherry picked from commit f9671b60f9395cb1dca128b92f5dd215f5aeaae1) commit 527dccb33e54ffe49fb1507fc4539968f48a9d12 Author: Jakub Jelinek Date: Fri Jul 1 11:17:41 2022 +0200 wide-int: Fix up wi::shifted_mask [PR106144] As the following self-test testcase shows, wi::shifted_mask sometimes doesn't create canonicalized wide_ints, which then fail to compare equal to canonicalized wide_ints with the same value. In particular, wi::mask (128, false, 128) gives { -1 } with len 1 and prec 128, while wi::shifted_mask (0, 128, false, 128) gives { -1, -1 } with len 2 and prec 128. The problem is that the code is written with the assumption that there are 3 bit blocks (or 2 if start is 0), but doesn't consider the possibility where there are 2 bit blocks (or 1 if start is 0) where the highest block isn't present. In that case, there is the optional block of negate ? 0 : -1 elts, followed by just one elt (either one from the if (shift) or just negate ? -1 : 0) and the rest is implicit sign-extension. Only if end < prec there is 1 or more bits above it that have different bit value and so we need to emit all the elts till end and then one more elt. if (end == prec) would work too, because we have: if (width > prec - start) width = prec - start; unsigned int end = start + width; so end is guaranteed to be end <= prec, dunno what is preferred. 2022-07-01 Jakub Jelinek PR middle-end/106144 * wide-int.cc (wi::shifted_mask): If end >= prec, return right after emitting element for shift or if shift is 0 first element after start. (wide_int_cc_tests): Add tests for equivalency of wi::mask and wi::shifted_mask with 0 start. (cherry picked from commit e52592073f6df3d7a3acd9f0436dcc32a8b7493d) commit 2339ee2c89af80270840e04fc0906acea765489f Author: GCC Administrator Date: Sat Jul 30 00:18:55 2022 +0000 Daily bump. commit 8351dd962000f9699c9d9f373a913034f0a91b11 Author: GCC Administrator Date: Fri Jul 29 00:19:13 2022 +0000 Daily bump. commit b2ae75fd2afc7d92f5f71748540390b7aebde4c6 Author: GCC Administrator Date: Thu Jul 28 00:19:00 2022 +0000 Daily bump. commit 7455e982f09832418fd98b7b0c2152eb7e3c1765 Author: David Malcolm Date: Wed Jul 27 17:38:55 2022 -0400 analyzer: fix stray get_element decls (cherry picked from r13-1847-g0460ba622e833d) These were copy&paste errors. gcc/analyzer/ChangeLog: * region.h (code_region::get_element): Remove stray decl. (function_region::get_element): Likewise. Signed-off-by: David Malcolm commit 71a4f739c218746df70612eeb844024d1fe206bb Author: David Malcolm Date: Wed Jul 27 17:38:55 2022 -0400 analyzer: fix false positives from -Wanalyzer-tainted-divisor [PR106225] (cherry picked from r13-1562-g897b3b31f0a94b) gcc/analyzer/ChangeLog: PR analyzer/106225 * sm-taint.cc (taint_state_machine::on_stmt): Move handling of assignments from division to... (taint_state_machine::check_for_tainted_divisor): ...this new function. Reject warning when the divisor is known to be non-zero. * sm.cc: Include "analyzer/program-state.h". (sm_context::get_old_region_model): New. * sm.h (sm_context::get_old_region_model): New decl. gcc/testsuite/ChangeLog: PR analyzer/106225 * gcc.dg/analyzer/taint-divisor-1.c: Add test coverage for various correct and incorrect checks against zero. Signed-off-by: David Malcolm commit 09cb9c88ef8e2c0c89ada9cde2caf1a960db7a77 Author: David Malcolm Date: Wed Jul 27 17:38:55 2022 -0400 analyzer: fix uninit false positive with -ftrivial-auto-var-init= [PR106204] (cherry picked from r13-1517-gb33dd7874523af) -fanalyzer handles -ftrivial-auto-var-init= by special-casing IFN_DEFERRED_INIT to be a no-op, so that e.g.: len_2 = .DEFERRED_INIT (4, 2, &"len"[0]); is treated as a no-op, so that len_2 is still uninitialized after the stmt. PR analyzer/106204 reports that -fanalyzer gives false positives from -Wanalyzer-use-of-uninitialized-value on locals that have their address taken, due to e.g.: _1 = .DEFERRED_INIT (4, 2, &"len"[0]); len = _1; where -fanalyzer leaves _1 uninitialized, and then complains about the assignment to "len". Fixed thusly by suppressing the warning when assigning from such SSA names. gcc/analyzer/ChangeLog: PR analyzer/106204 * region-model.cc (within_short_circuited_stmt_p): Move extraction of assign_stmt to caller. (due_to_ifn_deferred_init_p): New. (region_model::check_for_poison): Move extraction of assign_stmt from within_short_circuited_stmt_p to here. Share logic with call to due_to_ifn_deferred_init_p. gcc/testsuite/ChangeLog: PR analyzer/106204 * gcc.dg/analyzer/torture/uninit-pr106204.c: New test. * gcc.dg/analyzer/uninit-pr106204.c: New test. Signed-off-by: David Malcolm commit 9fa11419ef59fde9d00ea8458235baa2bc83cd7a Author: David Malcolm Date: Wed Jul 27 17:38:54 2022 -0400 analyzer: show saved diagnostics as nodes in .eg.dot dumps (cherry picked from r13-1117-gc540077a3bf600) I've been using this tweak to the output of -fdump-analyzer-exploded-graph in my working copies for a while; the extra red nodes make it *much* easier to find the places where diagnostics are being emitted (or rejected by the diagnostic_manager). gcc/analyzer/ChangeLog: * diagnostic-manager.cc (saved_diagnostic::dump_dot_id): New. (saved_diagnostic::dump_as_dot_node): New. * diagnostic-manager.h (saved_diagnostic::dump_dot_id): New decl. (saved_diagnostic::dump_as_dot_node): New decl. * engine.cc (exploded_node::dump_dot): Add nodes for saved diagnostics. Signed-off-by: David Malcolm commit 4eac9fa087f4efd0748c9ff51bec1155a9b6b41e Author: David Malcolm Date: Wed Jul 27 17:38:54 2022 -0400 analyzer: add more uninit test coverage (cherry picked from r13-1116-g44681d45473883) gcc/testsuite/ChangeLog: * gcc.dg/analyzer/uninit-1.c: Add test coverage of attempts to jump through an uninitialized function pointer, and of attempts to pass an uninitialized value to a function call. Signed-off-by: David Malcolm commit 6fd39b060420125c17c60e837836d30993b7ed84 Author: David Malcolm Date: Wed Jul 27 17:38:54 2022 -0400 json: fix escaping of '\' (cherry picked from r13-965-g4f9ad0b4b0a8c7) gcc/ChangeLog: * json.cc (string::print): Fix escaping of '\'. Signed-off-by: David Malcolm commit 1d38fa564edeae1e69e2ad8aa651e9452a6d687a Author: David Malcolm Date: Wed Jul 27 17:38:53 2022 -0400 analyzer: fix memory leaks (cherry picked from r13-334-g99988b0e8b57b3) These leaks all relate to logging within -fdump-analyzer[-stderr] or are one-time leaks; seen with valgrind. gcc/analyzer/ChangeLog: * checker-path.cc (state_change_event::get_desc): Call maybe_free on label_text temporaries. * diagnostic-manager.cc (diagnostic_manager::prune_for_sm_diagnostic): Likewise. * engine.cc (exploded_graph::~exploded_graph): Fix leak of m_per_point_data and m_per_call_string_data values. Simplify cleanup of m_per_function_stats and m_per_point_data values. (feasibility_state::maybe_update_for_edge): Fix leak of result of superedge::get_description. * region-model-manager.cc (region_model_manager::~region_model_manager): Move cleanup of m_setjmp_values to match the ordering of the fields within region_model_manager. Fix leak of values within m_repeated_values_map, m_bits_within_values_map, m_asm_output_values_map, and m_const_fn_result_values_map. Signed-off-by: David Malcolm commit 05530fcea07a9ee5c7501867f3f11f0fbc504a06 Author: David Malcolm Date: Wed Jul 27 17:38:53 2022 -0400 analyzer: handle repeated accesses after init of unknown size [PR105285] (cherry-picked from r13-7-g00c4405cd7f6a144d0a439e4d848d246920e6ff3) PR analyzer/105285 reports a false positive from -Wanalyzer-null-dereference on git.git's reftable/reader.c. A reduced version of the problem can be seen in test_1a of gcc.dg/analyzer/symbolic-12.c in the following: void test_1a (void *p, unsigned next_off) { struct st_1 *r = p; external_fn(); if (next_off >= r->size) return; if (next_off >= r->size) /* We should have already returned if this is the case. */ __analyzer_dump_path (); /* { dg-bogus "path" } */ } where the analyzer erroneously considers this path, where (next_off >= r->size) is both false and then true: symbolic-12.c: In function ‘test_1a’: symbolic-12.c:22:5: note: path 22 | __analyzer_dump_path (); /* { dg-bogus "path" } */ | ^~~~~~~~~~~~~~~~~~~~~~~ ‘test_1a’: events 1-5 | | 17 | if (next_off >= r->size) | | ^ | | | | | (1) following ‘false’ branch... |...... | 20 | if (next_off >= r->size) | | ~ ~~~~~~~ | | | | | | | (2) ...to here | | (3) following ‘true’ branch... | 21 | /* We should have already returned if this is the case. */ | 22 | __analyzer_dump_path (); /* { dg-bogus "path" } */ | | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) ...to here | | (5) here | The root cause is that, at the call to the external function, the analyzer considers the cluster for *p to have been touched, binding it to a conjured_svalue, but because p is void * no particular size is known for the write, and so the cluster is bound using a symbolic key covering the base region. Later, the accesses to r->size are handled by binding_cluster::get_any_binding, but binding_cluster::get_binding fails to find a match for the concrete field lookup, due to the key for the binding being symbolic, and reaching this code: 1522 /* If this cluster has been touched by a symbolic write, then the content 1523 of any subregion not currently specifically bound is "UNKNOWN". */ 1524 if (m_touched) 1525 { 1526 region_model_manager *rmm_mgr = mgr->get_svalue_manager (); 1527 return rmm_mgr->get_or_create_unknown_svalue (reg->get_type ()); 1528 } Hence each access to r->size is an unknown svalue, and thus the condition (next_off >= r->size) isn't tracked, leading to the path with contradictory conditions being treated as satisfiable. In the original reproducer in git's reftable/reader.c, the call to the external fn is: reftable_record_type(rec) which is considered to possibly write to *rec, which is *tab, where tab is the void * argument to reftable_reader_seek_void, and thus after the call to reftable_record_type some arbitrary amount of *rec could have been written to. This patch fixes things by detecting the "this cluster has been 'filled' with a conjured value of unknown size" case, and handling get_any_binding on it by returning a sub_svalue of the conjured_svalue, so that repeated accesses to r->size give the same symbolic value, so that the constraint manager rejects the bogus execution path, fixing the false positive. gcc/analyzer/ChangeLog: PR analyzer/105285 * store.cc (binding_cluster::get_any_binding): Handle accessing sub_svalues of clusters where the base region has a symbolic binding. gcc/testsuite/ChangeLog: PR analyzer/105285 * gcc.dg/analyzer/symbolic-12.c: New test. Signed-off-by: David Malcolm commit 1321183a13540b5c3503586b94c758198471c7b3 Author: David Malcolm Date: Wed Jul 27 17:38:53 2022 -0400 analyzer: add .fpath.txt dumps to -fdump-analyzer-feasibility (cherry picked from r13-6-gd8586b00dd00a1783862da5f0c8811a740400074) I found this extension to -fdump-analyzer-feasibility very helpful when debugging PR analyzer/105285. gcc/analyzer/ChangeLog: * diagnostic-manager.cc (epath_finder::process_worklist_item): Call dump_feasible_path when a path that reaches the the target enode is found. (epath_finder::dump_feasible_path): New. * engine.cc (feasibility_state::dump_to_pp): New. * exploded-graph.h (feasibility_state::dump_to_pp): New decl. * feasible-graph.cc (feasible_graph::dump_feasible_path): New. * feasible-graph.h (feasible_graph::dump_feasible_path): New decls. * program-point.cc (function_point::print): Fix missing trailing newlines. * program-point.h (program_point::print_source_line): Remove unimplemented decl. gcc/ChangeLog: * doc/invoke.texi (-fdump-analyzer-feasibility): Mention the fpath.txt output. Signed-off-by: David Malcolm commit 4c1c38ba9535435b04ee22cda33042b7d48ca183 Author: Maciej W. Rozycki Date: Wed Jul 27 11:09:43 2022 +0100 RISC-V: Remove duplicate backslashes from `stack_protect_set_' Remove redundant duplicate backslash characters from \t sequences in the output pattern of the `stack_protect_set_' RTL insn. gcc/ * config/riscv/riscv.md (stack_protect_set_): Remove duplicate backslashes. (cherry picked from commit 3cf07cc5e51c833f39f5bad5ca6fbe23c853a214) commit 5b8458bc35b5df34c1b4b8735975f2686444f6c8 Author: Richard Biener Date: Mon Jul 25 17:24:57 2022 +0200 tree-optimization/106189 - avoid division by zero exception The diagnostic code can end up with zero sized array elements with T[][0] and the wide-int code nicely avoids exceptions when dividing by zero in one codepath but not in another. The following fixes the exception by using wide-int in both paths. PR tree-optimization/106189 * gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Divide using offset_ints. * gcc.dg/pr106189.c: New testcase. (cherry picked from commit bb04f9f23ac0dee2c003118c85372ece50a52220) commit d2892faac6d760ebc47f8f6ebee51e5cf6255cc8 Author: Joseph Myers Date: Thu Jun 30 16:41:40 2022 +0000 lto: Fix option merging [PR106129] The LTO merging of options from different input files was broken by: commit 227a2ecf663d69972b851f51f1934d18927b62cd Author: Martin Liska Date: Fri Mar 12 11:53:47 2021 +0100 lto-wrapper: Use vec data type. Previously, find_and_merge_options would merge options it read into those in *opts. After this commit, options in *opts on entry to find_and_merge_options are ignored; the only merging that takes place is between multiple sets of options in the same input file that are read in the same call to this function (not sure how that case can occur at all). The effects include, for example, that if some objects are built with PIC enabled and others with it disabled, and the last LTO object processed has PIC enabled, the choice of PIC for the last object will result in the whole program being built as PIC, when the merging logic is intended to ensure that a mixture of PIC and non-PIC objects results in the whole program being built as non-PIC. Fix this with an extra argument to find_and_merge_options to determine whether merging should take place. This shows up a second issue with that commit (which I think wasn't actually intended to change code semantics at all): once merging is enabled again, the check for -Xassembler options became an infinite loop in the case where both inputs had -Xassembler options, with the same first option, so fix that loop to restore the previous semantics. Note that I'm not sure how LTO option merging might be tested in the testsuite (clearly there wasn't sufficient, if any, coverage to detect these bugs). Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR lto/106129 * lto-wrapper.cc (find_option): Add argument start. (merge_and_complain): Loop over existing_opt_index and existing_opt2_index for Xassembler check. Update calls to find_option. (find_and_merge_options): Add argument first to determine whether to merge options with those passed in *opts. (run_gcc): Update calls to find_and_merge_options. (cherry picked from commit 8a8ee37a3325f1009034245676ef4e482c0444a2) commit e0e388998b797da09a8c018f6f94d1358fd4b8f1 Author: Andrew Pinski Date: Thu Jul 7 22:06:19 2022 +0000 Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars The problem here is that when we mark the ssa name that was referenced in the now removed dead store (to a write only static variable), the inline-asm would also be removed even though it was defining another ssa name. This fixes the problem by checking to make sure that the statement was only defining one ssa name. Committed as approved after a bootstrapped and tested on x86_64 with no regressions. PR tree-optimization/106087 gcc/ChangeLog: * tree-ssa-dce.cc (simple_dce_from_worklist): Check to make sure the statement is only defining one operand. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/inline-asm-1.c: New test. (cherry picked from commit 71e3daa31cfa35ee58e5899cb00767be92227fd2) commit 019a9ef7f7466c0f41bdc8c5838f4f4926c938aa Author: Dimitar Dimitrov Date: Sun Jul 10 11:15:39 2022 +0300 testsuite: Require int128 for gcc.dg/pr106063.c Require effective target int128 for gcc.dg/pr106063.c. PR tree-optimization/106063 gcc/testsuite/ChangeLog: * gcc.dg/pr106063.c: Require effective target int128. Signed-off-by: Dimitar Dimitrov (cherry picked from commit 4ebbf3906895bcb40d7ff2729cf46deae66bc268) commit 13d23c313374e15186f33fa6d57a0c9fd5d8b486 Author: Tamar Christina Date: Fri Jul 8 08:30:22 2022 +0100 middle-end: don't lower past veclower [PR106063] Hi All, My previous patch can cause a problem if the pattern matches after veclower as it may replace the construct with a vector sequence which the target may not directly support. As such don't perform the rewriting if after veclower unless the target supports the operation. If before veclower do the rewriting as well if the target didn't support the original operation either. gcc/ChangeLog: PR tree-optimization/106063 * match.pd: Do not apply pattern after veclower is not supported. gcc/testsuite/ChangeLog: PR tree-optimization/106063 * gcc.dg/pr106063.c: New test. (cherry picked from commit f7854e2faf7640230062dec3596e71773ca500ed) commit 4ca164a6372412a1b3dc62b6fbde77d338e22bd4 Author: Alexandre Oliva Date: Fri Jun 3 03:59:03 2022 -0300 [PR105665] ivopts: check defs of names in base for undefs The patch for PR 100810 tested for undefined SSA_NAMEs appearing directly in the base expression of the potential IV candidate, but that's not enough. The testcase for PR105665 shows an undefined SSA_NAME has the same ill effect if it's referenced as an PHI_NODE arg in the referenced SSA_NAME. The variant of that test shows it can be further removed from the referenced SSA_NAME. To avoid deep recursion, precompute maybe-undefined SSA_NAMEs: start from known-undefined nonvirtual default defs, and propagate them to any PHI nodes reached by a maybe-undefined arg, as long as there aren't intervening non-PHI uses, that would imply the maybe-undefined name must be defined at that point, otherwise it would invoke undefined behavior. Also test for intervening non-PHI uses of DEFs in the base expr. The test for intervening uses implemented herein relies on dominance; this could be further extended, regarding conditional uses in every path leading to a point as an unconditional use dominating that point, but I haven't implemented that. for gcc/ChangeLog PR tree-optimization/105665 PR tree-optimization/100810 * tree-ssa-loop-ivopts.cc (ssa_name_maybe_undef_p, ssa_name_set_maybe_undef): New. (ssa_name_any_use_dominates_bb_p, mark_ssa_maybe_undefs): New. (find_ssa_undef): Check precomputed flag and intervening uses. (tree_ssa_iv_optimize): Call mark_ssa_maybe_undefs. for gcc/testsuite/ChangeLog PR tree-optimization/105665 PR tree-optimization/100810 * gcc.dg/torture/pr105665.c: New. (cherry picked from commit be2861fe8c527a5952257462ceca899bb43b1452) commit 5e45d078e36428de7c836037ec2707c538fcb774 Author: GCC Administrator Date: Wed Jul 27 00:19:35 2022 +0000 Daily bump. commit f281d9dd1ed63825efa234df63d3f2ae6cc9022a Author: Thomas Rodgers Date: Tue Jul 5 17:42:42 2022 -0700 libstdc++: Minor codegen improvement for atomic wait spinloop This patch merges the spin loops in the atomic wait implementation which is a minor codegen improvement. libstdc++-v3/ChangeLog: * include/bits/atomic_wait.h (__atomic_spin): Merge spin loops. (cherry picked from commit e75da2ace6b6f634237259ef62cfb2d3d34adb10) commit 81a0fa31ce96327618023b476ea121dbe2494b04 Author: Iain Buclaw Date: Tue Jul 26 18:13:54 2022 +0200 d: Merge upstream dmd 76e3b41375, druntime 1462ebd1, phobos 5fef0d28f. Updates D language version to v2.100.1. D front-end changes: - Fix delegate literal with inferred return value that requires following alias-this to not use class cast. - Fix internal error on variadic template type instantiated with two arrays of classes. - `scope(failure)' blocks that contain `return' statements are now deprecated. - Fix regression where wrong cast was inserted for ternary operator and non-int enums. - Fix internal error in code generation trying to reference _d_arraysetctor. - Fix memory corruption when array literal is passed to map in lambda, then returned from nested function. - Generate invariant id on the basis of location rather than a global counter. - Make `noreturn' conversions work. - Fix segfault when `.stringof' of template alias overloaded with function accessed by trait. - Empty array literal passed to scope param not 'falsey' anymore. Phobos changes: - Avoid copying ranges in std.algorithm.comparison.equal. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 76e3b41375. * dmd/VERSION: Bump version to v2.100.1. * decl.cc (DeclVisitor::visit (VarDeclaration *)): Evaluate RHS of noreturn declaration expressions first. * expr.cc (ExprVisitor::visit (AssignExp *)): Don't generate assignment for noreturn types. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 1462ebd1. * src/MERGE: Merge upstream phobos 5fef0d28f. commit 2009850b2b7042a678c385cd72e6ceb40caac8cd Author: Harald Anlauf Date: Mon Jul 25 22:29:50 2022 +0200 Fortran: error recovery from calculation of storage size of a symbol [PR103504] gcc/fortran/ChangeLog: PR fortran/103504 * interface.cc (get_sym_storage_size): Array bounds and character length can only be of integer type. gcc/testsuite/ChangeLog: PR fortran/103504 * gfortran.dg/pr103504.f90: New test. (cherry picked from commit 600956c81c784f4a0cc9d10f6e03e01847afd961) commit 9be0feeadeeac2166fbe3823421bc5712bc59087 Author: Marek Polacek Date: Fri Jul 15 09:51:50 2022 -0400 c++: ICE with erroneous template redeclaration [PR106311] Here we ICE trying to get DECL_SOURCE_LOCATION of the parm that happens to be error_mark_node in this ill-formed test. I kept running into this while reducing code, so it'd be good to have it fixed. PR c++/106311 gcc/cp/ChangeLog: * pt.cc (redeclare_class_template): Check DECL_P before accessing DECL_SOURCE_LOCATION. gcc/testsuite/ChangeLog: * g++.dg/template/redecl5.C: New test. (cherry picked from commit 2333b58c9892667545d0c2c3ecd2d7b947197511) commit 60954a06ceb1598d86763e5504d8e1b874b6bd6a Author: Jason Merrill Date: Mon Jul 25 11:13:31 2022 -0400 c++: aggregate prvalue as for range [PR106230] Since my PR94041 work on temporary lifetime in aggregate initialization, we end up calling build_vec_init to initialize the reference-extended temporary for the artificial __for_range variable. And build_vec_init uses finish_for_stmt to implement its loop. That function assumes that if __for_range is in current_binding_level, we're finishing a range-for, and we should fix up the variable as it goes out of scope. But when called from build_vec_init we aren't finishing a range-for, and do_poplevel doesn't remove the variable from scope because stmts_are_full_exprs_p is false. So let's check that here as well, and leave the DECL_NAME alone. PR c++/106230 gcc/cp/ChangeLog: * semantics.cc (finish_for_stmt): Check stmts_are_full_exprs_p. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/range-for38.C: New test. commit 3387ec265151e6635e4b382c6023e898eb8bb08b Author: GCC Administrator Date: Tue Jul 26 00:19:22 2022 +0000 Daily bump. commit 0057fda05e26d182760967dbcdf32d1c538cdfab Author: Sebastian Huber Date: Fri Jul 22 14:09:20 2022 +0200 RTEMS: Do not define _GNU_SOURCE by default gcc/ChangeLog: * config/rs6000/rtems.h (CPLUSPLUS_CPP_SPEC): Undef. (cherry picked from commit 556b816b820f6749910784cbaca8bb0bb822a970) commit 16ea82f0fc99b9c6b8afa8faa1e811e959729548 Author: GCC Administrator Date: Mon Jul 25 00:19:30 2022 +0000 Daily bump. commit 8b85716d35c560c1efdef47cedf6351010067e71 Author: GCC Administrator Date: Sun Jul 24 00:19:01 2022 +0000 Daily bump. commit 2a1263d3638bb04e9593e3e879524e542eb4854f Author: GCC Administrator Date: Sat Jul 23 00:19:16 2022 +0000 Daily bump. commit 4be7b79d055446a0f647a41ca273ba22a119c7f2 Author: Jonathan Wakely Date: Tue Jun 28 09:26:12 2022 +0100 libstdc++: Do not optimize away storing pathname if it's needed libstdc++-v3/ChangeLog: * src/c++17/fs_dir.cc (_Dir::_Dir) [!_GLIBCXX_HAVE_OPENAT]: Always store pathname if we don't have openat or unlinkat, because the full path is needed to open sub-directories and remove entries. (cherry picked from commit 835b19936bf30d693783bfa39145a4ce243bbd7c) commit 4eb15eceaac0bb900303986fc5164190d3692a0a Author: Alexandre Oliva Date: Mon Jun 27 10:34:16 2022 -0300 libstdc++: check for openat with dirfd in std::filesystem In the recent patch to check for openat, I missed an occurrence of dirfd in std::filesystem. for libstdc++-v3/ChangeLog * src/c++17/fs_dir.cc (dir_and_pathname): Use dirfd if _GLIBCXX_HAVE_OPENAT. (cherry picked from commit 486893b1d325d22d54c1380937943913a7501f91) commit ca82e7900f40d240f246371c376d0c6fb126b5a0 Author: Alexandre Oliva Date: Thu Jun 23 23:20:53 2022 -0300 libstdc++: check for openat rtems6.0 has fdopendir, and fcntl.h defines AT_FDCWD and declares openat, but there's no openat in libc. Adjust dir-common.h to not assume ::openat just because of AT_FDCWD. for libstdc++-v3/ChangeLog * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for openat. * configure, config.h.in: Rebuilt. * src/filesystem/dir-common.h (openat): Use ::openat if _GLIBCXX_HAVE_OPENAT. * src/filesystem/dir.cc (dir_and_pathname): Use dirfd if _GLIBCXX_HAVE_OPENAT. (cherry picked from commit 93070671eae44f24ba822383e17571a39257c637) commit 98ce66a48fb01475e011757464c49a3b284ae5da Author: Jonathan Wakely Date: Fri May 6 13:23:45 2022 +0100 libstdc++: Do not include in This avoids polluting the global namespace with the "abi" namespace alias. libstdc++-v3/ChangeLog: * include/std/stacktrace: Do not include . (__cxa_demangle): Declare. (cherry picked from commit e112e37f2920bcc9185e53b754d9145aac912c72) commit 64edeadbcced95203fa7fc049c26d7ca47ecab7b Author: GCC Administrator Date: Fri Jul 22 00:19:09 2022 +0000 Daily bump. commit 707bc64fbeecf8a10f7aad103534b6999e9d190c Author: Jason Merrill Date: Wed Jul 20 20:00:58 2022 -0400 c++: defaulted friend op== [PR106361] Now non-member functions can be defaulted, so this assert is wrong. move_signature_fn_p already checks for ctor or op=. PR c++/106361 gcc/cp/ChangeLog: * decl.cc (move_fn_p): Remove assert. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-eq14.C: New test. commit a074ae297d5dbd69e03c6c30f9cb7720685fdb62 Author: Patrick Palka Date: Thu Jul 21 12:59:44 2022 -0400 c++: non-dependent call to consteval operator [PR105912] Here we're crashing when substituting a non-dependent call to a consteval operator, whose CALL_EXPR_OPERATOR_SYNTAX flag we try to propagate to the result, but the result isn't a CALL_EXPR since the selected function is consteval. This patch fixes this by checking the result of extract_call_expr accordingly. (Note that we can't check DECL_IMMEDIATE_FUNCTION_P here because we don't know which function was selected by overload resolution from here.) PR c++/105912 gcc/cp/ChangeLog: * call.cc (extract_call_expr): Return a NULL_TREE on failure instead of asserting. * pt.cc (tsubst_copy_and_build) : Guard against NULL_TREE extract_call_expr result. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/consteval31.C: New test. (cherry picked from commit f70c18524221dcefa6cd26cee7b55503181bd912) commit 5d6286903f325a7a85e5ab1d04ba942d33d755bc Author: Patrick Palka Date: Wed Jul 13 14:01:28 2022 -0400 c++: dependence of constrained memfn from current inst [PR105842] Here we incorrectly deem the calls to func1, func2 and tmpl2 as ambiguous ahead of time ultimately because we mishandle dependence of a constrained member function from the current instantiation. In type_dependent_expression_p, we already consider dependence of a TEMPLATE_DECL's constraints (via uses_outer_template_parms), but neglect to do the same for a FUNCTION_DECL (such as that for func1). And in satisfy_declaration_constraints, we give up if _any_ template argument is dependent, but for non-dependent member functions from the current instantiation (such as func2 and tmpl2), we can and must check constraints as long as the innermost arguments aren't dependent. PR c++/105842 gcc/cp/ChangeLog: * constraint.cc (satisfy_declaration_constraints): Refine early exit test for argument dependence. * cp-tree.h (uses_outer_template_parms_in_constraints): Declare. * pt.cc (template_class_depth): Handle TI_TEMPLATE being a FIELD_DECL. (usse_outer_template_parms): Factor out constraint dependence test into ... (uses_outer_template_parms_in_constraints): ... here. (type_dependent_expression_p): Use it for FUNCTION_DECL. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-memtmpl6.C: New test. (cherry picked from commit f07778f6f92111aa0abfd0f669b148a0bda537a9) commit 670ef5b108d0acfbde96f44b064079f2fa0c92d4 Author: Patrick Palka Date: Mon Jun 6 14:29:12 2022 -0400 c++: function NTTP argument considered unused [PR53164, PR105848] Here at parse time the template argument f (an OVERLOAD) in A gets resolved ahead of time to the FUNCTION_DECL f, and we defer marking f as used until instantiation (of g) as usual. Later when instantiating g the type A (where f has already been resolved) is non-dependent, so tsubst_aggr_type avoids re-processing its template arguments, and we end up never actually marking f as used (which means we never instantiate it) even though A::h() later calls it, leading to a link error. This patch works around this issue by looking through ADDR_EXPR when calling mark_used on the substituted callee of a CALL_EXPR. PR c++/53164 PR c++/105848 gcc/cp/ChangeLog: * pt.cc (tsubst_copy_and_build) : Look through an ADDR_EXPR callee when calling mark_used. gcc/testsuite/ChangeLog: * g++.dg/template/fn-ptr3.C: New test. (cherry picked from commit 733a792a2b2e1662e738fa358b45a2720a8618a7) commit 41487bff13fa98607ab5548bc1a0dca71147a5ac Author: Patrick Palka Date: Fri Jun 3 12:06:59 2022 -0400 c++: cv-quals of dummy obj for non-dep memfn call [PR105637] In non-dependent23.C below we expect the Base::foo calls to resolve to the second, third and fourth overloads respectively in light of the cv-qualifiers of 'this' in each case. But ever since r12-6075-g2decd2cabe5a4f, the calls incorrectly resolve to the first overload at instantiation time. This happens because the calls to Base::foo are all deemed non-dependent (ever since r7-755-g23cb72663051cd made us ignore 'this' dependence when considering the dependence of a non-static memfn call), hence we end up checking the call ahead of time, using as the object argument a dummy object of type Base. Since this object argument is cv-unqualified, the calls in turn resolve to the unqualified overload of baseDevice. Before r12-6075 this incorrect result would just get silently discarded and we'd end up redoing OR at instantiation time using 'this' as the object argument. But after r12-6075 we now reuse this incorrect result at instantiation time. This patch fixes this by making maybe_dummy_object respect the cv-quals of (the non-lambda) 'this' when returning a dummy object. Thus, ahead of time OR using a dummy object will give us the right answer that's consistent with the instantiation time answer. An earlier version of this patch didn't handle 'this'-capturing lambdas correctly, which broke lambda-this22.C below. PR c++/105637 gcc/cp/ChangeLog: * tree.cc (maybe_dummy_object): When returning a dummy object, respect the cv-quals of 'this' if available. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-this22.C: New test. * g++.dg/template/non-dependent23.C: New test. (cherry picked from commit 44a5bd6d933d86ed988fc4695aa00f122cf83eb4) commit 90655e30130f8f609911335902db3c8354a5e21a Author: Patrick Palka Date: Fri Jun 3 09:29:12 2022 -0400 c++: don't substitute TEMPLATE_PARM_CONSTRAINTS [PR100374] This patch makes us avoid substituting into the TEMPLATE_PARM_CONSTRAINTS of each template parameter except as necessary for declaration matching, like we already do for the other constituent constraints of a declaration. This patch also improves the CA104 implementation of explicit specialization matching of a constrained function template inside a class template, by considering the function's combined constraints instead of just its trailing constraints. This allows us to correctly handle the first three explicit specializations in concepts-spec2.C below, but because we compare the constraints as a whole, it means we incorrectly accept the fourth explicit specialization which writes #3's constraints in a different way. For complete correctness here, determine_specialization should use tsubst_each_template_parm_constraints and template_parameter_heads_equivalent_p. PR c++/100374 gcc/cp/ChangeLog: * pt.cc (determine_specialization): Compare overall constraints not just the trailing constraints. (tsubst_each_template_parm_constraints): Define. (tsubst_friend_function): Use it. (tsubst_friend_class): Use it. (tsubst_template_parm): Don't substitute TEMPLATE_PARM_CONSTRAINTS. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-spec2.C: New test. * g++.dg/cpp2a/concepts-template-parm11.C: New test. (cherry picked from commit 43c013df02fdb07f9b7a5e7e6669e6d69769d451) commit 4ebc9fef1ac36f353866c66b398e9bd0f1c2ed3d Author: Patrick Palka Date: Tue May 31 16:49:08 2022 -0400 c++: non-dep call with empty TYPE_BINFO [PR105758] Here the out-of-line definition of Z::z causes duplicate_decls to change z's type from using the primary template type Z (which is also the type of the injected class name) to the implicit instantiation Z, and this latter type lacks a TYPE_BINFO (although its TYPE_CANONICAL was set by a special case in lookup_template_class to point to the former). Later, when processing the non-dependent call z->foo(0), build_over_call relies on the object argument's TYPE_BINFO to build the templated form for this call, which fails because the object argument type has empty TYPE_BINFO due to the above. It seems weird that the implicit instantiation Z doesn't have the same TYPE_BINFO as the primary template type Z, despite them being proclaimed equivalent via TYPE_CANONICAL. So I tried also setting TYPE_BINFO in the special case in lookup_template_class, but that led to some problems with constrained partial specializations of the form Z. I'm not sure what, if anything, we ought to do about the subtle differences between these two versions of the same type. Fortunately it seems we don't need to rely on TYPE_BINFO at all in build_over_call here -- the z_candidate struct already contains the exact binfos we need to rebuild the BASELINK for the templated form. PR c++/105758 gcc/cp/ChangeLog: * call.cc (build_over_call): Use z_candidate::conversion_path and ::access_path instead of TYPE_BINFO when building the BASELINK for the templated form. gcc/testsuite/ChangeLog: * g++.dg/template/non-dependent24.C: New test. (cherry picked from commit 4f84f12066953186cce4328b7f178d3daa2fe96e) commit 12d8a4a0fb26729290a184c40956329bb614625f Author: Patrick Palka Date: Thu May 26 09:43:14 2022 -0400 c++: constrained partial spec forward decl [PR96363] Here during cp_parser_single_declaration for #2, we were calling associate_classtype_constraints for TPL (the primary template type) before maybe_process_partial_specialization could get a chance to notice that we're in fact declaring a distinct constrained partial spec and not redeclaring the primary template. This caused us to emit a bogus error about differing constraints b/t the primary template and #2's constraints. This patch fixes this by moving the call to associate_classtype_constraints after the call to shadow_tag (which calls maybe_process_partial_specialization) and adjusting shadow_tag to use the return value of m_p_p_s. Moreover, if we later try to define a constrained partial specialization that's been declared earlier (as in the third testcase), then maybe_new_partial_specialization correctly notices it's a redeclaration and returns NULL_TREE. But in this case we also need to update TYPE to point to the redeclared partial spec (it'll otherwise continue pointing to the primary template type, eventually leading to a bogus error). PR c++/96363 gcc/cp/ChangeLog: * decl.cc (shadow_tag): Use the return value of maybe_process_partial_specialization. * parser.cc (cp_parser_single_declaration): Call shadow_tag before associate_classtype_constraints. * pt.cc (maybe_new_partial_specialization): Change return type to bool. Take 'type' argument by mutable reference. Set 'type' to point to the correct constrained specialization when appropriate. (maybe_process_partial_specialization): Adjust accordingly. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-partial-spec12.C: New test. * g++.dg/cpp2a/concepts-partial-spec12a.C: New test. * g++.dg/cpp2a/concepts-partial-spec13.C: New test. (cherry picked from commit 97dc78d705a90c1ae83c78a7f2e24942cc3a6257) commit 4f15d2234608e82159d030dadb17af678cfad626 Author: Ian Lance Taylor Date: Tue Jul 12 19:42:43 2022 -0700 libgo: don't include when building gen-sysinfo.go Removing this doesn't change anything at least with glibc 2.33. The include was added in https://go.dev/cl/6100049 but it's not clear why. Fixes PR go/106266 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/417294 (cherry picked from commit f35d65517a59565758107c5b1a51a5fa382f8d1a) commit f29c845782c43bda89820566648b921203bb967b Author: Martin Liska Date: Mon Jul 11 22:03:14 2022 +0200 libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream 9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include to resolve fsconfig_command/mount_attr conflict with glibc 2.36 (cherry picked from commit 2701442d0cf6292f6624443c15813d6d1a3562fe) commit 06443fa2d467ec3180cc2c287f71cc0fc2c16840 Author: Jonathan Wakely Date: Wed Jul 20 16:51:44 2022 +0100 libstdc++: Fix std::common_iterator assignment [PR100823] This fixes the following conformance problems reported in the PR: - Move constructor and move assignment should be defined. - Copy assignment from a valueless object should be allowed. Assignment is completely rewritten by this patch, as the previous version had a number of problems. The converting assignment failed to handle the case of assigning a new value to a valueless object, which should work. It only accepted lvalue arguments, so wasn't usable to implement the move assignment operator. Finally, it enforced the precondition that the argument is not valueless, which is correct for the converting assignment but not for the copy assignment. A new _M_assign member is added to handle all cases of assignment (copying from an lvalue, moving from an rvalue, and converting from a different type). The not valueless precondition is checked in the converting assignment before calling _M_assign, so isn't enforced for copy and move assignment. The new function no longer uses a switch, so handles valueless objects as the LHS or RHS of the assignment. libstdc++-v3/ChangeLog: PR libstdc++/100823 * include/bits/stl_iterator.h (common_iterator): Define move constructor and move assignment operator. (common_iterator::_M_assign): New function implementing assignment. (common_iterator::operator=): Use _M_assign. (common_iterator::_S_valueless): New constant. * testsuite/24_iterators/common_iterator/100823.cc: New test. (cherry picked from commit 56c999860bbbb2fd5091ba0985e2e5eaa90c6478) commit 6a7ed225223bc8a13c5bbf4e77fbd7738b5b66d0 Author: Jonathan Wakely Date: Wed Jul 20 12:49:28 2022 +0100 libstdc++: Fix minor bugs in std::common_iterator The noexcept-specifier for some std::common_iterator constructors was incorrectly using an rvalue as the first argument of std::is_nothrow_assignable_v. This gave the wrong answer for some types, e.g. std::common_iterator, because an rvalue of scalar type cannot be assigned to. Also fix the friend declaration to use the same constraints as on the definition of the class template. G++ fails to diagnose this error, due to PR c++/96830. Finally, the copy constructor was using std::move for its argument in some cases, which should be removed. libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (common_iterator): Fix incorrect uses of is_nothrow_assignable_v. Fix inconsistent constraints on friend declaration. Do not move argument in copy constructor. * testsuite/24_iterators/common_iterator/1.cc: Check for noexcept constructibnle/assignable. (cherry picked from commit 3b5567c3ec7e5759bdecc6a6fc0be2b65a93636e) commit 86fd1b0b4aacd81954d8350b9fef81ff40608a2e Author: Nathan Sidwell Date: Tue May 24 10:17:18 2022 +0100 libstdc++: Make headers include their prerequisites These headers were relying on their includers having already included some prerequisites. That makes them unsuitable to be header-units. So directly include the needed headers. Reviewed-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/hashtable.h: Include required headers. * include/bits/hashtable_policy.h: Likewise. * include/bits/stl_heap.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Likewise. (cherry picked from commit a44380541fee1c7ab14cc90a9af8d1aef3c72866) commit 545e8fb1418f52fa9541afb03a39233c1106d673 Author: Jonathan Wakely Date: Thu Jun 30 11:28:23 2022 +0100 libstdc++: Fix comment typos libstdc++-v3/ChangeLog: * include/bits/utility.h: Fix comment typos. (cherry picked from commit c1fe8ddf6847a14152668064f163a2585e9dc894) commit c19fe8ad4e2816b181e5d5d3757f1ad59c86cdca Author: Jonathan Wakely Date: Tue Jun 28 09:17:06 2022 +0100 libstdc++: testsuite: Guard use of C99 std::log2 This prevents the test from failing if the only thing not supported is the text printed to the log about the size of the floating-point type. libstdc++-v3/ChangeLog: * testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math functions are available. (cherry picked from commit 30aea28bd30027e0a6be8e3077828256779954b3) commit 145ef5e2be28183f2b92b1f81b4d75210b524503 Author: Jonathan Wakely Date: Thu Jun 23 11:58:16 2022 +0100 libstdc++: Simplify test by not using std::log2 This test uses std::log2 without including , but it doesn't need to use it at all. Just get the number of digits from numeric_limits instead. libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/random_device/entropy.cc: Use numeric_limits::digits. (cherry picked from commit 78fd15fd4a641cfac28ce60bf43a3e1ca309537b) commit 0bb30f94ace6be68bd315d03f36b24bbaec2bee7 Author: Marco Falke Date: Tue Jul 19 10:10:39 2022 +0100 libstdc++: Make __from_chars_alnum_to_val conversion explicit The optimizations from commit r12-8175-ga54137c88061c7 introduced a clang integer sanitizer error. Fix this with an explicit static_cast, similar to the fix for PR 96766. libstdc++-v3/ChangeLog: * include/std/charconv (__from_chars_alnum_to_val): Replace implicit conversion from int to unsigned char with explicit cast. (cherry picked from commit 20ab3972240aff596a3fa98e9fb09ddc0658fbb3) commit f3ff78e3db0fc18127dac4fe3eaf113d0c5ddd01 Author: Jonathan Wakely Date: Tue Jun 28 15:56:30 2022 +0100 libstdc++: Fix experimental::filesystem::status on Windows [PR88881] Although the Filesystem TS isn't properly supported on Windows (unlike the C++17 Filesystem lib), most tests do pass. Two of the failures are due to PR 88881 which was only fixed for std::filesystem not the TS. This applies the fix to the TS implementation too. libstdc++-v3/ChangeLog: PR libstdc++/88881 * src/filesystem/ops.cc (has_trailing_slash): New helper function. (fs::status): Strip trailing slashes. (fs::symlink_status): Likewise. * testsuite/experimental/filesystem/operations/temp_directory_path.cc: Clean the environment before each test and use TMP instead of TMPDIR so the test passes on Windows. (cherry picked from commit 6c96b14a19a9e6c365eacc59868a866b99f9786d) commit ade3197134cc9ed2b7e589a7b58c73110ae13f1c Author: Jonathan Wakely Date: Wed Jun 8 10:43:57 2022 +0100 libstdc++: Fix lifetime bugs for non-TLS eh_globals [PR105880] This ensures that the single-threaded fallback buffer eh_globals is not destroyed during program termination, using the same immortalization technique used for error category objects. Also ensure that init._M_init can still be read after init has been destroyed, by making it a static data member. libstdc++-v3/ChangeLog: PR libstdc++/105880 * libsupc++/eh_globals.cc (eh_globals): Ensure constant init and prevent destruction during termination. (__eh_globals_init::_M_init): Replace with static member _S_init. (__cxxabiv1::__cxa_get_globals_fast): Update. (__cxxabiv1::__cxa_get_globals): Likewise. (cherry picked from commit 1e65f2ed99024f23c56f7b6a961898bcaa882a92) commit 7f596e4314cbd496f90d16a91962141a418558af Author: GCC Administrator Date: Thu Jul 21 00:19:21 2022 +0000 Daily bump. commit 16155316ea663d854e3ab72b49f1fe1bfacd5e18 Author: Harald Anlauf Date: Wed Jul 20 20:40:23 2022 +0200 Fortran: fix parsing of omp task affinity iterator clause [PR101330] gcc/fortran/ChangeLog: PR fortran/101330 * openmp.cc (gfc_match_iterator): Remove left-over code from development that could lead to a crash on invalid input. gcc/testsuite/ChangeLog: PR fortran/101330 * gfortran.dg/gomp/affinity-clause-7.f90: New test. (cherry picked from commit 26bbe78f77f73bb66af1ac13d0deec888a3c6510) commit 94d44a83ff90a96237b0a40e6b2048d02fbff192 Author: GCC Administrator Date: Wed Jul 20 00:19:15 2022 +0000 Daily bump. commit deafa40eb57b39626e116ca6a15d34a34c57c9f6 Author: Marek Polacek Date: Tue Jul 19 14:24:25 2022 -0400 c++: fix SIGFPE with -Wclass-memaccess [PR105634] Here we crash because we attempt to % by 0. Thus fixed. PR c++/105634 gcc/cp/ChangeLog: * call.cc (maybe_warn_class_memaccess): Avoid % by zero. gcc/testsuite/ChangeLog: * g++.dg/warn/Wclass-memaccess-7.C: New test. commit 1a7200da71550e6f92da66f0b328bb20d3bcdf35 Author: Richard Biener Date: Tue Jul 19 09:57:22 2022 +0200 middle-end/106331 - fix mem attributes for string op arguments get_memory_rtx tries hard to come up with a MEM_EXPR to record in the memory attributes but in the last fallback fails to properly account for an unknown offset and thus, as visible in this testcase, incorrect alignment computed from set_mem_attributes. The following rectifies both parts. PR middle-end/106331 * builtins.cc (get_memory_rtx): Compute alignment from the original address and set MEM_OFFSET to unknown when we create a MEM_EXPR from the base object of the address. * gfortran.dg/pr106331.f90: New testcase. (cherry picked from commit e4ff11a8f2e80adb8ada69bf35ee6a1ab18a9c85) commit ec9287ba9718871aa64900d6168105802e1ca941 Author: Richard Biener Date: Thu Jun 30 10:33:40 2022 +0200 tree-optimization/106131 - wrong code with FRE rewriting The following makes sure to not use the original TBAA type for looking up a value across an aggregate copy when we had to offset the read. 2022-06-30 Richard Biener PR tree-optimization/106131 * tree-ssa-sccvn.cc (vn_reference_lookup_3): Force alias-set zero when offsetting the read looking through an aggregate copy. * g++.dg/torture/pr106131.C: New testcase. (cherry picked from commit 9701432ff79926a5dd3303be3417e0bd0c24140b) commit 854ab8be5d9ddfc5b4d57a5c040d1811a89fbe4f Author: Richard Biener Date: Tue Jun 28 13:57:29 2022 +0200 tree-optimization/106112 - fix CSE from wider operation The following fixes a mistake in looking up an extended operand in the CSE of a truncated operation. 2022-06-28 Richard Biener PR tree-optimization/106112 * tree-ssa-sccvn.cc (valueized_wider_op): Properly extend a constant operand according to its type. * gcc.dg/torture/pr106112.c: New testcase. (cherry picked from commit 2dbb45d6dc0d20dc159b3d8e27ebb6825074827a) commit 71c6baa9abc8c378a1aa913398a8f1a2277946e0 Author: Richard Biener Date: Mon Jun 20 13:40:50 2022 +0200 middle-end/106027 - fix types in needle folding The fold_to_nonsharp_ineq_using_bound folding ends up creating invalid typed IL which confuses later foldings. The following fixes that. 2022-06-20 Richard Biener PR middle-end/106027 * fold-const.cc (fold_to_nonsharp_ineq_using_bound): Use the type of the prevailing comparison for the new comparison type. (fold_binary_loc): Use proper types for the A < X && A + 1 > Y to A < X && A >= Y folding. * gcc.dg/pr106027.c: New testcase. (cherry picked from commit 713f2fd923442b1be620a44240ddf786ae0ab476) commit 8dd1c404ec77c6d2cdaaf93d219e3250081355c0 Author: Richard Biener Date: Wed Jun 15 11:27:31 2022 +0200 tree-optimization/105971 - less surprising refs_may_alias_p_2 When DSE asks whether __real a is using __imag a it gets a surprising result when a is a FUNCTION_DECL. The following makes sure this case is less surprising to callers but keeping the bail-out for the non-decl case where it is true that PTA doesn't track aliases to code correctly. 2022-06-15 Richard Biener PR tree-optimization/105971 * tree-ssa-alias.cc (refs_may_alias_p_2): Put bail-out for FUNCTION_DECL and LABEL_DECL refs after decl-decl disambiguation to leak less surprising alias results. * gcc.dg/torture/pr106971.c: New testcase. (cherry picked from commit 8c2733e16ec1c0cdda3db4cdc5ad158a96a658e8) commit 4f34a9e8d5ffcef99a212180d58718b00bdbb7d2 Author: Richard Biener Date: Wed Jun 15 10:54:48 2022 +0200 tree-optimization/105969 - FPE with array diagnostics For a [0][0] array we have to be careful when dividing by the element size which is zero for the outermost dimension. Luckily the division is only for an overflow check which is pointless for array size zero. 2022-06-15 Richard Biener PR tree-optimization/105969 * gimple-ssa-sprintf.cc (get_origin_and_offset_r): Avoid division by zero in overflow check. * gcc.dg/pr105969.c: New testcase. (cherry picked from commit edb9330c29fe8a0a0b76df6fafd6a223a4d0e41f) commit 1fe7321a6ce0dcb05763c8f1850a066824516342 Author: Richard Biener Date: Tue Jun 14 10:59:49 2022 +0200 middle-end/105965 - add missing v_c_e <{ el }> simplification When we got the simplification of bit-field-ref to view-convert we lost the ability to detect FMAs since we cannot look through _1 = {_10}; _11 = VIEW_CONVERT_EXPR(_1); the following amends the (view_convert CONSTRUCTOR) pattern to handle this case. 2022-06-14 Richard Biener PR middle-end/105965 * match.pd (view_convert CONSTRUCTOR): Handle single-element CTOR case. * gcc.target/i386/pr105965.c: New testcase. (cherry picked from commit 90467f0ad649d0817f9e034596a0fb85605b55af) commit 92aa9490315d969d6e7580fb6e8d006415877bd6 Author: Richard Biener Date: Tue Jun 14 11:10:13 2022 +0200 tree-optimization/105946 - avoid accessing excess args from uninit diag uninit diagnostics uses passing via reference and access attributes but that iterates over function type arguments which can in some cases appearantly outrun the actual arguments leading to ICEs. The following simply ignores not present arguments. 2022-06-14 Richard Biener PR tree-optimization/105946 * tree-ssa-uninit.cc (maybe_warn_pass_by_reference): Do not look at arguments not specified in the function call. (cherry picked from commit e07a876c07601e1f3a27420f7d055d20193c362c) commit 4ed850a568e4d27a2df566f13843714ca80d437e Author: Richard Biener Date: Fri Jul 1 14:11:35 2022 +0200 target/105459 - allow delayed target option node fixup The following avoids the need to massage the target optimization node at WPA time when we fixup the optimization node, copying FP related flags from callee to caller. The target is already set up to fixup, but that only works when not switching between functions. After fixing that the fixup is then done at LTRANS time when materializing the function. 2022-07-01 Richard Biener PR target/105459 * config/i386/i386-options.cc (ix86_set_current_function): Rebuild the target optimization node whenever necessary, not only when the optimization node didn't change. * gcc.dg/lto/pr105459_0.c: New testcase. (cherry picked from commit 4c94382a132a4b2b9d020806549a006fa6764d1b) commit f25b0b91d13ba26bdf49cd681ed147c037f154d8 Author: GCC Administrator Date: Tue Jul 19 00:19:24 2022 +0000 Daily bump. commit 1124c88978e8a69666169fac2216fe76064a1841 Author: GCC Administrator Date: Mon Jul 18 00:19:06 2022 +0000 Daily bump. commit 57f51070d0e7dfe65774d0c0b989ec2faa426652 Author: GCC Administrator Date: Sun Jul 17 00:19:13 2022 +0000 Daily bump. commit c1b0037bcc26019a87935e5634b6d448e9773193 Author: Steve Kargl Date: Fri Jul 15 22:07:15 2022 +0200 Fortran: do not generate conflicting results under -ff2c [PR104313] gcc/fortran/ChangeLog: PR fortran/104313 * trans-decl.cc (gfc_generate_return): Do not generate conflicting fake results for functions with no result variable under -ff2c. gcc/testsuite/ChangeLog: PR fortran/104313 * gfortran.dg/pr104313.f: New test. (cherry picked from commit 517fb1a78102df43f052c6934c27dd51d786aff7) commit 5b877e0f6881a3a4dbbd15e9d2849a460bfe171c Author: GCC Administrator Date: Sat Jul 16 00:19:13 2022 +0000 Daily bump. commit b8102d1ea4bfdf38cb8c4bd2cebdc9cafbcdf0ff Author: GCC Administrator Date: Fri Jul 15 00:19:21 2022 +0000 Daily bump. commit 22736f3d0d4fb8ce4afb3230023f8accdb03a623 Author: Michael Meissner Date: Thu Jul 14 11:16:08 2022 -0400 [BACKPORT] Disable generating load/store vector pairs for block copies. Testing has found that using load and store vector pair for block copies can result in a slow down on power10. This patch disables using the vector pair instructions for block copies if we are tuning for power10. 2022-06-11 Michael Meissner gcc/ * config/rs6000/rs6000.cc (rs6000_option_override_internal): Do not generate block copies with vector pair instructions if we are tuning for power10. Back port from master branch. commit 0380d008b1474373852fd2fc921886491304f854 Author: Surya Kumari Jangala Date: Fri Jun 10 19:52:57 2022 +0530 regrename: Fix -fcompare-debug issue in check_new_reg_p [PR105041] In check_new_reg_p, the nregs of a du chain is computed by obtaining the MODE of the first element in the chain, and then calling hard_regno_nregs() with the MODE. But the first element of the chain can be a DEBUG_INSN whose mode need not be the same as the rest of the elements in the du chain. This was resulting in fcompare-debug failure as check_new_reg_p was returning a different result with -g for the same candidate register. We can instead obtain nregs from the du chain itself. 2022-06-10 Surya Kumari Jangala gcc/ PR rtl-optimization/105041 * regrename.cc (check_new_reg_p): Use nregs value from du chain. gcc/testsuite/ PR rtl-optimization/105041 * gcc.target/powerpc/pr105041.c: New test. (cherry picked from commit 3e16b4359e86b36676ed01219e6deafa95f3c16b) commit 87d4bdc87f2b8c17bbc2f427821e23b65d77be69 Author: GCC Administrator Date: Thu Jul 14 00:19:28 2022 +0000 Daily bump. commit 8c57e8005db4864ecfba791d788f0b1dc6110f3b Author: GCC Administrator Date: Wed Jul 13 00:19:15 2022 +0000 Daily bump. commit e25a446597ee7964ae459bc21bac83ab9ef44338 Author: GCC Administrator Date: Tue Jul 12 00:19:05 2022 +0000 Daily bump. commit 1a78fffb3845f879e36ba33b4d15e75b3df8d5a7 Author: Martin Jambor Date: Mon Jul 11 18:43:23 2022 +0200 tree-sra: Fix union handling in build_reconstructed_reference As the testcase in PR 105860 shows, the code that tries to re-use the handled_component chains in SRA can be horribly confused by unions, where it thinks it has found a compatible structure under which it can chain the references, but in fact it found the type it was looking for elsewhere in a union and generated a write to a completely wrong part of an aggregate. I don't remember whether the plan was to support unions at all in build_reconstructed_reference but it can work, to an extent, if we make sure that we start the search only outside the outermost union, which is what the patch does (and the extra testcase verifies). Additionally, this commit also contains sqashed in it a backport of b984b84cbe4bf026edef2ba37685f3958a1dc1cf which fixes the testcase gcc.dg/tree-ssa/alias-access-path-13.c for many 32-bit targets. gcc/ChangeLog: 2022-07-01 Martin Jambor PR tree-optimization/105860 * tree-sra.cc (build_reconstructed_reference): Start expr traversal only just below the outermost union. gcc/testsuite/ChangeLog: 2022-07-01 Martin Jambor PR tree-optimization/105860 * gcc.dg/tree-ssa/alias-access-path-13.c: New test. * gcc.dg/tree-ssa/pr105860.c: Likewise. (cherry picked from commit b110e5283e368b5377e04766e4ff82cd52634208) commit 54b8432bda1414b3cc074a1f996821e31ef4c0bc Author: GCC Administrator Date: Mon Jul 11 00:19:21 2022 +0000 Daily bump. commit b568e0db565b189eb434dbd44791aa816d71e72f Author: Xi Ruoyao Date: Fri Jul 8 21:09:25 2022 +0800 loongarch: fix mulsidi3_64bit instruction (mult (sign_extend:DI rj:SI) (sign_extend:DI rk:SI)) should be "mulw.d.w", not "mul.d". gcc/ChangeLog: * config/loongarch/loongarch.md (mulsidi3_64bit): Use mulw.d.w instead of mul.d. gcc/testsuite/ChangeLog: * gcc.target/loongarch/mulw_d_w.c: New test. * gcc.c-torture/execute/mul-sext.c: New test. (cherry picked from commit 1fa42d62140b56589771eb3d46f89c810bfc8e0a) commit 7282722666c2bc43a4f10dcb88b100f8fe4d7bcc Author: GCC Administrator Date: Sun Jul 10 00:19:06 2022 +0000 Daily bump. commit 3ce205f62dea251482806d3efce992134c5677cd Author: Roger Sayle Date: Sat Jul 9 12:38:12 2022 +0100 PR target/105930: Split *xordi3_doubleword after reload on x86. This is a backport of the fix for PR target/105930 from mainline to the gcc12 release branch. 2022-07-09 Roger Sayle Uroš Bizjak gcc/ChangeLog PR target/105930 * config/i386/i386.md (*di3_doubleword): Split after reload. Use rtx_equal_p to avoid creating memory-to-memory moves, and emit NOTE_INSN_DELETED if operand[2] is zero (i.e. with -O0). commit 3fbb94b3a4ac9fa35f0a3b1b5e69ab0d6924c5bf Author: GCC Administrator Date: Sat Jul 9 00:19:34 2022 +0000 Daily bump. commit e623829c18ec2949f8b43a5a13775659e0cd1cbf Author: Lulu Cheng Date: Thu Jul 7 18:07:28 2022 +0800 LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero. Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack. step2: The rest of it. The stack drop operation is optimized when frame->total_size minus frame->sp_fp_offset is an integer multiple of 4096, can reduce the number of instructions required to drop the stack. However, this optimization is not effective because of the original calculation method The following case: int main() { char buf[1024 * 12]; printf ("%p\n", buf); return 0; } As you can see from the generated assembler, the old GCC has two more instructions than the new GCC, lines 14 and line 24. new old 10 main: | 11 main: 11 addi.d $r3,$r3,-16 | 12 lu12i.w $r13,-12288>>12 12 lu12i.w $r13,-12288>>12 | 13 addi.d $r3,$r3,-2032 13 lu12i.w $r5,-12288>>12 | 14 ori $r13,$r13,2016 14 lu12i.w $r12,12288>>12 | 15 lu12i.w $r5,-12288>>12 15 st.d $r1,$r3,8 | 16 lu12i.w $r12,12288>>12 16 add.d $r12,$r12,$r5 | 17 st.d $r1,$r3,2024 17 add.d $r3,$r3,$r13 | 18 add.d $r12,$r12,$r5 18 add.d $r5,$r12,$r3 | 19 add.d $r3,$r3,$r13 19 la.local $r4,.LC0 | 20 add.d $r5,$r12,$r3 20 bl %plt(printf) | 21 la.local $r4,.LC0 21 lu12i.w $r13,12288>>12 | 22 bl %plt(printf) 22 add.d $r3,$r3,$r13 | 23 lu12i.w $r13,8192>>12 23 ld.d $r1,$r3,8 | 24 ori $r13,$r13,2080 24 or $r4,$r0,$r0 | 25 add.d $r3,$r3,$r13 25 addi.d $r3,$r3,16 | 26 ld.d $r1,$r3,2024 26 jr $r1 | 27 or $r4,$r0,$r0 | 28 addi.d $r3,$r3,2032 | 29 jr $r1 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_compute_frame_info): Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD or UNITS_PER_FP_REG. gcc/testsuite/ChangeLog: * gcc.target/loongarch/prolog-opt.c: New test. (cherry picked from commit aa8fd7f65683ef9c3b6d2e9306bea2f28b5cadf7) commit e02edb338f530ba86ad944327f540e52bb709959 Author: GCC Administrator Date: Fri Jul 8 00:19:15 2022 +0000 Daily bump. commit ce5b1c3b95f7136c963d31673ca83f7392c40a53 Author: Jonathan Wakely Date: Fri Jul 1 22:23:43 2022 +0100 libstdc++: Add missing prerequisite to generated header [PR106162] The ${host_builddir}/largefile-config.h header can't be written until its parent directory has been created, so it needs to have the creation of that directory as a prerequisite. libstdc++-v3/ChangeLog: PR libstdc++/106162 * include/Makefile.am (largefile-config.h): Add stamp-${host_alias} prerequisite. * include/Makefile.in: Regenerate. (cherry picked from commit 8a6ee426c2be3bd4359520e02c00ec60cac2fece) commit e3b4dcfb58592b5c7335348ed883028f943cb66d Author: Jonathan Wakely Date: Thu Jun 23 14:25:49 2022 +0100 libstdc++: Properly remove temporary directories in filesystem tests Although these tests use filesystem::remove_all to clean up, that fails because it uses recursive_directory_iterator which is intentionally bodged by the custom readdir defined in the test. Just use POSIX rmdir to clean up. We don't need to use _rmdir or _wrmdir for Windows, because we'll never reach test02() on targets where the custom readdir doesn't interpose the one from libc. libstdc++-v3/ChangeLog: * testsuite/27_io/filesystem/iterators/error_reporting.cc: Use rmdir to remove directories. * testsuite/experimental/filesystem/iterators/error_reporting.cc: Likewise. (cherry picked from commit 7c1c7e120cca183671b11ba68a6350c8800823c0) commit ce40e06ea994dbb23e7856f02e2a8c06b7519dce Author: GCC Administrator Date: Thu Jul 7 00:19:11 2022 +0000 Daily bump. commit 40ddc305802cb7174e5b3d2e9b31e783b46f3769 Author: Jonathan Wakely Date: Wed Jun 29 23:41:46 2022 +0100 c-family: Add names to diagnostics for known headers gcc/c-family/ChangeLog: * known-headers.cc (get_stdlib_header_for_name): Add names. gcc/testsuite/ChangeLog: * g++.dg/spellcheck-stdlib.C: Check types and functions. (cherry picked from commit d489ec082ea214109ff54071410f8cd00344e654) commit 65941a910911a8d452b6a6baaccafcc7a1d85c1f Author: Marek Polacek Date: Tue Jul 5 14:22:26 2022 -0400 c-family: Prevent -Wformat warnings with u8 strings [PR105626] The thread seems to have concluded that -Wformat shouldn't warn about printf((const char*) u8"test %d\n", 1); saying "format string is not an array of type 'char'". This code is not an aliasing violation, and there are no I/O functions for u8 strings, so the const char * cast is OK and shouldn't be disregarded. PR c++/105626 gcc/c-family/ChangeLog: * c-format.cc (check_format_arg): Don't emit -Wformat warnings with u8 strings. gcc/testsuite/ChangeLog: * g++.dg/warn/Wformat-char8_t-1.C: New test. (cherry picked from commit 543828e79bfa63ef26b11a2c9ea81fd7905f33aa) commit 24f321345d8a6ed1aa740c54dca6c32f74423555 Author: GCC Administrator Date: Wed Jul 6 00:19:23 2022 +0000 Daily bump. commit 92d1e271a92dff333314f18379e61d8b3d84d2bd Author: GCC Administrator Date: Tue Jul 5 00:19:34 2022 +0000 Daily bump. commit d4738cbb02e201c031a2a44d8bc10d3e17d987dc Author: Andrew MacLeod Date: Mon Jul 4 11:21:34 2022 -0400 Don't use gori depedencies to optimize. The routine fold_using_range::relation_fold_and_or needs to verify that both operands of 2 stmts are the same, and uses GORIs dependency cache for this. This cache cannot be counted on to reflect the current contents of a stmt, expecially in the presence of an IL changing pass. Instead, look at the statement operands. PR tree-optimization/106114 gcc/ * gimple-range-fold.cc (fold_using_range::relation_fold_and_or): Check statement operands instead of GORI cache. gcc/testsuite/ * gcc.dg/pr106114.c: New. commit 32dfb075ad31413af9086ce546b5f5317a916d34 Author: Iain Buclaw Date: Wed Jun 29 21:52:39 2022 +0200 d: Fix error: aggregate value used where floating point was expected Casting from vector to static array is permitted, and the frontend generates a reinterpret cast, but casting back the other way resulted in an error. This has been fixed to be properly handled in the code generation pass of VectorExp, and the conversion for lvalue and rvalue handling done in convert_expr and convert_for_rvalue respectively. PR d/106139 gcc/d/ChangeLog: * d-convert.cc (convert_expr): Handle casting from array to vector. (convert_for_rvalue): Rewrite vector to array casts of the same element type into a constructor. (convert_for_assignment): Return calling convert_for_rvalue. * expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a vector expression from a static array. * toir.cc (IRVisitor::visit (ReturnStatement *)): Call convert_for_rvalue on return value. gcc/testsuite/ChangeLog: * gdc.dg/pr106139a.d: New test. * gdc.dg/pr106139b.d: New test. * gdc.dg/pr106139c.d: New test. * gdc.dg/pr106139d.d: New test. (cherry picked from commit 329bef49da30158d30fed1106002bb71674776bd) commit 6c175b3d170de2bb02b7bd45b3348eec05d28451 Author: Roger Sayle Date: Mon Jul 4 13:58:37 2022 +0100 PR target/105991: Recognize PLUS and XOR forms of rldimi in rs6000.md. This patch addresses PR target/105991 where a change to prefer representing shifts and adds at the tree-level as multiplications, causes problems for the rldimi patterns in the powerpc backend. The issue is that rs6000.md models this pattern using IOR, and some variants that have the equivalent PLUS or XOR in the RTL fail to match some *rotl4_insert patterns. This is fixed in this patch by adding a define_insn_and_split to locally canonicalize the PLUS and XOR forms to the backend's preferred IOR form. Backported from master. 2022-07-04 Roger Sayle Marek Polacek Segher Boessenkool Kewen Lin gcc/ChangeLog PR target/105991 * config/rs6000/rs6000.md (rotl3_insert_3): Check that exact_log2 doesn't return -1 (or zero). (plus_xor): New code iterator. (*rotl3_insert_3_): New define_insn_and_split. gcc/testsuite/ChangeLog PR target/105991 * gcc.target/powerpc/pr105991.c: New test case. commit d6bedcfcefccfbec0e258e797c393f42ab0882ce Author: Xi Ruoyao Date: Sat Jul 2 16:16:44 2022 +0800 loongarch: use -mno-check-zero-division as the default for optimized code Integer division by zero is undefined behavior anyway, and there are already many platforms where neither the GCC port and the hardware do anything to trap on division by zero. So any portable program shall not rely on SIGFPE on division by zero, in both theory and practice. As the result, there is no real reason to cost two additional instructions just for the trap on division by zero with a new ISA. One remaining reason to trap on division by zero may be debugging, especially while -fsanitize=integer-divide-by-zero is not implemented for LoongArch yet. To make debugging easier, keep -mcheck-zero-division as the default for -O0 and -Og, but use -mno-check-zero-division as the default for all other optimization levels. Backport this behavior change for 12.2, so 12.1 will be the only release with a different default. Co-authored-by: Lulu Cheng gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_check_zero_div_p): New static function. (loongarch_idiv_insns): Use loongarch_check_zero_div_p instead of TARGET_CHECK_ZERO_DIV. (loongarch_output_division): Likewise. * common/config/loongarch/loongarch-common.cc (TARGET_DEFAULT_TARGET_FLAGS): Remove unneeded hook. * doc/invoke.texi: Update to match the new behavior. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/20101011-1.c (dg-additional-options): add -mcheck-zero-division for LoongArch targets. (cherry picked from commit f150dc1bd11802b70277f0fa209f2d23695a1095) commit 554fa149a0b31e822c2f02925173a1d2ec58a678 Author: GCC Administrator Date: Mon Jul 4 00:19:07 2022 +0000 Daily bump. commit d870ce1a112c0cbdff6172346a4a164503d92573 Author: Harald Anlauf Date: Wed Jun 29 21:36:17 2022 +0200 Fortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243] gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * decl.cc (gfc_match_data_decl): Reject CLASS entity declaration when it is given the PARAMETER attribute. gcc/testsuite/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * gfortran.dg/class_58.f90: Fix test. * gfortran.dg/class_73.f90: New test. Co-authored-by: Steven G. Kargl (cherry picked from commit 4c233cabbe388a6b8957c1507e129090e9267ceb) commit cf12a703cf7af34d91a6346883600caac2156e6e Author: Harald Anlauf Date: Tue Jun 28 22:29:28 2022 +0200 Fortran: improve error recovery for EXTENDS_TYPE_OF() [PR106121] gcc/fortran/ChangeLog: PR fortran/106121 * simplify.cc (gfc_simplify_extends_type_of): Do not attempt to simplify when one of the arguments is a CLASS variable that was not properly declared. gcc/testsuite/ChangeLog: PR fortran/106121 * gfortran.dg/extends_type_of_4.f90: New test. Co-authored-by: Steven G. Kargl (cherry picked from commit b8f284d3673004dffae714b56ed663467c2a52a7) commit 55899e33de74082521708a58fdc79510e0c5efad Author: Roger Sayle Date: Sun Jul 3 14:01:17 2022 +0100 PR target/106122: Don't update %esp via the stack with -Oz on x86. When optimizing for size with -Oz, setting a register can be minimized by pushing an immediate value to the stack and popping it to the destination. Alas the one general register that shouldn't be updated via the stack is the stack pointer itself, where "pop %esp" can't be represented in GCC's RTL ("use of a register mentioned in pre_inc, pre_dec, post_inc or post_dec is not permitted within the same instruction"). This patch fixes PR target/106122 by explicitly checking for SP_REG in the problematic peephole2. 2022-07-O3 Roger Sayle gcc/ChangeLog PR target/106122 * config/i386/i386.md (peephole2): Avoid generating pop %esp when optimizing for size. gcc/testsuite/ChangeLog PR target/106122 * gcc.target/i386/pr106122.c: New test case. commit a60152e87cc0900ed01854cdda8c2be6aab34af2 Author: GCC Administrator Date: Sun Jul 3 00:19:11 2022 +0000 Daily bump. commit ad5d760b815b3d491bdb5d97f6e053d60d6991b9 Author: Sergei Trofimovich Date: Mon Jun 27 23:42:44 2022 +0100 jit: avoid calloc() poisoning on musl [PR106102] On musl uses calloc() (via ). jit/ includes it directly and exposes use of poisoned calloc(): /build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/jit/jit-playback.cc make[3]: *** [Makefile:1143: jit/libgccjit.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from /<>/musl-1.2.3-dev/include/pthread.h:30, from ../../gcc-13-20220626/gcc/jit/jit-playback.cc:44: /<>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc" 84 | void *calloc(size_t, size_t); | ^ /<>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc" 124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n))) | ^ The change moves inclusion to "system.h" under new INCLUDE_PTHREAD_H guard and uses this mechanism in libgccjit. gcc/ PR c++/106102 * system.h: Introduce INCLUDE_PTHREAD_H macros to include . gcc/jit/ PR c++/106102 * jit-playback.cc: Include via "system.h" to avoid calloc() poisoning. * jit-recording.cc: Ditto. * libgccjit.cc: Ditto. (cherry picked from commit 49d508065bdd36fb1a9b6aad9666b1edb5e06474) commit de6f402a54f7e6a3f8a79d723a25724e6274cc3e Author: Sergei Trofimovich Date: Mon Jun 27 13:27:24 2022 +0100 c++: avoid poisoning on musl [PR106102] On musl uses calloc() (via ). includes it indirectly and exposes use of poisoned calloc() when module code is built: /build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc In file included from /<>/musl-1.2.3-dev/include/pthread.h:30, from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35, .... from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77, from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24, from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25, from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23, from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32: /<>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc" 84 | void *calloc(size_t, size_t); | ^ /<>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc" 124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n))) | ^ gcc/cp/ PR c++/106102 * mapper-client.cc: Include via "system.h". * mapper-resolver.cc: Ditto. * module.cc: Ditto. libcc1/ PR c++/106102 * libcc1plugin.cc: Include via "system.h". * libcp1plugin.cc: Ditto. (cherry picked from commit 3b21c21f3f5726823e19728fdd1571a14aae0fb3) commit c7d4a71598aae7fc9500e9328cb39137c95c14ef Author: GCC Administrator Date: Sat Jul 2 00:19:15 2022 +0000 Daily bump. commit e748398b3ef6412ef35b85ef6b0893809aeb49cd Author: Jason Merrill Date: Fri Jul 1 11:02:54 2022 -0400 c++: simpler fix for PR106024 Actually, for release branches let's just avoid the lookup for the lambdas that are the problematic case and only make the bigger change on trunk. PR c++/106024 gcc/cp/ChangeLog: * parser.cc (cp_parser_lookup_name): Limit previous change to lambdas. commit 962e7f0803f163f9cf44d64a2e199935d3f361fe Author: Vladimir Makarov Date: Sat May 28 12:08:38 2022 -0600 Fix ICE on sh gcc/ PR target/103722 * config/sh/sh.cc (sh_register_move_cost): Avoid cost "2" (which is special) for various scenarios. (cherry picked from commit ce1580252ea57de23a595e9804ea87ed4353aa6a) commit b1c8ee2627696717013ebdb1ca3f5f97a76b1cb9 Author: Jason Merrill Date: Wed May 11 14:53:26 2022 -0400 c++: lambda template in requires [PR105541] Since the patch for PR103408, the template parameters for the lambda in this test have level 1 instead of 2, and we were treating null template args as 1 level of arguments, so tsubst_template_parms decided it had nothing to do. Fixed by distinguishing between <> and no args at all, which is what we have in our "substitution" in a requires-expression. PR c++/105541 gcc/cp/ChangeLog: * cp-tree.h (TMPL_ARGS_DEPTH): 0 for null args. * parser.cc (cp_parser_enclosed_template_argument_list): Use 0-length TREE_VEC for <>. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-requires1.C: New test. commit d9130880f77c7f9ffd5deaabda605bc151521be5 Author: Jason Merrill Date: Fri Jul 1 00:37:10 2022 -0400 c++: tweak resolve_args change I don't know why I used tf_error instead of complain here. PR c++/105779 gcc/cp/ChangeLog: * call.cc (resolve_args): Use complain. commit c17206709f94331e81443e2bdcf135a6ab7428ce Author: Jason Merrill Date: Thu Jun 23 23:14:35 2022 -0400 c++: dependent generic lambda template-id [PR106024] We were wrongly looking up the generic lambda op() in a dependent scope, and then trying to look up its instantiation at substitution time, but lambdas aren't instantiated, so we crashed. The fix is to not look into dependent class scopes. But this created trouble with wrongly trying to use a template from the enclosing scope when we aren't actually looking at a template-argument-list, in template/lookup18.C, so let's avoid that. PR c++/106024 gcc/cp/ChangeLog: * parser.cc (missing_template_diag): Factor out... (cp_parser_id_expression): ...from here. (cp_parser_lookup_name): Don't look in dependent object_type. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-generic10.C: New test. commit 8d8af1480b32495c82661c7864e8978a53529c1d Author: GCC Administrator Date: Fri Jul 1 00:19:20 2022 +0000 Daily bump. commit 6bcab64467d7393d69bf5abd7b2a0aba22d2896e Author: Harald Anlauf Date: Mon Jun 20 20:59:55 2022 +0200 Fortran: handle explicit-shape specs with constant bounds [PR105954] gcc/fortran/ChangeLog: PR fortran/105954 * decl.cc (variable_decl): Adjust upper bounds for explicit-shape specs with constant bound expressions to ensure non-negative extents. gcc/testsuite/ChangeLog: PR fortran/105954 * gfortran.dg/pr105954.f90: New test. (cherry picked from commit a312407bd715647f7c11b67e0a52effc94d0f15d) commit 26ea506a1e8719f8b1f559e70bee9f5d3392eb37 Author: Harald Anlauf Date: Tue Jun 21 23:20:18 2022 +0200 Fortran: fix simplification of INDEX(str1,str2) [PR105691] gcc/fortran/ChangeLog: PR fortran/105691 * simplify.cc (gfc_simplify_index): Replace old simplification code by the equivalent of the runtime library implementation. Use HOST_WIDE_INT instead of int for string index, length variables. gcc/testsuite/ChangeLog: PR fortran/105691 * gfortran.dg/index_6.f90: New test. (cherry picked from commit ff35dbc02092fbcd3d814fcd9fe8e871c3f741fd) commit eb4336f546b2a770717af608c79b4d46f45ef7c2 Author: Harald Anlauf Date: Fri Jun 24 22:21:39 2022 +0200 Fortran: fix checking of arguments to UNPACK when MASK is a variable [PR105813] gcc/fortran/ChangeLog: PR fortran/105813 * check.cc (gfc_check_unpack): Try to simplify MASK argument to UNPACK so that checking of the VECTOR argument can work when MASK is a variable. gcc/testsuite/ChangeLog: PR fortran/105813 * gfortran.dg/unpack_vector_1.f90: New test. (cherry picked from commit f21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40)