aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2025-07-30aarch64: Fix sme2+faminmax intrisic gating (PR 121300)Alfie Richards1-0/+9
Fixes the feature gating for the SME2+FAMINMAX intrinsics. PR target/121300 gcc/ChangeLog: * config/aarch64/aarch64-sve-builtins-sme.def (svamin/svamax): Fix arch gating. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr121300.c: New test.
2025-07-30aarch64: Add support for unpacked SVE FP conditional ternary arithmeticSpencer Abson10-12/+165
This patch extends the expander for fma, fnma, fms, and fnms to support partial SVE FP modes. We add the missing BF16 tests, which we can now trigger for having implemented the conditional expander. We also add tests for the 'merging with multiplicand' case, which this expander canonicalizes (albeit under SVE_STRICT_GP). gcc/ChangeLog: * config/aarch64/aarch64-sve.md (@cond_<optab><mode>): Extend to support partial FP modes. (*cond_<optab><mode>_2_strict): Extend from SVE_FULL_F to SVE_F, use aarch64_predicate_operand. (*cond_<optab><mode>_4_strict): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16, use aarch64_predicate_operand. (*cond_<optab><mode>_any_strict): Likewise. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/unpacked_cond_fmla_1.c: Add test cases for merging with multiplcand. * gcc.target/aarch64/sve/unpacked_cond_fmls_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fnmla_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fnmls_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fmla_2.c: New test. * gcc.target/aarch64/sve/unpacked_cond_fmls_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fnmla_2.c: Likewise.. * gcc.target/aarch64/sve/unpacked_cond_fnmls_2.c: Likewise. * g++.target/aarch64/sve/unpacked_cond_ternary_bf16_1.C: Likewise. * g++.target/aarch64/sve/unpacked_cond_ternary_bf16_2.C: Likewise.
2025-07-30aarch64: Relaxed SEL combiner patterns for unpacked SVE FP ternary arithmeticSpencer Abson4-0/+188
Extend the ternary op/UNSPEC_SEL combiner patterns from SVE_FULL_F/ SVE_FULL_F_BF to SVE_F/SVE_F_BF, where the strictness value is SVE_RELAXED_GP. We can only reliably test the 'merging with the third input' (addend) and 'independent value' patterns at this stage as the canocalisation that reorders the multiplicands based on the second SEL input would be performed by the conditional expander. Another difficulty is that we can't test these fused multiply/SEL combines without using __builtin_fma and friends. The reason for this is as follows: We support COND_ADD, COND_SUB, and COND_MUL optabs, so match.pd will canonicalize patterns like ADD/SUB/MUL combined with a VEC_COND_EXPR into these conditional forms. Later, when widening_mul tries to fold these into conditional fused multiply operations, the transformation fails - simply because we haven’t implemented those conditional fused multiply optabs yet. Hence why this patch lacks tests for BFloat16... gcc/ChangeLog: * config/aarch64/aarch64-sve.md (*cond_<optab><mode>_2_relaxed): Extend from SVE_FULL_F to SVE_F. (*cond_<optab><mode>_4_relaxed): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16. (*cond_<optab><mode>_any_relaxed): Likewise. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/unpacked_cond_fmla_1.c: New test. * gcc.target/aarch64/sve/unpacked_cond_fmls_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fnmla_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fnmls_1.c: Likewise.
2025-07-30fortran: implement split for fortran 2023Yuao Ma4-0/+72
This patch includes the implementation, documentation, and test case for SPLIT. gcc/fortran/ChangeLog: * check.cc (gfc_check_split): Argument check for SPLIT. * gfortran.h (enum gfc_isym_id): Define GFC_ISYM_SPLIT. * intrinsic.cc (add_subroutines): Register SPLIT intrinsic. * intrinsic.h (gfc_check_split): New decl. (gfc_resolve_split): Ditto. * intrinsic.texi: SPLIT documentation. * iresolve.cc (gfc_resolve_split): Add resolved_sym for SPLIT. * trans-decl.cc (gfc_build_intrinsic_function_decls): Add decl for SPLIT in libgfortran. * trans-intrinsic.cc (conv_intrinsic_split): SPLIT codegen. (gfc_conv_intrinsic_subroutine): Handle SPLIT case. * trans.h (GTY): Declare gfor_fndecl_string_split{, _char4}. libgfortran/ChangeLog: * gfortran.map: Add split symbol. * intrinsics/string_intrinsics_inc.c (string_split): Runtime support for SPLIT. gcc/testsuite/ChangeLog: * gfortran.dg/split_1.f90: New test. * gfortran.dg/split_2.f90: New test. * gfortran.dg/split_3.f90: New test. * gfortran.dg/split_4.f90: New test. Signed-off-by: Yuao Ma <c8ef@outlook.com>
2025-07-30aarch64: Add support for unpacked SVE FP ternary arithmeticSpencer Abson10-0/+250
This patch extends the expander for unconditional fma, fnma, fms, and fnms, so that it supports partial SVE FP modes. gcc/ChangeLog: * config/aarch64/aarch64-sve.md (<optab><mode>4): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16. Use aarch64_sve_fp_pred instead of aarch64_ptrue_reg. (@aarch64_pred_<optab><mode>): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16. Use aarch64_predicate_operand. gcc/testsuite/ChangeLog: * g++.target/aarch64/sve/unpacked_ternary_bf16_1.C: New test. * g++.target/aarch64/sve/unpacked_ternary_bf16_2.C: Likewise. * gcc.target/aarch64/sve/unpacked_fmla_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmla_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmls_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmls_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fnmla_1.c: Likeiwse. * gcc.target/aarch64/sve/unpacked_fnmla_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fnmls_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fnmls_2.c: Likewise.
2025-07-30Eliminate redundant vpextrq/vpinsrq when move TI to V4SI.liuhongt1-0/+24
r14-1902-g96c3539f2a3813 split TImode move with 2 DImode move, it's supposed to optimize TImode in parameter/return since accoring to psABI it's stored into 2 general registers. But when TImode is not in parameter/return, it could create redundancy in the PR. The patch add a splitter to handle that. .i.e. (insn 10 9 14 2 (set (subreg:V2DI (reg:V4SI 98 [ <retval> ]) 0) (vec_concat:V2DI (subreg:DI (reg:TI 101) 0) (subreg:DI (reg:TI 101) 8))) 8442 {vec_concatv2di} (expr_list:REG_DEAD (reg:TI 101) gcc/ChangeLog: PR target/121274 * config/i386/sse.md (*vec_concatv2di_0): Add a splitter before it. gcc/testsuite/ChangeLog: * gcc.target/i386/pr121274.c: New test.
2025-07-30RISC-V: Add testcases for unsigned avg ceil vx combine.Pan Li20-3/+303
The unsigned avg ceil share the vaaddux.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-u64.c: Add asm check for unsigned avg ceil. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.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. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-u16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-u32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-u64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-2-u8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-30Daily bump.GCC Administrator1-0/+108
2025-07-29testsuite: Cleanup after auto-profile testcases when auto-profile is not ↵Andrew Pinski1-0/+2
supported [PR121215] The problem here is that in tree-prof.exp does not cleanup if requiring auto-profile but it is not supported and the testcase uses dg-additional-sources. Currently additional_sources is not reset to "" and then another testcase comes along and thinks that is the additional source to be added. Committed as obvious after testing: make check-gcc RUNTESTFLAGS="tree-prof.exp=afdo-crossmodule-1.c tree-ssa.exp=pr67891.c" to make sure pr67891.c now no longer uses the additional source. PR testsuite/121215 gcc/testsuite/ChangeLog: * lib/profopt.exp (profopt-execute): Call cleanup-after-saved-dg-test if returning early for the -fauto-profile case failing case. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-29aarch64: Add support for unpacked SVE FP conditional binary arithmeticSpencer Abson9-0/+212
This patch extends the expander for conditional smax, smin, add, sub, mul, min, max, and div to support partial SVE FP modes. If exceptions from undefined vector elements must be suppressed, this expansion converts the container-level predicate to an element-level one, and ensures that these elements are inactive for the operation. In practice, this is a predicate AND with the existing mask and a container-size PTRUE. gcc/ChangeLog: * config/aarch64/aarch64-protos.h (aarch64_sve_emit_masked_fp_pred): Declare. * config/aarch64/aarch64-sve.md (and<mode>3): Change this to... (@and<mode>3): ...this, so that we can use gen_and3. (@cond_<optab><mode>): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16, use aarch64_predicate_operand. (*cond_<optab><mode>_2_strict): Likewise. (*cond_<optab><mode>_3_strict): Likewise. (*cond_<optab><mode>_any_strict): Likwise. (*cond_<optab><mode>_2_const_strict): Extend from SVE_FULL_F to SVE_F, use aarch64_predicate_operand. (*cond_<optab><mode>_any_const_strict): Likewise. (*cond_sub<mode>_3_const_strict): Likwise. (*cond_sub<mode>_const_strict): Likewise. (*vcond_mask_<mode><vpred>): Use aarch64_predicate_operand, and update the comment here. * config/aarch64/aarch64.cc (aarch64_sve_emit_masked_fp_pred): New function. Helper to mask the predicate in conditional expanders. gcc/testsuite/ChangeLog: * g++.target/aarch64/sve/unpacked_cond_binary_bf16_2.C: New test. * gcc.target/aarch64/sve/unpacked_cond_builtin_fmax_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_builtin_fmin_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fadd_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fdiv_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fmaxnm_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fminnm_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fmul_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fsubr_2.c: Likewise.
2025-07-29x86: Pass -mno-80387 to compile pr121208-1(a|b).cH.J. Lu2-2/+2
Pass -mno-80387 to compile pr121208-1(a|b).c to silence .../pr121208-1a.c:11:1: sorry, unimplemented: 80387 instructions aren’t allowed in a function with the ‘no_caller_saved_registers’ attribute PR target/121208 * gcc.target/i386/pr121208-1a.c (dg-options): Add -mno-80387. * gcc.target/i386/pr121208-1b.c (dg-options): Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-29testsuite: Adjust s390x params for vector tests.Juergen Christ2-0/+2
Loop peeling and minimal loop vectorization threshold prevented loop vectorization in these examples. Adjust parameters in the test to make the test pass. Signed-off-by: Juergen Christ <jchrist@linux.ibm.com> PR testsuite/121286 PR testsuite/121288 gcc/testsuite/ChangeLog: * gcc.dg/vect/pr112325.c: Adjust parameters for s390. * gcc.dg/vect/pr117888-1.c: Ditto.
2025-07-29testsuite: Generalise aarch64/saturating_arithmetic*.cRichard Sandiford2-10/+10
gcc.target/aarch64/saturating_arithmetic_{1,2}.c expect w0 and w1 to be duplicated into vectors. The tests expected the duplication of w1 to happen first, but the other order would be fine too. A later simplify-rtx.cc patch happens to change the order. gcc/testsuite/ * gcc.target/aarch64/saturating_arithmetic_1.c: Allow w0 and w1 to be duplicated in either order. * gcc.target/aarch64/saturating_arithmetic_2.c: Likewise.
2025-07-29testsuite: Make aarch64/cmpbr.c more forgivingRichard Sandiford1-20/+20
The 8-bit and 16-bit tests in cmpbr.c assumed an inverted operand order ("w1, w0"), but it's possible to use the uninverted operand order too. This patch generalises the tests to support both forms. This is a prerequisite for a later patch that adds a new simplify-rtx.cc rule. gcc/testsuite/ * gcc.target/aarch64/cmpbr.c: Support both operand orders for 8-bit and 16-bit comparisons.
2025-07-29asf: Fix case of multiple stores with base offset [PR120660]Konstantinos Eleftheriou1-0/+19
When having multiple stores with the same offset as the load, in the case that we are eliminating the load, we were generating a mov instruction for both of them, leading to the overwrite of the register containing the loaded value. This patch fixes this issue by generating a mov instruction only for the first store in the store-load sequence that has the same offset as the load. For the next ones that might be encountered, we use bit-field insertion. Bootstrapped/regtested on AArch64 and x86_64. PR rtl-optimization/120660 gcc/ChangeLog: * avoid-store-forwarding.cc (process_store_forwarding): Fix instruction generation when haveing multiple stores with base offset. gcc/testsuite/ChangeLog: * gcc.dg/pr120660.c: New test.
2025-07-29asf: Skip when an instruction doesn't satisfy the constraints [PR119795]Konstantinos Eleftheriou1-0/+26
While scanning the instructions and upon reaching an instruction that doesn't satisfy the constraints that we have set, we were removing the already detected stores, but we were continuing adding stores from that point onward. This was causing issues when the address ranges from later stores overlapped with the load's address, leading to partial and wrong update of the register containing the loaded value. With this patch, we are skipping the tranformation for stores that operate on the load's address range, when stores that operate on the same range have been deleted due to constraint violations. PR rtl-optimization/119795 gcc/ChangeLog: * avoid-store-forwarding.cc (store_forwarding_analyzer::avoid_store_forwarding): Skip transformations for stores that operate on the same address range as deleted ones. gcc/testsuite/ChangeLog: * gcc.target/i386/pr119795.c: New test.
2025-07-29RISC-V: Add test cases for mul based unsigned scalar SAT_MULPan Li12-3/+117
Add run and tree-optimized check for mul based unsigned scalar SAT_MUL instead of the widen_mul. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat/sat_u_mul-run-1-u16-from-u64.c: Add rv64 target for run. * gcc.target/riscv/sat/sat_u_mul-run-1-u32-from-u64.c: Ditto. * gcc.target/riscv/sat/sat_u_mul-run-1-u8-from-u64.c: Ditto. * gcc.target/riscv/sat/sat_u_mul-1-u16-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-1-u8-from-u16.c: New test. * gcc.target/riscv/sat/sat_u_mul-1-u8-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-2-u16-from-u64.c: New test. * gcc.target/riscv/sat/sat_u_mul-2-u32-from-u64.c: New test. * gcc.target/riscv/sat/sat_u_mul-2-u8-from-u64.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-1-u16-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-1-u8-from-u16.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-1-u8-from-u32.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-29Another testcase for PR120687Richard Biener1-0/+16
This shows reassoc is harmful even with len == 3. PR tree-optimization/120687 * gcc.dg/vect/pr120687-3.c: New testcase.
2025-07-29testsuite: Fix C++14 test failure with modules test [PR121285]Nathaniel Shead1-2/+2
I hadn't validated this test worked in C++14 before submitting, fixed thusly. PR testsuite/121285 gcc/testsuite/ChangeLog: * g++.dg/modules/class-11_a.H: Make static_asserts valid for C++14. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2025-07-29tree-optimization/120687 - avoid disturbing reduction chains in reassocRichard Biener2-0/+33
Reassoc carefully ranks operands to form reduction chains for vectorization so we are careful to not apply any width related changes in the early pass. Unfortunately we are not careful enough. The following gates fma related re-ordering and also the >= 3 ops tail "optimization" which is the culprit here. This does not fix the reported inefficient vectorization when using signed integer reductions yet. PR tree-optimization/120687 * tree-ssa-reassoc.cc (reassociate_bb): Do not disturb the sorted operand order in the early pass. * tree-vect-slp.cc (vect_analyze_slp): Dump when a detected reduction chain fails SLP discovery. * gcc.dg/vect/pr120687-1.c: New testcase. * gcc.dg/vect/pr120687-2.c: Likewise.
2025-07-29PR modula2/121289 Poor warning location when using Wstyle optionGaius Mulley2-0/+58
This patch adds a token location parameter to CheckVariableAgainstKeyword and dependants ensuring that the warning is generated from the token associated with the variable rather than the end of the statement. gcc/m2/ChangeLog: PR modula2/121289 * gm2-compiler/M2Students.def (CheckVariableAgainstKeyword): New parameter tok. * gm2-compiler/M2Students.mod (CheckVariableAgainstKeyword): New parameter tok. Pass tok to PerformVariableKeywordCheck. (PerformVariableKeywordCheck): New parameter tok. Pass tok to MetaErrorStringT0. * gm2-compiler/P2SymBuild.mod (BuildVariable): Pass tok to CheckVariableAgainstKeyword. * gm2-libs-iso/LowLong.mod (except): Replace with ... (exceptSrc): ... this. * gm2-libs-iso/LowReal.mod (except): Replace with ... (exceptSrc): ... this. * gm2-libs-iso/LowShort.mod (except): Replace with ... (exceptSrc): ... this. * gm2-libs-iso/Processes.mod (Wait): Replace from with fromCor. * gm2-libs-iso/RndFile.mod (EndPos): Replace end with endP. * gm2-libs/SCmdArgs.mod (GetArg): Replace start with startPos. Replace end with endPos. (NArg): Replace start with startPos. Replace end with endPos. gcc/testsuite/ChangeLog: PR modula2/121289 * gm2/warnings/style/fail/badvarname.mod: New test. * gm2/warnings/style/fail/warnings-style-fail.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-07-29testsuite: Restore dg-do run on pr116906 and pr78185 testsChristophe Lyon3-0/+3
Commit r15-7152-g57b706d141b87c removed /* { dg-do run { target*-*-linux* *-*-gnu* *-*-uclinux* } } */ from these tests, turning them into 'compile' only tests, even when they could be executed. This patch adds /* { dg-do run } */ which is OK since the tests are correctly skipped if needed thanks to the following effective-targets (alarm and signal). With this patch we have again two entries for these tests on linux targets: * compile (test for excess errors) * execution test gcc/testsuite/ChangeLog: * gcc.dg/pr116906-1.c: Add 'dg-do run'. * gcc.dg/pr116906-2.c: Likewise. * gcc.dg/pr78185.c: Likewise.
2025-07-29calls: Allow musttail calls to noreturn [PR121159]Jakub Jelinek2-1/+18
In the PR119483 r15-9003 change we've allowed musttail calls to noreturn functions, after all the decision not to normally tail call noreturn functions is not because it is not possible to tail call those, but because it screws up backtraces. As the following testcase shows, we've done that only for functions not declared [[noreturn]]/_Noreturn but later on discovered through IPA as noreturn. Functions explicitly declared [[noreturn]] have (for historical reasons) volatile FUNCTION_TYPE and the FUNCTION_DECLs are volatile as well, so in order to support those we shouldn't complain on ECF_NORETURN (we've stopped doing so for musttail in PR119483) but also shouldn't complain about TYPE_VOLATILE on their FUNCTION_TYPE (something that IPA doesn't change, I think it only sets TREE_THIS_VOLATILE on the FUNCTION_DECL). volatile on function type really means noreturn as well, it has no other meaning. 2025-07-29 Jakub Jelinek <jakub@redhat.com> PR middle-end/121159 * calls.cc (can_implement_as_sibling_call_p): Don't reject declared noreturn functions in musttail calls. * c-c++-common/pr121159.c: New test. * gcc.dg/plugin/must-tail-call-2.c (test_5): Don't expect an error.
2025-07-28Improve mergability of CSWTCH [PR120523]Andrew Pinski1-0/+48
When I did r16-1067-gaa935ce40a7, I thought it would be enough to mark the decl as mergable to get it to merge on all targets. Turns out a few things needed to be changed to support it being mergable on all targets. The first thing is improve the selecting of the mergable section and instead of basing it on the DECL's mode, it should be based on the size instead. The second thing that needed to be happen is change the alignment of the CSWTCH decl to be aligned to the next power of 2 compared to the size if the size is less than 32bytes (the max mergable size that is supported). With these changes, cswtch-6.c passes on ia32 and other targets. And the new testcase cswtch-7.c will pass now too. Note I noticed the darwin's darwin_mergeable_constant_section could be "fixed" up to use DECL_SIZE instead of the DECL_MODE but I am not sure it makes a huge difference. Bootstrapped and tested on x86_64-linux-gnu. PR middle-end/120523 gcc/ChangeLog: * output.h (mergeable_constant_section): New declaration taking unsigned HOST_WIDE_INT for the size. * tree-switch-conversion.cc (switch_conversion::build_one_array): Increase the alignment of CSWTCH for sizes less than 32bytes. * varasm.cc (mergeable_constant_section): Split out twice. One that takes the size in unsigned HOST_WIDE_INT and the other size in a tree. (default_elf_select_section): Pass DECL_SIZE instead of DECL_MODE to mergeable_constant_section. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/cswtch-7.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-29Daily bump.GCC Administrator1-0/+39
2025-07-28ifcvt: Fix ifcvt for multiple phi nodes after factoring operator [PR121236]Andrew Pinski1-0/+20
When I added the factor operations to ifcvt, I messed how handling of removing the phi nodes. The fix is we need to remove the phi node that was factored out as we factored out the operator because otherwise scev can go when it comes to detecting if the new args are from a reduction. Also the need to change the interface for is_cond_scalar_reduction as the phi node that was being passed after the factoring no longer exists so need to pass the parts that were being used. PR tree-optimization/121236 gcc/ChangeLog: * tree-if-conv.cc (is_cond_scalar_reduction): Instead of phi argument, pass bb and res of the phi. (factor_out_operators): Add iterator for the phi. Remove the phi if this is the first time. Return if we had removed the phi. (predicate_scalar_phi): Add the phi iterator argument. Update call to is_cond_scalar_reduction. Update call to factor_out_operators and set the return value to true when factor_out_operators returns true. (predicate_all_scalar_phis): Don't remove the phi if predicate_scalar_phi already removed it. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr121236-1.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-28x86: Disallow -mtls-dialect=gnu with no_caller_saved_registersH.J. Lu6-0/+61
__tls_get_addr doesn't preserve vector registers. When a function with no_caller_saved_registers attribute calls __tls_get_addr, YMM and ZMM registers will be clobbered. Issue an error and suggest -mtls-dialect=gnu2 in this case. gcc/ PR target/121208 * config/i386/i386.cc (ix86_tls_get_addr): Issue an error for -mtls-dialect=gnu with no_caller_saved_registers attribute and suggest -mtls-dialect=gnu2. gcc/testsuite/ PR target/121208 * gcc.target/i386/pr121208-1a.c: New test. * gcc.target/i386/pr121208-1b.c: Likewise. * gcc.target/i386/pr121208-2a.c: Likewise. * gcc.target/i386/pr121208-2b.c: Likewise. * gcc.target/i386/pr121208-3a.c: Likewise. * gcc.target/i386/pr121208-3b.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-28nvptx/nvptx.opt: Update -march-map= for newer sm_xxx: test casesThomas Schwinge15-0/+285
Test cases for commit 60ba2b61af23e6d561c5cbab8df57ea093ade3b3 "nvptx/nvptx.opt: Update -march-map= for newer sm_xxx". gcc/testsuite/ * gcc.target/nvptx/march-map=sm_100.c: New. * gcc.target/nvptx/march-map=sm_100a.c: Likewise. * gcc.target/nvptx/march-map=sm_100f.c: Likewise. * gcc.target/nvptx/march-map=sm_101.c: Likewise. * gcc.target/nvptx/march-map=sm_101a.c: Likewise. * gcc.target/nvptx/march-map=sm_101f.c: Likewise. * gcc.target/nvptx/march-map=sm_103.c: Likewise. * gcc.target/nvptx/march-map=sm_103a.c: Likewise. * gcc.target/nvptx/march-map=sm_103f.c: Likewise. * gcc.target/nvptx/march-map=sm_120.c: Likewise. * gcc.target/nvptx/march-map=sm_120a.c: Likewise. * gcc.target/nvptx/march-map=sm_120f.c: Likewise. * gcc.target/nvptx/march-map=sm_121.c: Likewise. * gcc.target/nvptx/march-map=sm_121a.c: Likewise. * gcc.target/nvptx/march-map=sm_121f.c: Likewise.
2025-07-28tree-optimization/121256 - properly support SLP in vectorizable recurrenceRichard Biener2-0/+103
We failed to build the correct initialization vector. For VLA vectors and a non-uniform initialization vector this rejects vectorization for now. PR tree-optimization/121256 * tree-vect-loop.cc (vectorizable_recurr): Build a correct initialization vector for SLP_TREE_LANES > 1. * gcc.dg/vect/vect-recurr-pr121256.c: New testcase. * gcc.dg/vect/vect-recurr-pr121256-2.c: Likewise.
2025-07-28Daily bump.GCC Administrator1-0/+63
2025-07-27fortran: Trigger reference saving on pointer dereference [PR121185]Mikael Morin1-0/+24
This is a follow-up to revision: r16-2371-g8f41c87654fd819e48c9f6f1ac3d87e35794d310 fortran: Factor array descriptor references That revision introduced new variables to limit repeated subexpressions in array descriptor references. The change added a walk along the reference from child to parent, that selected subreferences worth saving and applied the saving if the reference proved non-trivial enough. Trivialness was defined in a comment as: only made of a DECL and NOPs and COMPONENTs. But the case of a pointer derefence didn't trigger the saving, so the code was also considering a dereference as if it was trivial. This change triggers the reference saving on pointer dereferences, making the trivialness as defined by the code aligned with the comment. This change is not strictly speaking a bug fix, but PR #121185 exhibited wrong code examples where the lack of a variable hiding the polymorphic leading part of a non-polymorphic array reference was causing the latter to be evaluated in a polymorphic way. PR fortran/121185 gcc/fortran/ChangeLog: * trans-array.cc (set_factored_descriptor_value): Also trigger the saving of the previously selected reference on encountering an INDIRECT_REF. Extract the saving code... (save_ref): ... here as a new function. gcc/testsuite/ChangeLog: * gfortran.dg/assign_14.f90: New test.
2025-07-27fortran: Bound class container lookup after array descriptor [PR121185]Mikael Morin1-0/+25
Don't look for a class container too far after an array descriptor. This avoids generating a polymorphic array reference, using the virtual table of a parent object, to access a non-polymorphic child having a type unrelated to that of the parent. PR fortran/121185 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_get_class_from_expr): Give up class container lookup on the second COMPONENT_REF after an array descriptor. gcc/testsuite/ChangeLog: * gfortran.dg/assign_13.f90: New test.
2025-07-27RISC-V: Add test case for vaadd.vx combine polluting VXRMPan Li4-0/+92
Add asm check to make sure vx combine of vaadd.vx will not pollute the vxrm. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Add test for vec_duplicate + vaadd.vv combine case 1 with GR2VR cost ↵Pan Li13-2/+67
0, 1 and 2 Add asm dump check test for vec_duplicate + vaadd.vv combine to vaadd.vx, with the GR2VR cost is 0, 1 and 2 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check. * 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-5-u8.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. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Add test for vec_duplicate + vaadd.vv combine case 0 with GR2VR cost ↵Pan Li18-19/+302
0, 1 and 15 Add asm dump check and run test for vec_duplicate + vaadd.vv combine to vaadd.vx, with the GR2VR cost is 0, 2 and 15 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check. * 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-2-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-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-1-i16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Fix another vf FP16 combine run test failuresPan Li2-2/+10
Like Robin's fix for vf combine f16.c run tests, there is still another failures similar. This patch would like to fix it as previous. will commit it directly if the CI agrees. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwnmacc-run-1-f16.c: Add zvfh requirements and options. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwnmsac-run-1-f16.c: Ditto. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27Daily bump.GCC Administrator1-0/+5
2025-07-27c++/modules: Stream some missing lang_type flagsNathaniel Shead2-0/+51
I noticed that trivial relocation didn't work in modules yet, and there are a couple of other flags that seem potentially useful we weren't streaming. This streams those flags and adds a comment to cp-tree.h in the hope that people will remember about modules when adding more! As a drive-by improvement, update gcc_assert with gcc_checking_assert in lang_type_bools streaming. gcc/cp/ChangeLog: * cp-tree.h (struct lang_type): Add comment mentioning modules. * module.cc (trees_out::lang_type_bools): Stream new flags, use gcc_checking_assert. (trees_in::lang_type_bools): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/class-11_a.H: New test. * g++.dg/modules/class-11_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-07-26Daily bump.GCC Administrator1-0/+160
2025-07-25Introduce lazily-created.hDavid Malcolm3-5/+7
No functional change intended. gcc/ChangeLog: * diagnostics/context.cc: Eliminate digraphs::lazy_digraph in favor of lazily_created template. * diagnostics/context.h: Likewise. * diagnostics/digraphs.cc: Likewise, also digraphs::lazy_digraphs. * diagnostics/digraphs.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/metadata.h: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/sink.h: Likewise. * diagnostics/text-sink.h: Likewise. * lazily-created.h: New file. * libgdiagnostics.cc: Eliminate digraphs::lazy_digraph in favor of lazily_created template. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Eliminate digraphs::lazy_digraph and digraphs::lazy_digraphs in favor of lazily_created template. * gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: Define INCLUDE_VECTOR since diagnostics/metadata.h now requires it. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: make context::m_source_printing privateDavid Malcolm7-19/+19
No functional change intended. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Make diagnostics::context::m_source_printing private. gcc/analyzer/ChangeLog: * program-point.cc: Make diagnostics::context::m_source_printing private. gcc/c-family/ChangeLog: * c-common.cc: Make diagnostics::context::m_source_printing private. * c-format.cc: Likewise. * c-opts.cc: Likewise. gcc/ChangeLog: * diagnostic.h (diagnostic_set_caret_max_width): Drop forward decl. (diagnostic_same_line): Make diagnostics::context::m_source_printing private. * diagnostics/context.cc (diagnostic_set_caret_max_width): Convert to... (diagnostics::context::set_caret_max_width): ...this. * diagnostics/context.h (diagnostics::context::get_source_printing_options): New accessors. (diagnostics::context::m_source_printing): Make private. * diagnostics/html-sink.cc: Make diagnostics::context::m_source_printing private. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-context.h (diagnostics::selftest::test_context::colorize_source): New. (diagnostics::selftest::test_context::show_labels): New. (diagnostics::selftest::test_context::show_line_numbers): New. (diagnostics::selftest::test_context::show_ruler): New. (diagnostics::selftest::test_context::show_event_links): New. (diagnostics::selftest::test_context::set_caret_char): New. * diagnostics/source-printing.cc: Make diagnostics::context::m_source_printing private. * diagnostics/text-sink.h: Likewise. * libgdiagnostics.cc: Likewise. * opts.cc: Likewise. * toplev.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Make diagnostics::context::m_source_printing private. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_show_trees.cc: Make diagnostics::context::m_source_printing private. * gcc.dg/plugin/diagnostic_plugin_test_inlining.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: eliminate ::diagnostic_info typedefDavid Malcolm4-6/+7
No functional change intended. gcc/c-family/ChangeLog: * c-common.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * c-opts.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". gcc/cp/ChangeLog: * constexpr.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * cp-tree.h: Likewise. * error.cc: Likewise. * module.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc: Likewise. gcc/ChangeLog: * diagnostic.h: Eliminate "diagnostic_info" typedef. * diagnostics/context.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * langhooks.cc: Likewise. * libgdiagnostics.cc: Likewise. * rtl-error.cc: Likewise. * substring-locations.cc: Likewise. * toplev.cc: Likewise. * tree-diagnostic.cc: Likewise. * tree-diagnostic.h: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * error.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * gm2-gcc/rtegraph.cc: Likewise. gcc/rust/ChangeLog: * resolve/rust-ice-finalizer.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * resolve/rust-ice-finalizer.h: Likewise. gcc/testsuite/ChangeLog: * g++.dg/plugin/show_template_tree_color_plugin.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. libcc1/ChangeLog: * context.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move file_cache from input.{cc,h} to diagnostics/file-cache.{cc,h}David Malcolm1-3/+5
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Add diagnostics/file-cache.o. * diagnostics/changes.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * diagnostics/context.cc: Likewise. * diagnostics/diagnostics-selftests.cc: Likewise. * diagnostics/diagnostics-selftests.h: Likewise. * diagnostics/file-cache.cc: New file, based on the file_cache and file_cache_slot material in input.cc. * diagnostics/file-cache.h: Likewise for input.h. * diagnostics/selftest-source-printing.h: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * diagnostics/source-printing.cc: Likewise. * final.cc: Likewise. * gcc-rich-location.cc: Likewise. * input.cc (default_charset_callback): Move to diagnostics/file-cache.cc. (file_cache::initialize_input_context): Likewise. (class file_cache_slot): Likewise. (file_cache::tune): Likewise. (file_cache::lookup_file): Likewise. (file_cache::forcibly_evict_file): Likewise. (file_cache::missing_trailing_newline_p): Likewise. (file_cache::add_buffered_content): Likewise. (file_cache::evicted_cache_tab_entry): Likewise. (file_cache::add_file): Likewise. (file_cache::file_cache): Likewise. (file_cache::dump): Likewise. (file_cache::dump): Likewise. (file_cache::lookup_or_add_file): Likewise. (find_end_of_line): Likewise. (file_cache::get_source_line): Likewise. (check_line): Likewise. (test_replacement): Likewise. (test_reading_source_line): Likewise. (test_reading_source_buffer): Likewise. * input.h (class char_span): Move to diagnostics/file-cache.h and into the "diagnostics::" namespace. (class file_cache_slot): Likewise. (class file_cache): Likewise. * libgdiagnostics.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * selftest.cc: Likewise. * selftest.h: Likewise. * substring-locations.h: Likewise. * toplev.cc: Likewise. gcc/c-family/ChangeLog: * c-format.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * c-indentation.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: convert diagnostic_t to enum class diagnostics::kindDavid Malcolm4-6/+7
No functional change intended. gcc/ChangeLog: * Makefile.in: Replace diagnostic.def with diagnostics/kinds.def. * config/aarch64/aarch64.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * config/i386/i386-options.cc: Likewise. * config/s390/s390.cc: Likewise. * diagnostic-core.h: Replace typedef diagnostic_t with enum class diagnostics::kind in diagnostics/kinds.h and include it. * diagnostic-global-context.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostics/buffering.cc: Likewise. * diagnostics/buffering.h: Likewise. * diagnostics/context.h: Likewise. * diagnostics/diagnostic-info.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostic.def: Move to... * diagnostics/kinds.def: ...here and update for diagnostic_t becoming enum class diagnostics::kind. * diagnostics/kinds.h: New file, based on material in diagnostic-core.h. * diagnostics/lazy-paths.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * diagnostics/option-classifier.cc: Likewise. * diagnostics/option-classifier.h: Likewise. * diagnostics/output-spec.h: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-context.h: Likewise. * diagnostics/sink.h: Likewise. * diagnostics/source-printing.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * diagnostics/text-sink.h: Likewise. * gcc.cc: Likewise. * libgdiagnostics.cc: Likewise. * lto-wrapper.cc: Likewise. * opts-common.cc: Likewise. * opts-diagnostic.h: Likewise. * opts.cc: Likewise. * rtl-error.cc: Likewise. * substring-locations.cc: Likewise. * toplev.cc: Likewise. gcc/ada/ChangeLog: * gcc-interface/trans.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/analyzer/ChangeLog: * pending-diagnostic.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * program-point.cc: Likewise. gcc/c-family/ChangeLog: * c-common.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * c-format.cc: Likewise. * c-lex.cc: Likewise. * c-opts.cc: Likewise. * c-pragma.cc: Likewise. * c-warn.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * c-parser.cc: Likewise. * c-typeck.cc: Likewise. gcc/cobol/ChangeLog: * util.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/cp/ChangeLog: * call.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * constexpr.cc: Likewise. * cp-tree.h: Likewise. * decl.cc: Likewise. * error.cc: Likewise. * init.cc: Likewise. * method.cc: Likewise. * module.cc: Likewise. * parser.cc: Likewise. * pt.cc: Likewise. * semantics.cc: Likewise. * typeck.cc: Likewise. * typeck2.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/fortran/ChangeLog: * cpp.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * error.cc: Likewise. * options.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * gm2-gcc/rtegraph.cc: Likewise. gcc/rust/ChangeLog: * backend/rust-tree.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * backend/rust-tree.h: Likewise. * resolve/rust-ast-resolve-expr.cc: Likewise. * resolve/rust-ice-finalizer.cc: Likewise. * resolve/rust-ice-finalizer.h: Likewise. * resolve/rust-late-name-resolver-2.0.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. * lib/gcc-dg.exp: Likewise. libcpp/ChangeLog: * internal.h: Update comment for diagnostic_t becoming enum class diagnostics::kind. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostics::edit_context -> diagnostics::changes::change_setDavid Malcolm1-4/+4
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostics/changes.o with diagnostics/edit-context.o. * diagnostic.cc: Update for move of diagnostics/edit-context.h to diagnostics/changes.h. (diagnostics::context::initialize): Update for renaming of m_edit_context_ptr to m_fixits_change_set. (diagnostics::context::finish): Likewise. (diagnostics::context::create_edit_context): Rename to... (diagnostics::context::initialize_fixits_change_set): ...this and update for other renamings. (diagnostics::context::report_diagnostic): Update for renaming of m_edit_context_ptr to m_fixits_change_set. * diagnostic.h (diagnostics::edit_context): Drop forward decl * diagnostics/edit-context.cc: Move to... * diagnostics/changes.cc: ...here. Update for move of diagnostics/edit-context.h to diagnostics/changes.h. Rename diagnostics::edit_context to diagnostics::changes::change_set. Rename diagnostics::edited_file to diagnostics::changes::changed_file. Rename diagnostics::edited_line to diagnostics::changes::changed_line. * diagnostics/edit-context.h: Move to... * diagnostics/changes.h: ...here, renaming as above. * diagnostics/context.h (diagnostics::changes::change_set): New forward decl. (diagnostics::context::create_edit_context): Rename to... (diagnostics::context::initialize_fixits_change_set): ...this. (diagnostics::context::get_edit_context): Rename to... (diagnostics::context::get_fixits_change_set): ...this. (diagnostics::context::m_edit_context_ptr): Rename to... (diagnostics::context::m_fixits_change_set): ..this and update type. * diagnostics/diagnostics-selftests.cc: Update for renaming. * diagnostics/diagnostics-selftests.h: Likewise. * diagnostics/html-sink.cc: Update for above changes. * libgdiagnostics.cc: Likewise. * toplev.cc: Likewise. gcc/c-family/ChangeLog: * c-common.cc: Update comment for renaming of edit_context. gcc/testsuite/ChangeLog: * gcc.dg/plugin/expensive_selftests_plugin.cc: Update for change from edit-context.h to changes.h. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: reorganize selftestsDavid Malcolm1-1/+1
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS): Move diagnostics/lazy-paths.o to... (OBJS-libcommon): ...here. Add diagnostics/diagnostics-selftests.o. * diagnostic.cc: Update for move of selftest::test_diagnostic_context to diagnostics::selftest::test_context. * diagnostics/color.cc: Move selftests from selftest:: to diagnostics::selftest::. * diagnostics/diagnostics-selftests.cc: New file. * diagnostics/diagnostics-selftests.h: New file. * diagnostics/digraphs.cc: Move selftests from selftest:: to diagnostics::selftest::. * diagnostics/edit-context.cc: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/lazy-paths.cc: Likewise. Eliminate use of "tree" by porting selftests from simple-diagnostic-path.h to diagnostics/selftest-paths.h. * diagnostics/output-spec.cc: Move selftests from selftest:: to diagnostics::selftest::. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Move selftest::test_diagnostic_context to diagnostics::selftest::test_context. * diagnostics/selftest-context.h: Likewise. * diagnostics/selftest-logical-locations.cc: Move selftests from selftest:: to diagnostics::logical_locations::selftest::. * diagnostics/selftest-logical-locations.h: Move selftest::logical_location_manager to diagnostics::logical_locations::selftest::logical_location_manager. * diagnostics/selftest-paths.cc: Move selftest::test_diagnostic_path to diagnostics::paths::selftest::test_path. Move selftest::test_diagnostic_event to diagnostics::paths::selftest::test_event. * diagnostics/selftest-paths.h: Likewise, and move selftest::test_diagnostic_thread to diagnostics::paths::selftest::test_thread. * diagnostics/selftest-source-printing.h: Move selftest::diagnostic_show_locus_fixture to diagnostics::selftest::source_printing_fixture. * diagnostics/source-printing.cc: Move selftests from selftest:: to diagnostics::selftest:: and update for renames. * diagnostics/state-graphs.cc: Likewise. * selftest-run-tests.cc: Include "diagnostics/diagnostics-selftests.h". (selftest::run_tests): Replace invocation of the various diagnostics selftests with a call to diagnostics::selftest::run_diagnostics_selftests. * selftest.h: Move decls of the various per-file diagnostics invocation functions to diagnostics/diagnostics-selftests.h, renaming due to diagostics prefix being implied by namespace. gcc/c-family/ChangeLog: * c-format.cc (test_type_mismatch_range_labels): Update for move of selftest::test_diagnostic_context to diagnostics::selftest::test_context. gcc/testsuite/ChangeLog: * gcc.dg/plugin/expensive_selftests_plugin.cc: Update for move of selftest::test_diagnostic_context to diagnostics::selftest::test_context. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move gcc/diagnostic-color.{h,cc} to gcc/diagnostics/color.{h,cc}David Malcolm3-3/+3
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostic-color.o with diagnostics/color.o. (PLUGIN_HEADERS): Remove diagnostic-color.h in favor of glob. * common.opt: Update for move of diagnostic-color.h to diagnostics/color.h. * diagnostic.cc: Likewise. * diagnostic-color.cc: Move to... * diagnostics/color.cc: ...here. * diagnostic-color.h: Move to... * diagnostics/color.h: ...here. * diagnostics/edit-context.cc: Update for move of diagnostic-color.h to diagnostics/color.h. * diagnostics/output-spec.cc: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/source-printing.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * libgdiagnostics.cc: Likewise. * opts.cc: Likewise. * pretty-print-markup.h: Likewise. * pretty-print.cc: Likewise. * selftest-run-tests.cc: Likewise. * selftest.h: Likewise. * text-art/style.cc: Likewise. gcc/cp/ChangeLog: * error.cc: Update for move of diagnostic-color.h to diagnostics/color.h. gcc/fortran/ChangeLog: * error.cc: Update for move of diagnostic-color.h to diagnostics/color.h. gcc/m2/ChangeLog: * gm2-gcc/m2color.cc: Update for move of diagnostic-color.h to diagnostics/color.h. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Update for move of diagnostic-color.h to diagnostics/color.h. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move gcc/selftest-diagnostic.{h,cc} -> ↵David Malcolm1-1/+1
gcc/diagnostics/selftest-context.{h,cc} No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace selftest-diagnostic.o with diagnostics/selftest-context.o. * diagnostic.cc: Update for move of selftest-diagnostic.h to diagnostics/selftest-context.h. * diagnostics/html-sink.cc: Likewise. * diagnostics/lazy-paths.cc: Likewise. * diagnostics/output-spec.cc: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * selftest-diagnostic.cc: Move to... * diagnostics/selftest-context.cc: ...here and update for move of header file. * selftest-diagnostic.h: Move to... * diagnostics/selftest-context.h: ...here. * diagnostics/source-printing.cc: Update for move of selftest-diagnostic.h to diagnostics/selftest-context.h. gcc/c-family/ChangeLog: * c-format.cc: Update for move of selftest-diagnostic.h to diagnostics/selftest-context.h. gcc/testsuite/ChangeLog: * gcc.dg/plugin/expensive_selftests_plugin.cc: Update for move of selftest-diagnostic.h to diagnostics/selftest-context.h. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostic_context to diagnostics::context in its own headerDavid Malcolm4-13/+13
No functional change intended. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Update for diagnostic_context becoming diagnostics::context. gcc/analyzer/ChangeLog: * program-point.cc: : Update for diagnostic_context becoming diagnostics::context, and for diagnostic_source_print_policy becoming diagnostics::source_print_policy. gcc/c-family/ChangeLog: * c-common.h: Update for diagnostic_context becoming diagnostics::context. * c-opts.cc: Likewise. gcc/c/ChangeLog: * c-objc-common.cc: Update for diagnostic_context becoming diagnostics::context. * c-tree.h: Likewise. gcc/ChangeLog: * coretypes.h: Update for diagnostic_context becoming diagnostics::context. * diagnostic-global-context.cc: Likewise. * diagnostic.cc: Likewise. Also for diagnostic_option_classifier becoming diagnostics::option_classifier. * diagnostic.h (diagnostic_text_starter_fn): Rename to... (diagnostics::text_starter_fn): ...this, and move to diagnostics/context.h. (get_printer): Rename to... (diagnostics::get_printer): ...this, and move to diagnostics/context.h. (class diagnostic_option_manager): Rename to... (class diagnostics::option_manager): ...this, and move to diagnostics/context.h. (class diagnostic_option_classifier): Rename to... (class diagnostics::option_classifier): ...this, and move to diagnostics/context.h. (struct diagnostic_source_printing_options): Rename to... (struct diagnostics::source_printing_options): ...this, and move to diagnostics/context.h. (class diagnostic_column_policy): Rename to... (class diagnostics::column_policy): ...this, and move to diagnostics/context.h. (class diagnostic_location_print_policy): Rename to... (class diagnostics::location_print_policy): ...this, and move to diagnostics/context.h. (class html_label_writer): Rename to... (class diagnostics::html_label_writer): ...this, and move to diagnostics/context.h. (class diagnostic_source_print_policy): Rename to... (class diagnostics::source_print_policy): ...this, and move to diagnostics/context.h. (struct diagnostic_counters): Rename to... (struct diagnostics::counters): ...this, and move to diagnostics/context.h. (class diagnostic_context): Rename to... (class diagnostics::context): ...this, and move to diagnostics/context.h. (diagnostic_text_starter): Rename to... (diagnostics::text_starter): ...this, and move to diagnostics/context.h. (diagnostic_start_span): Rename to... (diagnostics::start_span): ...this, and move to diagnostics/context.h. (diagnostic_text_finalizer): Rename to... (diagnostics::text_finalizer): ...this, and move to diagnostics/context.h. Include "diagnostics/context.h". * diagnostics/buffering.h: Update for diagnostic_context becoming diagnostics::context; similarly for diagnostic_counters. * diagnostics/client-data-hooks.h: Likewise. * diagnostics/context.h: New file, taken from material in diagnostic.h. * diagnostics/html-sink.cc: : Update for diagnostic_context becoming diagnostics::context. * diagnostics/html-sink.h: Likewise. * diagnostics/lazy-paths.cc: Likewise for diagnostic_option_manager. * diagnostics/output-file.h: Likewise for diagnostic_context. * diagnostics/output-spec.cc: Likewise. * diagnostics/output-spec.h: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/sarif-sink.h: Likewise. * diagnostics/sink.h: Likewise. * diagnostics/source-printing.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * diagnostics/text-sink.h: Likewise. * gcc-rich-location.h: Likewise. * gcc.cc: Likewise. * gdbinit.in: Likewise. * langhooks-def.h: Likewise. * langhooks.cc: Likewise. * langhooks.h: Likewise. * libgdiagnostics.cc: Likewise. * optc-gen.awk: Likewise. * opth-gen.awk: Likewise. * opts-common.cc: Likewise. * opts-diagnostic.cc: Likewise. * opts-diagnostic.h: Likewise. * opts-global.cc: Likewise. * opts.cc: Likewise. * opts.h: Likewise. * selftest-diagnostic.cc: Likewise. * selftest-diagnostic.h: Likewise. * toplev.cc: Likewise. * tree-diagnostic-client-data-hooks.cc: Likewise. * tree-diagnostic.cc: Likewise. * tree-diagnostic.h: Likewise. gcc/cp/ChangeLog: * cp-tree.h: Update for diagnostic_context becoming diagnostics::context. * error.cc: Likewise. * module.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Update for diagnostic_context becoming diagnostics::context. gcc/jit/ChangeLog: * dummy-frontend.cc: Update for diagnostic_context becoming diagnostics::context. * jit-playback.h: Likewise. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc: Update for diagnostic_text_finalizer becoming diagnostics::text_finalizer. * resolve/rust-late-name-resolver-2.0.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/plugin/show_template_tree_color_plugin.cc: Update for moves to namespace diagnostics. * gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: add m_ prefix to fields of diagnostic_infoDavid Malcolm1-1/+1
No functional change intended. gcc/c-family/ChangeLog: * c-opts.cc (c_diagnostic_text_finalizer): Add "m_" prefix to fields of diagnostic_info. gcc/c/ChangeLog: * c-errors.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/cp/ChangeLog: * constexpr.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. * error.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc (d_diagnostic_report_diagnostic): Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/ChangeLog: * diagnostic.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. * diagnostic.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * libgdiagnostics.cc: Likewise. * substring-locations.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. Signed-off-by: David Malcolm <dmalcolm@redhat.com>