summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-11-22changelog: Add algol68 as a bugzilla componentHEADtrunkmasterAndrew Pinski
Adds algol68 as a bugzilla component for commits. Pushed as obvious. contrib/ChangeLog: * gcc-changelog/git_commit.py: Add algol68. Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-11-22[PR 122701] Emit fresh reg->reg copy rather than modifying existing insnOJeff Law
I took an ill-advised short-cut with the recent ext-dce improvement to detect certain shift pairs as sign/zero extensions. Specifically I was adjusting the SET_SRC of an object. Often we can get away with that, but as this case shows it's simply not safe for RTL. The core issue is the right shift we're modifying into a simple reg->reg move may have things like CLOBBERs outside the set resulting in (parallel (set (dstreg) (srcreg)) (clobber (whatever))) Even that is often OK as targets which have these kinds of clobbers often need them on their basic moves because those moves often set condition codes. But that's not true for GCN. On GCN that transformation leads to an unrecognizable insn as seen in the pr. The fix is pretty simple. Just emit a new move and delete the shift. Of course we have to be prepared to handle multiple insns once we use emit_move_insn, but that's not too bad. PR rtl-optimization/122701 gcc/ * ext-dce.cc (ext_dce_try_optimize_rshift): Emit a fresh reg->reg copy rather than modifying the existing right shift. gcc/testsuite/ * gcc.dg/torture/pr122701.c: New test.
2025-11-22OpenMP: Update docs for "begin declare variant" implementation statusSandra Loosemore
libgomp/ChangeLog * libgomp.texi (OpenMP 5.1): Update "begin declare variant" status.
2025-11-22OpenMP: C/C++ common testcases for "omp begin declare variant"Sandra Loosemore
gcc/testsuite/ChangeLog * c-c++-common/gomp/delim-declare-variant-1.c: New. * c-c++-common/gomp/delim-declare-variant-2.c: New. * c-c++-common/gomp/delim-declare-variant-3.c: New. * c-c++-common/gomp/delim-declare-variant-4.c: New. * c-c++-common/gomp/delim-declare-variant-5.c: New. * c-c++-common/gomp/delim-declare-variant-6.c: New. * c-c++-common/gomp/delim-declare-variant-7.c: New. * c-c++-common/gomp/delim-declare-variant-8.c: New. * c-c++-common/gomp/delim-declare-variant-9.c: New. libgomp/ChangeLog * testsuite/libgomp.c-c++-common/delim-declare-variant-1.c: New. * testsuite/libgomp.c-c++-common/delim-declare-variant-2.c: New. Co-Authored-By: Tobias Burnus <tburnus@baylibre.com>
2025-11-22OpenMP: C front end support for "begin declare variant"Sandra Loosemore
gcc/c/ChangeLog * c-decl.cc (current_omp_declare_variant_attribute): Define. * c-lang.h (struct c_omp_declare_variant_attr): Declare. (current_omp_declare_variant_attribute): Declare. * c-parser.cc (struct omp_begin_declare_variant_map_entry): New. (omp_begin_declare_variant_map): New. (c_parser_skip_to_pragma_omp_end_declare_variant): New. (c_parser_translation_unit): Check for "omp begin declare variant" with no matching "end". Record base functions for variants. (c_parser_declaration_or_fndef): Handle functions in "omp begin declare variant" block. (c_finish_omp_declare_variant): Merge context selectors with surrounding "omp begin declare variant". (JOIN_STR): Define. (omp_start_variant_function): New. (omp_finish_variant_function): New. (c_parser_omp_begin): Handle "omp begin declare variant". (c_parser_omp_end): Likewise. Co-Authored-By: Julian Brown <julian@codesourcery.com>
2025-11-22OpenMP: C++ front end support for "begin declare variant"Sandra Loosemore
This patch implements C++ support for the "begin declare variant" construct. The OpenMP specification is hazy on interaction of this feature with C++ language features. Variant functions in classes are supported but must be defined as members in the class definition, using an unqualified name for the base function which also must be present in that class. Similarly variant functions in a namespace can only be defined in that namespace using an unqualified name for a base function already declared in that namespace. Variants for template functions or inside template classes seem to (mostly) work. gcc/c-family/ChangeLog * c-omp.cc (c_omp_directives): Uncomment "begin declare variant" and "end declare variant". gcc/cp/ChangeLog * cp-tree.h (struct cp_omp_declare_variant_attr): New. (struct saved_scope): Add omp_declare_variant_attribute field. * decl.cc (omp_declare_variant_finalize_one): Add logic to inject "this" parameter for method calls. * parser.cc (cp_parser_skip_to_pragma_omp_end_declare_variant): New. (cp_parser_translation_unit): Handle leftover "begin declare variant" functions. (omp_start_variant_function): New. (omp_finish_variant_function): New. (omp_maybe_record_variant_base): New. (cp_parser_init_declarator): Handle variant functions. (cp_parser_class_specifier): Handle deferred lookup of base functions when the entire class has been seen. (cp_parser_member_declaration): Handle variant functions. (cp_finish_omp_declare_variant): Merge context selectors if in a "begin declare variant" block. (cp_parser_omp_begin): Match "omp begin declare variant". Adjust error messages. (cp_parser_omp_end): Match "omp end declare variant". * parser.h (struct omp_begin_declare_variant_map_entry): New. (struct cp_parser): Add omp_begin_declare_variant_map field. * semantics.cc (finish_translation_unit): Detect unmatched "omp begin declare variant". gcc/testsuite/ChangeLog * g++.dg/gomp/delim-declare-variant-1.C: New. * g++.dg/gomp/delim-declare-variant-2.C: New. * g++.dg/gomp/delim-declare-variant-3.C: New. * g++.dg/gomp/delim-declare-variant-4.C: New. * g++.dg/gomp/delim-declare-variant-5.C: New. * g++.dg/gomp/delim-declare-variant-6.C: New. * g++.dg/gomp/delim-declare-variant-7.C: New. * g++.dg/gomp/delim-declare-variant-40.C: New. * g++.dg/gomp/delim-declare-variant-41.C: New. * g++.dg/gomp/delim-declare-variant-50.C: New. * g++.dg/gomp/delim-declare-variant-51.C: New. * g++.dg/gomp/delim-declare-variant-52.C: New. * g++.dg/gomp/delim-declare-variant-70.C: New. * g++.dg/gomp/delim-declare-variant-71.C: New. libgomp/ * testsuite/libgomp.c++/bdv_module1.C: New. * testsuite/libgomp.c++/bdv_module1_main.C: New. * testsuite/libgomp.c++/bdv_module2.C: New. * testsuite/libgomp.c++/bdv_module2_impl.C: New. * testsuite/libgomp.c++/bdv_module2_main.C: New. * testsuite/libgomp.c++/bdv_module3.C: New. * testsuite/libgomp.c++/bdv_module3_impl.C: New. * testsuite/libgomp.c++/bdv_module3_main.C: New. * testsuite/libgomp.c++/delim-declare-variant-1.C: New. * testsuite/libgomp.c++/delim-declare-variant-2.C: New. * testsuite/libgomp.c++/delim-declare-variant-7.C: New. Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: waffl3x <waffl3x@baylibre.com>
2025-11-22OpenMP: Add flag for code elision to omp_context_selector_matches.Sandra Loosemore
The "begin declare variant" has different rules for determining whether a context selector cannot match for purposes of code elision than we normally use; it excludes the case of a constant false "condition" selector for the "user" set. gcc/ChangeLog * omp-general.cc (omp_context_selector_matches): Add an optional bool argument for the code elision case. * omp-general.h (omp_context_selector_matches): Likewise.
2025-11-22OpenMP: Support functions for nested "begin declare variant"Sandra Loosemore
This patch adds functions for variant name mangling and context selector merging that are shared by the C and C++ front ends. The OpenMP specification says that name mangling is supposed to encode the context selector for the variant, but also provides for no way to reference these functions directly by name or from a different compilation unit. It also gives no guidance on how dynamic selectors might be encoded across compilation units. The GCC implementation of this feature instead treats variant functions as if they have no linkage and uses a simple counter to generate names. The exception is variants declared in a module interface, which are given module linkage. gcc/ChangeLog * omp-general.cc (omp_mangle_variant_name): New. (omp_check_for_duplicate_variant): New. (omp_copy_trait_set): New. (omp_trait_selectors_equivalent): New. (omp_combine_trait_sets): New. (omp_merge_context_selectors): New. * omp-general.h (omp_mangle_variant_name): Declare. (omp_check_for_duplicate_variant): Declare. (omp_merge_context_selectors): Declare.
2025-11-22c++: Fix up [[maybe_unused]] handling on expansion stmts [PR122788]Jakub Jelinek
This PR complains that [[maybe_unused]] attribute is ignored on the range-for-declaration of expansion-statement. We copy DECL_ATTRIBUTES and apply late attributes, but early attributes don't have their handlers called again, so some extra flags need to be copied as well. This copies TREE_USED and DECL_READ_P flags. 2025-11-22 Jakub Jelinek <jakub@redhat.com> PR c++/122788 * pt.cc (finish_expansion_stmt): Or in TREE_USED and DECL_READ_P flags from range_decl to decl or from corresponding structured binding to this_decl. * g++.dg/cpp26/expansion-stmt27.C: New test.
2025-11-22c++: Readd type checks for cp_fold -ffold-simple-inlines foldings [PR122185]Jakub Jelinek
In GCC15, cp_fold -ffold-simple-inlines code contained if (INDIRECT_TYPE_P (TREE_TYPE (x)) && INDIRECT_TYPE_P (TREE_TYPE (r))) check around the optimization, but as std::to_underlying has been added to the set, it got removed. Now, the check isn't needed when using correct libstdc++-v3 headers, because the function template types ensure the converted types are sane (so for most of them both are some kind of REFERENCE_TYPEs, for addressof one REFERENCE_TYPE and one POINTER_TYPE, for to_underlying one ENUMERAL_TYPE and one INTEGRAL_TYPE_P). But when some fuzzer or user attempts to implement one or more of those std:: functions and does it wrong (sure, such code is invalid), we can ICE because build_nop certainly doesn't handle all possible type conversions. So, the following patch readds the INDIRECT_REF_P && INDIRECT_REF_P check for everything but to_underlying, for which it checks ENUMERAL_TYPE to INTEGRAL_TYPE_P. That way we don't ICE on bogus code. Though, I wonder about 2 things, whether the CALL_EXPR_ARG in there shouldn't be also guarded just in case somebody tries to compile namespace std { int to_underlying (); }; int a = std::to_underlying (); and also whether this to_underlying folding doesn't behave differently from the libstdc++-v3 implementation if the enum is enum A : bool { B, C }; I think -fno-fold-simple-inlines will compile it as != 0, while the -ffold-simple-inlines code just as a cast. Sure, enum with underlying bool can't contain enumerators with values other than 0 and 1, but it is still 8-bit at least and so what happens with other values? 2025-11-22 Jakub Jelinek <jakub@redhat.com> PR c++/122185 * cp-gimplify.cc (cp_fold) <case CALL_EXPR>: For -ffold-simple-inlines restore check that both types are INDIRECT_TYPE_P, except for "to_underlying" check that r has ENUMERAL_TYPE and x has INTEGRAL_TYPE_P. * g++.dg/cpp1z/pr122185.C: New test.
2025-11-22LoongArch: extract the base address to promote the combine of RTX.zhaozhou
When use 256 bits vec for move src to dest, extract the base address what plus operation to promote the combine of RTX. gcc/ChangeLog: * config/loongarch/loongarch.cc: Extract plus operation. gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/lasx/lasx-struct-move.c: New test.
2025-11-22LoongArch: Optimize statement to use bstrins.{w|d}Deng Jianbo
For statement (a << imm1) | (b & imm2), in case the imm2 equals to (1 << imm1) - 1, it can be optimized to use bstrins.{w|d} instruction. gcc/ChangeLog: * config/loongarch/loongarch.md (*bstrins_w_for_ior_ashift_and_extend): New template. (*bstrins_d_for_ior_ashift_and): New template. * config/loongarch/predicates.md (const_uimm63_operand): New predicate. gcc/testsuite/ChangeLog: * gcc.target/loongarch/bstrins-5.c: New test. * gcc.target/loongarch/bstrins-6.c: New test.
2025-11-22LoongArch: Optimize V4SImode vec_construct for load index length of two.zhaozhou
Under the V4SImode, the vec_construct with the load index {0, 1, 0, 1} use vldrepl.d, the vec_construct with the load index {0, 1, 0, 0} use vldrepl.d and vshuf4i, reduced the usage of scalar load and vinsgr2vr. gcc/ChangeLog: * config/loongarch/lsx.md (lsx_vshuf4i_mem_w_0): Add template. (lsx_vldrepl_merge_w_0): Ditto. gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/lsx/lsx-vec-construct-opt.c:
2025-11-21aarch64: Extract aarch64_indirect_branch_asm for sibcall codegenKees Cook
Extract indirect branch assembly generation into a new function aarch64_indirect_branch_asm, paralleling the existing aarch64_indirect_call_asm function. Replace the open-coded versions in the sibcall patterns (*sibcall_insn and *sibcall_value_insn) so there is a common helper for indirect branches where things like SLS mitigation need to be handled. gcc/ChangeLog: * config/aarch64/aarch64-protos.h (aarch64_indirect_branch_asm): Declare. * config/aarch64/aarch64.cc (aarch64_indirect_branch_asm): New function to generate indirect branch with SLS barrier. * config/aarch64/aarch64.md (*sibcall_insn): Use aarch64_indirect_branch_asm. (*sibcall_value_insn): Likewise. Signed-off-by: Kees Cook <kees@kernel.org>
2025-11-21c++: fix ICE with consteval functions in template decls [PR122658]Daniele Sahebi
Currently, build_over_call calls build_cplus_new in template decls, generating a TARGET_EXPR that it then passes to fold_non_dependent_expr, which ends up calling tsubst_expr, and since tsubst_expr doesn't handle TARGET_EXPRs, it ICEs. Since there is no way for this code path to be executed without causing an ICE, I believe it can be removed. PR c++/122658 gcc/cp/ChangeLog: * call.cc (build_over_call): Don't call build_cplus_new in template declarations. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/consteval42.C: New test. Co-authored-by: Jakub Jelinek <jakub@redhat.com> Signed-off-by: Daniele Sahebi <daniele@mkryss.me> Reviewed-by: Marek Polacek <polacek@redhat.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-11-22Daily bump.GCC Administrator
2025-11-21[PR118358, LRA]: Decrease pressure after issuing input reload insnsVladimir N. Makarov
LRA can generate sequence of reload insns for one input operand using intermediate pseudos. Register pressure when reload insn for another input operand is placed before the sequence is more than when the reload insn is placed after the sequence. The problem report reveals a case when several such sequences increase the pressure for input reload insns beyond available registers and as a consequence this results in LRA cycling. gcc/ChangeLog: PR target/118358 * lra-constraints.cc (curr_insn_transform): Move insn reloading constant into a register right before insn using it. gcc/testsuite/ChangeLog: PR target/118358 * gcc.target/xstormy16/pr118358.c: New.
2025-11-21libstdc++: fix dead links in docYuao Ma
libstdc++-v3/ChangeLog: * doc/html/manual/using_exceptions.html: Replace dead link. * doc/xml/manual/using_exceptions.xml: Likewise.
2025-11-21libstdc++: Implement LWG 4406 and LWG 3424 for std::optional and std::expectedJonathan Wakely
This adjusts the return statements of optional::value_or and expected::value_or to not perform explicit conversions, so that the actual conversion performed matches the requirements expressed in the Mandates: elements (LWG 4406). Also adjust the return types to remove cv-qualifiers (LWG 3424). libstdc++-v3/ChangeLog: * include/std/expected (expected::value_or): Use remove_cv_t for the return type. Do not use static_cast for return statement. Adjust static_assert conditions to match return statements. * include/std/optional (optional::value_or): Likewise. (optional<T&>::value_or): Likewise. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-21libstdc++: Implement P3223R2 Making std::istream::ignore less surprisingYuao Ma
libstdc++-v3/ChangeLog: * include/std/istream (ignore): Add an overload for char. * testsuite/27_io/basic_istream/ignore/char/93672.cc: Adjust expected behaviour for C++26 mode. * testsuite/27_io/basic_istream/ignore/char/4.cc: New test. Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
2025-11-21libstdc++: Update some old docs about predefined feature macrosJonathan Wakely
libstdc++-v3/ChangeLog: * doc/xml/faq.xml: Refresh information on _GNU_SOURCE and _XOPEN_SOURCE being predefined. * doc/xml/manual/internals.xml: Remove outdated paragraph about _POSIX_SOURCE in libstdc++ source files. * doc/html/*: Regenerate.
2025-11-21libstdc++: Include <ostream> in <regex> for debug modeJonathan Wakely
I don't know what changed, but I'm seeing some new failures: FAIL: 23_containers/vector/capacity/114945.cc -std=gnu++11 (test for excess errors) FAIL: 23_containers/vector/capacity/114945.cc -std=gnu++14 (test for excess errors) FAIL: 23_containers/vector/capacity/114945.cc -std=gnu++17 (test for excess errors) FAIL: 28_regex/basic_regex/85098.cc -std=gnu++11 (test for excess errors) FAIL: 28_regex/basic_regex/85098.cc -std=gnu++14 (test for excess errors) FAIL: 28_regex/basic_regex/85098.cc -std=gnu++17 (test for excess errors) FAIL: 28_regex/simple_c++11.cc (test for excess errors) libstdc++-v3/ChangeLog: * include/bits/regex_automaton.tcc [_GLIBCXX_DEBUG]: Include <ostream> so that _State_base::_M_print etc. can use it.
2025-11-21libstdc++: Remove no_pch from tests that shouldn't depend on PCHJonathan Wakely
libstdc++-v3/ChangeLog: * testsuite/23_containers/vector/debug/erase.cc: Remove no_pch option. * testsuite/23_containers/vector/debug/invalidation/erase.cc: Likewise.
2025-11-21libcody: Make it buildable by C++11 to C++26Jakub Jelinek
The following builds with -std=c++11 and c++14 and c++17 and c++20 and c++23 and c++26. I see the u8 string literals are mixed e.g. with strerror, so in -fexec-charset=IBM1047 there will still be garbage, so am not 100% sure if the u8 literals everywhere are worth it either. 2025-11-21 Jakub Jelinek <jakub@redhat.com> * cody.hh (S2C): For __cpp_char8_t >= 201811 use char8_t instead of char in argument type. (MessageBuffer::Space): Revert 2025-11-15 change. (MessageBuffer::Append): For __cpp_char8_t >= 201811 add overload with char8_t const * type of first argument. (Packet::Packet): Similarly for first argument. * client.cc (CommunicationError, Client::ProcessResponse, Client::Connect, ConnectResponse, PathnameResponse, OKResponse, IncludeTranslateResponse): Cast u8 string literals to (const char *) where needed. * server.cc (Server::ProcessRequests, ConnectRequest): Likewise.
2025-11-21Fix OMP SIMD clone mask register and queryRichard Biener
The following removes the confusion around num_mask_args that was added to properly "guess" the number of mask elements in a AVX512 mask that's just represented as int. The actual mistake lies in the mixup of 'ncopies' which is used to track the number of OMP SIMD calls to be emitted rather than the number of input vectors. So this reverts the earlier r16-5374-g5c2fdfc24e343c, uses the proper 'ncopies' for loop mask record/query and adjusts the guessing of the SIMD arg mask elements. PR tree-optimization/122762 PR tree-optimization/122736 PR tree-optimization/122790 * cgraph.h (cgraph_simd_clone_arg::linear_step): Document use for SIMD_CLONE_ARG_TYPE_MASK. * omp-simd-clone.cc (simd_clone_adjust_argument_types): Record the number of mask arguments in linear_step if mask_mode is not VOIDmode. * tree-vect-stmts.cc (vectorizable_simd_clone_call): Remove num_mask_args computation, use a proper ncopies to query/register loop masks, use linear_step for the number of mask arguments when determining the number of mask elements in a mask argument. * gcc.dg/vect/vect-simd-clone-23.c: New testcase.
2025-11-21tree-optimization/122778 - missed loop masking in OMP SIMD call handlingRichard Biener
For AVX512 style masking we fail to apply loop masking to a conditional OMP SIMD call. PR tree-optimization/122778 * tree-vect-stmts.cc (vectorizable_simd_clone_call): Honor a loop mask when passing the conditional mask with AVX512 style masking. * gcc.dg/vect/vect-simd-clone-22.c: New testcase. * gcc.dg/vect/vect-simd-clone-22a.c: Likewise.
2025-11-21c++: make __reference_*_from_temporary honor access [PR120529]Marek Polacek
This PR reports that our __reference_*_from_temporary ignore access control. The reason is that we only check if implicit_conversion works, but not if the conversion can actually be performed, via convert_like. PR c++/120529 gcc/cp/ChangeLog: * call.cc (ref_conv_binds_to_temporary): Don't ignore access control. gcc/testsuite/ChangeLog: * g++.dg/ext/reference_xes_from_temporary1.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2025-11-21c++: Fix up build_data_member_initialization [PR121445]Jakub Jelinek
The following testcase ICEs, because the constexpr ctor in C++14 or later doesn't contain any member initializers and so the massage_constexpr_body -> build_constexpr_constructor_member_initializers -> build_data_member_initialization member initialization discovery looks at the ctor body instead. And while it has various cases where it punts, including COMPONENT_REF with a VAR_DECL as first operand on lhs of INIT_EXPR, here there is COMPONENT_REF with several COMPONENT_REFs and VAR_DECL only inside the innermost. The following patch makes sure we punt on those as well, instead of blindly assuming it is anonymous union member initializer or asserting it is a vtable store. An alternative to this would be some flag on the INIT_EXPRs created by perform_member_init and let build_data_member_initialization inspect only INIT_EXPRs with that flag set. 2025-11-21 Jakub Jelinek <jakub@redhat.com> PR c++/121445 * constexpr.cc (build_data_member_initialization): Just return false if member is COMPONENT_REF of COMPONENT_REF with VAR_P get_base_address. * g++.dg/cpp1y/constexpr-121445.C: New test.
2025-11-21libgcc: Pass x87 control word in the correct typeLIU Hao
The x87 control word should be passed as an `unsigned short`. Previous code passed `unsigned int`, and when building with `-masm=intel`, __asm__ __volatile__ ("fnstcw\t%0" : "=m" (_cw)); could expand to `fnstcw DWORD PTR [esp+48]` and cause errors like {standard input}: Assembler messages: {standard input}:7137: Error: operand size mismatch for `fnstcw' libgcc/ChangeLog: PR target/122275 * config/i386/32/dfp-machine.h (DFP_GET_ROUNDMODE): Change `_frnd_orig` to `unsigned short` for x87 control word. (DFP_SET_ROUNDMODE): Manipulate the x87 control word as `unsigned short`, and manipulate the MXCSR as `unsigned int`. Signed-off-by: LIU Hao <lh_mouse@126.com>
2025-11-21i386: Remove cond_{ashl,lshr,ashr}v{64,16,32}qi expanders [PR122598]Jakub Jelinek
As mentioned in the PR, the COND_SH{L,R} internal fns are expanded without fallback, their expansion must succeed, and furthermore they don't differentiate between scalar and vector shift counts, so again both have to be supported. That is the case of the {ashl,lshr,ashr}v*[hsd]i patterns which use nonimmediate_or_const_vec_dup_operand predicate for the shift count, so if the argument isn't const vec dup, it can be always legitimized by loading into a vector register. This is not the case of the QImode element conditional vector shifts, there is no fallback for those and we emit individual element shifts in that case when not conditional and shift count is not a constant. So, I'm afraid we can't announce such an expander because then the vectorizer etc. count with it being fully available. As I've tried to show in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122598#c9 even without this pattern we can sometimes emit vgf2p8affineqb $0, .LC0(%rip), %ymm0, %ymm0{%k1} etc. instructions. 2025-11-21 Jakub Jelinek <jakub@redhat.com> PR target/122598 * config/i386/predicates.md (const_vec_dup_operand): Remove. * config/i386/sse.md (cond<<insn><mode> with VI1_AVX512VL iterator): Remove. * gcc.target/i386/pr122598.c: New test.
2025-11-21libgomp: Fix race condition data-2{,-lib}.c testcaseArsen Arsenović
In the testcases, the kernels scheduled on queues 11, 12, 13, 14 have data dependencies on, respectively, 'b', 'c', 'd', and 'e', as they write to them. However, they also have a data dependency on 'a' and 'N', as they read those. Previously, the testcases exited 'a' on queue 10 and 'N' on queue 15, meaning that it was possible for the aforementioned kernels to execute and to have 'a' and 'N' pulled under their feet. This patch adds waits for each of the kernels onto queue 10 before freeing 'a', guaranteeing that 'a' outlives the kernels, and the same on 'N'. libgomp/ChangeLog: * testsuite/libgomp.oacc-c-c++-common/data-2-lib.c (explanatory header): Fix typo. (main): Insert waits on kernels reading 'a' into queue 10 before exiting 'a', and waits on kernels reading 'N' into queue 15 before exiting 'N'. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Ditto.
2025-11-21Aarch64: Fix pasto in user manualEric Botcazou
gcc/ * doc/invoke.texi (Optimize Options) <-fmalloc-dce>: Remove trailing space. (AArch64 Options) <-march>: Fix pasto.
2025-11-21Fix email addressEric Botcazou
2025-11-21gimplify: Fix ICE in collect_fallthrough_labels [PR122773]Jakub Jelinek
In r16-4212 I had to tweak two spots in the gimplifier to ignore gotos jumping to labels with the new VACUOUS_INIT_LABEL_P flag (set by C++ FE when implementing goto/case interceptors with extra .DEFERRED_INIT calls, so that jumps over vacuous initialization are handled properly with the C++26 erroneous behavior requirements). Except as the following testcase shows, the checks blindly assumed that gimple_goto_dest operand is a LABEL_DECL, which is not the case for computed jumps. The following patch checks that gimple_goto_dest argument is a LABEL_DECL before testing VACUOUS_INIT_LABEL_P flag on it. 2025-11-21 Jakub Jelinek <jakub@redhat.com> PR middle-end/122773 * gimplify.cc (collect_fallthrough_labels): Check whether gimple_goto_dest is a LABEL_DECL before testing VACUOUS_INIT_LABEL_P. (expand_FALLTHROUGH_r): Likewise. * gcc.dg/pr122773.c: New test.
2025-11-21arc: emit clobber of CC for -mcpu=em x >> 31Loeka Rogge
Address PR target/120375 Devices without a barrel shifter end up using a sequence of instructions. These can use the condition codes and/or loop count register, so those need to be marked as 'clobbered'. These clobbers were previously added only after split1, which is too late. This patch adds these clobbers from the beginning, in the define_expand. Previously, define_insn_and_split *<insn>si3_nobs would match any shift or rotate instruction and would generate the necessary patterns to emulate a barrel shifter, but it did not have any output assembly for itself. In many cases this would create a loop with parallel clobbers. This pattern is then matched by the <insn>si3_loop pattern. In the no-barrel-shifter.c test tree code: ;; no-barrel-shifter.c:9: int sign = (x >> 31) & 1; _2 = x.0_1 >> 31; in the expand pass becomes the following pattern that matches *lshrsi3_nobs: (insn 18 17 19 4 (set (reg:SI 153 [ _2 ]) (lshiftrt:SI (reg/v:SI 156 [ x ]) (const_int 31 [0x1f]))) "test2.c":9:24 -1 (nil)) This pattern misses the necessary clobbers and remains untouched until the split1 pass. Together with the later branch it becomes ;; no-barrel-shifter.c:9: int sign = (x >> 31) & 1; add.f 0,r0,r0 ;; no-barrel-shifter.c:14: if (mag == 0x7f800000) beq.d .L8 ;; no-barrel-shifter.c:9: int sign = (x >> 31) & 1; rlc r0,0 Leading to an issue: the add.f instructions overwrites CC but beq expects CC to contain an earlier value indicating mag == 0x7f800000. Now, these are combined in define_insn_and_split <insn>si3_loop that is explicitly emitted in the define_expand and already contains the clobbers. This can then be split into another pattern or remain the loop pattern. In the expand pass, the same example now becomes: (insn 18 17 19 4 (parallel [ (set (reg:SI 153 [ _2 ]) (lshiftrt:SI (reg/v:SI 156 [ x ]) (const_int 31 [0x1f]))) (clobber (reg:SI 60 lp_count)) (clobber (reg:CC 61 cc)) ]) "test2.c":9:24 -1 (nil)) Because the correct clobbers are now taken into account, the branch condition is reevaluated by using breq instead of br. ;; no-barrel-shifter.c:9: int sign = (x >> 31) & 1; add.f 0,r0,r0 rlc r0,0 ;; no-barrel-shifter.c:14: if (mag == 0x7f800000) breq r2,2139095040,.L8 Regtested for arc. PR target/120375 gcc/ChangeLog: * config/arc/arc.md (*<insn>si3_nobs): merged with <insn>si3_loop. (<insn>si3_loop): splits to relevant pattern or emits loop assembly. (<insn>si3_cnt1_clobber): Removes clobber for shift or rotate by const1. gcc/testsuite/ChangeLog: * gcc.target/arc/no-barrel-shifter.c: New test. Co-authored-by: Keith Packard <keithp@keithp.com> Signed-off-by: Loeka Rogge <loeka@synopsys.com>
2025-11-21arc: Use correct input operand for *extvsi_n_0 define_insn_and_splitClaudiu Zissulescu
Correct the split condition of the instruction to happen after reload. Relax operand 1 constrain too. gcc/ChangeLog: * config/arc/arc.md: Modify define_insn_and_split "*extvsi_n_0" gcc/testsuite/ChangeLog: * gcc.target/arc/extvsi-3.c: New test. Co-authored-by: Michiel Derhaeg <michiel@synopsys.com> Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2025-11-21ada: Follow-on for duplicate formal iterator namesBob Duff
A previous fix titled "Avoid incorrect errors for duplicate formal iterator names" caused regressions. This patch cleans it up. In particular, the previous patch involved calling Preanalyze on a block statement in order to get the scope created, and then later calling Analyze on the same block statement. This caused certain temps created inside the block statement to be incorrectly duplicated. The fix here is to avoid setting the Statements of the block until after it has been preanalyzed. gcc/ada/ChangeLog: * exp_ch5.adb (Expand_Formal_Container_Loop): Preanalyze block with empty statements; then set the statements later before doing Analyze of the block.
2025-11-21ada: Remove obsolete call to Establish_Transient_ScopeEric Botcazou
There is a preceding call to Establish_Transient_Scope in the procedure for the cases where it is required, and we no longer build the aggregate on the stack before copying it to the heap for an allocator. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Array_Aggregate): Remove obsolete call to Establish_Transient_Scope for an allocator in a loop. * exp_ch7.adb (Establish_Transient_Scope): Adjust description.
2025-11-21ada: Sort cross-reference table using heap and not stackPiotr Trojanek
Cross-references are used by GNATprove for code that is not in SPARK. They are sorted using an auxiliary array. This array should be allocated on the heap and not on stack, because it can be arbitrarily large, especially for auto-generated code. gcc/ada/ChangeLog: * lib-xref.adb (Output_References): Put local array object on the heap.
2025-11-21ada: Avoid non-serious errors masking fatal errorsViljar Indus
Is_Redundant_Error_Message is used to filter diagnostic messages that would appear on the same line to avoid the noise comming from cascading error messages. However we still want to trigger an error even if the line already had a warning or a non-serious error at the same location so that we now that a fatal error has occured and the compiler knows how to exit correctly in that scenario. gcc/ada/ChangeLog: * erroutc.adb (Is_Redundant_Error_Message): Avoid non-serious errors masking fatal errors.
2025-11-21ada: Update description of extra formals for build-in-place functions.Eric Botcazou
This updates the description of the various kinds of extra formals after the latest change made to the implementation. gcc/ada/ChangeLog: * exp_ch6.ads (BIP_Formal_Kind): Update description of some values.
2025-11-21ada: Fix warnings given by static analyzer on Exp_Ch4Eric Botcazou
gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Op_Eq): Use No instead of not Present. (Optimize_Length_Comparison): Initialize Is_Zero and Comp variables. (Safe_In_Place_Array_Op): Do not use local variable to pass data to nested function Is_Safe_Operand.
2025-11-21ada: No extra formals on anonymous access types of C subprogramsJavier Miranda
Extra formals must not be added to anonymous access to subprogram types defined in the profile of imported C subprograms. gcc/ada/ChangeLog: * sem_ch6.adb (Create_Extra_Formals): Do not add extra formals to anonymous access to subprogram types defined in the profile of subprograms that have foreign convention.
2025-11-21ada: Fix memory leak for unconstrained limited arrays in anonymous contextsEric Botcazou
A change made a long time ago has introduced a leak of the secondary stack at run time for unconstrained limited non-controlled arrays in anonymous contexts, because of the lack of a transient scope in these contexts. The large comment preceding the call to Establish_Transient_Scope in the Resolve_Call procedure explains the strategy for build-in-place functions, so the best course of action is probably to revert the commit and to fix the original problem along the lines of the comment. gcc/ada/ChangeLog: * exp_ch3.adb (Expand_N_Object_Declaration): Delete ancient comment. * exp_ch6.adb (Expand_Call_Helper): Do not establish a transient scope for build-in-place functions in anonymous contexts here... (Make_Build_In_Place_Call_In_Anonymous_Context): ...but here instead. * sem_attr.adb (Resolve_Attribute) <Attribute_Range>: Remove obsolete code dealing with transient scopes. * sem_res.adb (Resolve_Actuals): Likewise. (Resolve_Call): Adjust comment on the strategy for transient scopes.
2025-11-21ada: Avoid incorrect errors for duplicate formal iterator namesBob Duff
This patch fixes the following bug: If a type has an Iterable aspect (as in the formal containers), and two or more cursor loops of the form "for C in ..." occur in the same scope, and the cursor type has discriminants without defaults, the compiler complains incorrectly about duplicate names "Tc". This is because the generated declaration of the C object was being analyzed in the wrong scope. In the discriminated case, an internal subtype name TcS is generated for each C. Errout "helpfully" removes "S" in the error message, resulting in a complaint about "Tc". The fix is to push the correct scope (that of the generated surrounding block statement) when analyzing the declaration of C. gcc/ada/ChangeLog: * exp_ch5.adb (Expand_Formal_Container_Loop): Analyze Init_Decl in the correct scope. Remove patch-up code that was needed because we were using the wrong scope. * exp_ch7.adb (Process_Object_Declaration): Remove code to unique-ify the name of Master_Node_Id; no longer needed because of change to exp_ch5.adb. * sem_warn.adb (Check_References): Suppress warnings during preanalysis, because we don't have complete information yet; otherwise, the new Preanalyze call in exp_ch5.adb generates bogus warnings.
2025-11-21ada: Improve Append performance for Ada.Containers.Bounded_VectorsSteve Baird
In (any instance of) Ada.Containers.Bounded_Vectors, for the procedure overload of Append that takes parameters of types Vector and Element_Type, improve performance in the case where either of the GNAT-defined checks Container_Checks or Tampering_Check are suppressed. gcc/ada/ChangeLog: * libgnat/a-cobove.adb (Append): Add an equivalent fast path for the case where tampering checks are suppressed.
2025-11-21ada: Update the message for -gnatwx switchViljar Indus
Some messages triggered by this switch did not have the gnatwx tag and were not treated as a continuation of the same error message. gcc/ada/ChangeLog: * freeze.adb (Freeze_Profile): Improve -gnatwx message.
2025-11-21ada: Remove suspicious entries generated by -gnatR for generic formal typesEric Botcazou
Generic formal type parameters may have an unspecified layout when they are processed for the -gnatR output, so it's better to skip them entirely. The change also reverts an earlier change that would output "??" for an unknown alignment on a type, which is inconsistent and undocumented. gcc/ada/ChangeLog: * repinfo.adb (List_Location): Do not output the final comma. (List_Common_Type_Info): Adjust to above change. Do not output "??" for an unknown alignment. (List_Entities): Do not output generic types. (List_Object_Info): Adjust to above change. (List_Subprogram_Info): Likewise.
2025-11-21ada: Ensure a limited type is marking the packing as usedViljar Indus
gcc/ada/ChangeLog: * sem_ch4.adb (Analyze_Call): ensure we generate a reference to the non limited view of the return type to avoid scenarios where the with-ed unit is not considered referenced.
2025-11-21ipa: Remove LTO requirement for builtin callback carriers.Josef Melcr
Due to the if statement in ipa_compute_jump_functions_for_bb, callback edges were never constructed for builtin functions unless LTO was enabled. This patch corrects this behavior, allowing GCC to optimize callbacks more broadly. It also extends our testing capabilities. gcc/ChangeLog: * attr-callback.cc (callback_edge_callee_has_attr): New function. * attr-callback.h (callback_edge_callee_has_attr): New function decl. * ipa-prop.cc (ipa_compute_jump_functions_for_bb): Don't skip callback carriers when calculating jump functions. libgomp/ChangeLog: * testsuite/libgomp.c/ipcp-cb-spec1.c: Remove LTO requirement. * testsuite/libgomp.c/ipcp-cb-spec2.c: Likewise. * testsuite/libgomp.c/ipcp-cb1.c: Likewise. Signed-off-by: Josef Melcr <josef.melcr@suse.com>