aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
6 hoursc++: Add stringification testcase for CWG1709 [PR120778]HEADtrunkmasterJakub Jelinek1-0/+18
The CWG1709 just codifies existing GCC (and clang) behavior, so this just adds a testcase for that. 2025-08-03 Jakub Jelinek <jakub@redhat.com> PR preprocessor/120778 * g++.dg/DRs/dr1709.C: New test.
6 hourslibcpp: Fix up cpp_maybe_module_directive [PR120845]Jakub Jelinek1-0/+8
My changes for "Module Declarations Shouldn’t be Macros" paper broke the following testcase. The backup handling intentionally tries to drop CPP_PRAGMA_EOL token if things go wrong, which is desirable for the case where we haven't committed to the module preprocessing directive (i.e. changed the first token to the magic one). In that case there is no preprocessing directive start and so CPP_PRAGMA_EOL would be wrong. If there is a premature new-line after we've changed the first token though, we shouldn't drop CPP_PRAGMA_EOL, because otherwise we ICE in the FE. While clang++ and MSVC accept the testcase, in my reading it is incorrect at least in the C++23 and newer wordings and I think the changes have been a DR, https://eel.is/c++draft/cpp.module has no exception for new-lines and https://eel.is/c++draft/cpp.pre#1.sentence-2 says that new-line (unless deleted during phase 2 when after backslash) ends the preprocessing directive. The patch arranges for eol being set only in the not_module case. 2025-08-03 Jakub Jelinek <jakub@redhat.com> PR c++/120845 libcpp/ * lex.cc (cpp_maybe_module_directive): Move eol variable declaration to the start of the function, initialize to false and only set it to peek->type == CPP_PRAGMA_EOL in the not_module case. Formatting fix. gcc/testsuite/ * g++.dg/modules/cpp-21.C: New test.
13 hoursAVR: Use avr_add_ccclobber / DONE_ADD_CCC in md instead of repeats.Georg-Johann Lay3-961/+436
There are many post-reload define_insn_and_split's that just append a (clobber (reg:CC REG_CC)) to the pattern. Instead of repeating the original patterns, avr_add_ccclobber (curr_insn) is used to do that job. This avoids repeating patterns all over the place, and splits that do something different (like using a canonical form) stand out clearly. gcc/ * config/avr/avr.md (define_insn_and_split) [reload_completed]: For splits that just append a (clobber (reg:CC REG_CC)) to the pattern, use avr_add_ccclobber (curr_insn) instead of repeating the original pattern. * config/avr/avr-dimode.md: Same. * config/avr/avr-fixed.md: Same.
14 hoursAVR: Add avr.cc::avr_add_ccclobber().Georg-Johann Lay2-0/+25
gcc/ * config/avr/avr.cc (avr_add_ccclobber): New function. * config/avr/avr-protos.h (avr_add_ccclobber): New proto. (DONE_ADD_CCC): New define.
15 hourstree-optimization/90242 - UBSAN error in vn_reference_compute_hashRichard Biener1-3/+3
The following plugs possible overflow issues in vn_reference_compute_hash and possibly in vn_reference_eq. The inchash "integer" adds are a bit of a mess, but I know overloads with different integer types can get messy, so not this time. For hashing simply truncate to 64bits. PR tree-optimization/90242 * tree-ssa-sccvn.cc (vn_reference_compute_hash): Use poly_offset_int for offset accumulation. For hashing truncate to 64 bits and also hash 64 bits. (vn_reference_eq): Likewise.
22 hoursDaily bump.GCC Administrator6-1/+33
23 hoursdoc: Drop note on 16-bit Windows supportGerald Pfeifer1-7/+0
gcc: PR target/69374 * doc/install.texi (Specific) <windows>: Drop note on 16-bit Windows support. Streamline note on 32-bit support.
39 hourscobol: Use %td in error_msg in 3 spotsJakub Jelinek3-5/+5
On Thu, Jul 31, 2025 at 11:33:07PM +0200, Jakub Jelinek via Gcc wrote: > > this was all described in excruciating detail in the patch submission > > > > https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687385.html > > > > and the commit message. > > Looking at that patch, the dbgmsg change looks correct (dbgmsg is > ATTRIBUTE_PRINTF_1), while the last 3 hunks are suboptimal, they should > really use %td and keep the ptrdiff_t arguments without casts. Here it is in patch form. I couldn't find other similar casts in calls to ATTRIBUTE_GCOBOL_DIAG functions. 2025-08-02 Jakub Jelinek <jakub@redhat.com> * parse.y (intrinsic): Use %td format specifier with no cast on argument instead of %ld with cast to long. * scan_ante.h (numstr_of): Likewise. * util.cc (cbl_field_t::report_invalid_initial_value): Likewise.
39 hoursc: rewrite implementation of `arg spec' attributeMartin Uecker4-199/+145
Rewrite the implementation of the `arg spec' attribute to pass the the original type of an array parameter instead of passing a string description and a list of bounds. The string and list are then created from this type during the integration of the information of `arg spec' into the access attribute because it still needed later for various warnings. This change makes the implementation simpler and more robust as the declarator is not processed and information that is already encoded in the type is not duplicated. A similar change to the access attribute could then completely remove the string processing. With this change, the original type is now available and can be used for other warnings or for _Countof. The new implementation tries to be faithful to the original, but this is not entirely true as it fixes a bug in the old implementation. gcc/c-family/ChangeLog: * c-attribs.cc (handle_argspec_attribute): Update. (build_arg_spec): New function. (build_attr_access_from_parms): Rewrite `arg spec' handling. gcc/c/ChangeLog: * c-decl.cc (get_parm_array_spec): Remove. (push_parm_decl): Do not add `arg spec` attribute. (build_arg_spec_attribute): New function. (grokdeklarator): Add `arg spec` attribute. gcc/testsuite/ChangeLog: * gcc.dg/Warray-parameter-11.c: Change Warray-parameter to -Wvla-parameter as these are VLAs. * gcc.dg/Warray-parameter.c: Remove xfail.
46 hoursDaily bump.GCC Administrator7-1/+134
2 daysi386: Fix incorrect attributes-error.c testArtemiy Granat1-1/+2
gcc/testsuite/ChangeLog: * gcc.target/i386/attributes-error.c: Change incorrect sseregparm,fastcall combination to cdecl,fastcall.
2 dayscobol: 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.
2 daysPR 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>
2 daysfortran: 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.
2 daysProperly 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.
2 daysAvoid 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.
2 daysdoc: 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.
3 daysMerge 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.
3 daysSome 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.
3 daysAdd 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.
3 daystree-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.
3 daysPut 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.
3 daysUse 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.
3 daysbswap: 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.
3 daysc++/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>
3 daysc++/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>
3 daysDaily bump.GCC Administrator8-1/+578
3 daysPR 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>
3 daysfortran: 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.
3 daysAVR: avr.opt.urls: Add -mfuse-move2Georg-Johann Lay1-0/+3
PR rtl-optimization 121340 gcc/ * config/avr/avr.opt.urls (-mfuse-move2): Add url.
3 daysAVR: 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.
3 daysAVR: 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.
3 daysc++: 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.
3 daysRevert "Ada: Add System.C_Time and GNAT.C_Time units to libgnat"Eric Botcazou71-546/+2164
This reverts commit 41974d6ed349507ca1532629851b7b5d74f44abc.
3 daysAda: 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.
3 daysAda: 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.
3 daysc++: 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>
3 daysRISC-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>
3 daysvect: 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.
3 dayslibgcc: Update FMV features to latest ACLE spec 2024Q4Wilco Dijkstra2-18/+19
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.
3 daysAArch64: 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.
3 daysFixup 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.
3 daysExtend 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.
3 dayscobol: 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.
3 daysi386: 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.
3 daysi386: 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.
3 daysi386: 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.
3 daysi386: 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.
3 daystree-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.
3 daystree-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.