aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-23tree-optimization/116791 - Elementwise SLP vectorizationRichard Biener2-6/+37
The following restricts the elementwise SLP vectorization to the single-lane case which is the reason I enabled it to avoid regressions with non-SLP. The PR shows that multi-line SLP loads with elementwise accesses require work, I'll open a new bug to track this for the future. PR tree-optimization/116791 * tree-vect-stmts.cc (get_group_load_store_type): Only fall back to elementwise access for single-lane SLP, restore hard failure mode for other cases. * gcc.dg/vect/pr116791.c: New testcase.
2024-09-23gcn/mkoffload.cc: Re-add fprintf for #include of stdlib.h/stdbool.hTobias Burnus1-0/+6
In commit r15-3629-g508ef585243d4674d06b0737bfe8769fc18f824f, #embed was added and no longer required fprintf '#include' removed, missing somehow that with -mstack-size=, the generated configure_stack_size will use 'setenv' and 'true'. gcc/ChangeLog: * config/gcn/mkoffload.cc (process_asm): (Re)add the fprintf lines for stdlib.h/stdbool.h inclusion if gcn_stack_size is used.
2024-09-23Genmatch: Fix ICE for binary phi cfg mismatching [PR116795]Pan Li2-1/+15
This patch would like to fix one ICE when try to match the binary phi for below cfg. We check the first edge of the Phi block comes from b0, instead of check the only one edge of b1 comes from the b0 too. Thus, it will result in some code to be recog as .SAT_SUB but it is not, and finally result the verify_ssa failure. +------+ | b0: | | def | +-----+ | ... | | b1: | | cond |------>| def | +------+ | ... | | +-----+ | | | | v | +-----+ | | b2: | | | Phi |<----------+ +-----+ The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. PR target/116795 gcc/ChangeLog: * gimple-match-head.cc (match_cond_with_binary_phi): Fix the incorrect cfg check as b0->b1 in above example. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116795-1.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-23gimple: Simplify gimple_seq_nondebug_singleton_pAndrew Pinski1-21/+2
The implementation of gimple_seq_nondebug_singleton_p was convoluted on how to determine if the sequence was a singleton (which could contain debug statements). This simplifies the function into two calls. One to get the start after all of the debug statements and then check to see if it is at the one before the end (or there is only debug statements afterwards). Bootstrapped and tested on x86_64-linux-gnu (including ada). gcc/ChangeLog: * gimple-iterator.h (gimple_seq_nondebug_singleton_p): Rewrite to be simplely, gsi_start_nondebug/gsi_one_nondebug_before_end_p. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-23gimple: Remove custom remove_pointerAndrew Pinski1-6/+2
Since r11-2700-g22dc89f8073cd0, type_traits has been included via system.h so we don't need a custom version for gimple.h. Note a small C++14 cleanup is to use remove_pointer_t directly here instead of remove_pointer<t>::type. bootstrapped and tested on x86_64-linux-gnu gcc/ChangeLog: * gimple.h (remove_pointer): Remove. (GIMPLE_CHECK2): Use std::remove_pointer instead of custom one. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-23Remove commented out PHI_ARG_DEF macro defitionAndrew Pinski1-3/+0
This was commented out since r0-125500-g80560f9521f81a and a new defition was added at the same time. Let's remove the commented out version. gcc/ChangeLog: * tree-ssa-operands.h (PHI_ARG_DEF): Remove definition. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-23Update email in MAINTAINERS file.Aldy Hernandez1-4/+5
ChangeLog: * MAINTAINERS: Update email and add myself to DCO.
2024-09-23Match: Support form 2 for vector signed integer .SAT_ADDPan Li1-0/+16
This patch would like to support the form 2 of the vector signed integer .SAT_ADD. Aka below example: Form 2: #define DEF_VEC_SAT_S_ADD_FMT_2(T, UT, MIN, MAX) \ void __attribute__((noinline)) \ vec_sat_s_add_##T##_fmt_2 (T *out, T *op_1, T *op_2, unsigned limit) \ { \ unsigned i; \ for (i = 0; i < limit; i++) \ { \ T x = op_1[i]; \ T y = op_2[i]; \ T sum = (UT)x + (UT)y; \ if ((x ^ y) < 0 || (sum ^ x) >= 0) \ out[i] = sum; \ else \ out[i] = x < 0 ? MIN : MAX; \ } \ } DEF_VEC_SAT_S_ADD_FMT_2(int8_t, uint8_t, INT8_MIN, INT8_MAX) Before this patch: 104 │ loop_len_79 = MIN_EXPR <ivtmp.51_53, POLY_INT_CST [16, 16]>; 105 │ _50 = &MEM <vector([16,16]) signed char> [(int8_t *)vectp_op_1.9_77]; 106 │ vect_x_18.11_80 = .MASK_LEN_LOAD (_50, 8B, { -1, ... }, loop_len_79, 0); 107 │ _70 = vect_x_18.11_80 >> 7; 108 │ vect_x.12_81 = VIEW_CONVERT_EXPR<vector([16,16]) unsigned char>(vect_x_18.11_80); 109 │ _26 = (void *) ivtmp.47_20; 110 │ _27 = &MEM <vector([16,16]) signed char> [(int8_t *)_26]; 111 │ vect_y_20.15_84 = .MASK_LEN_LOAD (_27, 8B, { -1, ... }, loop_len_79, 0); 112 │ vect__7.21_90 = vect_x_18.11_80 ^ vect_y_20.15_84; 113 │ mask__50.23_92 = vect__7.21_90 >= { 0, ... }; 114 │ vect_y.16_85 = VIEW_CONVERT_EXPR<vector([16,16]) unsigned char>(vect_y_20.15_84); 115 │ vect__6.17_86 = vect_x.12_81 + vect_y.16_85; 116 │ vect_sum_21.18_87 = VIEW_CONVERT_EXPR<vector([16,16]) signed char>(vect__6.17_86); 117 │ vect__8.19_88 = vect_x_18.11_80 ^ vect_sum_21.18_87; 118 │ mask__45.20_89 = vect__8.19_88 < { 0, ... }; 119 │ mask__44.24_93 = mask__45.20_89 & mask__50.23_92; 120 │ _40 = .COND_XOR (mask__44.24_93, _70, { 127, ... }, vect_sum_21.18_87); 121 │ _60 = (void *) ivtmp.49_6; 122 │ _61 = &MEM <vector([16,16]) signed char> [(int8_t *)_60]; 123 │ .MASK_LEN_STORE (_61, 8B, { -1, ... }, loop_len_79, 0, _40); 124 │ vectp_op_1.9_78 = vectp_op_1.9_77 + POLY_INT_CST [16, 16]; 125 │ ivtmp.47_4 = ivtmp.47_20 + POLY_INT_CST [16, 16]; 126 │ ivtmp.49_21 = ivtmp.49_6 + POLY_INT_CST [16, 16]; 127 │ ivtmp.51_98 = ivtmp.51_53; 128 │ ivtmp.51_8 = ivtmp.51_53 + POLY_INT_CST [18446744073709551600, 18446744073709551600]; After this patch: 88 │ _103 = .SELECT_VL (ivtmp_101, POLY_INT_CST [16, 16]); 89 │ vect_x_18.11_90 = .MASK_LEN_LOAD (vectp_op_1.9_88, 8B, { -1, ... }, _103, 0); 90 │ vect_y_20.14_94 = .MASK_LEN_LOAD (vectp_op_2.12_92, 8B, { -1, ... }, _103, 0); 91 │ vect_patt_49.15_95 = .SAT_ADD (vect_x_18.11_90, vect_y_20.14_94); 92 │ .MASK_LEN_STORE (vectp_out.16_97, 8B, { -1, ... }, _103, 0, vect_patt_49.15_95); 93 │ vectp_op_1.9_89 = vectp_op_1.9_88 + _103; 94 │ vectp_op_2.12_93 = vectp_op_2.12_92 + _103; 95 │ vectp_out.16_98 = vectp_out.16_97 + _103; 96 │ ivtmp_102 = ivtmp_101 - _103; The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * match.pd: Add the case 3 for signed .SAT_ADD matching. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-23RISC-V: Add testcases for form 2 of signed vector SAT_ADDPan Li9-0/+128
Form 2: #define DEF_VEC_SAT_S_ADD_FMT_2(T, UT, MIN, MAX) \ void __attribute__((noinline)) \ vec_sat_s_add_##T##_fmt_2 (T *out, T *op_1, T *op_2, unsigned limit) \ { \ unsigned i; \ for (i = 0; i < limit; i++) \ { \ T x = op_1[i]; \ T y = op_2[i]; \ T sum = (UT)x + (UT)y; \ if ((x ^ y) < 0 || (sum ^ x) >= 0) \ out[i] = sum; \ else \ out[i] = x < 0 ? MIN : MAX; \ } \ } DEF_VEC_SAT_S_ADD_FMT_2 (int8_t, uint8_t, INT8_MIN, INT8_MAX) The below test are passed for this patch. * The rv64gcv fully regression test. It is test only patch and obvious up to a point, will commit it directly if no comments in next 48H. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vec_sat_arith.h: Add test helper macro. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-5.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-6.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-7.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-8.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-5.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-6.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-7.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-23testsuite/gfortran.dg/unsigned_22.f90: Add missing close with delete, PR116701Hans-Peter Nilsson1-0/+1
Without this patch, gfortran.dg/unsigned_22.f90 fails for non-effective-target fd_truncate targets, i.e. targets that don't support chsize or ftruncate. See also libgfortran/io/unix.c:raw_truncate. It passes on the first run, but leaves behind a file "fort.10" which is then picked up by subsequent runs, but since that file is to be rewritten, the libgfortran machinery tries to truncate it, which fails. The file always being left behind, is primarily because the test-case lacks a deleting close-statement, apparently accidentally. Incidentally, this "fort.10" artefact is also picked up by gfortran.dg/write_check3.f90 causing that test to fail too, observable as a regression for non-fd_truncate targets since the unsigned_22.f90 introduction. Also, when running e.g. the whole of gfortran.dg/dg.exp, the "fort.10" is later deleted by gfortran.dg/write_direct_eor.f90 (which regardlessly passes), erasing the clue of the cause of the write_check3 failure. Also, running just dg.exp=write_check3.f90 or manually repeating the commands in gfortran.log showed no error. N.B.: this close-statement will not help if unsigned_22 for some reason fails, executing one of the "stop" statements, but that's also the case for many other tests. PR testsuite/116701 * gfortran.dg/unsigned_22.f90: Add missing close with delete.
2024-09-23Daily bump.GCC Administrator5-1/+142
2024-09-23RISC-V: Add testcases for form 4 of signed scalar SAT_ADDPan Li9-0/+200
Form 4: #define DEF_SAT_S_ADD_FMT_4(T, UT, MIN, MAX) \ T __attribute__((noinline)) \ sat_s_add_##T##_fmt_4 (T x, T y) \ { \ T sum; \ bool overflow = __builtin_add_overflow (x, y, &sum); \ return !overflow ? sum : x < 0 ? MIN : MAX; \ } DEF_SAT_S_ADD_FMT_4 (int64_t, uint64_t, INT64_MIN, INT64_MAX) The below test are passed for this patch. * The rv64gcv fully regression test. It is test only patch and obvious up to a point, will commit it directly if no comments in next 48H. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat_arith.h: Add test helper macros. * gcc.target/riscv/sat_s_add-13.c: New test. * gcc.target/riscv/sat_s_add-14.c: New test. * gcc.target/riscv/sat_s_add-15.c: New test. * gcc.target/riscv/sat_s_add-16.c: New test. * gcc.target/riscv/sat_s_add-run-13.c: New test. * gcc.target/riscv/sat_s_add-run-14.c: New test. * gcc.target/riscv/sat_s_add-run-15.c: New test. * gcc.target/riscv/sat_s_add-run-16.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-23RISC-V: Add testcases for form 3 of signed scalar SAT_ADDPan Li9-0/+200
This patch would like to add testcases of the signed scalar SAT_ADD for form 3. Aka: Form 3: #define DEF_SAT_S_ADD_FMT_3(T, UT, MIN, MAX) \ T __attribute__((noinline)) \ sat_s_add_##T##_fmt_3 (T x, T y) \ { \ T sum; \ bool overflow = __builtin_add_overflow (x, y, &sum); \ return overflow ? x < 0 ? MIN : MAX : sum; \ } DEF_SAT_S_ADD_FMT_3 (int64_t, uint64_t, INT64_MIN, INT64_MAX) The below test are passed for this patch. * The rv64gcv fully regression test. It is test only patch and obvious up to a point, will commit it directly if no comments in next 48H. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat_arith.h: Add test helper macros. * gcc.target/riscv/sat_s_add-10.c: New test. * gcc.target/riscv/sat_s_add-11.c: New test. * gcc.target/riscv/sat_s_add-12.c: New test. * gcc.target/riscv/sat_s_add-9.c: New test. * gcc.target/riscv/sat_s_add-run-10.c: New test. * gcc.target/riscv/sat_s_add-run-11.c: New test. * gcc.target/riscv/sat_s_add-run-12.c: New test. * gcc.target/riscv/sat_s_add-run-9.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-22testsuite, coroutines: Add tests for non-supension ramp returns.Iain Sandoe2-0/+256
Although it is most common for the ramp function to see a return when a coroutine first suspends, there are other possibilities. For example all the awaits could be ready - effectively the coroutine will then run to completion and deallocation. Another case is where the first active suspension point causes the current routine to be cancelled and thence destroyed. These cases are tested here. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/special-termination-00-sync-completion.C: New test. * g++.dg/coroutines/torture/special-termination-01-self-destruct.C: New test. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-22libgcc, Darwin: From macOS 11, make that the earliest supported.Iain Sandoe2-1/+7
For libgcc, we have (so far) supported building a DSO that supports earlier versions of the OS than the target. From macOS 11, there are APIs that do not exist on earlier OS versions, so limit the libgcc range to macOS11..current. libgcc/ChangeLog: * config.host: From macOS 11, limit earliest macOS support to macOS 11. * config/t-darwin-min-11: New file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-22libstdc++: Disable std::formatter<char8_t, C> specializationJonathan Wakely2-25/+45
I noticed that char8_t was missing from the list of types that were prevented from using the std::formatter partial specialization for integer types. That partial specialization was also matching cv-qualified integer types, because std::integral<const int> is true. This change simplifies the constraints by introducing a new variable template which is only true for cv-unqualified integer types, with explicit specializations to exclude the character types. This should be slightly more efficient than the previous constraints that checked std::integral<T> and (!__is_one_of<T, char, wchar_t, ...>). It also avoids the need for a separate std::formatter specialization for 128-bit integers, as they can be handled by the new variable template too. libstdc++-v3/ChangeLog: * include/std/format (__format::__is_formattable_integer): New variable template and specializations. (template<integral, __char> struct formatter): Replace constraints on first arg with __is_formattable_integer. * testsuite/std/format/formatter/requirements.cc: Check that std::formatter specializations for char8_t and const int are disabled.
2024-09-22libstdc++: Fix condition for ranges::copy to use memmove [PR116754]Jonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: PR libstdc++/116754 * include/bits/ranges_algobase.h (__copy_or_move): Fix order of arguments to __memcpyable.
2024-09-22libstdc++: Fix formatting of most negative chrono::duration [PR116755]Jonathan Wakely2-2/+22
When formatting chrono::duration<signed-integer-type, P>::min() we were causing undefined behaviour by trying to form the negative of the most negative value. If we convert negative durations with integer rep to the corresponding unsigned integer rep then we can safely represent all values. libstdc++-v3/ChangeLog: PR libstdc++/116755 * include/bits/chrono_io.h (formatter<duration<R,P>>::format): Cast negative integral durations to unsigned rep. * testsuite/20_util/duration/io.cc: Test the most negative integer durations.
2024-09-22libstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector>Jonathan Wakely1-3/+3
For the operator<=> overload we can use the 'constexpr' keyword directly, because we know the language dialect is at least C++20. libstdc++-v3/ChangeLog: * include/bits/stl_vector.h (operator<=>): Use constexpr instead of _GLIBCXX20_CONSTEXPR macro.
2024-09-22libstdc++: Silence -Wattributes warning in exception_ptrJonathan Wakely1-2/+1
libstdc++-v3/ChangeLog: * libsupc++/exception_ptr.h (__exception_ptr::_M_safe_bool_dummy): Remove __attribute__((const)) from function returning void.
2024-09-22libstdc++: Silence -Woverloaded-virtual warning in cxx11-ios_failure.ccJonathan Wakely1-0/+2
libstdc++-v3/ChangeLog: * src/c++11/cxx11-ios_failure.cc (__iosfail_type_info): Unhide the three-arg overload of __do_upcast.
2024-09-22libstdc++: Reorder C++26 entries in version.defJonathan Wakely2-37/+37
This puts the C++26 ftms definitions in alphabetical order. libstdc++-v3/ChangeLog: * include/bits/version.def: Sort C++26 entries alphabetically. * include/bits/version.h: Regenerate.
2024-09-22libstdc++: add default template parameters to algorithmsJonathan Wakely19-81/+392
This implements P2248R8 + P3217R0, both approved for C++26. The changes are mostly mechanical; the struggle is to keep readability with the pre-P2248 signatures. * For containers, "classic STL" algorithms and their parallel versions, introduce a macro and amend their declarations/definitions with it. The macro either expands to the defaulted parameter or to nothing in pre-C++26 modes. * For range algorithms, we need to reorder their template parameters. I've done so unconditionally, because users cannot rely on template parameters of algorithms (this is explicitly authorized by [algorithms.requirements]/15). The defaults are then hidden behind another macro. libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h: Add projected_value_t. * include/bits/algorithmfwd.h: Add the default template parameter to the relevant forward declarations. * include/pstl/glue_algorithm_defs.h: Likewise. * include/bits/ranges_algo.h: Add the default template parameter to range-based algorithms. * include/bits/ranges_algobase.h: Likewise. * include/bits/ranges_util.h: Likewise. * include/bits/ranges_base.h: Add helper macros. * include/bits/stl_iterator_base_types.h: Add helper macro. * include/bits/version.def: Add the new feature-testing macro. * include/bits/version.h: Regenerate. * include/std/algorithm: Pull the feature-testing macro. * include/std/ranges: Likewise. * include/std/deque: Pull the feature-testing macro, add the default for std::erase. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/string: Likewise. * include/std/vector: Likewise. * testsuite/23_containers/default_template_value.cc: New test. * testsuite/25_algorithms/default_template_value.cc: New test. Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
2024-09-22middle-end: lower COND_EXPR into gimple form in vect_recog_bool_patternTamar Christina9-9/+139
Currently the vectorizer cheats when lowering COND_EXPR during bool recog. In the cases where the conditonal is loop invariant or non-boolean it instead converts the operation back into GENERIC and hides much of the operation from the analysis part of the vectorizer. i.e. a ? b : c is transformed into: a != 0 ? b : c however by doing so we can't perform any optimization on the mask as they aren't explicit until quite late during codegen. To fix this this patch lowers booleans earlier and so ensures that we are always in GIMPLE. For when the value is a loop invariant boolean we have to generate an additional conversion from bool to the integer mask form. This is done by creating a loop invariant a ? -1 : 0 with the target mask precision and then doing a normal != 0 comparison on that. To support this the patch also adds the ability to during pattern matching create a loop invariant pattern that won't be seen by the vectorizer and will instead me materialized inside the loop preheader in the case of loops, or in the case of BB vectorization it materializes it in the first BB in the region. gcc/ChangeLog: * tree-vect-patterns.cc (append_inv_pattern_def_seq): New. (vect_recog_bool_pattern): Lower COND_EXPRs. * tree-vect-slp.cc (vect_slp_region): Materialize loop invariant statements. * tree-vect-loop.cc (vect_transform_loop): Likewise. * tree-vect-stmts.cc (vectorizable_comparison_1): Remove VECT_SCALAR_BOOLEAN_TYPE_P handling for vectype. * tree-vectorizer.cc (vec_info::vec_info): Initialize inv_pattern_def_seq. * tree-vectorizer.h (LOOP_VINFO_INV_PATTERN_DEF_SEQ): New. (class vec_info): Add inv_pattern_def_seq. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-conditional_store_1.c: New test. * gcc.dg/vect/vect-conditional_store_5.c: New test. * gcc.dg/vect/vect-conditional_store_6.c: New test.
2024-09-22aarch64: Take into account when VF is higher than known scalar itersTamar Christina10-29/+79
Consider low overhead loops like: void foo (char *restrict a, int *restrict b, int *restrict c, int n) { for (int i = 0; i < 9; i++) { int res = c[i]; int t = b[i]; if (a[i] != 0) res = t; c[i] = res; } } For such loops we use latency only costing since the loop bounds is known and small. The current costing however does not consider the case where niters < VF. So when comparing the scalar vs vector costs it doesn't keep in mind that the scalar code can't perform VF iterations. This makes it overestimate the cost for the scalar loop and we incorrectly vectorize. This patch takes the minimum of the VF and niters in such cases. Before the patch we generate: note: Original vector body cost = 46 note: Vector loop iterates at most 1 times note: Scalar issue estimate: note: load operations = 2 note: store operations = 1 note: general operations = 1 note: reduction latency = 0 note: estimated min cycles per iteration = 1.000000 note: estimated cycles per vector iteration (for VF 32) = 32.000000 note: SVE issue estimate: note: load operations = 5 note: store operations = 4 note: general operations = 11 note: predicate operations = 12 note: reduction latency = 0 note: estimated min cycles per iteration without predication = 5.500000 note: estimated min cycles per iteration for predication = 12.000000 note: estimated min cycles per iteration = 12.000000 note: Low iteration count, so using pure latency costs note: Cost model analysis: vs after: note: Original vector body cost = 46 note: Known loop bounds, capping VF to 9 for analysis note: Vector loop iterates at most 1 times note: Scalar issue estimate: note: load operations = 2 note: store operations = 1 note: general operations = 1 note: reduction latency = 0 note: estimated min cycles per iteration = 1.000000 note: estimated cycles per vector iteration (for VF 9) = 9.000000 note: SVE issue estimate: note: load operations = 5 note: store operations = 4 note: general operations = 11 note: predicate operations = 12 note: reduction latency = 0 note: estimated min cycles per iteration without predication = 5.500000 note: estimated min cycles per iteration for predication = 12.000000 note: estimated min cycles per iteration = 12.000000 note: Increasing body cost to 1472 because the scalar code could issue within the limit imposed by predicate operations note: Low iteration count, so using pure latency costs note: Cost model analysis: gcc/ChangeLog: * config/aarch64/aarch64.cc (adjust_body_cost): Cap VF for low iteration loops. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/asrdiv_4.c: Update bounds. * gcc.target/aarch64/sve/cond_asrd_2.c: Likewise. * gcc.target/aarch64/sve/cond_uxt_6.c: Likewise. * gcc.target/aarch64/sve/cond_uxt_7.c: Likewise. * gcc.target/aarch64/sve/cond_uxt_8.c: Likewise. * gcc.target/aarch64/sve/miniloop_1.c: Likewise. * gcc.target/aarch64/sve/spill_6.c: Likewise. * gcc.target/aarch64/sve/sve_iters_low_1.c: New test. * gcc.target/aarch64/sve/sve_iters_low_2.c: New test.
2024-09-22Daily bump.GCC Administrator6-1/+193
2024-09-21fortran: Add -finline-intrinsics flag for MINLOC/MAXLOC [PR90608]Mikael Morin10-5/+927
Introduce the -finline-intrinsics flag to control from the command line whether to generate either inline code or calls to the functions from the library, for the MINLOC and MAXLOC intrinsics. The flag allows to specify inlining either independently for each intrinsic (either MINLOC or MAXLOC), or all together. For each intrinsic, a default value is set if none was set. The default value depends on the optimization setting: inlining is avoided if not optimizing or if optimizing for size; otherwise inlining is preferred. There is no direct support for this behaviour provided by the .opt options framework. It is obtained by defining three different variants of the flag (finline-intrinsics, fno-inline-intrinsics, finline-intrinsics=) all using the same underlying option variable. Each enum value (corresponding to an intrinsic function) uses two identical bits, and the variable is initialized with alternated bits, so that we can tell whether the value was set or not by checking whether the two bits have different values. PR fortran/90608 gcc/ChangeLog: * flag-types.h (enum gfc_inlineable_intrinsics): New type. gcc/fortran/ChangeLog: * invoke.texi(finline-intrinsics): Document new flag. * lang.opt (finline-intrinsics, finline-intrinsics=, fno-inline-intrinsics): New flags. * options.cc (gfc_post_options): If the option variable controlling the inlining of MAXLOC (respectively MINLOC) has not been set, set it or clear it depending on the optimization option variables. * trans-intrinsic.cc (gfc_inline_intrinsic_function_p): Return false if inlining for the intrinsic is disabled according to the option variable. gcc/testsuite/ChangeLog: * gfortran.dg/minmaxloc_18.f90: New test. * gfortran.dg/minmaxloc_18a.f90: New test. * gfortran.dg/minmaxloc_18b.f90: New test. * gfortran.dg/minmaxloc_18c.f90: New test. * gfortran.dg/minmaxloc_18d.f90: New test.
2024-09-21fortran: Continue MINLOC/MAXLOC second loop where the first stopped [PR90608]Mikael Morin1-2/+31
Continue the second set of loops where the first one stopped in the generated inline MINLOC/MAXLOC code in the cases where the generated code contains two sets of loops. This fixes a regression that was introduced when enabling the generation of inline MINLOC/MAXLOC code with ARRAY of rank greater than 1, no DIM argument, and either non-scalar MASK or floating- point ARRAY. In the cases where two sets of loops are generated as inline MINLOC/MAXLOC code, we previously generated code such as (for rank 2 ARRAY, so with two levels of nesting): for (idx11 in lower1..upper1) { for (idx12 in lower2..upper2) { ... if (...) { ... goto second_loop; } } } second_loop: for (idx21 in lower1..upper1) { for (idx22 in lower2..upper2) { ... } } which means we process the first elements twice, once in the first set of loops and once in the second one. This change avoids this duplicate processing by using a conditional as lower bound for the second set of loops, generating code like: second_loop_entry = false; for (idx11 in lower1..upper1) { for (idx12 in lower2..upper2) { ... if (...) { ... second_loop_entry = true; goto second_loop; } } } second_loop: for (idx21 in (second_loop_entry ? idx11 : lower1)..upper1) { for (idx22 in (second_loop_entry ? idx12 : lower2)..upper2) { ... second_loop_entry = false; } } It was expected that the compiler optimizations would be able to remove the state variable second_loop_entry. It is the case if ARRAY has rank 1 (so without loop nesting), the variable is removed and the loop bounds become unconditional, which restores previously generated code, fully fixing the regression. For larger rank, unfortunately, the state variable and conditional loop bounds remain, but those cases were previously using library calls, so it's not a regression. PR fortran/90608 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Generate a set of index variables. Set them using the loop indexes before leaving the first set of loops. Generate a new loop entry predicate. Initialize it. Set it before leaving the first set of loops. Clear it in the body of the second set of loops. For the second set of loops, update each loop lower bound to use the corresponding index variable if the predicate variable is set.
2024-09-21fortran: Inline non-character MINLOC/MAXLOC with no DIM [PR90608]Mikael Morin3-48/+87
Enable generation of inline MINLOC/MAXLOC code in the case where DIM is not present, and either ARRAY is of floating point type or MASK is an array. Those cases are the remaining bits to fully support inlining of non-CHARACTER MINLOC/MAXLOC without DIM. They are treated together because they generate similar code, the NANs for REAL types being handled a bit like a second level of masking. These are the cases for which we generate two sets of loops. This change affects the code generating the second loop, that was previously accessible only in the cases ARRAY has rank 1 only. The single variable initialization and update are changed to apply to multiple variables, one per dimension. The code generated is as follows (if ARRAY has rank 2): for (idx11 in lower1..upper1) { for (idx12 in lower2..upper2) { ... if (...) { ... goto second_loop; } } } second_loop: for (idx21 in lower1..upper1) { for (idx22 in lower2..upper2) { ... } } This code leads to processing the first elements redundantly, both in the first set of loops and in the second one. The loop over idx22 could start from idx12 the first time it is run, but as it has to start from lower2 for the rest of the runs, this change uses the same bounds for both set of loops for simplicity. In the rank 1 case, this makes the generated code worse compared to the inline code that was generated before. A later change will introduce conditionals to avoid the duplicate processing and restore the generated code in that case. PR fortran/90608 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Initialize and update all the variables. Put the label and goto in the outermost scalarizer loop. Don't start the second loop where the first stopped. (gfc_inline_intrinsic_function_p): Also return TRUE for array MASK or for any REAL type. gcc/testsuite/ChangeLog: * gfortran.dg/maxloc_bounds_5.f90: Additionally accept error messages reported by the scalarizer. * gfortran.dg/maxloc_bounds_6.f90: Ditto.
2024-09-21fortran: Inline integral MINLOC/MAXLOC with no DIM and scalar MASK [PR90608]Mikael Morin2-7/+10
Enable the generation of inline code for MINLOC/MAXLOC when argument ARRAY is of integral type, DIM is not present, and MASK is present and is scalar (only absent MASK or rank 1 ARRAY were inlined before). Scalar masks are implemented with a wrapping condition around the code one would generate if MASK wasn't present, so they are easy to support once inline code without MASK is working. PR fortran/90608 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Generate variable initialization for each dimension in the else branch of the toplevel condition. (gfc_inline_intrinsic_function_p): Return TRUE for scalar MASK. gcc/testsuite/ChangeLog: * gfortran.dg/maxloc_bounds_7.f90: Additionally accept the error message reported by the scalarizer.
2024-09-21fortran: Inline integral MINLOC/MAXLOC with no DIM and no MASK [PR90608]Mikael Morin3-57/+165
Enable generation of inline code for the MINLOC and MAXLOC intrinsic, if the ARRAY argument is of integral type and of any rank (only the rank 1 case was previously inlined), and neither DIM nor MASK arguments are present. This needs a few adjustments in gfc_conv_intrinsic_minmaxloc, mainly to replace the single variables POS and OFFSET, with collections of variables, one variable per dimension each. The restriction to integral ARRAY and absent MASK limits the scope of the change to the cases where we generate single loop inline code. The code generation for the second loop is only accessible with ARRAY of rank 1, so it can continue using a single variable. A later change will extend inlining to the double loop cases. There is some bounds checking code that was previously handled by the library, and that needed some changes in the scalarizer to avoid regressing. The bounds check code generation was already supported by the scalarizer, but it was only applying to array reference sections, checking both for array bound violation and for shape conformability between all the involved arrays. With this change, for MINLOC or MAXLOC, enable the conformability check between all the scalarized arrays, and disable the array bound violation check. PR fortran/90608 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_ss_startstride): Set the MINLOC/MAXLOC result upper bound using the rank of the ARRAY argument. Ajdust the error message for intrinsic result arrays. Only check array bounds for array references. Move bound check decision code... (bounds_check_needed): ... here as a new predicate. Allow bound check for MINLOC/MAXLOC intrinsic results. * trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Change the result array upper bound to the rank of ARRAY. Update the NONEMPTY variable to depend on the non-empty extent of every dimension. Use one variable per dimension instead of a single variable for the position and the offset. Update their declaration, initialization, and update to affect the variable of each dimension. Use the first variable only in areas only accessed with rank 1 ARRAY argument. Set every element of the result using its corresponding variable. (gfc_inline_intrinsic_function_p): Return true for integral ARRAY and absent DIM and MASK. gcc/testsuite/ChangeLog: * gfortran.dg/maxloc_bounds_4.f90: Additionally accept the error message emitted by the scalarizer.
2024-09-21fortran: Outline array bound check generation codeMikael Morin1-154/+143
gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_ss_startstride): Move array bound check generation code... (add_check_section_in_array_bounds): ... here as a new function.
2024-09-21fortran: Remove MINLOC/MAXLOC frontend optimizationMikael Morin1-58/+0
Remove the frontend pass rewriting calls of MINLOC/MAXLOC without DIM to calls with one-valued DIM enclosed in an array constructor. This transformation was circumventing the limitation of inline MINLOC/MAXLOC code generation to scalar cases only, allowing inline code to be generated if ARRAY had rank 1 and DIM was absent. As MINLOC/MAXLOC has gained support of inline code generation in that case, the limitation is no longer effective, and the transformation no longer necessary. gcc/fortran/ChangeLog: * frontend-passes.cc (optimize_minmaxloc): Remove. (optimize_expr): Remove dispatch to optimize_minmaxloc.
2024-09-21fortran: Inline MINLOC/MAXLOC with no DIM and ARRAY of rank 1 [PR90608]Mikael Morin2-68/+181
Enable inline code generation for the MINLOC and MAXLOC intrinsic, if the DIM argument is not present and ARRAY has rank 1. This case is similar to the case where the result is scalar (DIM present and rank 1 ARRAY), which already supports inline expansion of the intrinsic. Both cases return the same value, with the difference that the result is an array of size 1 if DIM is absent, whereas it's a scalar if DIM is present. So all there is to do for the new case to work is hook the inline expansion with the scalarizer. PR fortran/90608 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_ss_startstride): Set the scalarization rank based on the MINLOC/MAXLOC rank if needed. Call the inline code generation and setup the scalarizer array descriptor info in the MINLOC and MAXLOC cases. * trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Return the result array element if the scalarizer is setup and we are inside the loops. Restrict library function call dispatch to the case where inline expansion is not supported. Declare an array result if the expression isn't scalar. Initialize the array result single element and return the result variable if the expression isn't scalar. (walk_inline_intrinsic_minmaxloc): New function. (walk_inline_intrinsic_function): Add MINLOC and MAXLOC cases, dispatching to walk_inline_intrinsic_minmaxloc. (gfc_add_intrinsic_ss_code): Add MINLOC and MAXLOC cases. (gfc_inline_intrinsic_function_p): Return true if ARRAY has rank 1, regardless of DIM.
2024-09-21fortran: Disable frontend passes for inlinable MINLOC/MAXLOC [PR90608]Mikael Morin2-1/+25
Disable rewriting of MINLOC/MAXLOC expressions for which inline code generation is supported. Update the gfc_inline_intrinsic_function_p predicate (already existing) for that, with the current state of MINLOC/MAXLOC inlining support, that is only the cases of a scalar result and non-CHARACTER argument for now. This change has no effect currently, as the MINLOC/MAXLOC front-end passes only change expressions of rank 1, but the inlining control predicate gfc_inline_intrinsic_function_p returns false for those. However, later changes will extend MINLOC/MAXLOC inline expansion support to array expressions and update the inlining control predicate, and this will become effective. PR fortran/90608 gcc/fortran/ChangeLog: * frontend-passes.cc (optimize_minmaxloc): Skip if we can generate inline code for the unmodified expression. * trans-intrinsic.cc (gfc_inline_intrinsic_function_p): Add MINLOC and MAXLOC cases.
2024-09-21fortran: Add tests covering inline MINLOC/MAXLOC without DIM [PR90608]Mikael Morin6-0/+1249
Add the tests covering the various cases for which we are about to implement inline expansion of MINLOC and MAXLOC. Those are cases where the DIM argument is not present. PR fortran/90608 gcc/testsuite/ChangeLog: * gfortran.dg/ieee/maxloc_nan_1.f90: New test. * gfortran.dg/ieee/minloc_nan_1.f90: New test. * gfortran.dg/maxloc_7.f90: New test. * gfortran.dg/maxloc_with_mask_1.f90: New test. * gfortran.dg/minloc_8.f90: New test. * gfortran.dg/minloc_with_mask_1.f90: New test.
2024-09-21modula2: Tidyup remove unnecessary parametersGaius Mulley1-6/+6
This patch removes ununsed parameters from gm2-compiler/M2Comp.mod. gcc/m2/ChangeLog: * gm2-compiler/M2Comp.mod (GenerateDependencies): Remove unused parameter. (WriteDep): Remove parameter dep. (WritePhoneDep): Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-09-20libstdc++: fix C header include guardsJason Merrill37-95/+92
Ever since the c_global and c_compatibility directories were added in r122533, the include guards have been oddly late in the files, with no comment about why that might be either in the commit message or the files themselves. I don't see any justification for this; it seems like a scripting error in creating these files based on the ones in include/c. libstdc++-v3/ChangeLog: * include/c_compatibility/ctype.h * include/c_compatibility/errno.h * include/c_compatibility/float.h * include/c_compatibility/iso646.h * include/c_compatibility/limits.h * include/c_compatibility/locale.h * include/c_compatibility/setjmp.h * include/c_compatibility/signal.h * include/c_compatibility/stdarg.h * include/c_compatibility/stdbool.h * include/c_compatibility/stddef.h * include/c_compatibility/stdio.h * include/c_compatibility/string.h * include/c_compatibility/tgmath.h * include/c_compatibility/time.h * include/c_compatibility/uchar.h * include/c_compatibility/wchar.h * include/c_compatibility/wctype.h * include/c_global/ccomplex * include/c_global/cctype * include/c_global/cerrno * include/c_global/cfloat * include/c_global/climits * include/c_global/clocale * include/c_global/cmath * include/c_global/csetjmp * include/c_global/csignal * include/c_global/cstdalign * include/c_global/cstdarg * include/c_global/cstdbool * include/c_global/cstdio * include/c_global/cstdlib * include/c_global/cstring * include/c_global/ctgmath * include/c_global/ctime * include/c_global/cwchar * include/c_global/cwctype: Move header guard before #includes.
2024-09-21Daily bump.GCC Administrator13-1/+412
2024-09-20diagnostics: add HTML output format as a plugin [PR116792]David Malcolm3-0/+887
This patch adds an experimental diagnostics output format that writes HTML. It isn't ready yet for end-users, but seems worth keeping in the tree as I refactor the diagnostics subsystem, to ensure that this code still builds, and to verify that it's possible to implement new diagnostic output formats via GCC plugins. Hence this patch merely adds it to the testsuite as an example of a GCC plugin, rather than exposing it as a feature for end-users. gcc/testsuite/ChangeLog: PR other/116792 * gcc.dg/plugin/diagnostic-test-xhtml-1.c: New test. * gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: New test plugin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20analyzer: simplify dumps using tree_dump_pretty_printer [PR116613]David Malcolm19-171/+55
There are numerous "dump" member functions in the analyzer with copied-and-pasted logic. Simplify them by moving the shared code to a new class tree_dump_pretty_printer. As well as reducing code duplication, this eliminates numerous uses of pp_show_color (global_dc->m_printer), which should ultimately help with supporting multiple diagnostic sinks. No functional change intended. gcc/analyzer/ChangeLog: PR other/116613 * access-diagram.cc (access_range::dump): Simplify using tree_dump_pretty_printer. * call-details.cc (call_details::dump): Likewise. * call-summary.cc (call_summary::dump): Likewise. (call_summary_replay::dump): Likewise. * checker-event.cc (checker_event::debug): Likewise. * constraint-manager.cc (range::dump): Likewise. (bounded_range::dump): Likewise. (bounded_ranges::dump): Likewise. (constraint_manager::dump): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. * program-point.cc (program_point::dump): Likewise. * program-state.cc (extrinsic_state::dump_to_file): Likewise. (sm_state_map::dump): Likewise. (program_state::dump_to_file): Likewise. * ranges.cc (symbolic_byte_offset::dump): Likewise. (symbolic_byte_range::dump): Likewise. * record-layout.cc (record_layout::dump): Likewise. * region-model-reachability.cc (reachable_regions::dump): Likewise. * region-model.cc (region_to_value_map::dump): Likewise. (region_model::dump): Likewise. (model_merger::dump): Likewise. * region.cc (region_offset::dump): Likewise. (region::dump): Likewise. * sm-malloc.cc (deallocator_set::dump): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (bit_range::dump): Likewise. (byte_range::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/ChangeLog: PR other/116613 * text-art/dump.h (dump_to_file): Simplify using tree_dump_pretty_printer. * tree-diagnostic.h (class tree_dump_pretty_printer): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20diagnostics: isolate SARIF output's pretty_printer [PR116613]David Malcolm2-67/+51
Add an m_printer to sarif_builder and use throughout, rather than using the context's printer. For now this is the same printer, but eventually this should help with transitioning to multiple output sinks. No functional change intended. gcc/ChangeLog: PR other/116613 * diagnostic-format-sarif.cc (sarif_builder::m_printer): New field. (sarif_invocation::add_notification_for_ice): Drop context param. (sarif_invocation::prepare_to_flush): Convert param from context to builder. (sarif_result::on_nested_diagnostic): Drop context param. Use builder's printer. (sarif_result::on_diagram): Drop context param. (sarif_ice_notification::sarif_ice_notification): Drop context param. Use builder's printer. (sarif_builder::sarif_builder): Initialize m_printer. (sarif_builder::on_report_diagnostic): Drop context param. Use builder's printer. (sarif_builder::emit_diagram): Drop context param. (sarif_builder::flush_to_object): Use this rather than context for call to prepare_to_flush. (sarif_builder::make_result_object): Drop context param. Use builder's printer. (sarif_builder::make_reporting_descriptor_object_for_warning): Drop context param. (sarif_builder::make_message_object_for_diagram): Likewise. Use builder's printer. (sarif_output_format::on_report_diagnostic): Drop context param from call to sarif_builder::on_report_diagnostic. (sarif_output_format::on_diagram): Drop context param from call to sarif_builder::emit_diagram. * diagnostic.h (diagnostic_conetxt::get_client_data_hooks): Make const. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20diagnostics: convert text hooks to use diagnostic_text_output_format [PR116613]David Malcolm26-475/+587
The diagnostic_starter and diagnostic_finalizer callbacks and most of their support subroutines are only used by the "text" output format. Emphasize this and reduce the binding with diagnostic_context by renaming the callbacks to add "_text" in their names, and converting the first param from diagnostic_context * to diagnostic_text_output_output &. Update the various subroutines used by diagnostic starter/finalizer callbacks to also take a diagnostic_text_output_output & rather than a diagnostic_context *. Move m_includes and m_last_seen from the context to the text output. Use the text_output's get_printer () rather than the context's m_printer, which should ease the transition to multiple output sinks. No functional change intended. gcc/c-family/ChangeLog: PR other/116613 * c-opts.cc: Include "diagnostic-format-text.h". (c_diagnostic_finalizer): Rename to... (c_diagnostic_text_finalizer): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (c_common_diagnostics_set_defaults): Update for renamings. gcc/ChangeLog: PR other/116613 * coretypes.h (class diagnostic_text_output_format): Add forward decl. * diagnostic-format-json.cc (json_output_format::after_diagnostic): New. * diagnostic-format-sarif.cc (sarif_output_format::after_diagnostic): New. * diagnostic-format-text.cc: Use pragmas to ignore -Wformat-diag. (diagnostic_text_output_format::~diagnostic_text_output_format): Use get_printer. Clean up m_includes_seen here, rather than in ~diagnostic_context. (diagnostic_text_output_format::on_report_diagnostic): Use get_printer. Update for callback renamings and pass *this to them, rather than &m_context. (diagnostic_text_output_format::after_diagnostic): New. (diagnostic_text_output_format::includes_seen_p): Move here from diagnostic_context/diagnostic.cc. (diagnostic_text_output_format::get_location_text): New. (maybe_line_and_column): Move here from diagnostic.cc and make non-static. (diagnostic_text_output_format::report_current_module): Move here from diagnostic_context/diagnostic.cc. (default_diagnostic_text_starter): Move here from diagnostic.cc, renaming from default_diagnostic_starter. (default_diagnostic_text_finalizer): Likewise, renaming from default_diagnostic_finalizer. * diagnostic-format-text.h (diagnostic_text_output_format::diagnostic_text_output_format): Initialize m_last_module and m_includes_seen. (diagnostic_text_output_format::after_diagnostic): New decl. (diagnostic_text_output_format::build_prefix): New decl. (diagnostic_text_output_format::report_current_module): New decl. (diagnostic_text_output_format::append_note): New decl. (diagnostic_text_output_format::file_name_as_prefix): New decl. (diagnostic_text_output_format::print_path): New decl. (diagnostic_text_output_format::show_column_p): New decl. (diagnostic_text_output_format::get_location_text): New decl. (diagnostic_text_output_format::includes_seen_p): New decl. (diagnostic_text_output_format::show_any_path): New decl. (diagnostic_text_output_format::m_last_module): New field. (diagnostic_text_output_format::m_includes_seen): New field. * diagnostic-format.h (diagnostic_output_format::after_diagnostic): New vfunc. (diagnostic_output_format::get_context): New. (diagnostic_output_format::get_diagram_theme): New. * diagnostic-macro-unwinding.cc: Include "diagnostic-format-text.h". (maybe_unwind_expanded_macro_loc): Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (virt_loc_aware_diagnostic_finalizer): Likewise. * diagnostic-macro-unwinding.h (virt_loc_aware_diagnostic_finalizer): Likewise. (maybe_unwind_expanded_macro_loc): Likewise. * diagnostic-path.cc: Include "diagnostic-format-text.h". (path_label::path_label): Drop "ctxt" param and add "colorize" and "allow_emojis" params. Update initializations. (path_label::get_text): Use m_colorize rather than querying m_ctxt.m_printer. Use m_allow_emojis rather than querying m_ctxt's diagram theme. (path_label::m_ctxt): Drop field. (path_label::m_colorize): Drop field. (path_label::m_allow_emojis): Drop field. (event_range::event_range): Drop param "ctxt". Add params "colorize_labels" and "allow_emojis". (event_range::print): Convert first param from diagnostic_context & to diagnostic_text_output_format & and update accordingly. (path_summary::path_summary): Likewise. (path_summary::print_swimlane_for_event_range): Likewise. (print_path_summary_as_text): Likewise for 3rd param. (diagnostic_context::print_path): Convert to... (diagnostic_text_output_format::print_path): ...this. (selftest::test_empty_path): Update to use a diagnostic_text_output_format. (selftest::test_intraprocedural_path): Likewise. (selftest::test_interprocedural_path_1): Likewise. (selftest::test_interprocedural_path_2): Likewise. (selftest::test_recursion): Likewise. (selftest::test_control_flow_1): Likewise. (selftest::test_control_flow_2): Likewise. (selftest::test_control_flow_3): Likewise. (selftest::assert_cfg_edge_path_streq): Likewise. (selftest::test_control_flow_5): Likewise. (selftest::test_control_flow_6): Likewise. * diagnostic.cc (file_name_as_prefix): Convert to... (diagnostic_text_output_format::file_name_as_prefix): ...this. (diagnostic_context::initialize): Update for renamings. Move m_last_module and m_includes_seen into text output. (diagnostic_context::finish): Likewise. (diagnostic_context::get_location_text): Add "colorize" param. (diagnostic_build_prefix): Convert to... (diagnostic_text_output_format::build_prefix): ...this. (diagnostic_context::includes_seen_p): Move from here to diagnostic_text_output_format/diagnostic-format-text.cc. (diagnostic_context::report_current_module): Likewise. (diagnostic_context::show_any_path): Convert to... (diagnostic_text_output_format::show_any_path): ...this. (default_diagnostic_starter): Rename and move to diagnostic-format-text.cc. (default_diagnostic_start_span_fn): Pass colorize bool to get_location_text. (default_diagnostic_finalizer): Rename and move to diagnostic-format-text.cc. (diagnostic_context::report_diagnostic): Replace call to show_any_path with call to new output format "after_diagnostic" vfunc, moving show_any_path call to the text output format. (diagnostic_append_note): Convert to... (diagnostic_text_output_format::append_note): ...this. (selftest::assert_location_text): Pass in false for colorization. * diagnostic.h (diagnostic_starter_fn): Rename to... (diagnostic_text_starter_fn): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format &. (diagnostic_finalizer_fn, diagnostic_text_finalizer_fn): Likewise. (diagnostic_context): Update friends for renamings. (diagnostic_context::report_current_module): Move to text output format. (diagnostic_context::get_location_text): Add "colorize" bool. (diagnostic_context::includes_seen_p): Move to text output format. (diagnostic_context::show_any_path): Likewise. (diagnostic_context::print_path): Likewise. (diagnostic_context::m_text_callbacks): Update for renamings. (diagnostic_context::m_last_module): Move to text output format. (diagnostic_context::m_includes_seen): Likewise. (diagnostic_starter): Rename to... (diagnostic_text_starter): ...this and update return type. (diagnostic_finalizer): Rename to... (diagnostic_text_finalizer): ...this and update return type. (diagnostic_report_current_module): Drop decl in favor of a member function of diagnostic_text_output_format. (diagnostic_append_note): Likewise. (default_diagnostic_starter): Rename to... (default_diagnostic_text_starter): ...this, updating type. (default_diagnostic_finalizer): Rename to... (default_diagnostic_text_finalizer): ...this, updating type. (file_name_as_prefix): Drop decl. * langhooks-def.h (lhd_print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format &. * langhooks.cc: Include "diagnostic-format-text.h". (lhd_print_error_function): Likewise. Update accordingly * langhooks.h (lang_hooks::print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format &. * tree-diagnostic.cc: Include "diagnostic-format-text.h". (diagnostic_report_current_function): Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (default_tree_diagnostic_starter): Rename to... (default_tree_diagnostic_text_starter): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (tree_diagnostics_defaults): Update for renamings. gcc/cp/ChangeLog: PR other/116613 * cp-tree.h (cxx_print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format &. * error.cc: Include "diagnostic-format-text.h". (cxx_initialize_diagnostics): Update for renamings. (cxx_print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly (cp_diagnostic_starter): Rename to... (cp_diagnostic_text_starter): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (cp_print_error_function): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context_line): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (maybe_print_constexpr_context): Likewise. (print_location): Likewise. (print_constrained_decl_info): Likewise. (print_concept_check_info): Likewise. (print_constraint_context_head): Likewise. (print_requires_expression_info): Likewise. (maybe_print_single_constraint_context): Likewise. gcc/fortran/ChangeLog: PR other/116613 * error.cc: Include "diagnostic-format-text.h". (gfc_diagnostic_starter): Rename to... (gfc_diagnostic_text_starter): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (gfc_diagnostic_finalizer, gfc_diagnostic_text_finalizer): Likewise. (gfc_diagnostics_init): Update for renamings. (gfc_diagnostics_finish): Likewise. gcc/jit/ChangeLog: PR other/116613 * dummy-frontend.cc: Include "diagnostic-format-text.h". (jit_begin_diagnostic): Convert first param from diagnostic_context * to diagnostic_text_output_format & (jit_end_diagnostic): Likewise. Update accordingly. (jit_langhook_init): Update for renamings. gcc/rust/ChangeLog: PR other/116613 * resolve/rust-ast-resolve-expr.cc (funny_ice_finalizer): : Convert first param from diagnostic_context * to diagnostic_text_output_format &. (ResolveExpr::visit): Update for renaming. gcc/testsuite/ChangeLog: PR other/116613 * g++.dg/plugin/show_template_tree_color_plugin.c (noop_starter_fn): Rename to... (noop_text_starter_fn): ...this. Update first param from dc to text_output. (plugin_init): Update for renamings. * gcc.dg/plugin/diagnostic_group_plugin.c (test_diagnostic_starter): Rename to... (test_diagnostic_text_starter): ...this. Update first param from dc to text_output. (plugin_init): Update for renaming. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Include "diagnostic-format-text.h". (custom_diagnostic_finalizer): Rename to... (custom_diagnostic_text_finalizer): ...this. Update first param from dc to text_output. (test_show_locus): Update for renamings. * gcc.dg/plugin/location_overflow_plugin.c: Include "diagnostic-format-text.h". (original_finalizer): Rename to... (original_text_finalizer): ...this and update type. (verify_unpacked_ranges): Update first param from dc to text_output. Update for this and for renamings. (verify_no_columns): Likewise. (plugin_init): Update for renamings. libcc1/ChangeLog: PR other/116613 * context.cc: Include "diagnostic-format-text.h". (plugin_print_error_function): Update first param from diagnostic_context * to diagnostic_text_output_format &. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20analyzer: remove redundant 'pp' [PR116613]David Malcolm1-3/+0
diagnostic_manager::emit_saved_diagnostic makes a useless clone of global_dc->m_printer; remove it. No functional change intended. gcc/analyzer/ChangeLog: PR other/116613 * diagnostic-manager.cc (diagnostic_manager::emit_saved_diagnostic): Remove remove redundant 'pp'. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20libstdc++: Avoid forming T* in unique_ptr(auto_ptr<U>&&) constraints [PR116529]Jonathan Wakely2-2/+38
PR 116529 shows that std::unique_ptr<X&, D> is currently unusable because the constructor taking std::auto_ptr (which is a non-standard extension since C++17) tries to form the invalid type X&* during overload resolution. We can use the `pointer` type in the constructor constraints, instead of trying to form an invalid type. The std::auto_ptr constructor can never actually match for the case where element_type is a reference, so we just need it to produce a substitution failure instead of being ill-formed. LWG 4144 might make std::unique_ptr<X&, D> ill-formed, which would invalidate this new test. We would have to remove this test in that case. Using `pointer` in the constructor from std::auto_ptr would not be needed to support the std::unique_ptr<X&, D> case, but would not cause any harm either. libstdc++-v3/ChangeLog: PR libstdc++/116529 * include/bits/unique_ptr.h (unique_ptr(auto_ptr<U>&&)): Use pointer instead of T*. * testsuite/20_util/unique_ptr/creation/116529.cc: New test.
2024-09-20libstdc++: Document missing features for old std:string ABI [PR116777]Jonathan Wakely2-2/+42
There are several features that are not supported when using the old std::string ABI. It's possible that PR 81967 will get fixed, but the missing C++20 features almost certainly won't be. Document this in the manual. libstdc++-v3/ChangeLog: PR libstdc++/116777 * doc/xml/manual/using.xml: Document features that are not supported for the gcc4-compatible ABI. * doc/html/manual/using_dual_abi.html: Regenerate.
2024-09-20c: fix crash when checking for compatibility of structures [PR116726]Martin Uecker2-1/+22
When checking for compatibility of structure or union types in tagged_types_tu_compatible_p, restore the old value of the pointer to the top of the temporary cache after recursively calling comptypes_internal when looping over the members of a structure of union. While the next iteration of the loop overwrites the pointer, I missed the fact that it can be accessed again when types of function arguments are compared as part of recursive type checking and the function is entered again. PR c/116726 gcc/c/ChangeLog: * c-typeck.cc (tagged_types_tu_compatible_p): Restore value of the cache after recursing into comptypes_internal. gcc/testsuite/ChangeLog: * gcc.dg/pr116726.c: New test.
2024-09-20c++: CWG 2789 and reversed operator candidatesPatrick Palka2-7/+10
As a follow-up to r15-3741-gee3efe06c9c49c, which was specifically concerned with usings, it seems the CWG 2789 refinement should also compare contexts of a reversed vs non-reversed (member) candidate during operator overload resolution. DR 2789 gcc/cp/ChangeLog: * call.cc (cand_parms_match): Check for matching class contexts even in the reversed case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-memfun4.C: Adjust expected result involving reversed candidate. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-20modula2: Remove unused parameter warnings seen in buildGaius Mulley9-15/+213
This patch removes unused parameters in gm2-compiler/M2Check.mod. It also removes a --fixme-- and completes the missing code which type checks unbounded arrays. The patch also fixes a build error seen when building m2/stage2/cc1gm2. gcc/m2/ChangeLog: * gm2-compiler/M2Check.mod (checkUnboundedArray): New procedure function. (checkUnboundedUnbounded): Ditto. (checkUnbounded): Rewrite to check the unbounded data type. (checkPair): Add comment. (doCheckPair): Add comment. Remove tinfo parameter from the call to checkTypeKindViolation. (checkTypeKindViolation): Remove ununsed parameter tinfo. * gm2-libs-ch/UnixArgs.cc (GM2RTS.h): Remove include. * gm2-libs-ch/m2rts.h (M2RTS_INIT): New define. (M2RTS_DEP): Ditto. (M2RTS_RegisterModule): New prototype. (GM2RTS.h): Add include to the MC_M2 block. gcc/testsuite/ChangeLog: * gm2/iso/fail/testarrayunbounded2.mod: New test. * gm2/iso/fail/testarrayunbounded3.mod: New test. * gm2/iso/fail/testarrayunbounded4.mod: New test. * gm2/iso/fail/testarrayunbounded5.mod: New test. * gm2/iso/fail/testarrayunbounded6.mod: New test. * gm2/iso/pass/testarrayunbounded.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-09-20Daily bump.GCC Administrator11-1/+584