aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-11-06c: Add -std=c23, -std=gnu23, -Wc11-c23-compat options [PR107954]Joseph Myers16-34/+95
At the June WG14 meeting, WG14 decided it preferred to keep C23 as the informal name for the next revision of the C standard, despite publication not being before 2024 (publication is due in 2024 whether or not technical changes at the January meeting result in an FDIS ballot being needed). At the Cauldron I raised the question of whether we should thus now add option names such as -std=c23 to GCC, and there was support for doing so. Add -std=c23, making -std=c2x a deprecated alias; also add the alias -std=iso9899:2024. Likewise, add -std=gnu23, making -std=gnu2x a deprecated alias, and add -Wc11-c23-compat, making -Wc11-c2x-compat a deprecated alias. Here, I'm generally just adding the new options and making the minimum changes required to do so, with documentation changed to refer to C23 instead of C2X only where directly associated with documentation of these options. It's intended that future changes will update documentation, diagnostics, comments, variable names, testcase names, etc. to refer consistently to C23. When such changes are made, the new tests c23-opts-3.c, c23-opts-5.c and gnu23-opts-2.c are intended to keep using the old option names they are specifically testing, while other tests would start using the c23/gnu23 versions of the names (as well as the tests themselves being renamed). Updating option names is independent of updating to the final __STDC_VERSION__ value. There, the question is whether we should update the value now or wait for the remaining significant features to be implemented first. (I intend to review Martin's tag compatibility patches for GCC 14. I'm not aware of anyone working on #embed - or on the [[unsequenced]] and [[reproducible]] attributes, though support for standard attributes is optional.) Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/107954 gcc/ * doc/cpp.texi (__STDC_VERSION__): Refer to -std=c23 and -std=gnu23 instead of -std=c2x and -std=gnu2x. * doc/extend.texi (Attribute Syntax): Refer to C23 and -std=c23 instead of C2x and -std=c2x. * doc/invoke.texi (-Wc11-c23-compat, -std=c23, -std=gnu23) (-std=iso9899:2024): Document, with -Wc11-c2x-compat, -std=c2x and -std=gnu2x as deprecated aliases. Update descriptions of C23. * doc/standards.texi (Standards): Describe C23 with C2X as an old name. gcc/c-family/ * c.opt (Wc11-c2x-compat): Rename to Wc11-c23-compat and make into a deprecated alias of Wc11-c23-compat. (std=c2x): Rename to std=c23 and make into a deprecated alias of std=c23. (std=gnu2x): Rename to std=gnu23 and make into a deprecated alias of std=gnu23. (std=iso9899:2024): New option. Alias of std=c23. * c-lex.cc (interpret_float): Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat. * c-opts.cc (c_common_handle_option): Use OPT_std_c23 instead of OPT_std_c2x and OPT_std_gnu23 instead of OPT_std_gnu2x. gcc/c/ * c-errors.cc (pedwarn_c11): Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat. * c-typeck.cc (build_conditional_expr, convert_for_assignment): Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat. gcc/testsuite/ * gcc.dg/c23-opts-1.c, gcc.dg/c23-opts-2.c, gcc.dg/c23-opts-3.c, gcc.dg/c23-opts-4.c, gcc.dg/c23-opts-5.c, gcc.dg/gnu23-opts-1.c, gcc.dg/gnu23-opts-2.c: New tests.
2023-11-06nvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)'Thomas Schwinge1-0/+3
With this 'MAKE_DECL_ONE_ONLY' definition, we get 'SUPPORTS_ONE_ONLY', and thus '__GXX_WEAK__', and thus '__GXX_TYPEINFO_EQUALITY_INLINE'. This unblocks build of 'libstdc++-v3/libsupc++/tinfo.cc', which otherwise depends on symbol alias support, which GCC/nvptx doesn't generally provide. Also, this gets us a number of FAIL -> PASS progressions in the test suite. Given that GCC/nvptx support for weak symbols isn't complete, we also get a few more of the already-known 'error: PTX does not support weak declarations (only weak definitions)': [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++14 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++17 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++98 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++14 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++17 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++98 (test for excess errors) [-PASS:-]{+FAIL:+} 23_containers/map/56613.cc -std=gnu++17 (test for excess errors) ... as well as one more of the already-known 'sorry, unimplemented: target cannot support nonlocal goto': PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++14 (test for excess errors) PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++17 (test for excess errors) PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.dg/tree-ssa/pr22488.C -std=gnu++98 (test for excess errors) We shall look into these, later. gcc/ * config/nvptx/nvptx.h (MAKE_DECL_ONE_ONLY): Define.
2023-11-06tree-optimization/112405 - SIMD clone calls with (loop) maskRichard Biener1-28/+34
The following fixes the mask argument generation for SIMD clone calls under either loop masking or when the actual call is not masked but only a inbranch simd clone is available. The issue was that we tried to directly convert the vector mask to the call argument type but SIMD clone masks require 1 or 0 (which could be even float) values for mask elements so we have to resort to a VEC_COND_EXPR to generate them just like we do for regular passing of the mask. PR tree-optimization/112405 * tree-vect-stmts.cc (vectorizable_simd_clone_call): Properly handle invariant and/or loop mask passing.
2023-11-06RISC-V: Support FP round to i/l/ll diff size autovecPan Li14-9/+520
This patch would like to support the FP below API auto vectorization with different type size +----------+-----------+----------+ | API | RV64 | RV32 | +----------+-----------+----------+ | iround | DF => SI | DF => SI | | iroundf | - | - | | lround | - | DF => SI | | lroundf | SF => DI | - | | llround | - | - | | llroundf | SF => DI | SF => DI | +----------+-----------+----------+ Given below code: void test_lroundf (long *out, float *in, unsigned count) { for (unsigned i = 0; i < count; i++) out[i] = __builtin_lroundf (in[i]); } Before this patch: .L3: flw fa5,0(a1) addi a1,a1,4 addi a0,a0,8 fcvt.l.s a5,fa5,rmm sd a5,-8(a0) bne a4,a1,.L3 After this patch: fsrmi 4 // RMM rounding mode vsetivli zero,16,e32,m4,ta,ma .L4: vle32.v v4,0(a5) addi a5,a5,64 vfwcvt.x.f.v v8,v4 vse64.v v8,0(a4) addi a4,a4,128 bne a3,a5,.L4 andi a5,a2,15 andi a4,a2,-16 beq a5,zero,.L16 Unfortunately, the HF mode is not include due to it requires additional middle-end support from internal-fun.def. gcc/ChangeLog: * config/riscv/autovec.md: Remove the size check of lround. * config/riscv/riscv-v.cc (expand_vec_lround): Leverage emit_vec_rounding_to_integer for round. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-iround-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-iround-run-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llroundf-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llroundf-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lround-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lround-rv32-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lroundf-rv64-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lroundf-rv64-run-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-iround-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-llroundf-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lround-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lroundf-rv64-0.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-06RISC-V: Early expand DImode vec_duplicate in RV32 systemJuzhe-Zhong5-9/+70
An ICE was discovered in recent rounding autovec support: config/riscv/riscv-v.cc:4314 65 | } | ^ 0x1fa5223 riscv_vector::validate_change_or_fail(rtx_def*, rtx_def**, rtx_def*, bool) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-v.cc:4314 0x1fb1aa2 pre_vsetvl::remove_avl_operand() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3342 0x1fb18c1 pre_vsetvl::cleaup() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3308 0x1fb216d pass_vsetvl::lazy_vsetvl() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3480 0x1fb2214 pass_vsetvl::execute(function*) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3504 The root cause is that the RA reload into (set (reg) vec_duplicate:DI). However, it is not valid in RV32 system since we don't have a single broadcast instruction DI scalar in RV32 system. We should expand it early for RV32 system. gcc/ChangeLog: * config/riscv/predicates.md: Adapt predicate. * config/riscv/riscv-protos.h (can_be_broadcasted_p): New function. * config/riscv/riscv-v.cc (can_be_broadcasted_p): Ditto. * config/riscv/vector.md (vec_duplicate<mode>): New pattern. (*vec_duplicate<mode>): Adapt vec_duplicate insn pattern. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/sew64-rv32.c: New test.
2023-11-06tree-optimization/111950 - vectorizer loop copyingRichard Biener2-217/+41
The following simplifies LC-PHI arg population during epilog peeling, thereby fixing the testcase in this PR. PR tree-optimization/111950 * tree-vect-loop-manip.cc (slpeel_duplicate_current_defs_from_edges): Remove. (find_guard_arg): Likewise. (slpeel_update_phi_nodes_for_guard2): Likewise. (slpeel_tree_duplicate_loop_to_edge_cfg): Remove calls to slpeel_duplicate_current_defs_from_edges, do not elide LC-PHIs for invariant values. (vect_do_peeling): Materialize PHI arguments for the edge around the epilog from the PHI defs of the main loop exit. * gcc.dg/torture/pr111950.c: New testcase.
2023-11-06tree-optimization/112404 - two issues with SLP of .MASK_LOADRichard Biener5-34/+82
The following fixes an oversight in vect_check_scalar_mask when the mask is external or constant. When doing BB vectorization we need to provide a group_size, best via an overload accepting the SLP node as argument. When fixed we then run into the issue that we have not analyzed alignment of the .MASK_LOADs because they were not identified as loads by vect_gather_slp_loads. Fixed by reworking the detection. PR tree-optimization/112404 * tree-vectorizer.h (get_mask_type_for_scalar_type): Declare overload with SLP node argument. * tree-vect-stmts.cc (get_mask_type_for_scalar_type): Implement it. (vect_check_scalar_mask): Use it. * tree-vect-slp.cc (vect_gather_slp_loads): Properly identify loads also for nodes with children, like .MASK_LOAD. * tree-vect-loop.cc (vect_analyze_loop_2): Look at the representative for load nodes and check whether it is a grouped access before looking for load-lanes support. * gfortran.dg/pr112404.f90: New testcase.
2023-11-06C99 testsuite readiness: Some unverified test case un-reductionsFlorian Weimer112-83/+174
gcc/testsuite/ * gcc.c-torture/compile/20000412-2.c (f): Call __builtin_strlen instead of strlen. * gcc.c-torture/compile/20000427-1.c (FindNearestPowerOf2): Declare. * gcc.c-torture/compile/20000802-1.c (bar): Call __builtin_memcpy instead of memcpy. * gcc.c-torture/compile/20010525-1.c (kind_varread): Likewise. * gcc.c-torture/compile/20010706-1.c (foo): Add missing int return type. * gcc.c-torture/compile/20020314-1.c (add_output_space_event) (del_tux_atom, add_req_to_workqueue): Declare. * gcc.c-torture/compile/20020701-1.c (f): Call __builtin_memcpy instead of memcpy. * gcc.c-torture/compile/20021015-2.c (f): Call __builtin_bcmp instead of bcmo. * gcc.c-torture/compile/20030110-1.c (inb): Declare. * gcc.c-torture/compile/20030314-1.c (bar): Add missing void return type. * gcc.c-torture/compile/20030405-1.c (bar): Add missing int return type. * gcc.c-torture/compile/20030416-1.c (bar): Declare. (main): Add missing int return type. * gcc.c-torture/compile/20030503-1.c (bar): Declare. * gcc.c-torture/compile/20030530-1.c: (bar): Declare. * gcc.c-torture/compile/20031031-2.c (foo, bar, baz): Declare. * gcc.c-torture/compile/20040101-1.c (test16): Call __builtin_printf instead of printf. * gcc.c-torture/compile/20040124-1.c (f2, f3): Declare. * gcc.c-torture/compile/20040304-1.c (macarg): Declare. * gcc.c-torture/compile/20040705-1.c (f): Call __builtin_memcpy instead of memcpy. * gcc.c-torture/compile/20040908-1.c (bar): Declare. * gcc.c-torture/compile/20050510-1.c (dont_remove): Declare. * gcc.c-torture/compile/20051228-1.c (bar): Declare. * gcc.c-torture/compile/20060109-1.c (cpp_interpret_string): Declare. (int_c_lex, cb_ident): Add missing void return type. (cb_ident): Define as static. * gcc.c-torture/compile/20060202-1.c (sarray_get): Declare. * gcc.c-torture/compile/20070129.c (regcurly) (reguni): Declare. * gcc.c-torture/compile/20070529-1.c (__fswab16): Declare. * gcc.c-torture/compile/20070529-2.c (kmem_free): Declare. * gcc.c-torture/compile/20070605-1.c (quantize_fs_dither): Add missing void return type. * gcc.c-torture/compile/20071107-1.c (settings_install_property_parser): Declare. * gcc.c-torture/compile/20090907-1.c (load_waveform): Call __builtin_abort instead of abort. * gcc.c-torture/compile/20100907.c (t): Add missing void types. * gcc.c-torture/compile/20120524-1.c (build_packet): Call __builtin_memcpy instead of memcpy. * gcc.c-torture/compile/20120830-2.c (ubidi_writeReordered_49): Add missing void return type. * gcc.c-torture/compile/20121010-1.c (read_long): Add missing int return type. * gcc.c-torture/compile/920301-1.c (f, g): Add missing void types. * gcc.c-torture/compile/920409-1.c (x): Likewise. * gcc.c-torture/compile/920410-1.c (main): Add missing int return type. Call __builtin_printf instead of printf. * gcc.c-torture/compile/920410-2.c (joe): Add missing void types. * gcc.c-torture/compile/920411-2.c (x): Likewise. * gcc.c-torture/compile/920413-1.c (f): Add missing int return type. * gcc.c-torture/compile/920428-3.c (x): Add missing int types. * gcc.c-torture/compile/920428-4.c (x): Add missing void return type and int parameter type. * gcc.c-torture/compile/920501-10.c (x): Add missing int types. * gcc.c-torture/compile/920501-12.c (x, a, b, A, B): Likewise. * gcc.c-torture/compile/920501-17.c (x): Add missing void types. * gcc.c-torture/compile/920501-19.c (y): Likewise. * gcc.c-torture/compile/920501-22.c (x): Likewise. * gcc.c-torture/compile/920501-3.c (x): Likewise. * gcc.c-torture/compile/920501-4.c (foo): Likewise. * gcc.c-torture/compile/920529-1.c (f): Call __builtin_abort instead of abort. * gcc.c-torture/compile/920615-1.c (f): Add missing void types. * gcc.c-torture/compile/920623-1.c (g): Likewise. * gcc.c-torture/compile/920624-1.c (f): Likewise. * gcc.c-torture/compile/920711-1.c (f): Add missing int types. * gcc.c-torture/compile/920729-1.c (f): Add missing void types. * gcc.c-torture/compile/920806-1.c (f): Likewise. * gcc.c-torture/compile/920821-2.c (f): Likewise. * gcc.c-torture/compile/920825-1.c (f): Likewise. * gcc.c-torture/compile/920825-2.c (f, g): Add missing void return type. * gcc.c-torture/compile/920826-1.c (f): Likewise. * gcc.c-torture/compile/920828-1.c (f): Add missing int types. * gcc.c-torture/compile/920829-1.c (f): Add missing void return type. * gcc.c-torture/compile/920928-3.c (f): Likewise. * gcc.c-torture/compile/921012-2.c (f): Likewise. * gcc.c-torture/compile/921013-1.c (f): Likewise. * gcc.c-torture/compile/921019-1.c (f): Add missing void types. * gcc.c-torture/compile/921026-1.c (f): Add missing void return type. * gcc.c-torture/compile/921126-1.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/921227-1.c (f): Add missing void types. * gcc.c-torture/compile/930109-2.c (f): Add missing int types. * gcc.c-torture/compile/930210-1.c (f): Add missing void types. * gcc.c-torture/compile/930222-1.c (g): Declare. (f): Add missing int return type. * gcc.c-torture/compile/930421-1.c (f): Add missing void return type. * gcc.c-torture/compile/930503-1.c (f): Likewise. * gcc.c-torture/compile/930513-1.c (f): Add missing int return type. * gcc.c-torture/compile/930513-3.c (test): Add missing void types. * gcc.c-torture/compile/930523-1.c (f): Likewise. * gcc.c-torture/compile/930527-1.c (f): Likewise. * gcc.c-torture/compile/930603-1.c (f): Likewise. * gcc.c-torture/compile/930607-1.c (g): Likewise. * gcc.c-torture/compile/930702-1.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/931018-1.c (f): Add missing void return type. * gcc.c-torture/compile/931031-1.c (f): Likewise. * gcc.c-torture/compile/931102-1.c (xxx): Add missing void types. * gcc.c-torture/compile/940611-1.c (f): Likewise. * gcc.c-torture/compile/940712-1.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/950512-1.c (g): Declare. (f): Add missing void return type. * gcc.c-torture/compile/950530-1.c (f): Add missing int return type. * gcc.c-torture/compile/950610-1.c (f): Add missing void return type. * gcc.c-torture/compile/950613-1.c (f): Add missing void types. * gcc.c-torture/compile/950816-1.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/950816-2.c (func): Declare. (f): Add missing void types. * gcc.c-torture/compile/950816-3.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/950919-1.c (f): Add missing void types. * gcc.c-torture/compile/950921-1.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/951004-1.c (f): Add missing void return type. * gcc.c-torture/compile/951116-1.c (f): Add missing int return type and missing void. * gcc.c-torture/compile/951128-1.c (f): Add missing void return type. * gcc.c-torture/compile/951220-1.c (f): Add missing int return type. * gcc.c-torture/compile/960220-1.c (f): Add missing void types. * gcc.c-torture/compile/960221-1.c (foo): Add missing void return type. * gcc.c-torture/compile/960704-1.c (main): Add missing int return type and missing void. * gcc.c-torture/compile/961031-1.c (f): Add missing void types. * gcc.c-torture/compile/961126-1.c (sub, sub2): Declare. (main): Add missing int return type and missing void. * gcc.c-torture/compile/961203-1.c (main): Call __builtin_exit instead of exit. * gcc.c-torture/compile/981001-1.c (main): Likewise. * gcc.c-torture/compile/981107-1.c (call): Declare. * gcc.c-torture/compile/990517-1.c (sdbm__splpage): Call __builtin_memcpy instead of memcpy. * gcc.c-torture/compile/990617-1.c (main): Call __builtin_printf instead of printf. * gcc.c-torture/compile/991026-2.c (detach): Add missing void types. * gcc.c-torture/compile/991229-1.c (ejEval): Likewise. * gcc.c-torture/compile/991229-3.c (rand): Declare.
2023-11-06gcc.c-torture/execute/builtins/fputs.c: fputs_unlocked prototypeFlorian Weimer1-0/+4
Current glibc headers only declare fputs_unlocked for _GNU_SOURCE, so define it to obtain an official prototype. Add a fallback prototype declaration for other systems that do not have fputs_unlocked. This seems to the most straightforward approach to avoid an implicit function declaration, without reducing test coverage and introducing ongoing maintenance requirements (e.g., FreeBSD added fputs_unlocked support fairly recently). gcc/testsuite/ * gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE): Define. (fputs_unlocked): Declare.
2023-11-06internal-fn: Add VCOND_MASK_LEN.Robin Dapp11-6/+120
In order to prevent simplification of a COND_OP with degenerate mask (CONSTM1_RTX) into just an OP in the presence of length masking this patch introduces a length-masked analog to VEC_COND_EXPR: IFN_VCOND_MASK_LEN. It also adds new match patterns that allow the combination of unconditional unary, binary and ternay operations with the VCOND_MASK_LEN into a conditional operation if the target supports it. gcc/ChangeLog: PR tree-optimization/111760 * config/riscv/autovec.md (vcond_mask_len_<mode><vm>): Add expander. * config/riscv/riscv-protos.h (enum insn_type): Add. * config/riscv/riscv-v.cc (needs_fp_rounding): Add !pred_mov. * doc/md.texi: Add vcond_mask_len. * gimple-match-exports.cc (maybe_resimplify_conditional_op): Create VCOND_MASK_LEN when length masking. * gimple-match.h (gimple_match_op::gimple_match_op): Always initialize len and bias. * internal-fn.cc (vec_cond_mask_len_direct): Add. (direct_vec_cond_mask_len_optab_supported_p): Add. (internal_fn_len_index): Add VCOND_MASK_LEN. (internal_fn_mask_index): Ditto. * internal-fn.def (VCOND_MASK_LEN): New internal function. * match.pd: Combine unconditional unary, binary and ternary operations into the respective COND_LEN operations. * optabs.def (OPTAB_D): Add vcond_mask_len optab. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-cond-arith-2.c: No vect cost model for riscv_v.
2023-11-06explow: Avoid unnecessary alignment operationsRichard Sandiford1-0/+3
align_dynamic_address would output alignment operations even for a required alignment of 1 byte. gcc/ * explow.cc (align_dynamic_address): Do nothing if the required alignment is a byte.
2023-11-06explow: Allow dynamic allocations after vregsRichard Sandiford3-4/+19
This patch allows allocate_dynamic_stack_space to be called before or after virtual registers have been instantiated. It uses the same approach as allocate_stack_local, which already supported this. gcc/ * function.h (get_stack_dynamic_offset): Declare. * function.cc (get_stack_dynamic_offset): New function, split out from... (get_stack_dynamic_offset): ...here. * explow.cc (allocate_dynamic_stack_space): Handle calls made after virtual registers have been instantiated.
2023-11-06libgfortran: Fix calloc call by swapping arg order [PR112364]Tobias Burnus1-4/+4
The prototype of calloc is void *calloc(size_t nmemb, size_t size); denoting "an array of nmemb objects, each of whose size is size." (C23) In order to follow the meaning of the argument names and to silence a -Walloc-size warning, this commit swaps the order of the two args to read now: calloc (1, sizeof (transfer_queue)); libgfortran/ChangeLog: PR libfortran/112364 * io/async.c (enqueue_transfer, enqueue_done_id, enqueue_done, enqueue_close): Swap 1st and 2nd arg in calloc call.
2023-11-06Avoid generating RTL code when d->testing_p.liuhongt2-0/+23
gcc/ChangeLog: PR target/112393 * config/i386/i386-expand.cc (ix86_expand_vec_perm_vpermt2): Avoid generating RTL code when d->testing_p. gcc/testsuite/ChangeLog: * gcc.target/i386/pr112393.c: New test.
2023-11-06libstdc++: Improve static assert messages for monadic operationsJonathan Wakely2-22/+66
The monadic operations for std::optional and std::expected make use of internal helper traits __is_optional nad __is_expected, which are not very user-friendly when shown in diagnostics. Add messages to the assertions explaining the problem more clearly. libstdc++-v3/ChangeLog: * include/std/expected (expected::and_then, expected::or_else): Add string literals to static assertions. * include/std/optional (optional::and_then, optional::or_else): Likewise.
2023-11-06tree-optimization/112369 - strip_float_extensions and vectorsRichard Biener2-1/+24
The following fixes an error in strip_float_extensions when facing vector conversions. PR tree-optimization/112369 * tree.cc (strip_float_extensions): Use element_precision. * gcc.dg/pr112369.c: New testcase.
2023-11-06RISC-V: Adjust FP rint round tests for RV32Pan Li3-139/+141
The FP rint test cases for RV32 need some additional adjust for types and data. This patch would like to fix this which is missed in FP rint support PATCH for RV32 only by mistake. Please note the math-llrintf-run-0.c will trigger one ICE in the vsetvl pass in RV32 only. ./riscv32-unknown-elf-gcc -march=rv32gcv -mabi=ilp32d \ -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math \ gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c \ -o test.elf -lm Then there will have ICE similar as below, and will file bugzilla for it. config/riscv/riscv-v.cc:4314 65 | } | ^ 0x1fa5223 riscv_vector::validate_change_or_fail(rtx_def*, rtx_def**, rtx_def*, bool) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-v.cc:4314 0x1fb1aa2 pre_vsetvl::remove_avl_operand() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3342 0x1fb18c1 pre_vsetvl::cleaup() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3308 0x1fb216d pass_vsetvl::lazy_vsetvl() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3480 0x1fb2214 pass_vsetvl::execute(function*) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3504 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c: Adjust test cases. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c: Ditto. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c: Ditto. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-06middle-end/112296 - __builtin_constant_p and side-effectsRichard Biener1-7/+9
The following tries to clarify the __builtin_constant_p documentation, stating that the argument expression is not evaluated and side-effects are discarded. I'm struggling to find the correct terms matching what the C language standard would call things so I'd appreciate some help here. OK for trunk? Shall we diagnose arguments with side-effects? It seems to me such use is usually unintended? I think rather than dropping side-effects as a side-effect of folding the frontend should discard them at parsing time instead, no? Thanks, Richard. PR middle-end/112296 * doc/extend.texi (__builtin_constant_p): Clarify that side-effects are discarded.
2023-11-06rs6000: Consider inline asm as safe if no assembler complains [PR111828]Kewen Lin7-1/+211
As discussed in PR111828, rs6000_update_ipa_fn_target_info is much conservative, currently for any non-empty inline asm, without any parsing, it would take inline asm could have HTM insns. It means for one function attributed with power8 having inline asm, even if it has no HTM insns, we don't make a function attributed with power10 inline it. Peter pointed out an inline asm parser can be a slippery slope, and noticed that the current gnu assembler still allows HTM insns even with power10 machine type, so he suggested that we can aggressively ignore the handling on inline asm, this patch goes for this suggestion. Considering that there are a few assembler alternatives and assembler can update its behaviors (complaining HTM insns at power10 and later cpus sounds reasonable from a certain point of view), this patch also checks assembler complains on HTM insns at power10 or not. For a case that a caller attributed power10 calls a callee attributed power8 having inline asm with HTM insn, without inlining at least the compilation succeeds, but if assembler complains HTM insns at power10, after inlining the compilation would fail. The two associated test cases are fine without and with this patch (effective target takes effect or not). PR target/111828 gcc/ChangeLog: * config.in: Regenerate. * config/rs6000/rs6000.cc (rs6000_update_ipa_fn_target_info): Guard inline asm handling under !HAVE_AS_POWER10_HTM. * configure: Regenerate. * configure.ac: Detect assembler support for HTM insns at power10. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_powerpc_as_p10_htm): New proc. * g++.target/powerpc/pr111828-1.C: New test. * g++.target/powerpc/pr111828-2.C: New test.
2023-11-06RISC-V: Implement RESOLVE_OVERLOADED_BUILTIN for RVV intrinsicxuli24-18/+708
Update in v6: * Rename maybe_require_frm_p to may_require_frm_p. * Rename maybe_require_vxrm_p to may_require_vxrm_p. * Move may_require_frm_p and may_require_vxrm_p to function_base. Update in v5: * Split has_vxrm_or_frm_p into maybe_require_frm_p and maybe_require_vxrm_p. * Adjust comments. Update in v4: * Remove class function_resolver. * Remove function get_non_overloaded_instance. * Add overloaded hash traits for non-overloaded intrinsic. * All overloaded intrinsics are implemented, and the tests pass. Update in v3: * Rewrite comment for overloaded function add. * Move get_non_overloaded_instance to function_base. Update in v2: * Add get_non_overloaded_instance for function instance. * Fix overload check for policy function. * Enrich the test cases check. Original log: This patch would like add the framework to support the RVV overloaded intrinsic API in riscv-xxx-xxx-gcc, like riscv-xxx-xxx-g++ did. However, it almost leverage the hook TARGET_RESOLVE_OVERLOADED_BUILTIN with below steps. * Register overloaded functions. * Add function_resolver for overloaded function resolving. * Add resolve API for function shape with default implementation. * Implement HOOK for navigating the overloaded API to non-overloaded API. gcc/ChangeLog: * config/riscv/riscv-c.cc (riscv_resolve_overloaded_builtin): New function for the hook. (riscv_register_pragmas): Register the hook. * config/riscv/riscv-protos.h (resolve_overloaded_builtin): New decl. * config/riscv/riscv-vector-builtins-bases.cc: New function impl. * config/riscv/riscv-vector-builtins-shapes.cc (build_one): Register overloaded function. * config/riscv/riscv-vector-builtins.cc (struct non_overloaded_registered_function_hasher): New hash table. (function_builder::add_function): Add overloaded arg. (function_builder::add_unique_function): Map overloaded function to non-overloaded function. (function_builder::add_overloaded_function): New API impl. (registered_function::overloaded_hash): Calculate hash value. (has_vxrm_or_frm_p): New function impl. (non_overloaded_registered_function_hasher::hash): Ditto. (non_overloaded_registered_function_hasher::equal): Ditto. (handle_pragma_vector): Allocate space for hash table. (resolve_overloaded_builtin): New function impl. * config/riscv/riscv-vector-builtins.h (function_base::may_require_frm_p): Ditto. (function_base::may_require_vxrm_p): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/overloaded_rv32_vadd.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv32_vfadd.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv32_vget_vset.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv32_vloxseg2ei16.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv32_vmv.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv32_vreinterpret.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv64_vadd.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv64_vfadd.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv64_vget_vset.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv64_vloxseg2ei16.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv64_vmv.c: New test. * gcc.target/riscv/rvv/base/overloaded_rv64_vreinterpret.c: New test. * gcc.target/riscv/rvv/base/overloaded_vadd.h: New test. * gcc.target/riscv/rvv/base/overloaded_vfadd.h: New test. * gcc.target/riscv/rvv/base/overloaded_vget_vset.h: New test. * gcc.target/riscv/rvv/base/overloaded_vloxseg2ei16.h: New test. * gcc.target/riscv/rvv/base/overloaded_vmv.h: New test. * gcc.target/riscv/rvv/base/overloaded_vreinterpret.h: New test. Signed-off-by: Li Xu <xuli1@eswincomputing.com> Co-Authored-By: Pan Li <pan2.li@intel.com>
2023-11-06Push no-evex512 target for 128/256 bit intrinsHaochen Jiang18-35/+47
gcc/ChangeLog: PR target/111889 * config/i386/avx512bf16intrin.h: Push no-evex512 target. * config/i386/avx512bf16vlintrin.h: Ditto. * config/i386/avx512bitalgvlintrin.h: Ditto. * config/i386/avx512bwintrin.h: Ditto. * config/i386/avx512dqintrin.h: Ditto. * config/i386/avx512fintrin.h: Ditto. * config/i386/avx512fp16intrin.h: Ditto. * config/i386/avx512fp16vlintrin.h: Ditto. * config/i386/avx512ifmavlintrin.h: Ditto. * config/i386/avx512vbmi2vlintrin.h: Ditto. * config/i386/avx512vbmivlintrin.h: Ditto. * config/i386/avx512vlbwintrin.h: Ditto. * config/i386/avx512vldqintrin.h: Ditto. * config/i386/avx512vlintrin.h: Ditto. * config/i386/avx512vnnivlintrin.h: Ditto. * config/i386/avx512vp2intersectvlintrin.h: Ditto. * config/i386/avx512vpopcntdqvlintrin.h: Ditto. gcc/testsuite/ChangeLog: PR target/111889 * gcc.target/i386/pr111889.c: New test.
2023-11-06[PATCH 3/3] Change internal intrin call for AVX512 intrinsHaochen Jiang5-69/+409
gcc/ChangeLog: * config/i386/avx512bf16vlintrin.h (_mm_avx512_castsi128_ps): New. (_mm256_avx512_castsi256_ps): Ditto. (_mm_avx512_slli_epi32): Ditto. (_mm256_avx512_slli_epi32): Ditto. (_mm_avx512_cvtepi16_epi32): Ditto. (_mm256_avx512_cvtepi16_epi32): Ditto. (__attribute__): Change intrin call. * config/i386/avx512bwintrin.h (_mm_avx512_set_epi32): New. (_mm_avx512_set_epi16): Ditto. (_mm_avx512_set_epi8): Ditto. (__attribute__): Change intrin call. * config/i386/avx512fp16intrin.h: Ditto. * config/i386/avx512fp16vlintrin.h (_mm_avx512_set1_ps): New. (_mm256_avx512_set1_ps): Ditto. (_mm_avx512_and_si128): Ditto. (_mm256_avx512_and_si256): Ditto. (__attribute__): Change intrin call. * config/i386/avx512vlbwintrin.h (_mm_avx512_set1_epi32): New. (_mm_avx512_set1_epi16): Ditto. (_mm_avx512_set1_epi8): Ditto. (_mm256_avx512_set_epi16): Ditto. (_mm256_avx512_set_epi8): Ditto. (_mm256_avx512_set1_epi16): Ditto. (_mm256_avx512_set1_epi32): Ditto. (_mm256_avx512_set1_epi8): Ditto. (_mm_avx512_max_epi16): Ditto. (_mm_avx512_min_epi16): Ditto. (_mm_avx512_max_epu16): Ditto. (_mm_avx512_min_epu16): Ditto. (_mm_avx512_max_epi8): Ditto. (_mm_avx512_min_epi8): Ditto. (_mm_avx512_max_epu8): Ditto. (_mm_avx512_min_epu8): Ditto. (_mm256_avx512_max_epi16): Ditto. (_mm256_avx512_min_epi16): Ditto. (_mm256_avx512_max_epu16): Ditto. (_mm256_avx512_min_epu16): Ditto. (_mm256_avx512_insertf128_ps): Ditto. (_mm256_avx512_extractf128_pd): Ditto. (_mm256_avx512_extracti128_si256): Ditto. (_MM256_AVX512_REDUCE_OPERATOR_BASIC_EPI16): Ditto. (_MM256_AVX512_REDUCE_OPERATOR_MAX_MIN_EP16): Ditto. (_MM256_AVX512_REDUCE_OPERATOR_BASIC_EPI8): Ditto. (_MM256_AVX512_REDUCE_OPERATOR_MAX_MIN_EP8): Ditto. (__attribute__): Change intrin call.
2023-11-06[PATCH 2/3] Change internal intrin call for AVX512 intrinsHaochen Jiang6-53/+113
gcc/ChangeLog: * config/i386/avx512bf16vlintrin.h: Change intrin call. * config/i386/avx512fintrin.h (_mm_avx512_undefined_ps): New. (_mm_avx512_undefined_pd): Ditto. (__attribute__): Change intrin call. * config/i386/avx512vbmivlintrin.h: Ditto. * config/i386/avx512vlbwintrin.h: Ditto. * config/i386/avx512vldqintrin.h: Ditto. * config/i386/avx512vlintrin.h (_mm_avx512_undefined_si128): New. (_mm256_avx512_undefined_ps): Ditto. (_mm256_avx512_undefined_pd): Ditto. (_mm256_avx512_undefined_si256): Ditto. (__attribute__): Change intrin call.
2023-11-06[PATCH 1/3] Change internal intrin call for AVX512 intrinsHaochen Jiang12-1067/+1109
The newly added _mm{,256}_avx512* intrins are duplicated from their _mm{,256}_* forms from AVX2 or before. We need to add them to prevent target option mismatch when calling AVX512 intrins implemented with these intrins under no-evex512 function attribute. All AVX512 intrins calling those AVX2 intrins or before will change their calls to these newly added AVX512 version. gcc/ChangeLog: * config/i386/avx512bitalgvlintrin.h: Change intrin call. * config/i386/avx512dqintrin.h: Ditto. * config/i386/avx512fintrin.h: (_mm_avx512_setzero_ps): New. (_mm_avx512_setzero_pd): Ditto. (__attribute__): Change intrin call. * config/i386/avx512fp16intrin.h: Ditto. * config/i386/avx512fp16vlintrin.h: Ditto. * config/i386/avx512vbmi2vlintrin.h: Ditto. * config/i386/avx512vbmivlintrin.h: Ditto. * config/i386/avx512vlbwintrin.h: Ditto. * config/i386/avx512vldqintrin.h: Ditto. * config/i386/avx512vlintrin.h (_mm_avx512_setzero_si128): New. (_mm256_avx512_setzero_pd): Ditto. (_mm256_avx512_setzero_ps): Ditto. (_mm256_avx512_setzero_si256): Ditto. (__attribute__): Change intrin call. * config/i386/avx512vpopcntdqvlintrin.h: Ditto. * config/i386/gfniintrin.h: Ditto.
2023-11-06Daily bump.GCC Administrator5-1/+95
2023-11-05Testsuite, i386: Mark test as requiring dfpFrancois-Xavier Coudert1-1/+1
Test is currently failing on x86_64-apple-darwin with "decimal floating-point not supported for this target". gcc/testsuite/ChangeLog: * gcc.target/i386/pr111753.c: Require dfp.
2023-11-05i386: Add LEGACY_INDEX_REG register class.Uros Bizjak2-16/+22
Also rename LEGACY_REGS to LEGACY_GENERAL_REGS. gcc/ChangeLog: * config/i386/i386.h (enum reg_class): Add LEGACY_INDEX_REGS. Rename LEGACY_REGS to LEGACY_GENERAL_REGS. (REG_CLASS_NAMES): Ditto. (REG_CLASS_CONTENTS): Ditto. * config/i386/constraints.md ("R"): Update for rename.
2023-11-05mode-switching: Remove unused bbnum fieldRichard Sandiford1-13/+5
seginfo had an unused bbnum field, presumably dating from before BB information was attached directly to insns. gcc/ * mode-switching.cc: Remove unused forward references. (seginfo): Remove bbnum. (new_seginfo): Remove associated argument. (optimize_mode_switching): Update calls accordingly.
2023-11-05read-rtl: Fix infinite loop while parsing [...]Richard Sandiford1-1/+3
read_rtx_operand would spin endlessly for: (unspec [(...))] UNSPEC_FOO) because read_nested_rtx does nothing if the next character is not '('. gcc/ * read-rtl.cc (read_rtx_operand): Avoid spinning endlessly for invalid [...] operands.
2023-11-05openmp: Mention C attribute syntax in documentationJakub Jelinek1-1/+1
This patch mentions the C attribute syntax support in the libgomp documentation. 2023-11-05 Jakub Jelinek <jakub@redhat.com> * libgomp.texi (Enabling OpenMP): Adjust wording for attribute syntax supported also in C.
2023-11-05openmp: Adjust handling of __has_attribute (omp::directive)/sequence and add ↵Jakub Jelinek4-189/+115
omp::decl I forgot to tweak c_common_has_attribute for the C++ omp::decl addition and now also for the C omp::{directive,sequence,decl} addition. 2023-11-05 Jakub Jelinek <jakub@redhat.com> * c-lex.cc (c_common_has_attribute): Return 1 for omp::directive and omp::sequence with -fopenmp or -fopenmp-simd also for C, not just for C++. Return 1 for omp::decl with -fopenmp or -fopenmp-simd for both C and C++. * c-c++-common/gomp/attrs-1.c: Adjust for omp::directive and omp::sequence being supported also in C and add tests for omp::decl. * c-c++-common/gomp/attrs-2.c: Likewise. * c-c++-common/gomp/attrs-3.c: Add tests for omp::decl.
2023-11-05aarch64: Rework aarch64_modes_tieable_p [PR112105]Richard Sandiford3-111/+147
On AArch64, can_change_mode_class and modes_tieable_p are mostly answering the same questions: (a) Do two modes have the same layout for the bytes that are common to both modes? (b) Do all valid subregs involving the two modes behave as GCC would expect? (c) Is there at least one register that can hold both modes? These questions involve no class-dependent tests, and the relationship is symmetrical. This means we can do most of the checks in a common subroutine. can_change_mode_class is the hook that matters for correctness, while modes_tieable_p is more for optimisation. It was therefore can_change_mode_class that had the more accurate tests. modes_tieable_p was looser in some ways (e.g. it missed some big-endian tests) and overly strict in others (it didn't allow ties between a vector structure mode and the mode of a single lane). The overly strict part caused a missed combination in the testcase. I think the can_change_mode_class logic also needed some tweaks, as described in the changelog. gcc/ PR target/112105 * config/aarch64/aarch64.cc (aarch64_modes_compatible_p): New function, with the core logic extracted from... (aarch64_can_change_mode_class): ...here. Extend the previous rules to allow changes between partial SVE modes and other modes if the other mode is no bigger than an element, and if no other rule prevents it. Use the aarch64_modes_tieable_p handling of partial Advanced SIMD structure modes. (aarch64_modes_tieable_p): Use aarch64_modes_compatible_p. Allow all vector mode ties that it allows. gcc/testsuite/ PR target/112105 * gcc.target/aarch64/pr112105.c: New test. * gcc.target/aarch64/sve/pcs/struct_3_128.c: Expect a 32-bit spill rather than a 16-bit spill.
2023-11-05RISC-V: Support FP rint to i/l/ll diff size autovecPan Li16-56/+514
This patch would like to support the FP below API auto vectorization with different type size +---------+-----------+----------+ | API | RV64 | RV32 | +---------+-----------+----------+ | irint | DF => SI | DF => SI | | irintf | - | - | | lrint | - | DF => SI | | lrintf | SF => DI | - | | llrint | - | - | | llrintf | SF => DI | SF => DI | +---------+-----------+----------+ Given below code: void test_lrintf (long *out, float *in, unsigned count) { for (unsigned i = 0; i < count; i++) out[i] = __builtin_lrintf (in[i]); } Before this patch: test_lrintf: beq a2,zero,.L8 slli a5,a2,32 srli a2,a5,30 add a4,a1,a2 .L3: flw fa5,0(a1) addi a1,a1,4 addi a0,a0,8 fcvt.l.s a5,fa5,dyn sd a5,-8(a0) bne a1,a4,.L3 After this patch: test_lrintf: beq a2,zero,.L8 slli a2,a2,32 srli a2,a2,32 .L3: vsetvli a5,a2,e32,mf2,ta,ma vle32.v v2,0(a1) slli a3,a5,2 slli a4,a5,3 vfwcvt.x.f.v v1,v2 sub a2,a2,a5 vse64.v v1,0(a0) add a1,a1,a3 add a0,a0,a4 bne a2,zero,.L3 Unfortunately, the HF mode is not include due to it requires additional middle-end support from internal-fun.def. gcc/ChangeLog: * config/riscv/autovec.md: Remove the size check of lrint. * config/riscv/riscv-v.cc (emit_vec_narrow_cvt_x_f): New help emit func impl. (emit_vec_widden_cvt_x_f): New help emit func impl. (emit_vec_rounding_to_integer): New func impl to emit the rounding from FP to integer. (expand_vec_lrint): Leverage emit_vec_rounding_to_integer. * config/riscv/vector.md: Take V_VLSF for vfncvt. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c: * gcc.target/riscv/rvv/autovec/unop/math-irint-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-irintf-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrintf-rv64-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrintf-rv64-run-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-irint-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-llrintf-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lrint-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lrintf-rv64-0.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-05RISC-V: Fix bug of vlds attributeJuzhe-Zhong1-1/+1
This issue is noticed when support strided load/store auto-vectorization. Commit it as it is obvious. gcc/ChangeLog: * config/riscv/vector.md: Fix bug.
2023-11-05Daily bump.GCC Administrator12-1/+545
2023-11-04diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]Sergei Trofimovich1-1/+2
Without the change `./configure --enable-checking=release` bootstrap fails as: gcc/gcc-urlifier.cc:100:1: error: 'get_url_suffix_for_quoted_text()' defined but not used [-Werror=unused-function] This happens because the helper is used only in `ASSERT` macros which don't always get expanded to executable code. The fix marks helper function with `ATTRIBUTE_UNUSED`. gcc/ PR bootstrap/112379 * gcc-urlifier.cc (get_url_suffix_for_quoted_text): Mark as ATTRIBUTE_UNUSED.
2023-11-04libstdc++: Remove redundant partial specialization in _Nth_typeFeng Jisen1-4/+0
libstdc++-v3/ChangeLog: * include/bits/utility.h (_Nth_type): Remove redundant partial specialization.
2023-11-04libstdc++: Use strerror_r in std::generic_category()::message(int) [PR110133]Jonathan Wakely2-10/+72
Use strerror_r instead of strerror when available, due to the latter not being thread-safe. This is complicated by Glibc providing a GNU-specific strerror_r which is not compatible with POSIX strerror_r, so we need to dispatch on the return type. We can use the recently-added std::string::__resize_and_overwrite to write directly into the string buffer when possible. Because we estimate the initial buffer size we might end up with excess capacity in the returned std::string. We can slightly tweak the std::system_error constructors to make use of that excess capacity, so that in some cases we require fewer allocations to construct the std::system_error::what() string. libstdc++-v3/ChangeLog: PR libstdc++/110133 * include/std/system_error (system_error::system_error): Group arguments so that concatenation can reuse rvalue's capacity. * src/c++11/system_error.cc (strerror_string): New function. [_GLIBCXX_HAVE_STRERROR_R] (use_strerror_result): New functions. (generic_error_category::message): Use strerror_string. (system_error_category::message): Likewise.
2023-11-04libstdc++: Replace "_N" in examples of naming conventionsJonathan Wakely2-4/+4
The name "_N" is listed as a reserved name on Solaris, so we shouldn't use it as an example of our naming conventions. libstdc++-v3/ChangeLog: * doc/xml/manual/appendix_contributing.xml: Replace example that uses a BADNAME. * doc/html/manual/source_code_style.html: Regenerate.
2023-11-04openmp: Add omp::decl support for C2XJakub Jelinek6-8/+394
This patch adds omp::decl support which has been added recently for C++ also to C. 2023-11-04 Jakub Jelinek <jakub@redhat.com> * c-parser.h (c_maybe_parse_omp_decl): Declare. * c-parser.cc (struct c_parser): Add in_omp_decl_attribute member. (c_parser_std_attribute): Uncoment omp::decl handling. (c_parser_omp_var_list_parens): If parser->in_omp_decl_attribute don't expect any arguments, instead create clause or TREE_LIST for that decl. (c_maybe_parse_omp_decl): New function. (c_parser_omp_declare_target): If parser->in_omp_decl_attribute and first token isn't name or comma invoke c_parser_omp_var_list_parens. * c-decl.cc (c_decl_attributes): Uncomment omp::decl handling and use *node rather than non-existing *decl. * gcc.dg/gomp/attrs-19.c: New test. * gcc.dg/gomp/attrs-20.c: New test. * gcc.dg/gomp/attrs-21.c: New test.
2023-11-04openmp: Add support for omp::directive and omp::sequence attributes in C2XJakub Jelinek32-81/+1767
The following patch adds support for attribute syntax which we have in C++11 and above since GCC 12 also for C, where OpenMP standard is going to add it in OpenMP 6.0. 2023-11-04 Jakub Jelinek <jakub@redhat.com> gcc/c/ * c-tree.def: New file. * c-tree.h (struct c_tree_token_vec): Forward declare. (c_tree_size): Declare. * c-lang.h (struct c_omp_declare_target_attr): Add attr_syntax member. (struct c_omp_begin_assumes_data): New type. (current_omp_begin_assumes): Change type from int to vec<c_omp_begin_assumes_data, va_gc> *. * c-lang.cc: Include c-family/c-pragma.h and c-parser.h. * c-parser.h (struct c_tree_token_vec_struct): New type. (C_TOKEN_VEC_TOKENS): New macro. * c-parser.cc (struct c_parser): Add omp_attrs_forbidden_p and in_omp_attribute_pragma members. (c_parser_skip_until_found): Handle CPP_PRAGMA_EOL when parser->in_omp_attribute_pragma. (c_parser_skip_to_pragma_eol): Likewise. (c_parser_translation_unit): Adjust for current_omp_begin_assumes being a vector rather than counter. (c_parser_declaration_or_fndef): Handle omp::directive and omp::sequence attributes on attribute declaration and declare simd or declare variant directives in those on function declarations. (c_parser_check_balanced_raw_token_sequence): Forward declare. (c_parser_omp_directive_args, c_parser_omp_sequence_args): New functions. (c_parser_std_attribute): Handle omp::directive and omp::sequence attributes. (struct c_omp_attribute_data): New type. (c_parser_handle_statement_omp_attributes, c_parser_handle_directive_omp_attributes): New functions. (c_parser_compound_statement_nostart): Handle omp::directive and omp::sequence attributes on statements. Formatting fix. (c_parser_all_labels): Handle omp::directive and omp::sequence attributes on statements. (c_parser_statement): Clear parser->omp_attrs_forbidden_p. (c_parser_omp_variable_list): Handle parser->tokens != &parser->tokens_buf[0] by saving/restoring it. (c_parser_omp_structured_block): Set parser->omp_attrs_forbidden_p. (c_parser_omp_section_scan): New function. (c_parser_omp_structured_block_sequence, c_parser_omp_sections_scope): Use it. (c_parser_omp_parallel): Set parser->omp_attrs_forbidden_p. (c_parser_omp_task): Likewise. (c_parser_omp_declare_simd): Handle function declaration after std attributes. (c_finish_omp_declare_simd): Don't assert all kinds are the same. (c_parser_omp_declare_target): Also push attr_syntax flag. (c_parser_omp_begin): Likewise. Adjust for current_omp_begin_assumes type change. (c_parser_omp_end): Adjust for current_omp_begin_assumes type change. Diagnose mixing of attribute vs. pragma syntax on end assumes or end declare target. (c_parser_omp_declare_reduction): Handle parser->tokens != &parser->tokens_buf[0] by saving/restoring it. * c-decl.cc: Include c-parser.h. (current_omp_begin_assumes): Change type from int to vec<c_omp_begin_assumes_data, va_gc> *. (struct c_tree_token_vec): New type. Add static assertions for sizeof and offsetof. (union lang_tree_node): Add c_token_vec member and adjust GTY desc for it. (c_tree_size): New function. (c_decl_attributes): Diagnose invalid omp::directive attribute uses. * c-objc-common.h (LANG_HOOKS_TREE_SIZE): Redefine. gcc/cp/ * parser.h (struct cp_parser): Adjust comment on omp_attrs_forbidden_p member. * parser.cc (cp_parser_omp_section_scan): Allow __directive__ spelling. gcc/objc/ * objc-act.h (objc_common_tree_size): Remove. * objc-act.cc (objc_common_tree_size): Remove. * objc-lang.cc (LANG_HOOKS_TREE_SIZE): Remove. gcc/testsuite/ * gcc.dg/gomp/attrs-1.c: New test. * gcc.dg/gomp/attrs-2.c: New test. * gcc.dg/gomp/attrs-3.c: New test. * gcc.dg/gomp/attrs-4.c: New test. * gcc.dg/gomp/attrs-5.c: New test. * gcc.dg/gomp/attrs-6.c: New test. * gcc.dg/gomp/attrs-7.c: New test. * gcc.dg/gomp/attrs-8.c: New test. * gcc.dg/gomp/attrs-9.c: New test. * gcc.dg/gomp/attrs-10.c: New test. * gcc.dg/gomp/attrs-11.c: New test. * gcc.dg/gomp/attrs-12.c: New test. * gcc.dg/gomp/attrs-13.c: New test. * gcc.dg/gomp/attrs-14.c: New test. * gcc.dg/gomp/attrs-15.c: New test. * gcc.dg/gomp/attrs-16.c: New test. * gcc.dg/gomp/attrs-17.c: New test. * gcc.dg/gomp/attrs-18.c: New test. * g++.dg/gomp/attrs-2.C: Enable for c++11 rather than just c++17. Avoid using omp : syntax for c++11, c++14 and c.
2023-11-04RISC-V: Remove HF modes of FP to INT rounding autovecPan Li1-57/+2
The [i|l|ll][rint|round|ceil|floor] internal functions are defined as DEF_INTERNAL_FLT_FN instead of DEF_INTERNAL_FLT_FLOATN_FN. Then the *f16 (N=16 of FLOATN) format of these functions are not available when try to get the ifn from the given cfn in the vectorizable_call. Aka: BUILT_IN_LRINTF16 => IFN_LAST (should be IFN_LRINT here) BUILT_IN_RINTF16 => IFN_RINT It is better to remove FP16 related modes until the additional middle-end support is ready. This patch would like to clean the FP16 modes with some comments. gcc/ChangeLog: * config/riscv/vector-iterators.md: Remove HF modes. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-03diagnostics: add automatic URL-ification within messagesDavid Malcolm14-11/+498
In r10-3781-gd26082357676a3 GCC's pretty-print framework gained the ability to emit embedding URLs via escape sequences for marking up text output.. In r10-3783-gb4c7ca2ef3915a GCC started using this for the [-Wname-of-option] emitted at the end of each diagnostic so that it becomes a hyperlink to the documentation for that option on the GCC website. This makes it much more convenient for the user to locate pertinent documentation when a diagnostic is emitted. The above involved special-casing in one specific place, but there is plenty of quoted text throughout GCC's diagnostic messages that could usefully have a documentation URL: references to options, pragmas, etc This patch adds a new optional "urlifier" parameter to pp_format. The idea is that a urlifier object has responsibility for mapping from quoted strings in diagnostic messages to URLs, and pp_format has the ability to automatically add URL escapes for strings that the urlifier gives it URLs for. For example, given the format string: "%<#pragma pack%> has no effect with %<-fpack-struct%>" with this patch GCC is able to automatically linkify the "#pragma pack" text to https://gcc.gnu.org/onlinedocs/gcc/Structure-Layout-Pragmas.html and the "-fpack-struct" text to: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fpack-struct and we don't have to modify the format string itself. This is only done for the pp_format within diagnostic_context::report_diagnostic i.e. just for the primary message in each diagnostics, and not for other places within GCC that use pp format internally. "urlifier" is an abstract base class, with a GCC-specific subclass implementing the logic for generating URLs into GCC's HTML documentation via binary search in a data table. This patch implements the gcc_urlifier with a small table generated by hand; the data table in this patch only covers various pragmas and the option referenced by the above pragma message. I have a followup patch that scripts the creation of this data by directly scraping the output of "make html", thus automating all this, and (I hope) minimizing the work of ensuring that documentation URLs emitted by GCC match the generated documentation. gcc/ChangeLog: * Makefile.in (GCC_OBJS): Add gcc-urlifier.o. (OBJS): Likewise. gcc/c-family/ChangeLog: * c-pragma.cc:: (handle_pragma_push_options): Fix missing "GCC" in name of pragma in "junk" message. (handle_pragma_pop_options): Likewise. gcc/ChangeLog: * diagnostic.cc: Include "pretty-print-urlifier.h". (diagnostic_context::initialize): Initialize m_urlifier. (diagnostic_context::finish): Clean up m_urlifier (diagnostic_report::diagnostic): m_urlifier to pp_format. * diagnostic.h (diagnostic_context::m_urlifier): New field. * gcc-urlifier.cc: New file. * gcc-urlifier.def: New file. * gcc-urlifier.h: New file. * gcc.cc: Include "gcc-urlifier.h". (driver::global_initializations): Initialize global_dc->m_urlifier. * pretty-print-urlifier.h: New file. * pretty-print.cc: Include "pretty-print-urlifier.h". (obstack_append_string): New. (urlify_quoted_string): New. (pp_format): Add "urlifier" param and use it to implement optional urlification of quoted text strings. (pp_output_formatted_text): Make buffer a const pointer. (selftest::pp_printf_with_urlifier): New. (selftest::test_urlification): New. (selftest::pretty_print_cc_tests): Call it. * pretty-print.h (class urlifier): New forward declaration. (pp_format): Add optional urlifier param. * selftest-run-tests.cc (selftest::run_tests): Call selftest::gcc_urlifier_cc_tests . * selftest.h (selftest::gcc_urlifier_cc_tests): New decl. * toplev.cc: Include "gcc-urlifier.h". (general_init): Initialize global_dc->m_urlifier. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-03diagnostics: convert diagnostic_context to a classDavid Malcolm37-689/+851
This patch: - converts "struct diagnostic_context" to "class diagnostic_context". - ensures all data members have an "m_" prefix, except for "printer", which has so many uses that renaming would be painful. - makes most of the data members private - converts much of the diagnostic_* functions to member functions of diagnostic_context, adding compatibility wrappers for users such as the Fortran frontend, and making as many as possible private. No functional change intended. gcc/ChangeLog: * common.opt (fdiagnostics-text-art-charset=): Remove refererence to diagnostic-text-art.h. * coretypes.h (struct diagnostic_context): Replace forward decl with... (class diagnostic_context): ...this. * diagnostic-format-json.cc: Update for changes to diagnostic_context. * diagnostic-format-sarif.cc: Likewise. * diagnostic-show-locus.cc: Likewise. * diagnostic-text-art.h: Deleted file, moving content... (enum diagnostic_text_art_charset): ...to diagnostic.h, (DIAGNOSTICS_TEXT_ART_CHARSET_DEFAULT): ...deleting, (diagnostics_text_art_charset_init): ...deleting in favor of diagnostic_context::set_text_art_charset. * diagnostic.cc: Remove include of "diagnostic-text-art.h". (pedantic_warning_kind): Update for field renaming. (permissive_error_kind): Likewise. (permissive_error_option): Likewise. (diagnostic_initialize): Convert to... (diagnostic_context::initialize): ...this, updating for field renamings. (diagnostic_color_init): Convert to... (diagnostic_context::color_init): ...this. (diagnostic_urls_init): Convert to... (diagnostic_context::urls_init): ...this. (diagnostic_initialize_input_context): Convert to... (diagnostic_context::initialize_input_context): ...this. (diagnostic_finish): Convert to... (diagnostic_context::finish): ...this, updating for field renamings. (diagnostic_context::set_output_format): New. (diagnostic_context::set_client_data_hooks): New. (diagnostic_context::create_edit_context): New. (diagnostic_converted_column): Convert to... (diagnostic_context::converted_column): ...this. (diagnostic_get_location_text): Update for field renaming. (diagnostic_check_max_errors): Convert to... (diagnostic_context::check_max_errors): ...this, updating for field renamings. (diagnostic_action_after_output): Convert to... (diagnostic_context::action_after_output): ...this, updating for field renamings. (last_module_changed_p): Delete. (set_last_module): Delete. (includes_seen): Convert to... (diagnostic_context::includes_seen_p): ...this, updating for field renamings. (diagnostic_report_current_module): Convert to... (diagnostic_context::report_current_module): ...this, updating for field renamings, and replacing uses of last_module_changed_p and set_last_module to simple field accesses. (diagnostic_show_any_path): Convert to... (diagnostic_context::show_any_path): ...this. (diagnostic_classify_diagnostic): Convert to... (diagnostic_context::classify_diagnostic): ...this, updating for field renamings. (diagnostic_push_diagnostics): Convert to... (diagnostic_context::push_diagnostics): ...this, updating for field renamings. (diagnostic_pop_diagnostics): Convert to... (diagnostic_context::pop_diagnostics): ...this, updating for field renamings. (get_any_inlining_info): Convert to... (diagnostic_context::get_any_inlining_info): ...this, updating for field renamings. (update_effective_level_from_pragmas): Convert to... (diagnostic_context::update_effective_level_from_pragmas): ...this, updating for field renamings. (print_any_cwe): Convert to... (diagnostic_context::print_any_cwe): ...this. (print_any_rules): Convert to... (diagnostic_context::print_any_rules): ...this. (print_option_information): Convert to... (diagnostic_context::print_option_information): ...this, updating for field renamings. (diagnostic_enabled): Convert to... (diagnostic_context::diagnostic_enabled): ...this, updating for field renamings. (warning_enabled_at): Convert to... (diagnostic_context::warning_enabled_at): ...this. (diagnostic_report_diagnostic): Convert to... (diagnostic_context::report_diagnostic): ...this, updating for field renamings and conversions to member functions. (diagnostic_append_note): Update for field renaming. (diagnostic_impl): Use diagnostic_context::report_diagnostic directly. (diagnostic_n_impl): Likewise. (diagnostic_emit_diagram): Convert to... (diagnostic_context::emit_diagram): ...this, updating for field renamings. (error_recursion): Convert to... (diagnostic_context::error_recursion): ...this. (diagnostic_text_output_format::~diagnostic_text_output_format): Use accessor. (diagnostics_text_art_charset_init): Convert to... (diagnostic_context::set_text_art_charset): ...this. (assert_location_text): Update for field renamings. * diagnostic.h (enum diagnostic_text_art_charset): Move here from diagnostic-text-art.h. (struct diagnostic_context): Convert to... (class diagnostic_context): ...this. (diagnostic_context::ice_handler_callback_t): New typedef. (diagnostic_context::set_locations_callback_t): New typedef. (diagnostic_context::initialize): New decl. (diagnostic_context::color_init): New decl. (diagnostic_context::urls_init): New decl. (diagnostic_context::file_cache_init): New decl. (diagnostic_context::finish): New decl. (diagnostic_context::set_set_locations_callback): New. (diagnostic_context::initialize_input_context): New decl. (diagnostic_context::warning_enabled_at): New decl. (diagnostic_context::option_unspecified_p): New. (diagnostic_context::report_diagnostic): New decl. (diagnostic_context::report_current_module): New decl. (diagnostic_context::check_max_errors): New decl. (diagnostic_context::action_after_output): New decl. (diagnostic_context::classify_diagnostic): New decl. (diagnostic_context::push_diagnostics): New decl. (diagnostic_context::pop_diagnostics): New decl. (diagnostic_context::emit_diagram): New decl. (diagnostic_context::set_output_format): New decl. (diagnostic_context::set_text_art_charset): New decl. (diagnostic_context::set_client_data_hooks): New decl. (diagnostic_context::create_edit_context): New decl. (diagnostic_context::set_warning_as_error_requested): New. (diagnostic_context::set_report_bug): New. (diagnostic_context::set_extra_output_kind): New. (diagnostic_context::set_show_cwe): New. (diagnostic_context::set_show_rules): New. (diagnostic_context::set_path_format): New. (diagnostic_context::set_show_path_depths): New. (diagnostic_context::set_show_option_requested): New. (diagnostic_context::set_max_errors): New. (diagnostic_context::set_escape_format): New. (diagnostic_context::set_ice_handler_callback): New. (diagnostic_context::warning_as_error_requested_p): New. (diagnostic_context::show_path_depths_p): New. (diagnostic_context::get_path_format): New. (diagnostic_context::get_escape_format): New. (diagnostic_context::get_file_cache): New. (diagnostic_context::get_edit_context): New. (diagnostic_context::get_client_data_hooks): New. (diagnostic_context::get_diagram_theme): New. (diagnostic_context::converted_column): New decl. (diagnostic_context::diagnostic_count): New. (diagnostic_context::includes_seen_p): New decl. (diagnostic_context::print_any_cwe): New decl. (diagnostic_context::print_any_rules): New decl. (diagnostic_context::print_option_information): New decl. (diagnostic_context::show_any_path): New decl. (diagnostic_context::error_recursion): New decl. (diagnostic_context::diagnostic_enabled): New decl. (diagnostic_context::get_any_inlining_info): New decl. (diagnostic_context::update_effective_level_from_pragmas): New decl. (diagnostic_context::m_file_cache): Make private. (diagnostic_context::diagnostic_count): Rename to... (diagnostic_context::m_diagnostic_count): ...this and make private. (diagnostic_context::warning_as_error_requested): Rename to... (diagnostic_context::m_warning_as_error_requested): ...this and make private. (diagnostic_context::n_opts): Rename to... (diagnostic_context::m_n_opts): ...this and make private. (diagnostic_context::classify_diagnostic): Rename to... (diagnostic_context::m_classify_diagnostic): ...this and make private. (diagnostic_context::classification_history): Rename to... (diagnostic_context::m_classification_history): ...this and make private. (diagnostic_context::n_classification_history): Rename to... (diagnostic_context::m_n_classification_history): ...this and make private. (diagnostic_context::push_list): Rename to... (diagnostic_context::m_push_list): ...this and make private. (diagnostic_context::n_push): Rename to... (diagnostic_context::m_n_push): ...this and make private. (diagnostic_context::show_cwe): Rename to... (diagnostic_context::m_show_cwe): ...this and make private. (diagnostic_context::show_rules): Rename to... (diagnostic_context::m_show_rules): ...this and make private. (diagnostic_context::path_format): Rename to... (diagnostic_context::m_path_format): ...this and make private. (diagnostic_context::show_path_depths): Rename to... (diagnostic_context::m_show_path_depths): ...this and make private. (diagnostic_context::show_option_requested): Rename to... (diagnostic_context::m_show_option_requested): ...this and make private. (diagnostic_context::abort_on_error): Rename to... (diagnostic_context::m_abort_on_error): ...this. (diagnostic_context::show_column): Rename to... (diagnostic_context::m_show_column): ...this. (diagnostic_context::pedantic_errors): Rename to... (diagnostic_context::m_pedantic_errors): ...this. (diagnostic_context::permissive): Rename to... (diagnostic_context::m_permissive): ...this. (diagnostic_context::opt_permissive): Rename to... (diagnostic_context::m_opt_permissive): ...this. (diagnostic_context::fatal_errors): Rename to... (diagnostic_context::m_fatal_errors): ...this. (diagnostic_context::dc_inhibit_warnings): Rename to... (diagnostic_context::m_inhibit_warnings): ...this. (diagnostic_context::dc_warn_system_headers): Rename to... (diagnostic_context::m_warn_system_headers): ...this. (diagnostic_context::max_errors): Rename to... (diagnostic_context::m_max_errors): ...this and make private. (diagnostic_context::internal_error): Rename to... (diagnostic_context::m_internal_error): ...this. (diagnostic_context::option_enabled): Rename to... (diagnostic_context::m_option_enabled): ...this. (diagnostic_context::option_state): Rename to... (diagnostic_context::m_option_state): ...this. (diagnostic_context::option_name): Rename to... (diagnostic_context::m_option_name): ...this. (diagnostic_context::get_option_url): Rename to... (diagnostic_context::m_get_option_url): ...this. (diagnostic_context::print_path): Rename to... (diagnostic_context::m_print_path): ...this. (diagnostic_context::make_json_for_path): Rename to... (diagnostic_context::m_make_json_for_path): ...this. (diagnostic_context::x_data): Rename to... (diagnostic_context::m_client_aux_data): ...this. (diagnostic_context::last_location): Rename to... (diagnostic_context::m_last_location): ...this. (diagnostic_context::last_module): Rename to... (diagnostic_context::m_last_module): ...this and make private. (diagnostic_context::lock): Rename to... (diagnostic_context::m_lock): ...this and make private. (diagnostic_context::lang_mask): Rename to... (diagnostic_context::m_lang_mask): ...this. (diagnostic_context::inhibit_notes_p): Rename to... (diagnostic_context::m_inhibit_notes_p): ...this. (diagnostic_context::report_bug): Rename to... (diagnostic_context::m_report_bug): ...this and make private. (diagnostic_context::extra_output_kind): Rename to... (diagnostic_context::m_extra_output_kind): ...this and make private. (diagnostic_context::column_unit): Rename to... (diagnostic_context::m_column_unit): ...this and make private. (diagnostic_context::column_origin): Rename to... (diagnostic_context::m_column_origin): ...this and make private. (diagnostic_context::tabstop): Rename to... (diagnostic_context::m_tabstop): ...this and make private. (diagnostic_context::escape_format): Rename to... (diagnostic_context::m_escape_format): ...this and make private. (diagnostic_context::edit_context_ptr): Rename to... (diagnostic_context::m_edit_context_ptr): ...this and make private. (diagnostic_context::set_locations_cb): Rename to... (diagnostic_context::m_set_locations_cb): ...this and make private. (diagnostic_context::ice_handler_cb): Rename to... (diagnostic_context::m_ice_handler_cb): ...this and make private. (diagnostic_context::includes_seen): Rename to... (diagnostic_context::m_includes_seen): ...this and make private. (diagnostic_inhibit_notes): Update for field renaming. (diagnostic_context_auxiliary_data): Likewise. (diagnostic_abort_on_error): Convert from macro to inline function and update for field renaming. (diagnostic_kind_count): Convert from macro to inline function and use diagnostic_count accessor. (diagnostic_report_warnings_p): Update for field renaming. (diagnostic_initialize): Convert decl to inline function calling into diagnostic_context. (diagnostic_color_init): Likewise. (diagnostic_urls_init): Likewise. (diagnostic_urls_init): Likewise. (diagnostic_finish): Likewise. (diagnostic_report_current_module): Likewise. (diagnostic_show_any_path): Delete decl. (diagnostic_initialize_input_context): Convert decl to inline function calling into diagnostic_context. (diagnostic_classify_diagnostic): Likewise. (diagnostic_push_diagnostics): Likewise. (diagnostic_pop_diagnostics): Likewise. (diagnostic_report_diagnostic): Likewise. (diagnostic_action_after_output): Likewise. (diagnostic_check_max_errors): Likewise. (diagnostic_file_cache_fini): Delete decl. (diagnostic_converted_column): Delete decl. (warning_enabled_at): Convert decl to inline function calling into diagnostic_context. (option_unspecified_p): New. (diagnostic_emit_diagram): Delete decl. * gcc.cc: Remove include of "diagnostic-text-art.h". Update for changes to diagnostic_context. * input.cc (diagnostic_file_cache_init): Move implementation to... (diagnostic_context::file_cache_init): ...this new member function. (diagnostic_file_cache_fini): Delete. (diagnostics_file_cache_forcibly_evict_file): Update for m_file_cache becoming private. (location_get_source_line): Likewise. (get_source_file_content): Likewise. (location_missing_trailing_newline): Likewise. * input.h (diagnostics_file_cache_fini): Delete. * langhooks.cc: Update for changes to diagnostic_context. * lto-wrapper.cc: Likewise. * opts.cc: Remove include of "diagnostic-text-art.h". Update for changes to diagnostic_context. * selftest-diagnostic.cc: Update for changes to diagnostic_context. * toplev.cc: Likewise. * tree-diagnostic-path.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Update for changes to diagnostic_context. gcc/analyzer/ChangeLog: * bounds-checking.cc: Update for changes to diagnostic_context. gcc/c-family/ChangeLog: * c-common.cc: Update for changes to diagnostic_context. * c-indentation.cc: Likewise. * c-opts.cc: Likewise. * c-warn.cc: Likewise. gcc/cp/ChangeLog: * call.cc: Update for changes to diagnostic_context. * class.cc: Likewise. * decl.cc: Likewise. * error.cc: Likewise. * except.cc: Likewise. * pt.cc: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update for changes to diagnostic_context. * error.cc: Likewise. * options.cc: Likewise. gcc/jit/ChangeLog: * jit-playback.cc: Update for changes to diagnostic_context. * jit-playback.h: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_group_plugin.c: Update for changes to diagnostic_context. * gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-04Daily bump.GCC Administrator6-1/+331
2023-11-03Reduce false positives for -Wnonnull for VLA parameters [PR98541]Martin Uecker3-36/+27
This patch limits the warning about NULL arguments to VLA parameters declared [static n]. PR c/98541 gcc/ * gimple-ssa-warn-access.cc (pass_waccess::maybe_check_access_sizes): For VLA bounds in parameters, only warn about null pointers with 'static'. gcc/testsuite: * gcc.dg/Wnonnull-4.c: Adapt test. * gcc.dg/Wstringop-overflow-40.c: Adapt test.
2023-11-03Fortran: fix issue with multiple references of a procedure pointer [PR97245]Harald Anlauf2-0/+36
gcc/fortran/ChangeLog: PR fortran/97245 * match.cc (gfc_match_call): If a procedure pointer has already been resolved, do not create a new symbol in a procedure reference of the same name shadowing the first one if it is host-associated. gcc/testsuite/ChangeLog: PR fortran/97245 * gfortran.dg/proc_ptr_53.f90: New test.
2023-11-03vect: allow using inbranch simdclones for masked loopsAndre Vieira4-3/+97
In a previous patch I did most of the work for this, but forgot to change the check for number of arguments matching between call and simdclone. This check should accept calls without a mask to be matched against simdclones with mask arguments. I also added tests to verify this feature actually works. gcc/ChangeLog: * tree-vect-stmts.cc (vectorizable_simd_clone_call): Allow unmasked calls to use masked simdclones. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-simd-clone-20.c: New file. * gfortran.dg/simd-builtins-1.h: Adapt. * gfortran.dg/simd-builtins-6.f90: Adapt.
2023-11-03diagnostics: consolidate group-handling fields in diagnostic_contextDavid Malcolm2-19/+42
No functional change intended. gcc/ChangeLog: * diagnostic.cc (diagnostic_initialize): Update for consolidation of group-based fields. (diagnostic_report_diagnostic): Likewise. (diagnostic_context::begin_group): New, based on body of auto_diagnostic_group's ctor. (diagnostic_context::end_group): New, based on body of auto_diagnostic_group's dtor. (auto_diagnostic_group::auto_diagnostic_group): Convert to a call to begin_group. (auto_diagnostic_group::~auto_diagnostic_group): Convert to a call to end_group. * diagnostic.h (diagnostic_context::begin_group): New decl. (diagnostic_context::end_group): New decl. (diagnostic_context::diagnostic_group_nesting_depth): Rename to... (diagnostic_context::m_diagnostic_groups.m_nesting_depth): ...this. (diagnostic_context::diagnostic_group_emission_count): Rename to... (diagnostic_context::m_diagnostic_groups::m_emission_count): ...this. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-03Fortran: passing of allocatable/pointer arguments to OPTIONAL+VALUE [PR92887]Harald Anlauf2-3/+130
gcc/fortran/ChangeLog: PR fortran/92887 * trans-expr.cc (conv_cond_temp): Helper function for creation of a conditional temporary. (gfc_conv_procedure_call): Handle passing of allocatable or pointer actual argument to dummy with OPTIONAL + VALUE attribute. Actual arguments that are not allocated or associated are treated as not present. gcc/testsuite/ChangeLog: PR fortran/92887 * gfortran.dg/value_optional_1.f90: New test.