aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-08-01cobol: Minor changes to quiet cppcheck warnings. [PR119324]Robert Dubner4-10/+12
gcc/cobol/ChangeLog: PR cobol/119324 * cbldiag.h (location_dump): Inline suppression of knownConditionTrueFalse. * genapi.cc (parser_statement_begin): Combine two if() statements. * genutil.cc (get_binary_value): File-level suppression of duplicateBreak. * symbols.cc (symbol_elem_cmp): File-level suppression of duplicateBreak.
2025-08-01PR modula2/121354: ICE when attempting to fold HIGH from an unbounded array ↵Gaius Mulley1-18/+33
in a nested procedure The bug fix re-implements gcc/m2/gm2-compiler/M2GenGCC.mod:FoldHigh to ignore any attempt to constant fold HIGH if it has an unbounded array operand. gcc/m2/ChangeLog: PR modula2/121354 * gm2-compiler/M2GenGCC.mod (FoldHigh): Rewrite. (IsUnboundedArray): New procedure function. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-08-01fortran: Fix closing brace in commentMikael Morin1-1/+1
In a comment, fix the closing brace of the tree layout definition of the openmp allocate clause. It was confusing vim's matching brace support. gcc/fortran/ChangeLog: * trans-decl.cc (gfc_trans_deferred_vars): Fix closing brace in a comment.
2025-08-01Properly record SLP node when costing a vectorized storeRichard Biener1-1/+1
Even when we emit scalar stores we should pass down the SLP node. PR tree-optimization/121350 * tree-vect-stmts.cc (vectorizable_store): Pass down SLP node when costing scalar stores in vect_body.
2025-08-01Avoid representing SLP mask by scalar opRichard Biener1-55/+62
The following removes the scalar mask output from vect_check_scalar_mask and deals with the fallout, eliminating uses of it. That's mostly replacing checks on 'mask' by checks on 'mask_node' but also realizing PR121349 and fixing that up a bit in check_load_store_for_partial_vectors. PR tree-optimization/121349 * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Get full SLP mask, reduce to uniform scalar_mask for further processing if possible. (vect_check_scalar_mask): Remove scalar mask output, remove code conditional on slp_mask. (vectorizable_call): Adjust. (check_scan_store): Get and check SLP mask. (vectorizable_store): Eliminate scalar mask variable. (vectorizable_load): Likewise.
2025-08-01doc: mdocml.bsd.lv is now mandoc.bsd.lvGerald Pfeifer1-1/+1
On the way switch from http to https. gcc: * doc/install.texi (Prerequisites): mdocml.bsd.lv is now mandoc.bsd.lv.
2025-08-01Merge get_group_load_store_type into get_load_store_typeRichard Biener1-74/+31
The following merges back get_group_load_store_type into get_load_store_type, it gets easier to follow that way. I've removed the unused ncopies parameter as well. * tree-vect-stmts.cc (get_group_load_store_type): Remove, inline into ... (get_load_store_type): ... this. Remove ncopies parameter. (vectorizable_load): Adjust. (vectorizable_store): Likewise.
2025-08-01Some TLC to vectorizable_storeRichard Biener1-33/+12
The following removes redundant checks and scalar operand uses. * tree-vect-stmts.cc (get_group_load_store_type): Remove checks performed at SLP build time. (vect_check_store_rhs): Remove scalar RHS output. (vectorizable_store): Remove uses of scalar RHS.
2025-08-01Add VMAT_UNINITIALIZEDRichard Biener2-1/+3
We're using VMAT_INVARIANT as default, but we should simply have an uninitialized state. * tree-vectorizer.h (VMAT_UNINITIALIZED): New vect_memory_access_type. * tree-vect-slp.cc (_slp_tree::_slp_tree): Use it.
2025-08-01tree-optimization/121338 - UBSAN error in adjust_setup_costRichard Biener1-3/+5
The following avoids possibly overflowing adds for rounding. We know cost is bound, so it's enough to do this simple test. PR tree-optimization/121338 * tree-ssa-loop-ivopts.cc (avg_loop_niter): Return an unsigned. (adjust_setup_cost): When niters is so large the division result is one or zero avoid it. (create_new_ivs): Adjust.
2025-08-01Put SLP_TREE_SIMD_CLONE_INFO into type specifc dataRichard Biener3-11/+17
The following adds vect_simd_clone_data as a container for vect type specific data for vectorizable_simd_clone_call and moves SLP_TREE_SIMD_CLONE_INFO there. * tree-vectorizer.h (vect_simd_clone_data): New. (_slp_tree::simd_clone_info): Remove. (SLP_TREE_SIMD_CLONE_INFO): Likewise. * tree-vect-slp.cc (_slp_tree::_slp_tree): Adjust. (_slp_tree::~_slp_tree): Likewise. * tree-vect-stmts.cc (vectorizable_simd_clone_call): Use tyupe specific data to store SLP_TREE_SIMD_CLONE_INFO.
2025-08-01Use a class hierarchy for vect specific dataRichard Biener2-6/+13
The following turns the union into a class hierarchy. One completed SLP_TREE_TYPE could move into the base class. * tree-vect-slp.cc (_slp_tree::_slp_tree): Adjust. (_slp_tree::~_slp_tree): Likewise. * tree-vectorizer.h (vect_data): New base class. (_slp_tree::u): Remove. (_slp_tree::data): Add pointer to vect_data. (_slp_tree::get_data): New helper template.
2025-08-01bswap: Fix up ubsan detected UB in find_bswap_or_nop [PR121322]Jakub Jelinek2-0/+16
The following testcase results in compiler UB as detected by ubsan. find_bswap_or_nop first checks is_bswap_or_nop_p and if that fails on the tmp_n value, tries some rotation of that if possible. The discovery what rotate count to use ignores zero bytes from the least significant end (those mean zero bytes and so can be masked away) and on the first non-zero non-0xff byte (0xff means don't know), 1-8 means some particular byte of the original computes count (the rotation count) from that byte + the byte index. Now, on the following testcase we have tmp_n 0x403020105060700, i.e. the least significant byte is zero, then the msb from the original value, byte below it, another one below it, then the low 32 bits of the original value. So, we stop at count 7 with i 1, it wraps around and we get count 0. Then we invoke UB on tmp_n = tmp_n >> count | tmp_n << (range - count); because count is 0 and range is 64. Now, of course I could fix it up by doing tmp_n << ((range - count) % range) or something similar, but that is just wasted compile time, if count is 0, we already know that is_bswap_or_nop_p failed on that tmp_n value and so it will fail again if the value is the same. So I think better just return NULL (i.e. punt). 2025-08-01 Jakub Jelinek <jakub@redhat.com> PR middle-end/121322 * gimple-ssa-store-merging.cc (find_bswap_or_nop): Return NULL if count is 0. * gcc.dg/pr121322.c: New test.
2025-08-01MAINTAINERS: Update my e-mail address.Luis Machado1-1/+1
ChangeLog/ * MAINTAINERS: Update my e-mail address.
2025-08-01c++/modules: Warn for optimize attributes instead of ICEing [PR108080]Nathaniel Shead2-10/+24
This PR is the most frequently reported modules bug for 15, as the ICE message does not indicate the issue at all and reducing to find the underlying cause can be tricky. I have a WIP patch to fix this issue by just reconstructing these nodes on stream-in from any attributes applied to the functions, but since at this stage it may still take a while to be ready, it seems useful to me to at least make the error here more friendly and guide users to what they could do to work around this issue. In fact, as noted on the PR, a lot of the time it should be harmless to just ignore the optimize etc. attribute and continue translation, at the user's own risk; this patch as such turns the ICE into a warning with no option to silence. PR c++/108080 gcc/cp/ChangeLog: * module.cc (trees_out::core_vals): Warn when streaming target/optimize node; adjust comments. (trees_in::core_vals): Don't stream a target/optimize node. gcc/testsuite/ChangeLog: * g++.dg/modules/pr108080.H: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-08-01c++/modules: Merge PARM_DECL properties from function definitions [PR121238]Nathaniel Shead4-0/+56
When we merge a function definition, if there already exists a forward declaration in the importing TU we use the PARM_DECLs belonging to that decl. This usually works fine, except as noted in the linked PR there are some flags (such as TREE_ADDRESSABLE) that only get set on a PARM_DECL once a definition is provided. This patch fixes the wrong-code issues by propagating any properties on PARM_DECLs I could find that may affect codegen. PR c++/121238 gcc/cp/ChangeLog: * module.cc (trees_in::fn_parms_fini): Merge properties for definitions. gcc/testsuite/ChangeLog: * g++.dg/modules/merge-19.h: New test. * g++.dg/modules/merge-19_a.H: New test. * g++.dg/modules/merge-19_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-08-01Daily bump.GCC Administrator11-1/+605
2025-07-31PR modula2/121314: quotes appearing in concatenated error stringsGaius Mulley9-12/+177
This patch fixes the addition of strings so that no extraneous quotes appear in the result string. The fix is made to the bootstrap tool mc and it has been rebuilt. gcc/m2/ChangeLog: PR modula2/121314 * mc-boot/GFormatStrings.cc (PerformFormatString): Rebuilt. * mc-boot/GM2EXCEPTION.cc (M2EXCEPTION_M2Exception): Rebuilt. * mc-boot/GSFIO.cc (SFIO_GetFileName): Rebuilt. * mc-boot/GSFIO.h (SFIO_GetFileName): Rebuilt. * mc-boot/Gdecl.cc: Rebuilt. * mc-boot/GmcFileName.h: Rebuilt. * mc/decl.mod (getStringChar): New procedure function. (getStringContents): Call getStringChar. (addQuotes): New procedure function. (foldBinary): Call addQuotes to add delimiting quotes to the new string. gcc/testsuite/ChangeLog: PR modula2/121314 * gm2/errors/fail/badindrtype.mod: New test. * gm2/errors/fail/badindrtype2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-07-31fortran: Evaluate class function bounds in the scalarizer [PR121342]Mikael Morin3-54/+132
There is code in gfc_conv_procedure_call that, for polymorphic functions, initializes the scalarization array descriptor information and forcedfully sets loop bounds. This code is changing the decisions made by the scalarizer behind his back, and the test shows an example where the consequences are (badly) visible. In the test, for one of the actual arguments to an elemental subroutine, an offset to the loop variable is missing to access the array, as it was the one originally chosen to set the loop bounds from. This could theoretically be fixed by just clearing the array of choice for the loop bounds. This change takes instead the harder path of adding the missing information to the scalarizer's knowledge so that its decision doesn't need to be forced to something else after the fact. The array descriptor information initialisation for polymorphic functions is moved to gfc_add_loop_ss_code (after the function call generation), and the loop bounds initialization to a new function called after that. As the array chosen to set the loop bounds from is no longer forced to be the polymorphic function result, we have to let the scalarizer set a delta for polymorphic function results. For regular non-polymorphic function result arrays, they are zero-based and the temporary creation makes the loop zero-based as well, so we can continue to skip the delta calculation. In the cases where a temporary is created to store the result of the array function, the creation of the temporary shifts the loop bounds to be zero-based. As there was no delta for polymorphic result arrays, the function result descriptor offset was set to zero in that case for a zero-based array reference to be correct. Now that the scalarizer sets a delta, those forced offset updates have to go because they can make the descriptor invalid and cause erroneous array references. PR fortran/121342 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_subref_array_arg): Remove offset update. (gfc_conv_procedure_call): For polymorphic functions, move the scalarizer descriptor information... * trans-array.cc (gfc_add_loop_ss_code): ... here, and evaluate the bounds to fresh variables. (get_class_info_from_ss): Remove offset update. (gfc_conv_ss_startstride): Don't set a zero value for function result upper bounds. (late_set_loop_bounds): New. (gfc_conv_loop_setup): If the bounds of a function result have been set, and no other array provided loop bounds for a dimension, use the function result bounds as loop bounds for that dimension. (gfc_set_delta): Don't skip delta setting for polymorphic function results. gcc/testsuite/ChangeLog: * gfortran.dg/class_elemental_1.f90: New test.
2025-07-31AVR: avr.opt.urls: Add -mfuse-move2Georg-Johann Lay1-0/+3
PR rtl-optimization 121340 gcc/ * config/avr/avr.opt.urls (-mfuse-move2): Add url.
2025-07-31AVR: Set .type of jump table label.Georg-Johann Lay1-0/+7
gcc/ * config/avr/avr.cc (avr_output_addr_vec) <labl>: Asm out its .type.
2025-07-31AVR: rtl-optimization/121340 - New mini-pass to undo superfluous moves from ↵Georg-Johann Lay6-1/+158
insn combine. Insn combine may come up with superfluous reg-reg moves, where the combine people say that these are no problem since reg-alloc is supposed to optimize them. The issue is that the lower-subreg pass sitting between combine and reg-alloc may split such moves, coming up with a zoo of subregs which are only handled poorly by the register allocator. This patch adds a new avr mini-pass that handles such cases. As an example, take int f_ffssi (long x) { return __builtin_ffsl (x); } where the two functions have the same interface, i.e. there are no extra moves required for the argument or for the return value. However, $ avr-gcc -S -Os -dp -mno-fuse-move ... f_ffssi: mov r20,r22 ; 29 [c=4 l=1] movqi_insn/0 mov r21,r23 ; 30 [c=4 l=1] movqi_insn/0 mov r22,r24 ; 31 [c=4 l=1] movqi_insn/0 mov r23,r25 ; 32 [c=4 l=1] movqi_insn/0 mov r25,r23 ; 33 [c=4 l=4] *movsi/0 mov r24,r22 mov r23,r21 mov r22,r20 rcall __ffssi2 ; 34 [c=16 l=1] *ffssihi2.libgcc ret ; 37 [c=0 l=1] return where all the moves add up to a no-op. The -mno-fuse-move option stops any attempts by the avr backend to clean up that mess. PR rtl-optimization/121340 gcc/ * config/avr/avr.opt (-mfuse-move2): New option. * config/avr/avr-passes.def (avr_pass_2moves): Insert after combine. * config/avr/avr-passes.cc (make_avr_pass_2moves): New function. (pass_data avr_pass_data_2moves): New static variable. (avr_pass_2moves): New rtl_opt_pass. * config/avr/avr-protos.h (make_avr_pass_2moves): New proto. * common/config/avr/avr-common.cc (default_options avr_option_optimization_table) <-mfuse-move2>: Set for -O1 and higher. * doc/invoke.texi (AVR Options) <-mfuse-move2>: Document.
2025-07-31c++: constexpr, array, private ctor [PR120800]Jason Merrill2-0/+25
Here cxx_eval_vec_init_1 wants to recreate the default constructor call that we previously built and threw away in build_vec_init_elt, but we aren't in the same access context at this point. Since we already checked access, let's just suppress access control here. Redoing overload resolution at constant evaluation time is sketchy, but should usually be fine for a default/copy constructor. PR c++/120800 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_vec_init_1): Suppress access control. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-array30.C: New test.
2025-07-31Revert "Ada: Add System.C_Time and GNAT.C_Time units to libgnat"Eric Botcazou71-546/+2164
This reverts commit 41974d6ed349507ca1532629851b7b5d74f44abc.
2025-07-31Ada: Fix miscompilation of GNAT tools with -march=znver3Eric Botcazou1-4/+4
The throw and catch sides of the Ada exception machinery disagree about the BIGGEST_ALIGNMENT setting. gcc/ada/ PR ada/120440 * gcc-interface/Makefile.in (GNATLINK_OBJS): Add s-excmac.o. (GNATMAKE_OBJS): Likewise.
2025-07-31Ada: Add System.C_Time and GNAT.C_Time units to libgnatNicolas Boulenguez71-2164/+546
The first unit provides the time_t, timeval and timespec types corresponding to the C types defined by the OS, as well as various conversion functions. The second unit is a mere renaming of the first under the GNAT hierarchy. This removes C time types and conversions under System, and from bodies and private parts under GNAT, while keeping visible types and conversions under GNAT as Obsolescent. [changelog] PR ada/114065 * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-c_time$(objext) and s-c_time$(objext). (Aarch64/Android): Do not use s-osinte__android.adb. (SPARC/Solaris): Do not use s-osprim__solaris.adb. (x86/Solaris): Likewise. (LynxOS178): Do not use s-parame__posix2008.ads. (RTEMS): Likewise. (x32/Linux): Likewise, as well as s-linux__x32.ads. Replace s-osprim__x32.adb with s-osprim__posix.adb. (LIBGNAT_OBJS): Remove cal.o. * cal.c: Delete. * doc/gnat_rm/the_gnat_library.rst (GNAT.C_Time): New entry. (GNAT.Calendar): Do not mention the obsolete conversion functions. * impunit.adb (Non_Imp_File_Names_95): Add g-c_time. * libgnarl/a-exetim__posix.adb: Add with clause for System.C_Time (Clock): Use type and functions from System.C_Time. * libgnarl/s-linux.ads: Remove with clause for System.Parameters. Remove declarations of C time types. * libgnarl/s-linux__alpha.ads: Likewise. * libgnarl/s-linux__android-aarch64.ads: Likewise. * libgnarl/s-linux__android-arm.ads: Likewise. * libgnarl/s-linux__hppa.ads: Likewise. * libgnarl/s-linux__loongarch.ads: Likewise. * libgnarl/s-linux__mips.ads: Likewise. * libgnarl/s-linux__riscv.ads: Likewise. * libgnarl/s-linux__sparc.ads: Likewise. * libgnarl/s-osinte__aix.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__cheribsd.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__dragonfly.ads: Likewise. * libgnarl/s-osinte__freebsd.ads: Likewise. * libgnarl/s-osinte__gnu.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__lynxos178e.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-osinte__rtems.ads: Likewise. * libgnarl/s-osinte__solaris.ads: Likewise. * libgnarl/s-osinte__vxworks.ads: Likewise. * libgnarl/s-qnx.ads: Likewise. * libgnarl/s-linux__x32.ads: Delete. * libgnarl/s-osinte__darwin.adb (To_Duration): Remove. (To_Timespec): Likewise. * libgnarl/s-osinte__aix.adb: Likewise. * libgnarl/s-osinte__dragonfly.adb: Likewise. * libgnarl/s-osinte__freebsd.adb: Likewise. * libgnarl/s-osinte__gnu.adb: Likewise. * libgnarl/s-osinte__lynxos178.adb: Likewise. * libgnarl/s-osinte__posix.adb: Likewise. * libgnarl/s-osinte__qnx.adb: Likewise. * libgnarl/s-osinte__rtems.adb: Likewise. * libgnarl/s-osinte__solaris.adb: Likewise. * libgnarl/s-osinte__vxworks.adb: Likewise. * libgnarl/s-osinte__x32.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Add with clause for System.C_Time. (Monotonic_Clock): Use type and functions from System.C_Time. (RT_Resolution): Likewise. (Timed_Sleep): Likewise. (Timed_Delay): Likewise. * libgnarl/s-taprop__vxworks.adb: Likewise. * libgnarl/s-tpopmo.adb: Likewise. * libgnarl/s-osinte__android.adb: Delete. * libgnat/g-c_time.ads: New file. * libgnat/g-calend.adb: Delegate to System.C_Time. * libgnat/g-calend.ads: Likewise. * libgnat/g-socket.adb: Likewise. * libgnat/g-socthi.adb: Likewise. * libgnat/g-socthi__vxworks.adb: Likewise. * libgnat/g-sothco.ads: Likewise. * libgnat/g-spogwa.adb: Likewise. * libgnat/s-c_time.adb: New file. * libgnat/s-c_time.ads: Likewise. * libgnat/s-optide.adb: Import nanosleep here. * libgnat/s-os_lib.ads (time_t): Remove. (To_Ada): Adjust. (To_C): Likewise. * libgnat/s-os_lib.adb: Likewise. * libgnat/s-osprim__darwin.adb: Delegate to System.C_Time. * libgnat/s-osprim__posix.adb: Likewise. * libgnat/s-osprim__posix2008.adb: Likewise. * libgnat/s-osprim__rtems.adb: Likewise. * libgnat/s-osprim__unix.adb: Likewise. * libgnat/s-osprim__solaris.adb: Delete. * libgnat/s-osprim__x32.adb: Likewise. * libgnat/s-parame.ads (time_t_bits): Remove. * libgnat/s-parame__hpux.ads: Likewise. * libgnat/s-parame__vxworks.ads: Likewise. * libgnat/s-parame__posix2008.ads: Delete. * s-oscons-tmplt.c (SIZEOF_tv_nsec): New constant.
2025-07-31c++: consteval blocksMarek Polacek14-39/+600
This patch implements consteval blocks, as specified by P2996. They aren't very useful without define_aggregate, but having a reviewed implementation on trunk would be great. consteval {} can be anywhere where a member-declaration or block-declaration can be. The expression corresponding to it is: [] -> void static consteval compound-statement () and it must be a constant expression. I've used cp_parser_lambda_expression to take care of most of the parsing. Since a consteval block can find itself in a template, we need a vehicle to carry the block for instantiation. Rather than inventing a new tree, I'm using STATIC_ASSERT. A consteval block can't return a value but that is checked by virtue of the lambda having a void return type. PR c++/120775 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_outermost_constant_expr): Use extract_call_expr. * cp-tree.h (CONSTEVAL_BLOCK_P, LAMBDA_EXPR_CONSTEVAL_BLOCK_P): Define. (finish_static_assert): Adjust declaration. (current_nonlambda_function): Likewise. * lambda.cc (current_nonlambda_function): New parameter. Only keep iterating if the function represents a consteval block. * parser.cc (cp_parser_lambda_expression): New parameter for consteval blocks. Use it. Set LAMBDA_EXPR_CONSTEVAL_BLOCK_P. (cp_parser_lambda_declarator_opt): Likewise. (build_empty_string): New. (cp_parser_next_tokens_are_consteval_block_p): New. (cp_parser_consteval_block): New. (cp_parser_block_declaration): Handle consteval blocks. (cp_parser_static_assert): Use build_empty_string. (cp_parser_member_declaration): Handle consteval blocks. * pt.cc (tsubst_stmt): Adjust a call to finish_static_assert. * semantics.cc (finish_fname): Warn for consteval blocks. (finish_static_assert): New parameter for consteval blocks. Set CONSTEVAL_BLOCK_P. Evaluate consteval blocks specially. gcc/testsuite/ChangeLog: * g++.dg/cpp26/consteval-block1.C: New test. * g++.dg/cpp26/consteval-block2.C: New test. * g++.dg/cpp26/consteval-block3.C: New test. * g++.dg/cpp26/consteval-block4.C: New test. * g++.dg/cpp26/consteval-block5.C: New test. * g++.dg/cpp26/consteval-block6.C: New test. * g++.dg/cpp26/consteval-block7.C: New test. * g++.dg/cpp26/consteval-block8.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-31RISC-V: Add testcases for signed avg ceil vx combinePan Li22-5/+293
The unsigned avg ceil share the vaaddx.vx for the vx combine, so add the test case to make sure it works well as expected. The below test suites are passed for this patch series. * The rv64gcv fully regression test. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check for signed avg ceil. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test helper macros. * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test data for run test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-i16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-i32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-i64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-i8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-31vect: Don't set bogus bounds on epilogues [PR120805]Tamar Christina1-1/+1
The testcases in the PR are failing due to the code trying to set a vector range on an epilogue. However on epilogues the range doesn't make sense. In particular we are setting ranged to help niters analysis. But the epilogue doesn't iterate. Secondly the bounds variable hasn't been adjusted to vector iterations: In the epilogue this is calculated as <bb 13> [local count: 81467476]: # i_127 = PHI <tmp.7_131(10), 0(5)> # _132 = PHI <_133(10), 0(5)> _181 = (unsigned int) n_41(D); bnd.31_180 = _181 - _132; where _133 = niters_vector_mult_vf.6_130; but _132 is a phi node, and if coming from the vector loop skip edge _181 will be <1, VF>. But this is a range VRP or Ranger can easily report due to the guard on the skip_vector loop. Previously, non-const VF would skip this code entirely due to the .is_constant() check. Non-partial vector loop would also skip it because the bounds would fold to a constant. so it doesn't enter the !gimple_value check. When support for partial vector ranges was added, this accidentally enabled ranges on partial vector epilogues. This patch now makes it explicit that ranges shouldn't be set for epilogues, as they don't seem to be useful anyway. gcc/ChangeLog: PR tree-optimization/120805 * tree-vect-loop-manip.cc (vect_gen_vector_loop_niters): Skip setting bounds on epilogues.
2025-07-31libgcc: Update FMV features to latest ACLE spec 2024Q4Wilco Dijkstra3-46/+25
Update FMV features to latest ACLE spec of 2024Q4 - several features have been removed or merged. Add FMV support for CSSC and MOPS. Preserve the ordering in enum CPUFeatures. gcc: * common/config/aarch64/cpuinfo.h: Remove unused features, add FEAT_CSSC and FEAT_MOPS. * config/aarch64/aarch64-option-extensions.def: Remove FMV support for RPRES, use PULL rather than AES, add FMV support for CSSC and MOPS. libgcc: * config/aarch64/cpuinfo.c (__init_cpu_features_constructor): Remove unused features, add support for CSSC and MOPS.
2025-07-31libgcc: Cleanup HWCAP defines in cpuinfo.cWilco Dijkstra1-197/+49
Cleanup HWCAP defines - rather than including hwcap.h and then repeating it using ifndef, just define the HWCAPs we need exactly as in hwcap.h. libgcc: * config/aarch64/cpuinfo.c: Cleanup HWCAP defines.
2025-07-31AArch64: Use correct cost for shifted halfword load/storesWilco Dijkstra1-1/+1
Since all Armv9 cores support shifted LDRH/STRH, use the correct cost of zero for these. gcc: * config/aarch64/tuning_models/generic_armv9_a.h (generic_armv9_a_addrcost_table): Use zero cost for himode.
2025-07-31Fixup wrong change to get_group_load_store_typeRichard Biener1-1/+1
The following fixes up the r16-2593-g6ac78317aa6adf change which made us match up a scalar with a vector type. Oops. Noticed when removing the gather/scatter pattern that creates the IFNs early. * tree-vect-stmts.cc (get_group_load_store_type): Properly compare the scalar type of the gather/scatter offset to the offset vector component type.
2025-07-31zlib: refresh version in configureSam James2-11/+11
zlib/ChangeLog: * configure: Regenerate. * configure.ac: Set version to 1.3.1.
2025-07-31Extend gimple_fold_inplace APIRichard Biener2-6/+6
The following allows to specify the valueization hook to be used. * gimple-fold.h (fold_stmt_inplace): Add valueization hook argument, defaulted to no_follow_ssa_edges. * gimple-fold.cc (fold_stmt_inplace): Adjust.
2025-07-31zlib: update ChangeLogSam James1-56/+159
zlib/ChangeLog: PR other/105404 * Import zlib-1.3.1
2025-07-31zlib: import zlib-1.3.1Sam James152-5489/+18294
This is vanilla zlib-1.3.1 imported over the existing zlib/ dir with: * README adjusted to add the GCC note at the top; * GCC's ChangeLog merged with the upstream one, as before; * Deleted upstream Makefile as has been done before (we use an autoconf- generated one)
2025-07-31cobol: Eliminate various errors. [PR120244]Robert Dubner3-13/+25
The following coding errors were located by running extended tests through valgrind. These changes repair the errors. gcc/cobol/ChangeLog: PR cobol/120244 * genapi.cc (get_level_88_domain): Increase array size for final byte. (psa_FldLiteralA): Use correct length in build_string_literal call. * scan.l: Use a loop instead of std:transform to avoid EOF overrun. * scan_ante.h (binary_integer_usage): Use a variable-length buffer.
2025-07-31i386: Fix typo in diagnostic about simultaneous regparm and thiscall useArtemiy Granat1-1/+1
gcc/ChangeLog: * config/i386/i386-options.cc (ix86_handle_cconv_attribute): Fix typo.
2025-07-31i386: Fix incorrect handling of simultaneous regparm and thiscall useArtemiy Granat2-7/+38
gcc/ChangeLog: * config/i386/i386-options.cc (ix86_handle_cconv_attribute): Handle simultaneous use of regparm and thiscall attributes in case when regparm is set before thiscall. gcc/testsuite/ChangeLog: * gcc.target/i386/attributes-error.c: Add more attributes combinations.
2025-07-31i386: Fix incorrect comment about stdcall and fastcall compatibilityArtemiy Granat1-3/+2
gcc/ChangeLog: * config/i386/i386-options.cc (ix86_handle_cconv_attribute): Fix comments which state that combination of stdcall and fastcall attributes is valid but redundant.
2025-07-31i386: Ignore regparm attribute and warn for it in 64-bit modeArtemiy Granat10-25/+69
The regparm attribute does not affect code generation on x86-64 target. Despite this, regparm was accepted silently, unlike other calling convention attributes handled in the ix86_handle_cconv_attribute function. Due to lack of diagnostics, Linux kernel attempted to specify regparm(0) on vmread_error_trampoline declaration, which is supposed to be invoked with all arguments on stack: https://lore.kernel.org/all/20220928232015.745948-1-seanjc@google.com/ To produce a warning for regparm in 64-bit mode, simply move the block that produces diagnostics above the block that handles the regparm attribute. gcc/ChangeLog: * config/i386/i386-options.cc (ix86_handle_cconv_attribute): Move 64-bit mode check before regparm handling. gcc/testsuite/ChangeLog: * g++.dg/abi/regparm1.C: Require ia32 target. * gcc.target/i386/20020224-1.c: Likewise. * gcc.target/i386/pr103785.c: Use regparm attribute only if not in 64-bit mode. * gcc.target/i386/pr36533.c: Likewise. * gcc.target/i386/pr59099.c: Likewise. * gcc.target/i386/sibcall-8.c: Likewise. * gcc.target/i386/sw-1.c: Likewise. * gcc.target/i386/pr15184-2.c: Fix invalid comment. * gcc.target/i386/attributes-ignore.c: New test.
2025-07-31tree-optimization/121320 - UBSAN error in ao_ref_init_from_vn_referenceRichard Biener1-2/+2
The multiplication by BITS_PER_UNIT should be done in poly_offset_int. PR tree-optimization/121320 * tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference): Convert op->off to poly_offset_int before multiplying by BITS_PER_UNIT.
2025-07-31tree-optimization/121323 - UBSAN error in ao_ref_init_from_ptr_and_rangeRichard Biener1-1/+3
We should check the offset fits a HWI when multiplied to be in bits. PR tree-optimization/121323 * tree-ssa-alias.cc (ao_ref_init_from_ptr_and_range): Check the pointer offset fits in a HWI when represented in bits.
2025-07-31testsuite: Add runtime test for FMV resolversYury Khrustalev1-0/+82
gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-cpu-features.C: new test.
2025-07-31testsuite: Add tests for __init_cpu_features_constructorYury Khrustalev6-0/+118
Add tests that would call __init_cpu_features_resolver() directly from an ifunc resolver that would in tern call the function under test __init_cpu_features_constructor() using synthetic parameters for different sizes of the 2nd argument. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ifunc-resolver.in: add core test functions. * gcc.target/aarch64/ifunc-resolver-0.c: new test. * gcc.target/aarch64/ifunc-resolver-1.c: ditto. * gcc.target/aarch64/ifunc-resolver-2.c: ditto. * gcc.target/aarch64/ifunc-resolver-3.c: ditto. * gcc.target/aarch64/ifunc-resolver-4.c: as above.
2025-07-31aarch64: Stop using sys/ifunc.h header in libatomic and libgccYury Khrustalev3-13/+57
This optional header is used to bring in the definition of the struct __ifunc_arg_t type. Since it has been added to glibc only recently, the previous implementation had to check whether this header is present and, if not, it provide its own definition. This creates dead code because either one of these two parts would not be tested. The ABI specification for ifunc resolvers allows to create own ABI-compatible definition for this type, which is the right way of doing it. In addition to improving consistency, the new approach also helps with addition of new fields to struct __ifunc_arg_t type without the need to work-around situations when the definition imported from the header lacks these new fields. ABI allows to define as many hwcap fields in this struct as needed, provided that at runtime we only access the fields that are permitted by the _size value. gcc/ * config/aarch64/aarch64.cc (build_ifunc_arg_type): Add new fields _hwcap3 and _hwcap4. libatomic/ * config/linux/aarch64/host-config.h (__ifunc_arg_t): Remove sys/ifunc.h and add new fields _hwcap3 and _hwcap4. libgcc/ * config/aarch64/cpuinfo.c (__ifunc_arg_t): Likewise. (__init_cpu_features): obtain and assign values for the fields _hwcap3 and _hwcap4. (__init_cpu_features_constructor): check _size in the arg argument.
2025-07-31rs6000: Avoid undefined behavior caused by overflow and invalid shiftsKishan Parmar2-11/+16
While building GCC with --with-build-config=bootstrap-ubsan on powerpc64le-unknown-linux-gnu, multiple UBSAN runtime errors were encountered in rs6000.cc and rs6000.md due to undefined behavior involving left shifts on negative values and shift exponents equal to or exceeding the type width. The issue was in bit pattern recognition code (in can_be_rotated_to_negative_lis and can_be_built_by_li_and_rldic), where signed values were shifted without handling negative inputs or guarding against shift counts equal to the type width, causing UB. The fix ensures shifts and rotations are done unsigned HOST_WIDE_INT, and casting back only where needed (like for arithmetic right shifts) with proper guards to prevent shift-by-64. 2025-07-31 Kishan Parmar <kishan@linux.ibm.com> gcc: PR target/118890 * config/rs6000/rs6000.cc (can_be_rotated_to_negative_lis): Avoid left shift of negative value and guard shift count. (can_be_built_by_li_and_rldic): Likewise. (rs6000_emit_set_long_const): Likewise. * config/rs6000/rs6000.md (splitter for plus into two 16-bit parts): Fix UB from overflow in addition.
2025-07-31Add checks for node in aarch64 vector cost modelingRichard Biener1-1/+3
After removing STMT_VINFO_MEMORY_ACCESS_TYPE we now ICE when costing for scalar stmts required in the epilog since the cost model tries to pattern-match gathers (an earlier patch tried to improve this by introducing stmt groups, but that was on hold due to negative feedback). The following shot-cuts those attempts when node is NULL as that then cannot be a vector stmt. Another possibility would be to gate on vect_body, or restructure everything. Note we now ensure that when m_costing_for_scalar node is NULL. * config/aarch64/aarch64.cc (aarch64_detect_vector_stmt_subtype): Check for node before dereferencing. (aarch64_vector_costs::add_stmt_cost): Likewise.
2025-07-31aarch64: Prevent streaming-compatible code from assembler rejection [PR121028]Spencer Abson4-6/+61
Streaming-compatible functions can be compiled without SME enabled, but need to use "SMSTART SM" and "SMSTOP SM" to temporarily switch into the streaming state of a callee. These switches are conditional on the current mode being opposite to the target mode, so no SME instructions are executed if SME is not available. However, in GAS, "SMSTART SM" and "SMSTOP SM" always require +sme. A call from a streaming-compatible function, compiled without SME enabled, to a non -streaming function will be rejected as: Error: selected processor does not support `smstop sm'.. To work around this, we make use of the .inst directive to insert the literal encodings of "SMSTART SM" and "SMSTOP SM". gcc/ChangeLog: PR target/121028 * config/aarch64/aarch64-sme.md (aarch64_smstart_sm): Use the .inst directive if !TARGET_SME. (aarch64_smstop_sm): Likewise. gcc/testsuite/ChangeLog: PR target/121028 * gcc.target/aarch64/sme/call_sm_switch_1.c: Tell check-function -bodies not to ignore .inst directives, and replace the test for "smstart sm" with one for it's encoding. * gcc.target/aarch64/sme/call_sm_switch_11.c: Likewise. * gcc.target/aarch64/sme/pr121028.c: New test.