aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-09-07Fix pr116588.c for -m32Andrew Pinski1-0/+1
This is a simple fix which adds the target supports requirement of int128 to the testcase too. Pushed as obvious after testing to make sure the testcase is UNSUPPORTED now with -m32 but working with -m64 on x86_64-linux-gnu. gcc/testsuite/ChangeLog: * gcc.dg/pr116588.c: Require int128. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-07c++: exception spec and stdlib specializationJason Merrill4-5/+22
We were silently accepting the pr65923.C specialization of std::swap with the wrong exception specification; it should be declared noexcept. Let's limit ignoring mismatch with system headers to extern "C" functions so we get a diagnostic for the C++ library. In the case of an omitted exception-specification, let's also lower the error to a pedwarn, and copy the missing spec over, to avoid a hard break for code that accidentally relied on the old behavior. ...except extern "C" functions keep the new spec, to avoid breaking dubious code like noexcept-type19.C. gcc/cp/ChangeLog: * decl.cc (check_redeclaration_exception_specification): Remove OPT_Wsystem_headers from pedwarn when the old declaration is in a system header. Also check std namespace. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/pr65923.C: Add noexcept. * g++.dg/cpp1z/aligned-new3.C: Expect pedwarn. * g++.dg/cpp1z/noexcept-type19.C: Add comment.
2024-09-07split-path: Fix dump wording about duplicating too many statementsAndrew Pinski1-1/+1
It was pointed out in https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662183.html, that the wording with this print has too many words. Fixed thusly. Pushed as obvious after a build and test for x86_64-linux-gnu. gcc/ChangeLog: * gimple-ssa-split-paths.cc (is_feasible_trace): Fix wording on the print. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-07c++: deferring partial substitution into lambda [PR116567]Patrick Palka2-17/+60
Here we correctly defer partial substitution into the lambda used as a default template argument, but then incorrectly perform the full substitution, because add_extra_args adds outer template arguments from the full substitution that are not related to the original template context of the lambda. For example, the template depth of the first lambda is 1 but add_extra_args return a set of args with 3 levels, with the inner level corresponding to the parameters of v1 (good) and the outer levels corresponding to those of A and B (bad). For the cases that we're interested in, add_extra_args can assume that the deferred args are a full set of template arguments, and so it suffices to just substitute into the deferred args and not do any additional merging. This patch refines add_extra_args accordingly, and additionally makes it look for the tf_partial flag instead of for dependent args to decide if the deferred substitution is a partial one. This reveals we were neglecting to set tf_partial when substituting into a default template argument in a template context. PR c++/116567 gcc/cp/ChangeLog: * pt.cc (coerce_template_parms): Set tf_partial when substituting into a default template argument in a template context. (build_extra_args): Set TREE_STATIC on the deferred args if this is a partial substitution. (add_extra_args): Check TREE_STATIC instead of dependence of args. Adjust merging behavior in that case. (tsubst_lammda_expr): Check for tf_partial instead of dependence of args when determining whether to defer substitution. (tsubst_expr) <case LAMBDA_EXPR>: Remove tf_partial early exit. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-targ7.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-07Before running fast VRP, make sure all edges have EXECUTABLE set.Andrew MacLeod2-0/+32
PR tree-optimization/116588 gcc/ * tree-vrp.cc (execute_fast_vrp): Start with all edges executable. gcc/testsuite/ * gcc.dg/pr116588.c: New.
2024-09-07[PATCH] RISC-V: Add missing insn types for XiangShan Nanhu scheduler modelZhao Dingyi1-3/+8
This patch aims to add the missing instruction types to the XiangShan-Nanhu scheduler model. The current XiangShan -Nanhu model lacks the trap, atomic trap, fcvt_i2f, and fcvt_f2i instructions. The trap, atomic, and i2f instructions belong to xs_jmp_rs. [1] The f2i instruction belongs to xs_fmisc_rs.[2] [1] https://github.com/OpenXiangShan/XiangShan/blob/v2.0/src/main/scala/xiangshan/package.scala#L780 [2] https://github.com/OpenXiangShan/XiangShan/blob/v2.0/src/main/scala/xiangshan/backend/decode/DecodeUnit.scala#L290 gcc/ChangeLog: * config/riscv/xiangshan.md: Add atomic, trap, fcvt_i2f, fcvt_f2i.
2024-09-07[PATCH v4] [target/116592] RISC-V: Fix illegal operands "th.vsetvli ↵Jin Ma2-2/+40
zero,0,e32,m8" for XTheadVector Since the THeadVector vsetvli does not support vl as an immediate, we need to convert 0 to zero when outputting asm. PR target/116592 gcc/ChangeLog: * config/riscv/thead.cc (th_asm_output_opcode): Change '0' to "zero" gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/xtheadvector/pr116592.c: New test.
2024-09-07Implement first part of unsigned integers for Fortran.Thomas Koenig53-151/+2296
gcc/fortran/ChangeLog: * arith.cc (gfc_reduce_unsigned): New function. (gfc_arith_error): Add ARITH_UNSIGNED_TRUNCATED and ARITH_UNSIGNED_NEGATIVE. (gfc_arith_init_1): Initialize unsigned types. (gfc_check_unsigned_range): New function. (gfc_range_check): Handle unsigned types. (gfc_arith_uminus): Likewise. (gfc_arith_plus): Likewise. (gfc_arith_minus): Likewise. (gfc_arith_times): Likewise. (gfc_arith_divide): Likewise. (gfc_compare_expr): Likewise. (eval_intrinsic): Likewise. (gfc_int2int): Also convert unsigned. (gfc_uint2uint): New function. (gfc_int2uint): New function. (gfc_uint2int): New function. (gfc_uint2real): New function. (gfc_uint2complex): New function. (gfc_real2uint): New function. (gfc_complex2uint): New function. (gfc_log2uint): New function. (gfc_uint2log): New function. * arith.h (gfc_int2uint, gfc_uint2uint, gfc_uint2int, gfc_uint2real): Add prototypes. (gfc_uint2complex, gfc_real2uint, gfc_complex2uint, gfc_log2uint): Likewise. (gfc_uint2log): Likewise. * check.cc (gfc_boz2uint): New function (type_check2): New function. (int_or_real_or_unsigned_check): New function. (less_than_bitsizekind): Adjust for unsingeds. (less_than_bitsize2): Likewise. (gfc_check_allocated): Likewise. (gfc_check_mod): Likewise. (gfc_check_bge_bgt_ble_blt): Likewise. (gfc_check_bitfcn): Likewise. (gfc_check_digits): Likewise. (gfc_check_dshift): Likewise. (gfc_check_huge): Likewise. (gfc_check_iu): New function. (gfc_check_iand_ieor_ior): Adjust for unsigneds. (gfc_check_ibits): Likewise. (gfc_check_uint): New function. (gfc_check_ishft): Adjust for unsigneds. (gfc_check_ishftc): Likewise. (gfc_check_min_max): Likewise. (gfc_check_merge_bits): Likewise. (gfc_check_selected_int_kind): Likewise. (gfc_check_shift): Likewise. (gfc_check_mvbits): Likewise. (gfc_invalid_unsigned_ops): Likewise. * decl.cc (gfc_match_decl_type_spec): Likewise. * dump-parse-tree.cc (show_expr): Likewise. * expr.cc (gfc_get_constant_expr): Likewise. (gfc_copy_expr): Likewise. (gfc_extract_int): Likewise. (numeric_type): Likewise. * gfortran.h (enum arith): Extend with ARITH_UNSIGNED_TRUNCATED and ARITH_UNSIGNED_NEGATIVE. (enum gfc_isym_id): Extend with GFC_ISYM_SU_KIND and GFC_ISYM_UINT. (gfc_check_unsigned_range): New prototype- (gfc_arith_error): Likewise. (gfc_reduce_unsigned): Likewise. (gfc_boz2uint): Likewise. (gfc_invalid_unsigned_ops): Likewise. (gfc_convert_mpz_to_unsigned): Likewise. * gfortran.texi: Add some rudimentary documentation. * intrinsic.cc (gfc_type_letter): Adjust for unsigneds. (add_functions): Add uint and adjust functions to be called. (add_conversions): Add unsigned conversions. (gfc_convert_type_warn): Adjust for unsigned. * intrinsic.h (gfc_check_iu, gfc_check_uint, gfc_check_mod, gfc_simplify_uint, gfc_simplify_selected_unsigned_kind, gfc_resolve_uint): New prototypes. * invoke.texi: Add -funsigned. * iresolve.cc (gfc_resolve_dshift): Handle unsigneds. (gfc_resolve_iand): Handle unsigneds. (gfc_resolve_ibclr): Handle unsigneds. (gfc_resolve_ibits): Handle unsigneds. (gfc_resolve_ibset): Handle unsigneds. (gfc_resolve_ieor): Handle unsigneds. (gfc_resolve_ior): Handle unsigneds. (gfc_resolve_uint): Handle unsigneds. (gfc_resolve_merge_bits): Handle unsigneds. (gfc_resolve_not): Handle unsigneds. * lang.opt: Add -funsigned. * libgfortran.h: Add BT_UNSIGNED. * match.cc (gfc_match_type_spec): Match UNSIGNED. * misc.cc (gfc_basic_typename): Add UNSIGNED. (gfc_typename): Likewise. * primary.cc (convert_unsigned): New function. (match_unsigned_constant): New function. (gfc_match_literal_constant): Handle unsigned. * resolve.cc (resolve_operator): Handle unsigned. (resolve_ordinary_assign): Likewise. * simplify.cc (convert_mpz_to_unsigned): Renamed to... (gfc_convert_mpz_to_unsigned): and adjusted. (gfc_simplify_bit_size): Adjusted for unsigned. (compare_bitwise): Likewise. (gfc_simplify_bge): Likewise. (gfc_simplify_bgt): Likewise. (gfc_simplify_ble): Likewise. (gfc_simplify_blt): Likewise. (simplify_cmplx): Likewise. (gfc_simplify_digits): Likewise. (simplify_dshift): Likewise. (gfc_simplify_huge): Likewise. (gfc_simplify_iand): Likewise. (gfc_simplify_ibclr): Likewise. (gfc_simplify_ibits): Likewise. (gfc_simplify_ibset): Likewise. (gfc_simplify_ieor): Likewise. (gfc_simplify_uint): Likewise. (gfc_simplify_ior): Likewise. (simplify_shift): Likewise. (gfc_simplify_ishftc): Likewise. (gfc_simplify_merge_bits): Likewise. (min_max_choose): Likewise. (gfc_simplify_mod): Likewise. (gfc_simplify_modulo): Likewise. (gfc_simplify_popcnt): Likewise. (gfc_simplify_range): Likewise. (gfc_simplify_selected_unsigned_kind): Likewise. (gfc_convert_constant): Likewise. * target-memory.cc (size_unsigned): New function. (gfc_element_size): Adjust for unsigned. * trans-const.h (gfc_conv_mpz_unsigned_to_tree): Add prototype. * trans-const.cc (gfc_conv_mpz_unsigned_to_tree): Handle unsigneds. (gfc_conv_constant_to_tree): Likewise. * trans-decl.cc (gfc_conv_cfi_to_gfc): Put in "not yet implemented". * trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Likewise. * trans-stmt.cc (gfc_trans_integer_select): Handle unsigned. (gfc_trans_select): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_mod): Handle unsigned. (gfc_conv_intrinsic_shift): Likewise. (gfc_conv_intrinsic_function): Add GFC_ISYM_UINT. * trans-io.cc (enum iocall): Add IOCALL_X_UNSIGNED and IOCALL_X_UNSIGNED_WRITE. (gfc_build_io_library_fndecls): Add transfer_unsigned and transfer_unsigned_write. (transfer_expr): Handle unsigneds. * trans-types.cc (gfc_unsinged_kinds): New array. (gfc_unsigned_types): Likewise. (gfc_init_kinds): Handle them. (validate_unsigned): New function. (gfc_validate_kind): Use it. (gfc_build_unsigned_type): New function. (gfc_init_types): Use it. (gfc_get_unsigned_type): New function. (gfc_typenode_for_spec): Handle unsigned. * trans-types.h (gfc_get_unsigned_type): New prototype. libgfortran/ChangeLog: * gfortran.map: Add _gfortran_transfer_unsgned and _gfortran_transfer-signed. * io/io.h (set_unsigned): New prototype. (us_max): New prototype. (read_decimal_unsigned): New prototype. (write_iu): New prototype. * io/list_read.c (convert_unsigned): New function. (read_integer): Also handle unsigneds. (list_formatted_read_scalar): Handle unsigneds. (nml_read_obj): Likewise. * io/read.c (set_unsigned): New function. (us_max): New function. (read_utf8): Whitespace fixes. (read_default_char1): Whitespace fixes. (read_a_char4): Whitespace fixes. (next_char): Whiltespace fixes. (read_decimal_unsigned): New function. (read_f): Whitespace fixes. (read_x): Whitespace fixes. * io/transfer.c (transfer_unsigned): New function. (transfer_unsigned_write): New function. (require_one_of_two_types): New function. (formatted_transfer_scalar_read): Use it. (formatted_transfer_scalar_write): Also use it. * io/write.c (write_decimal_unsigned): New function. (write_iu): New function. (write_unsigned): New function. (list_formatted_write_scalar): Adjust for unsigneds. * libgfortran.h (GFC_UINTEGER_1_HUGE): Define. (GFC_UINTEGER_2_HUGE): Define. (GFC_UINTEGER_4_HUGE): Define. (GFC_UINTEGER_8_HUGE): Define. (GFC_UINTEGER_16_HUGE): Define. (HAVE_GFC_UINTEGER_1): Undefine (done by mk-kind-h.sh) (HAVE_GFC_UINTEGER_4): Likewise. * mk-kinds-h.sh: Add GFC_UINTEGER_*_HUGE. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_1.f90: New test. * gfortran.dg/unsigned_10.f90: New test. * gfortran.dg/unsigned_11.f90: New test. * gfortran.dg/unsigned_12.f90: New test. * gfortran.dg/unsigned_13.f90: New test. * gfortran.dg/unsigned_14.f90: New test. * gfortran.dg/unsigned_15.f90: New test. * gfortran.dg/unsigned_16.f90: New test. * gfortran.dg/unsigned_17.f90: New test. * gfortran.dg/unsigned_18.f90: New test. * gfortran.dg/unsigned_19.f90: New test. * gfortran.dg/unsigned_2.f90: New test. * gfortran.dg/unsigned_20.f90: New test. * gfortran.dg/unsigned_21.f90: New test. * gfortran.dg/unsigned_22.f90: New test. * gfortran.dg/unsigned_23.f90: New test. * gfortran.dg/unsigned_24.f: New test. * gfortran.dg/unsigned_3.f90: New test. * gfortran.dg/unsigned_4.f90: New test. * gfortran.dg/unsigned_5.f90: New test. * gfortran.dg/unsigned_6.f90: New test. * gfortran.dg/unsigned_7.f90: New test. * gfortran.dg/unsigned_8.f90: New test. * gfortran.dg/unsigned_9.f90: New test.
2024-09-07Daily bump.GCC Administrator8-1/+324
2024-09-06c++: adjust testcase to reveal failure [PR107919]Jason Merrill1-1/+3
This test appeared to be passing, but only because the warning was suppressed by #pragma system_header. PR tree-optimization/107919 gcc/testsuite/ChangeLog: * g++.dg/warn/Wuninitialized-pr107919-1.C: Add -Wsystem-headers and xfail.
2024-09-06Update gcc uk.poJoseph Myers1-2422/+1454
* uk.po: Update.
2024-09-06rs6000,extend and document built-ins vec_test_lsbb_all_ones and ↵Carl Love4-32/+158
vec_test_lsbb_all_zeros The built-ins currently support vector unsigned char arguments. Extend the built-ins to also support vector signed char and vector bool char arguments. Add documentation for the Power 10 built-ins vec_test_lsbb_all_ones and vec_test_lsbb_all_zeros. The vec_test_lsbb_all_ones built-in returns 1 if the least significant bit in each byte is a 1, returns 0 otherwise. Similarly, vec_test_lsbb_all_zeros returns a 1 if the least significant bit in each byte is a zero and 0 otherwise. Add addtional test cases for the built-ins in files: gcc/testsuite/gcc.target/powerpc/lsbb.c gcc/testsuite/gcc.target/powerpc/lsbb-runnable.c gcc/ChangeLog: * config/rs6000/rs6000-overload.def (vec_test_lsbb_all_ones, vec_test_lsbb_all_zeros): Add built-in instances for vector signed char and vector bool char. * doc/extend.texi (vec_test_lsbb_all_ones, vec_test_lsbb_all_zeros): Add documentation for the existing built-ins. gcc/testsuite/ChangeLog:gcc/testsuite/ChangeLog: * gcc.target/powerpc/lsbb-runnable.c: Add test cases for the vector signed char and vector bool char instances of vec_test_lsbb_all_zeros and vec_test_lsbb_all_ones built-ins. * gcc.target/powerpc/lsbb.c: Add compile test cases for the vector signed char and vector bool char instances of vec_test_lsbb_all_zeros and vec_test_lsbb_all_ones built-ins.
2024-09-06middle-end: check that the lhs of a COND_EXPR is an SSA_NAME in cond_store ↵Tamar Christina2-0/+17
recognition [PR116628] Because the vect_recog_bool_pattern can at the moment still transition out of GIMPLE and back into GENERIC the vect_recog_cond_store_pattern can end up using an expression as a mask rather than an SSA_NAME. This adds an explicit check that we have a mask and not an expression. gcc/ChangeLog: PR tree-optimization/116628 * tree-vect-patterns.cc (vect_recog_cond_store_pattern): Add SSA_NAME check on expression. gcc/testsuite/ChangeLog: PR tree-optimization/116628 * gcc.dg/vect/pr116628.c: New test.
2024-09-06aarch64: Use is_attribute_namespace_p and get_attribute_name inside ↵Andrew Pinski1-6/+2
aarch64_lookup_shared_state_flags [PR116598] The code in aarch64_lookup_shared_state_flags all C++11 attributes on the function type had a namespace associated with them. But with the addition of reproducible/unsequenced, this is not true. This fixes the issue by using is_attribute_namespace_p instead of manually figuring out the namespace is named "arm" and uses get_attribute_name instead of manually grabbing the attribute name. Built and tested for aarch64-linux-gnu. gcc/ChangeLog: PR target/116598 * config/aarch64/aarch64.cc (aarch64_lookup_shared_state_flags): Use is_attribute_namespace_p and get_attribute_name instead of manually grabbing the namespace and name of the attribute. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-06ipa: Move pass_ipa_cdtor_merge before pass_ipa_cp and pass_ipa_sraMartin Jambor1-1/+1
When looking at PR 115815 we realized that it would make sense to make calls to functions originally declared static constructors and destructors created by pass_ipa_cdtor_merge visible to IPA-SRA. This patch does that. gcc/ChangeLog: 2024-07-25 Martin Jambor <mjambor@suse.cz> * passes.def: Move pass_ipa_cdtor_merge before pass_ipa_cp and pass_ipa_sra.
2024-09-06ipa: Treat static constructors and destructors as non-local (PR 115815)Martin Jambor3-3/+24
In PR 115815, IPA-SRA thought it had control over all invocations of a (recursive) static destructor but it did not see the implied invocation which led to the original being left behind and the clean-up code encountering uses of SSAs that definitely should have been dead. Fixed by teaching cgraph_node::can_be_local_p about static constructors and destructors. Similar test is missing in cgraph_node::local_p so I added the check there as well. gcc/ChangeLog: 2024-07-25 Martin Jambor <mjambor@suse.cz> PR ipa/115815 * cgraph.cc (cgraph_node_cannot_be_local_p_1): Also check DECL_STATIC_CONSTRUCTOR and DECL_STATIC_DESTRUCTOR. * ipa-visibility.cc (non_local_p): Likewise. (cgraph_node::local_p): Delete extraneous line of tabs. gcc/testsuite/ChangeLog: 2024-07-25 Martin Jambor <mjambor@suse.cz> PR ipa/115815 * gcc.dg/lto/pr115815_0.c: New test.
2024-09-06Fix SLP double-reduction supportRichard Biener1-1/+3
When doing SLP discovery I forgot to handle double reductions even though they are already queued in LOOP_VINFO_REDUCTIONS. * tree-vect-slp.cc (vect_analyze_slp): Also handle discovery for double reductions.
2024-09-06c++: Partially implement CWG 2867 - Order of initialization for structured ↵Jakub Jelinek6-30/+388
bindings [PR115769] The following patch partially implements CWG 2867 - Order of initialization for structured bindings. The DR requires that initialization of e is sequenced before r_i and that r_i initialization is sequenced before r_j for j > i, we already do it that way, the former ordering is a necessity so that the get calls are actually emitted on already initialized variable, the rest just because we implemented it that way, by going through the structured binding vars in ascending order and doing their initialization. The hard part not implemented yet is the lifetime extension of the temporaries from the e initialization to after the get calls (if any). Unlike the range-for lifetime extension patch which I've posted recently where IMO we can just ignore lifetime extension of reference bound temporaries because all the temporaries are extended to the same spot, here lifetime extension of reference bound temporaries should last until the end of lifetime of e, while other temporaries only after all the get calls. The patch just attempts to deal with automatic structured bindings for now, I'll post a patch for static locals incrementally and I don't have a patch for namespace scope structured bindings yet, this patch should just keep existing behavior for both static locals and namespace scope structured bindings. What GCC currently emits is a CLEANUP_POINT_EXPR around the e initialization, followed optionally by nested CLEANUP_STMTs for cleanups like the e dtor if any and dtors of lifetime extended temporaries from reference binding; inside of the CLEANUP_STMT CLEANUP_BODY then the initialization of the individual variables for the tuple case, again with optional CLEANUP_STMT if e.g. lifetime extended temporaries from reference binding are needed in those. The following patch drops that first CLEANUP_POINT_EXPR and instead wraps the whole sequence of the e initialization and the individual variable initialization with get calls after it into a single CLEANUP_POINT_EXPR. If there are any CLEANUP_STMTs needed, they are all emitted first, with the CLEANUP_POINT_EXPR for e initialization and the individual variable initialization inside of those, and a guard variable set after different phases in those expressions guarding the corresponding cleanups, so that they aren't invoked until the respective variables are constructed. This is implemented by cp_finish_decl doing cp_finish_decomp on its own when !processing_template_decl (otherwise we often don't cp_finish_decl or process it at a different time from when we want to call cp_finish_decomp) or unless the decl is erroneous (cp_finish_decl has too many early returns for erroneous cases, and for those we can actually call it even multiple times, for the non-erroneous cases non-processing_template_decl cases we need to call it just once). The two testcases try to construct various temporaries and variables and verify the order in which the temporaries and variables are constructed and destructed. 2024-09-06 Jakub Jelinek <jakub@redhat.com> PR c++/115769 * cp-tree.h: Partially implement CWG 2867 - Order of initialization for structured bindings. (cp_finish_decomp): Add TEST_P argument defaulted to false. * decl.cc (initialize_local_var): Add DECOMP argument, if true, don't build cleanup and temporarily override stmts_are_full_exprs_p to 0 rather than 1. Formatting fix. (cp_finish_decl): Invoke cp_finish_decomp for structured bindings here, first with test_p. For automatic structured binding bases if the test cp_finish_decomp returned true wrap the initialization together with what non-test cp_finish_decomp emits with a CLEANUP_POINT_EXPR, and if there are any CLEANUP_STMTs needed, emit them around the whole CLEANUP_POINT_EXPR with guard variables for the cleanups. Call cp_finish_decomp using RAII if not called with decomp != NULL otherwise. (cp_finish_decomp): Add TEST_P argument, change return type from void to bool, if TEST_P is true, return true instead of emitting actual code for the tuple case, otherwise return false. * parser.cc (cp_convert_range_for): Don't call cp_finish_decomp after cp_finish_decl. (cp_parser_decomposition_declaration): Set DECL_DECOMP_BASE before cp_finish_decl call. Don't call cp_finish_decomp after cp_finish_decl. (cp_finish_omp_range_for): Don't call cp_finish_decomp after cp_finish_decl. * pt.cc (tsubst_stmt): Likewise. * g++.dg/DRs/dr2867-1.C: New test. * g++.dg/DRs/dr2867-2.C: New test.
2024-09-06AVR: lra/116321 - Add test case.Georg-Johann Lay1-0/+20
PR rtl-optimization/116321 gcc/testsuite/ * gcc.target/avr/torture/lra-pr116321.c: New test.
2024-09-06Fortran: Add OpenMP 'interop' directive parsing supportTobias Burnus13-37/+651
Parse OpenMP's 'interop' directive but stop with a 'sorry, unimplemented' after resolving. Additionally, it moves some clause dumping away from the end directive as that lead to 'nowait' not being printed when it should as some cases were missed. gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_namelist): Handle OMP_LIST_INIT. (show_omp_clauses): Handle OMP_LIST_{INIT,USE,DESTORY}; move 'nowait' from end-directive to the directive dump. (show_omp_node, show_code_node): Handle EXEC_OMP_INTEROP. * gfortran.h (enum gfc_statement): Add ST_OMP_INTEROP. (OMP_LIST_INIT, OMP_LIST_USE, OMP_LIST_DESTROY): Add. (enum gfc_exec_op): Add EXEC_OMP_INTEROP. (struct gfc_omp_namelist): Add interop items to union. (gfc_free_omp_namelist): Add boolean arg. * match.cc (gfc_free_omp_namelist): Update to free interop union members. * match.h (gfc_match_omp_interop): New. * openmp.cc (gfc_omp_directives): Uncomment 'interop' entry. (gfc_free_omp_clauses, gfc_match_omp_allocate, gfc_match_omp_flush, gfc_match_omp_clause_reduction): Update call. (enum omp_mask2): Add OMP_CLAUSE_{INIT,USE,DESTROY}. (OMP_INTEROP_CLAUSES): Use it. (gfc_match_omp_clauses): Match those clauses. (gfc_match_omp_prefer_type, gfc_match_omp_init, gfc_match_omp_interop): New. (resolve_omp_clauses): Handle interop clauses. (omp_code_to_statement): Add ST_OMP_INTEROP. (gfc_resolve_omp_directive): Add EXEC_OMP_INTEROP. * parse.cc (decode_omp_directive): Parse 'interop' directive. (next_statement, gfc_ascii_statement): Handle ST_OMP_INTEROP. * st.cc (gfc_free_statement): Likewise * resolve.cc (gfc_resolve_code): Handle EXEC_OMP_INTEROP. * trans.cc (trans_code): Likewise. * trans-openmp.cc (gfc_trans_omp_directive): Print 'sorry' for EXEC_OMP_INTEROP. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/interop-1.f90: New test. * gfortran.dg/gomp/interop-2.f90: New test. * gfortran.dg/gomp/interop-3.f90: New test.
2024-09-06Handle non-grouped stores as single-lane SLPRichard Biener22-36/+69
The following enables single-lane loop SLP discovery for non-grouped stores and adjusts vectorizable_store to properly handle those. For gfortran.dg/vect/vect-8.f90 we vectorize one additional loop, not running into the "not falling back to strided accesses" bail-out. I have not investigated in detail. There is a set of i386 target assembler test FAILs, gcc.target/i386/pr88531-2[bc].c in particular fail because the target cannot identify SLP emulated gathers, see another mail from me. Others need adjustment, I've adjusted one with this patch only. In particular there are gcc.target/i386/cond_op_fma_*-1.c FAILs that are because we no longer fold a VEC_COND_EXPR during the region value-numbering we do after vectorization since we code-generate a { 0.0, ... } constant in the VEC_COND_EXPR now instead of having a separate statement which gets forwarded and then triggers folding. This leads to sligtly different code generation. The solution is probably to use gimple_build when building stmts or, in this case, directly emit .COND_FMA instead of .FMA and a VEC_COND_EXPR. gcc.dg/vect/slp-19a.c mixes contiguous 8-lane SLP with a single lane contiguous store from one lane of the 8-lane load and we expect to use load-lanes for this reason but the heuristic for forcing single-lane rediscovery as implemented doesn't trigger here as it treats both SLP instances separately. FAILs on RISC-V gcc.dg/vect/slp-19c.c shows we fail to implement an interleaving scheme for group_size 12 (by extension using the group_size 3 scheme to reduce to 4 lanes and then continue with a pow2 scheme would work); we are also not considering load-lanes because of the above reason, but aarch64 cannot do ld12. FAILs on AARCH64 (load requires three vectors) and x86_64. gcc.dg/vect/slp-19c.c FAILs with variable-length vectors because of "SLP induction not supported for variable-length vectors". gcc.target/aarch64/pr110449.c will FAIL because the (contested) optimization in r14-2367-g224fd59b2dc8a5 was only applied to loop-vect but not SLP vect. I'll leave it to target maintainers to either XFAIL (the optimization is bad) or remove the test. * tree-vect-slp.cc (vect_analyze_slp): Perform single-lane loop SLP discovery for non-grouped stores. Move check on the root for re-doing SLP analysis with a single lane for load/store-lanes earlier and make sure we are dealing with a grouped access. * tree-vect-stmts.cc (vectorizable_store): Always set vec_num for SLP. * gcc.dg/vect/O3-pr39675-2.c: Adjust expected number of SLP. * gcc.dg/vect/fast-math-vect-call-1.c: Likewise. * gcc.dg/vect/no-scevccp-slp-31.c: Likewise. * gcc.dg/vect/slp-12b.c: Likewise. * gcc.dg/vect/slp-12c.c: Likewise. * gcc.dg/vect/slp-19a.c: Likewise. * gcc.dg/vect/slp-19b.c: Likewise. * gcc.dg/vect/slp-4-big-array.c: Likewise. * gcc.dg/vect/slp-4.c: Likewise. * gcc.dg/vect/slp-5.c: Likewise. * gcc.dg/vect/slp-7.c: Likewise. * gcc.dg/vect/slp-perm-7.c: Likewise. * gcc.dg/vect/slp-37.c: Likewise. * gcc.dg/vect/fast-math-vect-call-2.c: Likewise. * gcc.dg/vect/slp-26.c: RISC-V can now SLP two instances. * gcc.dg/vect/vect-outer-slp-3.c: Disable vectorization of initialization loop. * gcc.dg/vect/slp-reduc-5.c: Likewise. * gcc.dg/vect/no-scevccp-outer-12.c: Un-XFAIL. SLP can handle inner loop inductions with multiple vector stmt copies. * gfortran.dg/vect/vect-8.f90: Adjust expected number of vectorized loops. * gcc.target/i386/vectorize1.c: Adjust what we scan for.
2024-09-06AVR: Remove "Atmel" from header comment.Georg-Johann Lay24-29/+29
gcc/ * config/avr/avr.h: Remove "Atmel" from header comment. * config/avr/avr.cc: Same. * config/avr/avr.md: Same. * config/avr/avr.opt: Same. * config/avr/avr-dimode.md: Same. * config/avr/avr-fixed.md: Same. * config/avr/constraints.md: Same. * config/avr/predicates.md: Same. * config/avr/avr-log.cc: Same. * config/avr/avrlibc.h: Same. * config/avr/specs.h: Same. * common/config/avr/avr-common.cc: Same. * doc/install.texi: Same. * config/avr/avr-arch.h: Adjust header comment. * config/avr/avr-c.cc: Same. * config/avr/avr-mcus.def: Same. * config/avr/avr-modes.def: Same. * config/avr/avr-passes.cc: Same. * config/avr/avr-passes.def: Same. * config/avr/avr-protos.h: Same. * config/avr/driver-avr.cc: Same. * config/avr/elf.h: Same. * config/avr/gen-avr-mmcu-specs.cc: Same. * config/avr/gen-avr-mmcu-texi.cc: Same.
2024-09-06tree-optimization/116610 - wrong SLP induction bias for mask peelingRichard Biener1-1/+1
The following fixes a mistake when applying the bias for peeling via masking to the inital value of SLP inductions. This resolves gcc.target/aarch64/sve/peel_ind_1.c (a scan-assembler only unfortunately) when forcing single-lane SLP for it. PR tree-optimization/116610 * tree-vect-loop.cc (vectorizable_induction): Use MINUS_EXPR to apply a mask peeling adjustment.
2024-09-06tree-optimization/116609 - SLP live lane vectorization with partial vectorsRichard Biener1-7/+11
The following implements the simple case of single-lane SLP when using partial vectors which can use the VEC_EXTRACT_LAST code generation without changes. I'll keep the PR open for further enhancements. This avoids FAILs of gcc.target/aarch64/sve/live_1.c when using single-lane SLP for non-grouped stores. PR tree-optimization/116609 * tree-vect-loop.cc (vectorizable_live_operation_1): Support partial vectors for single-lane SLP.
2024-09-05[PATCH 2/2 v2] RISC-V: Constant synthesis of inverted halvesRaphael Moreira Zinsly2-0/+56
Changes since v1: - Fix synthesis-15.c. -- >8 -- Improve handling of constants where the high half can be constructed by inverting the lower half. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_build_integer): Detect constants were the higher half is the lower half inverted. gcc/testsuite/ChangeLog: * gcc.target/riscv/synthesis-15.c: New test.
2024-09-05[PATCH 1/2 v2] RISC-V: Additional large constant synthesis improvementsRaphael Moreira Zinsly5-7/+213
Changes since v1: - Fix bit31. - Remove negative shift checks. - Fix synthesis-7.c expected output. -- >8 -- Improve handling of large constants in riscv_build_integer, generate better code for constants where the high half can be constructed by shifting/shiftNadding the low half or if the halves differ by less than 2k. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_build_integer): Detect new case of constants that can be improved. (riscv_move_integer): Add synthesys for concatening constants without Zbkb. gcc/testsuite/ChangeLog: * gcc.target/riscv/synthesis-7.c: Adjust expected output. * gcc.target/riscv/synthesis-12.c: New test. * gcc.target/riscv/synthesis-13.c: New test. * gcc.target/riscv/synthesis-14.c: New test.
2024-09-06Match: Add int type fits check for form 2 of .SAT_SUB imm operandPan Li6-1/+105
This patch would like to add strict check for imm operand of .SAT_SUB matching. We have no type checking for imm operand in previous, which may result in unexpected IL to be catched by .SAT_SUB pattern. We leverage the int_fits_type_p here to make sure the imm operand is a int type fits the result type of the .SAT_SUB. For example: Fits uint8_t: uint8_t a; uint8_t sum = .SAT_SUB (a, 12); uint8_t sum = .SAT_SUB (a, 12u); uint8_t sum = .SAT_SUB (a, 126u); uint8_t sum = .SAT_SUB (a, 128u); uint8_t sum = .SAT_SUB (a, 228); uint8_t sum = .SAT_SUB (a, 223u); Not fits uint8_t: uint8_t a; uint8_t sum = .SAT_SUB (a, -1); uint8_t sum = .SAT_SUB (a, 256u); uint8_t sum = .SAT_SUB (a, 257); The below test suite are passed for this patch: * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * match.pd: Add int_fits_type_p check for .SAT_SUB imm operand. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat_arith.h: Add test helper macros. * gcc.target/riscv/sat_u_add_imm_type_check-57.c: New test. * gcc.target/riscv/sat_u_add_imm_type_check-58.c: New test. * gcc.target/riscv/sat_u_add_imm_type_check-59.c: New test. * gcc.target/riscv/sat_u_add_imm_type_check-60.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-06Match: Add int type fits check for form 1 of .SAT_SUB imm operandPan Li6-1/+105
This patch would like to add strict check for imm operand of .SAT_SUB matching. We have no type checking for imm operand in previous, which may result in unexpected IL to be catched by .SAT_SUB pattern. We leverage the int_fits_type_p here to make sure the imm operand is a int type fits the result type of the .SAT_SUB. For example: Fits uint8_t: uint8_t a; uint8_t sum = .SAT_SUB (12, a); uint8_t sum = .SAT_SUB (12u, a); uint8_t sum = .SAT_SUB (126u, a); uint8_t sum = .SAT_SUB (128u, a); uint8_t sum = .SAT_SUB (228, a); uint8_t sum = .SAT_SUB (223u, a); Not fits uint8_t: uint8_t a; uint8_t sum = .SAT_SUB (-1, a); uint8_t sum = .SAT_SUB (256u, a); uint8_t sum = .SAT_SUB (257, a); The below test suite are passed for this patch: * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * match.pd: Add int_fits_type_p check for .SAT_SUB imm operand. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat_arith.h: Add test helper macros. * gcc.target/riscv/sat_u_add_imm_type_check-53.c: New test. * gcc.target/riscv/sat_u_add_imm_type_check-54.c: New test. * gcc.target/riscv/sat_u_add_imm_type_check-55.c: New test. * gcc.target/riscv/sat_u_add_imm_type_check-56.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-06RISC-V: Fix out of index in riscv_select_multilib_by_abiYunQiang Su1-1/+1
commit b5c2aae48723c9098a8a3dab1409b30fd87bbf56 Author: YunQiang Su <yunqiang@isrc.iscas.ac.cn> Date: Thu Sep 5 15:14:43 2024 +0800 RISC-V: Lookup reversely in riscv_select_multilib_by_abi The last element should use index multilib_infos.size () - 1 gcc * common/config/riscv/riscv-common.cc(riscv_select_multilib_by_abi): Fix out of index problem.
2024-09-05c-family: add attribute flag_enum [PR81665]Jason Merrill8-5/+87
Several PRs complain about -Wswitch warning about a case for a bitwise combination of enumerators. Clang has an attribute flag_enum to prevent this; let's adopt that approach as well. This also recognizes the attribute as [[clang::flag_enum]], introducing handling of the clang attribute namespace. PR c++/46457 PR c++/81665 gcc/c-family/ChangeLog: * c-attribs.cc (handle_flag_enum_attribute): New. (c_common_gnu_attributes): Add it. (c_common_clang_attributes, c_common_clang_attribute_table): New. * c-common.h: Declare c_common_clang_attribute_table. * c-warn.cc (c_do_switch_warnings): Handle flag_enum. gcc/c/ChangeLog: * c-objc-common.h (c_objc_attribute_table): Add c_common_clang_attribute_table. gcc/cp/ChangeLog: * cp-objcp-common.h (cp_objcp_attribute_table): Add c_common_clang_attribute_table. gcc/testsuite/ChangeLog: * c-c++-common/attr-flag-enum-1.c: New test. gcc/ChangeLog: * doc/extend.texi: Document flag_enum attribute. * doc/invoke.texi: Mention flag_enum in -Wswitch. libstdc++-v3/ChangeLog: * include/bits/regex_constants.h: Use flag_enum.
2024-09-06Handle const0_operand for *avx2_pcmp<mode>3_1.liuhongt2-2/+45
*<avx512>_eq<mode>3<mask_scalar_merge_name>_1 supports nonimm_or_0_operand for op1 and op2, pass_combine would fail to lower avx512 comparision back to avx2 one when op1/op2 is const0_rtx. It's because the splitter only support nonimmediate_operand. Failed to match this instruction: (set (reg/i:V16QI 20 xmm0) (vec_merge:V16QI (const_vector:V16QI [ (const_int -1 [0xffffffffffffffff]) repeated x16 ]) (const_vector:V16QI [ (const_int 0 [0]) repeated x16 ]) (unspec:HI [ (reg:V16QI 105 [ a ]) (const_vector:V16QI [ (const_int 0 [0]) repeated x16 ]) (const_int 0 [0]) ] UNSPEC_PCMP))) The patch extend predicates of the splitter to handles that. gcc/ChangeLog: PR target/115517 * config/i386/sse.md (*avx2_pcmp<mode>3_1): Change predicate of operands[1] and operands[2] from nonimmdiate_operand to nonimm_or_0_operand. gcc/testsuite/ChangeLog: * gcc.target/i386/pr115517.c: New test.
2024-09-06Daily bump.GCC Administrator6-1/+460
2024-09-05[V2][RISC-V] Avoid unnecessary extensions after sCC insnsJeff Law1-5/+41
So the first patch failed the pre-commit CI; it didn't fail in my testing because I'm using --with-arch to set a default configuration that includes things like zicond to ensure that's always tested. And the failing test is skipped when zicond is enabled by default. The failing test is designed to ensure that we don't miss an if-conversion due to costing issues around the extension that was typically done in an sCC sequence (which is why it's only run when zicond is off). The test failed because we have a little routine that is highly dependent on the code generated by the sCC expander and will adjust the costing to account for expansion quirks that usually go away in register allocation. That code needs to be enhanced to work after the sCC expansion change. Essentially it needs to account for the subreg extraction that shows up in the sequence as well as being a bit looser on mode checking. I kept the code working for the old sequences -- in theory a user could conjure up the old sequence so handling them seems useful. This also drops the testsuite changes. Palmer's change makes them unnecessary. --- So I was looking at a performance regression in spec with Ventana's internal tree. Ultimately the problem was a bad interaction with an internal patch (REP_MODE_EXTENDED), fwprop and ext-dce. The details of that problem aren't particularly important. Removal of the local patch went reasonably well. But I did see some secondary cases where we had redundant sign extensions. The most notable cases come from the integer sCC insns. Expansion of those cases for rv64 can be improved using Jivan's trick. ie, if the target is not DImode, then create a DImode temporary for the result and copy the low bits out with a promoted subreg to the real target. With the change in expansion the final code we generate is slightly different for a few tests at -O1/-Og, but should perform the same. The key for the affected tests is we're not seeing the introduction of unnecessary extensions. Rather than adjust the regexps to handle the -O1/-Og output, skipping for those seemed OK to me. I didn't extract a testcase. I'm a bit fried from digging through LTO'd code right now. gcc/ * config/riscv/riscv.cc (riscv_expand_int_scc): For rv64, use a DI temporary for the output and a promoted subreg to extract it into SI arget. (riscv_noce_conversion_profitable_p): Recognize new output from sCC expansion too.
2024-09-05c++: tweak redeclaration-6.CJason Merrill1-0/+1
gcc/testsuite/ChangeLog: * g++.dg/diagnostic/redeclaration-6.C: Add -fno-implicit-constexpr.
2024-09-05Fortran: fix ICE in gfc_create_module_variable [PR100273]Harald Anlauf2-1/+28
gcc/fortran/ChangeLog: PR fortran/100273 * trans-decl.cc (gfc_create_module_variable): Handle module variable also when it is needed for the result specification of a contained function. gcc/testsuite/ChangeLog: PR fortran/100273 * gfortran.dg/pr100273.f90: New test.
2024-09-05c++: vtable referring to "unavailable" virtual fn [PR116606]Marek Polacek2-1/+10
mark_vtable_entries already has /* It's OK for the vtable to refer to deprecated virtual functions. */ warning_sentinel w(warn_deprecated_decl); but that doesn't cover __attribute__((unavailable)). We can use the following override to cover both. PR c++/116606 gcc/cp/ChangeLog: * decl2.cc (mark_vtable_entries): Temporarily override deprecated_state to UNAVAILABLE_DEPRECATED_SUPPRESS. Remove a warning_sentinel. gcc/testsuite/ChangeLog: * g++.dg/ext/attr-unavailable-13.C: New test.
2024-09-05c++, coroutines: Revise promise construction/destruction.Iain Sandoe1-13/+17
In examining the coroutine testcases for unexpected diagnostic output for 'Wall', I found a 'statement has no effect' warning for the promise construction in one case. In particular, the case is where the users promise type has an implicit CTOR but a user-provided DTOR. Further, the type does not actually need constructing. In very early versions of the coroutines code we used to check TYPE_NEEDS_CONSTRUCTING() to determine whether to attempt to build a constructor call for the promise. During review, it was suggested to use type_build_ctor_call () instead. This latter call checks the constructors in the type (both user-defined and implicit) and returns true, amongst other cases if any of the found CTORs are marked as deprecated. In a number of places (for example [class.copy.ctor] / 6) the standard says that some version of an implicit CTOR is deprecated when the user provides a DTOR. Thus, for this specific arrangement of promise type, type_build_ctor_call returns true, because of (for example) a deprecated implicit copy CTOR. We are not going to use any of the deprecated CTORs and thus will not see warnings from this - however, since the call returned true, we have now determined that we should attempt to build a constructor call. Note as above, the type does not actually require construction and thus one might expect either a NULL_TREE or error_mark_node in response to the build_special_member_call (). However, in practice the function returns the original instance object instead of a call or some error. When we add that as a statement it triggers the 'statement has no effect' warning. The patch here rearranges the promise construction/destruction code to allow for the case that a DTOR is required independently of a CTOR. In addition, we check that the return from build_special_member_call () has side effects before we add it as a statement. gcc/cp/ChangeLog: * coroutines.cc (cp_coroutine_transform::build_ramp_function): Separate the build of promise constructor and destructor. When evaluating the constructor, check that build_special_member_call returns an expression with side effects before adding it. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-05c++: local class memfn synth from noexcept context [PR113063]Patrick Palka3-0/+6
Extending the PR113063 testcase to additionally constant evaluate the <=> expression causes us to trip over the assert in cxx_eval_call_expression /* We used to shortcut trivial constructor/op= here, but nowadays we can only get a trivial function here with -fno-elide-constructors. */ gcc_checking_assert (!trivial_fn_p (fun) || !flag_elide_constructors /* We don't elide constructors when processing a noexcept-expression. */ || cp_noexcept_operand); since the local class's <=> was first used and therefore synthesized in a noexcept context and so its definition contains unelided trivial constructors. This patch fixes this by clearing cp_noexcept_operand alongside cp_unevaluated_context in the function-local case of maybe_push_to_top_level. PR c++/113063 gcc/cp/ChangeLog: * name-lookup.cc (local_state_t): Clear and restore cp_noexcept_operand as well. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-synth16.C: Also constant evaluate the <=> expression. * g++.dg/cpp2a/spaceship-synth16a.C: Likewise. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-05doc: remove stray characterMarek Polacek1-1/+1
There's an extra '+'. gcc/ChangeLog: * doc/invoke.texi: Remove an extra char in @item sme2.
2024-09-05c++: fn redecl in fn scope wrongly accepted [PR116239]Marek Polacek4-1/+38
Redeclaration such as void f(void); consteval void f(void); is invalid. In a namespace scope, we detect the collision in validate_constexpr_redeclaration, but not when one declaration is at block scope. When we have void f(void); void g() { consteval void f(void); } we call pushdecl on the second f and call push_local_extern_decl_alias. It finds the namespace-scope f: for (ovl_iterator iter (binding); iter; ++iter) if (decls_match (decl, *iter, /*record_versions*/false)) { alias = *iter; break; } but decls_match says they match so we just set DECL_LOCAL_DECL_ALIAS (and do not call another pushdecl leading to duplicate_decls which would detect mismatching return types, for example). I don't think we want to change decls_match, so a simple fix is to detect the problem in push_local_extern_decl_alias. PR c++/116239 gcc/cp/ChangeLog: * cp-tree.h (validate_constexpr_redeclaration): Declare. * decl.cc (validate_constexpr_redeclaration): No longer static. * name-lookup.cc (push_local_extern_decl_alias): Call validate_constexpr_redeclaration. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/redeclaration-6.C: New test.
2024-09-05Avoid ICE when passing VLA vector to accelerator.Prathamesh Kulkarni2-6/+6
gcc/ChangeLog: * gimplify.cc (omp_add_variable): Check if decl size is not poly_int_tree_p. (gimplify_adjust_omp_clauses): Likewise. * omp-low.cc (scan_sharing_clauses): Likewise. (lower_omp_target): Likewise. Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
2024-09-05nvptx: Emit DECL and DEF linker markers for aliases [PR104957]Thomas Schwinge5-12/+14
With nvptx '-malias' enabled (as implemented in commit f8b15e177155960017ac0c5daef8780d1127f91c "[nvptx] Use .alias directive for mptx >= 6.3"), the C++ front end in certain cases does 'write_fn_proto' before an eventual 'alias' attribute has been added. In that case, we do emit (via 'write_fn_marker') a DECL linker marker, but then never emit a corresponding DEF linker marker for the alias. This causes hundreds of instances of link-time 'unresolved symbol [alias]' across the C++ test suite, which are regressions compared to a test run with (default) '-mno-alias' (in which case the respective functions get duplicated). PR target/104957 gcc/ * config/nvptx/nvptx.cc (write_fn_proto_1): Revert 2022-03-22 change; 'write_fn_marker' also for alias DECL. (nvptx_asm_output_def_from_decls): 'write_fn_marker' for alias DEF. gcc/testsuite/ * g++.target/nvptx/alias-g++.dg_init_dtor2-1.C: Un-XFAIL. * gcc.target/nvptx/alias-1.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise.
2024-09-05Add 'g++.target/nvptx/alias-g++.dg_init_dtor2-1.C'Thomas Schwinge1-0/+33
... as one minimized example for the issue that with nvptx '-malias' enabled (as implemented in commit f8b15e177155960017ac0c5daef8780d1127f91c "[nvptx] Use .alias directive for mptx >= 6.3"), there are hundreds of instances of link-time 'unresolved symbol [alias]' across the C++ test suite, which are regressions compared to a test run with (default) '-mno-alias'. PR target/104957 gcc/testsuite/ * g++.target/nvptx/alias-g++.dg_init_dtor2-1.C: Add.
2024-09-05Enhance 'gcc.target/nvptx/alias-*.c' assembler scanningThomas Schwinge5-19/+66
... in order to demonstrate unexpected behavior (XFAILed here). PR target/104957 gcc/testsuite/ * gcc.target/nvptx/alias-1.c: Enhance assembler scanning. * gcc.target/nvptx/alias-2.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-4.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise.
2024-09-05Fix 'gcc.target/nvptx/alias-2.c' commentThomas Schwinge1-1/+1
PR target/104957 gcc/testsuite/ * gcc.target/nvptx/alias-2.c: Fix comment.
2024-09-05Move from 'gcc.target/nvptx/nvptx.exp' into 'target-supports.exp' additions ↵Thomas Schwinge10-78/+98
for nvptx target gcc/testsuite/ * gcc.target/nvptx/nvptx.exp (check_effective_target_default_ptx_isa_version_at_least) (check_effective_target_default_ptx_isa_version_at_least_6_0) (check_effective_target_runtime_ptx_isa_version_at_least) (check_effective_target_runtime_ptx_alias) (add_options_for_ptx_alias): Move... * lib/target-supports.exp (check_nvptx_default_ptx_isa_version_at_least) (check_effective_target_nvptx_default_ptx_isa_version_at_least_6_0) (check_nvptx_runtime_ptx_isa_version_at_least) (check_effective_target_nvptx_runtime_alias_ptx) (add_options_for_nvptx_alias_ptx): ... here. * gcc.target/nvptx/alias-1.c: Adjust. * gcc.target/nvptx/alias-2.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-4.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise. * gcc.target/nvptx/alias-weak-1.c: Likewise. * gcc.target/nvptx/uniform-simt-5.c: Likewise. gcc/ * doc/sourcebuild.texi (Effective-Target Keywords): Document 'nvptx_default_ptx_isa_version_at_least_6_0', 'nvptx_runtime_alias_ptx'. (Add Options): Document 'nvptx_alias_ptx'.
2024-09-05c++: Add missing auto_diagnostic_groupsNathaniel Shead21-94/+303
This patch goes through all .cc files in gcc/cp and adds in any auto_diagnostic_groups that seem to be missing by looking for any 'inform' calls that aren't grouped with their respective error/warning. Now with SARIF output support this seems to be a bit more important. The patch isn't complete; I've tried to also track helper functions used for diagnostics to group them, but some may have been missed. Additionally there are a few functions that are definitely missing groupings but I wasn't able to see an obvious way to add them without potentially grouping together unrelated messages. This list includes: - lazy_load_{binding,pendings} "during load of {binding,pendings} for" - cp_finish_decomp "in initialization of structured binding variable" - require_deduced_type "using __builtin_source_location" - convert_nontype_argument "in template argument for type %qT" - coerce_template_params "so any instantiation with a non-empty parameter pack" - tsubst_default_argument "when instantiating default argument" - invalid_nontype_parm_type_p "invalid template non-type parameter" gcc/cp/ChangeLog: * class.cc (add_method): Add missing auto_diagnostic_group. (handle_using_decl): Likewise. (maybe_warn_about_overly_private_class): Likewise. (check_field_decl): Likewise. (check_field_decls): Likewise. (resolve_address_of_overloaded_function): Likewise. (note_name_declared_in_class): Likewise. * constraint.cc (associate_classtype_constraints): Likewise. (diagnose_trait_expr): Clean up whitespace. * coroutines.cc (find_coro_traits_template_decl): Add missing auto_diagnostic_group. (coro_promise_type_found_p): Likewise. (coro_diagnose_throwing_fn): Likewise. * cvt.cc (build_expr_type_conversion): Likewise. * decl.cc (validate_constexpr_redeclaration): Likewise. (duplicate_function_template_decls): Likewise. (duplicate_decls): Likewise. (lookup_label_1): Likewise. (check_previous_goto_1): Likewise. (check_goto_1): Likewise. (make_typename_type): Likewise. (make_unbound_class_template): Likewise. (check_tag_decl): Likewise. (start_decl): Likewise. (maybe_commonize_var): Likewise. (check_for_uninitialized_const_var): Likewise. (reshape_init_class): Likewise. (check_initializer): Likewise. (cp_finish_decl): Likewise. (find_decomp_class_base): Likewise. (cp_finish_decomp): Likewise. (expand_static_init): Likewise. (grokfndecl): Likewise. (grokdeclarator): Likewise. (check_elaborated_type_specifier): Likewise. (lookup_and_check_tag): Likewise. (xref_tag): Likewise. (cxx_simulate_enum_decl): Likewise. (finish_function): Likewise. * decl2.cc (check_classfn): Likewise. (record_mangling): Likewise. (mark_used): Likewise. * error.cc (qualified_name_lookup_error): Likewise. * except.cc (build_throw): Likewise. * init.cc (get_nsdmi): Likewise. (diagnose_uninitialized_cst_or_ref_member_1): Likewise. (warn_placement_new_too_small): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_delete): Likewise. * lambda.cc (add_capture): Likewise. (add_default_capture): Likewise. * lex.cc (unqualified_fn_lookup_error): Likewise. * method.cc (synthesize_method): Likewise. (defaulted_late_check): Likewise. * module.cc (trees_in::is_matching_decl): Likewise. (trees_in::read_enum_def): Likewise. (module_state::check_not_purview): Likewise. (module_state::deferred_macro): Likewise. (module_state::read_config): Likewise. (module_state::check_read): Likewise. (declare_module): Likewise. (init_modules): Likewise. * name-lookup.cc (diagnose_name_conflict): Likewise. (lookup_using_decl): Likewise. (set_decl_namespace): Likewise. (finish_using_directive): Likewise. (push_namespace): Likewise. (add_imported_namespace): Likewise. * parser.cc (cp_parser_check_for_definition_in_return_type): Likewise. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_binary_expression): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_module_declaration): Likewise. (cp_parser_import_declaration): Likewise, removing gotos to support this. (cp_parser_declaration): Add missing auto_diagnostic_group. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_template_id): Likewise. (cp_parser_template_name): Likewise. (cp_parser_explicit_specialization): Likewise. (cp_parser_placeholder_type_specifier): Likewise. (cp_parser_elaborated_type_specifier): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_asm_definition): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_class_head): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_explicit_template_declaration): Likewise. (cp_parser_check_class_key): Likewise. * pt.cc (maybe_process_partial_specialization): Likewise. (determine_specialization): Likewise. (check_for_bare_parameter_packs): Likewise. (check_template_shadow): Likewise. (process_partial_specialization): Likewise. (push_template_decl): Likewise. (redeclare_class_template): Likewise. (convert_nontype_argument_function): Likewise. (check_valid_ptrmem_cst_expr): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (coerce_template_parms): Likewise. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (most_specialized_partial_spec): Likewise. (do_class_deduction): Likewise. (do_auto_deduction): Likewise. * search.cc (lookup_member): Likewise. * semantics.cc (finish_non_static_data_member): Likewise. (process_outer_var_ref): Likewise. (finish_id_expression_1): Likewise. (finish_offsetof): Likewise. (omp_reduction_lookup): Likewise. (finish_omp_clauses): Likewise. * tree.cc (check_abi_tag_redeclaration): Likewise. (check_abi_tag_args): Likewise. * typeck.cc (invalid_nonstatic_memfn_p): Likewise. (complain_about_unrecognized_member): Likewise. (finish_class_member_access_expr): Likewise. (error_args_num): Likewise. (warn_for_null_address): Likewise. (cp_build_binary_op): Likewise. (build_x_unary_op): Likewise. (cp_build_unary_op): Likewise. (build_static_cast): Likewise. (cp_build_modify_expr): Likewise. (get_delta_difference): Likewise. (convert_for_assignment): Widen scope of auto_diagnostic_group. (check_return_expr): Add missing auto_diagnostic_group. * typeck2.cc (cxx_incomplete_type_diagnostic): Likewise. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Marek Polacek <polacek@redhat.com>
2024-09-05[AARCH64] adjust gcc.target/aarch64/sve/mask_gather_load_7.cRichard Biener1-4/+4
The following adjusts the scan-assembler to also allow predicate registers p8-15 to be used for the destination of the compares. I see that code generation with a pending vectorizer patch (the only assembler change is different predicate register allocation). * gcc.target/aarch64/sve/mask_gather_load_7.c: Allow p8-15 to be used for the destination of the compares.
2024-09-05middle-end: have vect_recog_cond_store_pattern use pattern statement for ↵Tamar Christina1-1/+9
cond if available When vectorizing a conditional operation we rely on the bool_recog pattern to hit and convert the bool of the operand to a valid mask. However we are currently not using the converted operand as this is in a pattern statement. This change updates it to look at the actual statement to be vectorized so we pick up the pattern. Note that there are no tests here since vectorization will fail until we correctly lower all boolean conditionals early. Tests for these are in the next patch, namely vect-conditional_store_5.c and vect-conditional_store_6.c. And the existing vect-conditional_store_[1-4].c checks that the other cases are still handled correctly. gcc/ChangeLog: * tree-vect-patterns.cc (vect_recog_cond_store_pattern): Use pattern statement.
2024-09-05testsuite: remove -fwrapv from signbit-5.cTamar Christina1-3/+3
The meaning of the testcase was changed by passing it -fwrapv. The reason for the test failures on some platform was because the test was testing some implementation defined behavior wrt INT_MIN in generic code. Instead of using -fwrapv this just removes the border case from the test so all the values now have a defined semantic. It still relies on the handling of shifting a negative value right, but that wasn't changed with -fwrapv anyway. The -fwrapv case is being handled already by other testcases. gcc/testsuite/ChangeLog: * gcc.dg/signbit-5.c: Remove -fwrapv and change INT_MIN to INT_MIN+1.