aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-17doc: document Incremental LTO flagsMichal Jires1-3/+23
This adds missing documentation for LTO flags. gcc/ChangeLog: * doc/invoke.texi: (Optimize Options): Add incremental LTO flags.
2025-03-17testsuite: s390: Skip gcc.dg/vect/bb-slp-77.cStefan Schulze Frielinghaus1-1/+1
There exists no .REDUC_PLUS on s390. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-77.c: Skip on s390.
2025-03-17Move gfortran.dg/gomp/declare-variant-mod-1*.f90 to libgomp.fortran/ [PR115271]Tobias Burnus2-0/+0
The test is a supposed to be a compile-only test but as dg-additional-sources does not work with dg-compile (due to compiling with '-o'), dg-link had to be used; as the code actually compiles (no diagnostic error), the linker is actually invoked, which fails unless the system compiler by chance provides the required files. Solution: move the test to libgomp. PR fortran/115271 gcc/testsuite/ChangeLog: * gfortran.dg/gomp/declare-variant-mod-1-use.f90: Move to libgomp/testsuite/libgomp.fortran/. * gfortran.dg/gomp/declare-variant-mod-1.f90: Likewise. libgomp/ChangeLog: * testsuite/libgomp.fortran/declare-variant-mod-1-use.f90: Moved from gcc/testsuite/gfortran.dg/gomp/. * testsuite/libgomp.fortran/declare-variant-mod-1.f90: Likewise.
2025-03-17RISC-V: Mask values before initializing bitmask vector [PR119114].Robin Dapp2-1/+50
In the somewhat convoluted vector code of PR119114 we extract a <signed-boolean:1> mask value from a vector mask. After some middle-end simplifications we end up with a value of -2. Its lowest bit is correctly unset representing "false". When initializing a bitmak vector from values we compare the full value/register against zero instead of just the last bit. This causes erroneous mask values. This patch masks the values by & 0x1 before comparing against 0. PR target/119114 gcc/ChangeLog: * config/riscv/autovec.md: Apply & 0x1 mask when initializing bitmask vector. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr119114.c: New test.
2025-03-17Aarch64: Add FMA and FMAF intrinsic and corresponding testsAyan Shafqat2-0/+31
This patch introduces inline definitions for the __fma and __fmaf functions in arm_acle.h for Aarch64 targets. These definitions rely on __builtin_fma and __builtin_fmaf to ensure proper inlining and to meet the ACLE requirements [1]. The patch has been tested locally using a crosstool-NG sysroot for Aarch64, confirming that the generated code uses the expected fused multiply-accumulate instructions (fmadd). [1] https://arm-software.github.io/acle/main/acle.html#fused-multiply-accumulate-fma gcc/ChangeLog: * config/aarch64/arm_acle.h (__fma, __fmaf): New functions. gcc/testsuite/ChangeLog: * gcc.target/aarch64/acle/acle_fma.c: New test.
2025-03-17Add -[DU]_FORTIFY_SOURCE[=n] to DW_AT_producerRichard Biener1-2/+12
The following makes sure to record -D_FORTIFY_SOURCE=n and -U_FORTIFY_SOURCE in the DW_AT_producer debuginfo attribute when present on the compiler command line. * opts.cc (gen_producer_string): Record -D and -U with _FORTIFY_SOURCE prefix.
2025-03-17Daily bump.GCC Administrator7-1/+138
2025-03-16[RISC-V][PR target/116256][V4] Fix minor code quality regression in ↵Jeff Law2-7/+47
reassociated arithmetic Arggh. This time add arguments for rv32. Hand edited the testcase part of the patch, but I think I got it right. One. More. Time. -pedantic-errors this time ;( Adding an explicit -std=gnu23 to shut that up. Part of me wants to know why that's getting added by the pre-commit, but not enough to chase it down. -- This failed pre-commit CI the first time through. The only change is in the return type in the test bool -> _Bool. The patch for target/116256 significantly simplified the condition and, I guess not too surprisingly, exposed a minor code quality regression. Specifically the split part of the define_insn_and_split only splits after reload (because we use a match_scratch). So there's nothing to combine the load-immediate with the subsequent add into an addi when the immediate fits into a simm12 field. This patch adjusts the split code to handle that scenario directly and generate the more efficient code. We can squeeze out the slli in this test with a bit more work, but that's out of scope right now since that isn't a regression. Tested in my tester. Waiting on pre-commit testing to render a verdict. PR target/116256 gcc * config/riscv/riscv.md (reassociation splitters): Do not load the adjusted addend into a register if it fits in a simm12. gcc/testsuite * gcc.target/riscv/pr116256-1.c: New test.
2025-03-16Fortran: fix bogus dependency check in ALLOCATE statement [PR60560]Harald Anlauf3-14/+43
Restrict dependency check of ALLOCATE object to variables in the same statement, but exclude check of length type parameter that might be set in the declaration and could lead to a bogus cyclic dependency. PR fortran/60560 gcc/fortran/ChangeLog: * expr.cc (gfc_traverse_expr): Do not descend into length type parameter for negative values of auxiliary parameter f. * resolve.cc (gfc_find_var_in_expr): New helper function to check dependence of an expression on given variable. (resolve_allocate_expr): Use it to determine if array bounds in an ALLOCATE statement depend explicitly on a variable. gcc/testsuite/ChangeLog: * gfortran.dg/allocate_error_8.f90: New test.
2025-03-16d: Merge upstream dmd, druntime 603225372bIain Buclaw77-1295/+1722
D front-end changes: - Import dmd v2.111.0-beta.1. - Added placement `new' expressions. D runtime changes: - Import druntime v2.111.0-beta.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 603225372b. * dmd/VERSION: Bump version to v2.111.0-beta.1. * d-builtins.cc (build_frontend_type): Update for new front-end interface. * decl.cc (Class DeclVisitor): Likewise. (maybe_build_decl_tree): Likewise. (get_vtable_decl): Likewise. (layout_class_initializer): Likewise. * expr.cc (class ExprVisitor): Likewise. (ExprVisitor::visit (NewExp *)): Implement placement new for class, struct, and pointer types. * modules.cc (get_internal_fn): Update for new front-end interface. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 603225372b.
2025-03-16d: Merge upstream dmd, druntime 53a1cc8d13Iain Buclaw155-1077/+1556
D front-end changes: - Typesafe variadic class parameters have been deprecated. D runtime changes: - Added `entry' field to TypeInfo_AssociativeArray. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 53a1cc8d13. * d-tree.h (create_typeinfo): Change second parameter to Scope *. (speculative_type_p): Remove prototype. * d-frontend.cc (getTypeInfoType): Adjust. * decl.cc: Include dmd/typinf.h. (DeclVisitor::visit (TypeInfoDeclaration *)): Update for new front-end interface. * typeinfo.cc (create_typeinfo): Likewise. (class SpeculativeTypeVisitor): Remove class. (speculative_type_p): Remove function. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 53a1cc8d13. gcc/testsuite/ChangeLog: * gdc.dg/pr100967.d: Adjust error message.
2025-03-16cobol: add cobol.dg/group1/escape.cob test; modify cobol.dg/gd.exp to handle itRobert Dubner2-2/+26
gcc/testsuite * cobol.dg/dg.exp: modified to recurse into directories without .exp files and find *.cob files therein. * cobol.dg/group1/escape.cob: New testcase.
2025-03-16discriminators: Fix assigning discriminators on edge [PR113546]Andrew Pinski2-7/+14
The problem here is there was a compare debug since the discriminators would still take into account debug statements. For the edge we would look at the first statement after the labels and that might have been a debug statement. So we need to skip over debug statements otherwise we could get different discriminators # with and without -g. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR middle-end/113546 gcc/ChangeLog: * tree-cfg.cc (first_non_label_stmt): Rename to ... (first_non_label_nondebug_stmt): This and use gsi_start_nondebug_after_labels_bb. (assign_discriminators): Update call to first_non_label_nondebug_stmt. gcc/testsuite/ChangeLog: * c-c++-common/torture/pr113546-1.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-03-16PR modula2/115111 Incorrect line debugging locations at the end of the WHILE ↵Gaius Mulley7-25/+52
loop This fix corrects the END token position used during the GotoOp at the bottom of the WHILE loop. The fix is to pass the relative token position down to M2Quads. This method should be replicated for the other loops END or UNTIL keywords and possibly the END statements for conditional statements. gcc/m2/ChangeLog: PR modula2/115111 * gm2-compiler/M2GenGCC.mod (CodeStatementNote): Add debugging. * gm2-compiler/M2Quads.def (BuildEndWhile): New parameter reltokpos. * gm2-compiler/M2Quads.mod (BuildEndWhile): Reimplement using new parameter. * gm2-compiler/P3Build.bnf (WhileStatement): Call BuildEndWhile with -1 relative position. * gm2-gcc/m2block.cc (do_add_stmt): Tidy comment. (GetGlobals): Ditto. (flush_pending_note): Remove #if 0 code. * gm2-gcc/m2pp.cc (m2pp_nop_expr): New function. (m2pp_statement): New case clause call m2pp_nop_expr. gcc/testsuite/ChangeLog: PR modula2/115111 * gm2/pim/pass/whilestep.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-16Darwin: Pass -macos_version_min to the linker [PR119172].Iain Sandoe4-4/+44
For binaries to be notarised, the SDK version must be available. Since we do not, at present, parse this information we have been passing "0.0" to ld64. This now results in a warning and a fail to notarise. As a quick-fix, we can fall back to letting ld64 figure out the SDK version (which it does for -macos_version_min). TODO: Parse the SDKSetting.plist at some point. PR target/119172 gcc/ChangeLog: * config.in: Regenerate. * config/darwin.h (DARWIN_PLATFORM_ID): Add the option to use -macos_version_min where available. * configure: Regenerate. * configure.ac: Check for ld64 support of -macos_version_min. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 36f5ea5806d246d78555e65273a057718833e3cd)
2025-03-16d: Merge upstream dmd, druntime ffbad272b6Iain Buclaw88-916/+1210
D front-end changes: - Import latest fixes from dmd. D runtime changes: - Import latest fixes from druntime. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd ffbad272b6. * d-tree.h (make_location_t): Add overload taking a const SourceLoc &. * d-codegen.cc (make_location_t): Likewise. * d-diagnostic.cc (d_diagnostic_report_diagnostic): Change first parameter type to const SourceLoc &. (verrorReport): Update for new front-end interface. (verrorReportSupplemental): Likewise. * d-frontend.cc (eval_builtin): Likewise. (getTypeInfoType): Likewise. * d-lang.cc (d_parse_file): Likewise. * d-target.cc (Target::va_listType): Likewise. (Target::getTargetInfo): Likewise. * decl.cc (build_decl_tree): Likewise. * imports.cc (ImportVisitor::visit (Module *)): Likewise. * modules.cc (get_internal_fn): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime ffbad272b6.
2025-03-16Daily bump.GCC Administrator6-1/+74
2025-03-15d: Merge upstream dmd, druntime d29e3eca45Iain Buclaw82-1037/+1204
D front-end changes: - Error messages related to operator overloading have been improved. D runtime changes: - Import latest fixes from druntime. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd d29e3eca45. * d-codegen.cc (can_elide_copy_p): Update for new front-end interface. * d-lang.cc (d_handle_option): Likewise. * expr.cc (class ExprVisitor): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime d29e3eca45.
2025-03-15d: Merge upstream dmd, druntime b7e3b3b617Iain Buclaw87-2562/+2878
D front-end changes: - `delete' is no longer a keyword. - Initializing a field with itself has been deprecated. D runtime changes: - Add Windows BCrypt bindings under `core.sys.windows.bcrypt'. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream b7e3b3b617. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream b7e3b3b617. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/bcrypt.d. * libdruntime/Makefile.in: Regenerate. * libdruntime/gcc/sections/elf.d (sizeofTLS): Give function the same mangling as gcc.sections.sizeofTLS. * libdruntime/gcc/sections/package.d: Import core.internal.traits. (pinLoadedLibraries): Mangle as function from rt.sections_elf_shared. (unpinLoadedLibraries): Likewise. (inheritLoadedLibraries): Likewise. (cleanupLoadedLibraries): Likewise. (sizeOfTLS): Add forward declaration.
2025-03-15contrib/gcc-changelog: Fix Git.AutoInterrupt - sys.meta_path is None exceptionTobias Burnus1-0/+1
I think the following message is new with Python 3.13, at least I starting seeing the following exception, which could be fixed by a simple call to 'repo.close()'. Seemingly the issue was that the lifetime of the destructor exceeded the object lifetime. Exception ignored in: <function Git.AutoInterrupt.__del__ at 0x7ff995aa4f40> Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/git/cmd.py", line 790, in __del__ File "/usr/lib/python3.13/site-packages/git/cmd.py", line 781, in _terminate File "/usr/lib64/python3.13/subprocess.py", line 2227, in terminate ImportError: sys.meta_path is None, Python is likely shutting down contrib/ChangeLog: * gcc-changelog/git_repository.py (parse_git_revisions): Destroy the Repo object by calling repo.close() at the end of the function.
2025-03-15Fortran: Store OpenMP's 'declare variant' in module file [PR115271]Tobias Burnus9-66/+650
Write the 'omp declare variant' data into the .mod file: Base function, variant function(s), supporting the clauses match, append_args, and adjust_args. PR fortran/115271 gcc/fortran/ChangeLog: * module.cc (mio_omp_declare_simd_clauses): New, moved from ... (mio_omp_declare_simd): ... here. Update call, write empty '( )' if there is no declare simd but a declare variant. (mio_omp_declare_variant): New. (mio_symbol): Call it. * openmp.cc (gfc_match_omp_context_selector): Add comment about module.cc to TODO note. * trans-stmt.h (gfc_trans_omp_declare_variant): Take additional parent_ns argument. * trans-decl.cc (create_function_arglist, gfc_create_function_decl): Update call. * trans-openmp.cc (gfc_trans_omp_declare_variant): Take new argument, add some special case handling for attr.use_assoc. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/declare-variant-mod-1-use.f90: New test. * gfortran.dg/gomp/declare-variant-mod-1.f90: New test. * gfortran.dg/gomp/declare-variant-mod-2-use.f90: New test. * gfortran.dg/gomp/declare-variant-mod-2.f90: New test.
2025-03-15RISC-V: Refine the testcases for cond_widen_complicate-3Pan Li10-36/+93
Rearrange the test cases of cond_widen_complicate-3 by different types into different files, instead of put all types together. Then we can easily reduce the range when asm check fails. The below test suites are passed locally, let's wait online CI says. * The rv64gcv fully regression test. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.c: Removed. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f16.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f32.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i16.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i32.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i8.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u16.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u32.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u8.c: New test. * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.h: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-03-15Daily bump.GCC Administrator13-1/+191
2025-03-14Regenerate .pot filesJoseph Myers2-5180/+5896
gcc/po/ * gcc.pot: Regenerate. libcpp/po/ * cpplib.pot: Regenerate.
2025-03-14libstdc++: Missing 'constexpr' in vector's from_range ctor [PR119282]Patrick Palka2-1/+14
A missing 'constexpr' in the non-forward (and non-sized) branch of our recently implemented vector from_range ctor was causing this valid example to be rejected with a cryptic error. PR libstdc++/119282 libstdc++-v3/ChangeLog: * include/bits/stl_vector.h (vector::vector(from_range_t)): Add missing 'constexpr' to local class _Clear. * testsuite/std/ranges/conv/1.cc (test_pr119282): New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-03-14cobol: Don't run cobol tests with -m32 or -mx32 [PR119290]Jakub Jelinek3-1/+16
The following patch adds cobol effective target and uses it to guard main loop in cobol.dg/dg.exp, so that we don't run the tests on unsupported multilibs. Tested on x86_64-linux with make check-cobol RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg.exp' which previously had all FAILs in the -m32 case and now doesn't report any PASSes/FAILs/XFAILs/XPASSes etc, while for -m64 the testsuite is run normally. 2025-03-14 Jakub Jelinek <jakub@redhat.com> PR cobol/119290 * lib/target-supports.exp (check_compile): Use *.cob extension for "*> COBOL" comment. * lib/cobol-dg.exp (check_effective_target_cobol): New procedure. * cobol.dg/dg.exp: Guard main loop with [check_effective_target_cobol] test.
2025-03-14ipa: Do not modify cgraph edges from thunk clones during inlining (PR116572)Martin Jambor2-2/+42
In PR 116572 we hit an assert that a thunk which does not have a body looks like it has one. It does not, but the call_stmt of its outgoing edge points to a statement, which should not. In fact it has several outgoing call graph edges, which cannot be. The problem is that the code updating the edges to reflect inlining into the master clone (an ex-thunk, unlike the clone, which is still an unexpanded thunk) is being updated during inling into the master clone. This patch simply makes the code to skip unexpanded thunk clones. gcc/ChangeLog: 2025-03-13 Martin Jambor <mjambor@suse.cz> PR ipa/116572 * cgraph.cc (cgraph_update_edges_for_call_stmt): Do not update edges of clones that are unexpanded thunk. Assert that the node passed as the parameter is not an unexpanded thunk. gcc/testsuite/ChangeLog: 2025-03-13 Martin Jambor <mjambor@suse.cz> PR ipa/116572 * g++.dg/ipa/pr116572.C: New test.
2025-03-14match.pd: Fix up r15-8025 simplification [PR119287]Jakub Jelinek2-1/+17
The following testcase ICEs since r15-8025. tree_nop_conversion_p doesn't imply TREE_TYPE (@0) is uselessly convertible to type, e.g. they could be INTEGER_TYPEs with the same precision but different TYPE_SIGN. The following patch just adds a convert so that it creates a valid IL even in those cases. 2025-03-14 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/119287 * match.pd (((X >> C1) & C2) * (1 << C1) to X & (C2 << C1)): Use (convert @0) instead of @0 in the substitution. * gcc.dg/pr119287.c: New test.
2025-03-14c, c++: Set DECL_NOT_GIMPLE_REG_P on *PART_EXPR operand on lhs of ↵Jakub Jelinek3-0/+64
MODIFY_EXPR [PR119120] The PR119190 patch I've posted regresses the PR119120 testcase (not adding to testsuite, as it is fairly hard to scan for that problem). The issue is that for the partial setting of _Complex floating vars through __real__ on it first and __imag__ later (or vice versa) and since we forced all complex vars into SSA form we often have undefined (D) arguments of those COMPLEX_EXPRs. When we don't DCE them (for -O0 debug info reasons), their expansion will copy both the real and imag parts using the floating mode and on some targets like 387 that copying alone can unfortunately trigger exceptions on sNaNs or other problematic bit patterns and for uninitialized memory it can be triggered randomly based on whatever is on the stack before. The following patch sets DECL_NOT_GIMPLE_REG_P flag in the FEs during genericization. I think Fortran doesn't have a way to modify just real or just complex part separately. The patch is for code like _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value *= __t; return *this; at -O0 which used to appear widely even in libstdc++ before GCC 9 and happens in real-world code. At -O0 for debug info reasons (see PR119190) we don't want to aggressively DCE statements and when we since r0-100845 try to rewrite vars with COMPLEX_TYPE into SSA form aggressively, the above results in copying of uninitialized data when expanding COMPLEX_EXPRs added so that the vars can be in SSA form. The patch detects during genericization the partial initialization and doesn't rewrite such vars to SSA at -O0. This has to be done before gimplification starts, otherwise e.g. the attached testcase ICEs. 2025-03-14 Jakub Jelinek <jakub@redhat.com> PR target/119120 * c-gimplify.cc (c_genericize_control_r): Set DECL_NOT_GIMPLE_REG_P on {REAL,IMAG}PART_EXPR is_gimple_reg operand at -O0 if it is lhs of a MODIFY_EXPR. * cp-gimplify.cc (cp_genericize_r): Set DECL_NOT_GIMPLE_REG_P on {REAL,IMAG}PART_EXPR is_gimple_reg operand at -O0 if it is lhs of a MODIFY_EXPR. * c-c++-common/pr119120.c: New test.
2025-03-14analyzer: Fix ICE in cmp_csts_same_type on RAW_DATA_CST [PR119278]Jakub Jelinek2-2/+35
The following testcase ICEs in cmp_csts_same_type because RAW_DATA_CST isn't handled there. As TREE_TYPE (cst1) in that case is INTEGER_TYPE, e.g. char/signed char/unsigned char, the type itself doesn't imply the size, so the length is compared first, followed by comparing the data. While at it, I've noticed STRING_CST handling is wrong, because STRING_CST can represent even string literals with embedded nul characters. We shouldn't stop at those, hence memcmp. While for STRING_CST TREE_TYPE should likely already imply the length and so same type should imply same TREE_STRING_LENGTH, I've repeated the comparisons in there just in case. 2025-03-14 Jakub Jelinek <jakub@redhat.com> PR analyzer/119278 * svalue.cc (cmp_csts_same_type): For STRING_CST, compare TREE_STRING_LENGTH first just in case and use memcmp rather than strcmp. Handle RAW_DATA_CST. * c-c++-common/analyzer/pr119278.c: New test.
2025-03-14libstdc++: Fix views::zip_transform constraints for empty range pack [PR111138]Tomasz Kamiński2-5/+32
Add missing move_constructible && regular_invocable constrains on functor type, and is_object on functor result type for invocations of views::zip_transform without range arguments. PR libstdc++/111138 libstdc++-v3/ChangeLog: * include/std/ranges (_ZipTransform::operator()): Create separate overload for calls with empty range pack, and add move_constructible, regular_invocable and is_object_v<invoke_result_t<...>>> constraints. * testsuite/std/ranges/zip_transform/1.cc: New tests Reviewed-by: Patrick Palka <ppalka@redhat.com> Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-14Prevent use of ASM_EXPR for optimized COBOL compilations [PR119214]Robert Dubner1-25/+30
The creation of assembler labels using ASM_EXPR causes name collisions in the assembly language because some optimizations repeat code, and those labels can get repeated. Use of "if( !optimize )" prevents (at least) that problem when it cropped up with "-O -ftrace" gcc/cobol: PR cobol/119214 * gengen.cc: applies if( !optimize ) test
2025-03-14cobol/119281 - make sure $(gcc_version) is set for libgcobol installRichard Biener4-6/+30
When using --enable-version-specific-runtime-libs at least it's required that $(gcc_version) is set to be able to expand toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' The following fixes this by adjusting configure.ac to call GCC_BASE_VER and Makefile.am to include a definition for gcc_version. libgcobol/ * Makefile.am: Define gcc_version. * configure.ac: Execute GCC_BASE_VER. * Makefile.in: Regenerated. * configure: Likewise.
2025-03-14Revert "GCN, nvptx: Basic '__cxa_guard_{acquire,abort,release}' for C++ ↵Thomas Schwinge4-105/+0
static local variables support" GCN, nvptx now has libstdc++-v3/libsupc++ proper. This reverts commit c0bf7ea189ecf252152fe15134f70f576bcd20b2.
2025-03-14GCN, nvptx: Don't default-disable libstdc++ buildThomas Schwinge4-18/+22
In addition to making libstdc++ itself available, this, via enabling 'build-gcc/*/libstdc++-v3/scripts/testsuite_flags', in particular also makes the standard C++ headers available to 'make check-gcc-c++'. With that, there are a lot of FAIL/UNRESOLVED -> PASS progressions, where we previously ran into, for example: FAIL: g++.dg/coroutines/co-await-syntax-00-needs-expr.C (test for errors, line 6) FAIL: g++.dg/coroutines/co-await-syntax-00-needs-expr.C (test for excess errors) Excess errors: [...]/gcc/testsuite/g++.dg/coroutines/coro.h:132:10: fatal error: cstdlib: No such file or directory Similarly, there are a lot of FAIL/UNRESOLVED -> UNSUPPORTED "progressions" due to 'sorry, unimplemented: exception handling not supported'. The 'make check-target-libstdc++-v3' results don't look too bad, either. This also reverts Subversion r221362 (Git commit d94fae044da071381b73a2ee8afa874b14fa3820) "No libstdc++ for nvptx", and commit 2f4f3c0e9345805160ecacd6de527b519a8c9206 "No libstdc++ for GCN". With libstdc++ now available, libgrust gets enabled, which we in turn again have to disable, for 'sorry, unimplemented: exception handling not supported' reasons. PR target/92713 PR target/101544 * configure.ac [GCN, nvptx] (noconfigdirs): Don't add 'target-libstdc++-v3'. Add 'target-libgrust'. * configure: Regenerate. gcc/ * config/gcn/gcn.h (LIBSTDCXX): Don't set. * config/nvptx/nvptx.h (LIBSTDCXX): Likewise.
2025-03-14GCN, nvptx: Allow for "hosted" libstdc++ buildThomas Schwinge3-0/+80
We need '-fno-exceptions', '-fno-rtti', disable generation of PCH files, and for nvptx twiddle some more knobs. PR target/92713 PR target/101544 libstdc++-v3/ * config/cpu/nvptx/cpu_defines.h: New. * config/cpu/nvptx/t-nvptx: Likewise. * configure.host: Handle GCN, nvptx.
2025-03-14libstdc++: Include missing algorithm header in priority_queue tests.Tomasz Kamiński2-0/+2
libstdc++-v3/ChangeLog: * testsuite/23_containers/priority_queue/cons_from_range.cc: Add `#include <algorithm>. * testsuite/23_containers/priority_queue/members/push_range.cc: Add `#include <algorithm>.
2025-03-14tree-optimization/119274 - improve VN optimistic dominance queryRichard Biener2-0/+48
The following improves how VN performs its dominance queries to determine availability, exploiting edges considered unreachable. The function already contains code to handle the leader block forking the CFG, but that looks like a situation that won't help the dominance query ever. The following adds handling of the more useful case where this block forwards to a CFG merge with the forwarder being the only executable entry. This helps optimizing the code so the spurious array diagnostic does no longer appear. PR tree-optimization/119274 * tree-ssa-sccvn.cc (dominated_by_p_w_unex): Handle the top block being the only executable forwarder to a CFG merge. * g++.dg/opt/pr119274.C: New testcase.
2025-03-14vect: Fix aarch64/pr99873_2.c ld4/st4 failureRichard Sandiford1-3/+16
vect_slp_prefer_store_lanes_p allows an SLP tree to be split even if the tree could use store-lanes, provided that one of the new groups would operate on full vectors for each scalar iteration. That heuristic is no longer firing for gcc.target/aarch64/pr99873_2.c. The test contains: void __attribute ((noipa)) foo (uint64_t *__restrict x, uint64_t *__restrict y, int n) { for (int i = 0; i < n; i += 4) { x[i] += y[i]; x[i + 1] += y[i + 1]; x[i + 2] |= y[i + 2]; x[i + 3] |= y[i + 3]; } } and wants us to use V2DI for the first two elements and V2DI for the second two elements, rather than LD4s and ST4s. This gives: .L3: ldp q31, q0, [x0] add w3, w3, 1 ldp q29, q30, [x1], 32 orr v30.16b, v0.16b, v30.16b add v31.2d, v29.2d, v31.2d stp q31, q30, [x0], 32 cmp w2, w3 bhi .L3 instead of: .L4: ld4 {v28.2d - v31.2d}, [x2] ld4 {v24.2d - v27.2d}, [x3], 64 add v24.2d, v28.2d, v24.2d add v25.2d, v29.2d, v25.2d orr v26.16b, v30.16b, v26.16b orr v27.16b, v31.16b, v27.16b st4 {v24.2d - v27.2d}, [x2], 64 cmp x2, x5 bne .L4 The first loop only handles half the amount of data per iteration, but it requires far fewer internal permutations. One reason the heuristic no longer fired looks like a typo: the call to vect_slp_prefer_store_lanes_p was passing "1" as the new group size, instead of "i". However, even with that fixed, vect_analyze_slp later falls back on single-lane SLP with load/store lanes. I think that heuristic too should use vect_slp_prefer_store_lanes_p (but it otherwise looks good). The question is whether every load should pass vect_slp_prefer_store_lanes_p or whether just one is enough. I don't have an example that would make the call either way, so I went for the latter, given that it's the smaller change from the status quo. This also appears to improve fotonik3d and roms from SPEC2017 (cross-checked against two different systems). gcc/ * tree-vect-slp.cc (vect_build_slp_instance): Pass the new group size (i) rather than 1 to vect_slp_prefer_store_lanes_p. (vect_analyze_slp): Only force the use of load-lanes and store-lanes if that is preferred for at least one load/store pair.
2025-03-14libstdc++: fix compile error when converting std::weak_ptr<T[]>Giuseppe D'Angelo5-1/+91
A std::weak_ptr<T[]> can be converted to a compatible std::weak_ptr<U[]>. This is implemented by having suitable converting constructors to std::weak_ptr which dispatch to the __weak_ptr base class (implementation detail). In __weak_ptr<T[]>, lock() is supposed to return a __shared_ptr<T[]>, not a __shared_ptr<element_type> (that is, __shared_ptr<T>). Unfortunately the return type of lock() and the type of the returned __shared_ptr were mismatching and that was causing a compile error: when converting a __weak_ptr<T[]> to a __weak_ptr<U[]> through __weak_ptr's converting constructor, the code calls lock(), and that simply fails to build. Fix it by removing the usage of element_type inside lock(), and using _Tp instead. Note that std::weak_ptr::lock() itself was already correct; the one in __weak_ptr was faulty (and that is the one called by __weak_ptr's converting constructors). libstdc++-v3/ChangeLog: * include/bits/shared_ptr_base.h (lock): Fixed a compile error when calling lock() on a weak_ptr<T[]>, by removing an erroneous usage of element_type from within lock(). * testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc: Add more tests for array types. * testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/20_util/shared_ptr/requirements/1.cc: New test. * testsuite/20_util/weak_ptr/requirements/1.cc: New test.
2025-03-14tree-optimization/119155 - wrong aligned access for vectorized packed accessRichard Biener2-4/+47
When doing strided SLP vectorization we use the wrong alignment for the possibly piecewise access of the vector elements for loads and stores. While we are carefully using element aligned loads and stores that isn't enough for the case the original scalar accesses are packed. The following instead honors larger alignment when present but correctly falls back to the original scalar alignment used. PR tree-optimization/119155 * tree-vect-stmts.cc (vectorizable_store): Do not always use vector element alignment for VMAT_STRIDED_SLP but a more correct alignment towards both ends. (vectorizable_load): Likewise. * gcc.dg/vect/pr119155.c: New testcase.
2025-03-14Doc: Remove redundant info from documentation of -ansi.Sandra Loosemore2-43/+6
The -ansi option has essentially been superseded by the more general -std= option, and all the additional information about its effects is already covered elsewhere in the manual. I also cleaned up some confusing text about alternate keywords that I noticed while confirming this. gcc/ChangeLog * doc/extend.texi (Alternate Keywords): Clean up text and remove discussion of "restrict", which is not a GNU extension at all. * doc/invoke.texi (C Dialect Options): Remove detailed discussion.
2025-03-14Daily bump.GCC Administrator12-1/+267
2025-03-13libstdc++: Work around C++20 tuple<tuple<any>> constraint recursion [PR116440]Patrick Palka2-6/+37
The type tuple<tuple<any>> is clearly copy/move constructible, but for reasons that are not yet completely understood checking this triggers constraint recursion with our C++20 tuple implementation (but not the C++17 implementation). It turns out this recursion stems from considering the non-template tuple(const _Elements&) constructor during the copy/move constructibility check. Considering this constructor is ultimately redundant, since the defaulted copy/move constructors are better matches. GCC has a non-standard "perfect candidate" optimization[1] that causes overload resolution to shortcut considering template candidates if we find a (non-template) perfect candidate. So to work around this issue (and as a general compile-time optimization) this patch turns the problematic constructor into a template so that GCC doesn't consider it when checking for copy/move constructibility of this tuple type. Changing the template-ness of a constructor can affect overload resolution (since template-ness is a tiebreaker) so there's a risk this change could e.g. introduce overload resolution ambiguities. But the original C++17 implementation has long defined this constructor as a template (in order to constrain it etc), so doing the same thing in the C++20 mode should naturally be quite safe. The testcase still fails with Clang (in C++20 mode) since it doesn't implement said optimization. [1]: See r11-7287-g187d0d5871b1fa and https://isocpp.org/files/papers/P3606R0.html PR libstdc++/116440 libstdc++-v3/ChangeLog: * include/std/tuple (tuple::tuple(const _Elements&...)) [C++20]: Turn into a template. * testsuite/20_util/tuple/116440.C: New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-03-14Plug small loophole in the pattern matching done by -fdump-ada-specEric Botcazou1-2/+2
gcc/c-family/ PR ada/119265 * c-ada-spec.cc (dump_ada_node) <INTEGER_TYPE>: Deal with typedefs of unsigned __int128.
2025-03-13Update gcc de.poJoseph Myers1-2159/+721
* de.po: Update.
2025-03-13Fix speculation_useful_pJan Hubicka2-16/+24
This patch fixes issue with speculation and x264. With profile feedback we first introduce speculative calls to mc_chroma which is called indirectly. Then we propagate constants acorss these calls (which is useful transform) but then speculation_useful_p decides that these speculations are not useful and we end up calling unspecialized version. This patch updates speculation_useful_p to consider edges redirected earlier to clones as useful, since we can expect that ipa-cp knows what it is doing (originally it only looked for inlined calls). I also noticed that we want to keep edges even if they are not hot. Finally I noticed a typo in computing target in code which intends to keep devirtualized calls to functions where we propagated pureness/constness. Newly we also track ipa-modref summaries as they also may be useful. gcc/ChangeLog: PR ipa/119147 * ipa-inline.cc: Include ipa-modref-tree.h and ipa-modref.h. (speculation_useful_p): If target is a clone, speculation is usef; fix mixup of caller and callee; speculate also calls not considered hot; consider modref summary also possibly useful for optimization. * ipa-profile.cc (ipa_profile): Keep non-hot speculations.
2025-03-13Fortran: improve checking of substring bounds [PR119118]Harald Anlauf2-3/+7
Commit r15-7873 copy-pasted erroneous code containing a non-terminating loop that did not progress its control variable, and a switch statement with an unhandled case leading to a gcc_unreachable () with suitable input. PR fortran/119118 gcc/fortran/ChangeLog: * dependency.cc (contains_forall_index_p): Let loop over elements of a constructor update its control variable. Handle REF_INQUIRY in switch statement. (gfc_contains_implied_index_p): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/bounds_check_26.f90: Update test.
2025-03-13libstdc++: Add P1206R7 from_range members to container adaptors [PR111055]Jonathan Wakely9-0/+680
This is another piece of P1206R7, adding new members to std::stack, std::queue, and std::priority_queue. PR libstdc++/111055 libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (queue(from_range_t, _Rg&&)) (queue(from_range_t, _Rg&&, const _Alloc&), push_range): Define. (priority_queue(from_range_t, R&&, const Compare&)) (push_range): Define. * include/bits/stl_stack.h (stack(from_range_t, R&&)) (stack(from_range_t, R&&, const Alloc&), push_range): Define. * testsuite/util/testsuite_iterators.h (test_range_nocopy): Define. * testsuite/23_containers/priority_queue/cons_from_range.cc: New test. * testsuite/23_containers/priority_queue/members/push_range.cc: New test. * testsuite/23_containers/queue/cons_from_range.cc: New test. * testsuite/23_containers/queue/members/push_range.cc: New test. * testsuite/23_containers/stack/cons_from_range.cc: New test. * testsuite/23_containers/stack/members/push_range.cc: New test. Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-13testsuite, gm2: Use -B option for libstdc++ where required.Iain Sandoe1-10/+36
We need to add testsuite options to locate gm2 libs and libstdc++. Usually '-L' options are added to point to the relevant directories for the uninstalled libraries. In cases where libraries are available as both shared and convenience some additional checks are made. For some targets -static-xxxx options are handled by specs substitution and need a '-B' option rather than '-L'. For Darwin, when embedded runpaths are in use (the default for all versions after macOS 10.11), '-B' is also needed to provide the runpath. When '-B' is used, this results in a '-L' for each path that exists (so that appending a '-L' as well is a needless duplicate). There are also cases where tools warn for duplicates, leading to spurious fails. Therefore the objective of the code here is to add just one '-L' or '-B' for each of the libraries. Currently, we are forcing the full paths to each of the gm2 convenience libs onto the link line and therefore the B/L logic is not needed there. It would need to be added if/when gm2 is tested with shared libraries gcc/testsuite/ChangeLog: * lib/gm2.exp: Arrange for a '-B' option to be added for the libstdc++ paths on targets that need it. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>