aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2025-03-22c++: structural equality and partially inst typedef [PR119379]Patrick Palka2-0/+21
Complex alias templates (and their dependent specializations) always use structural equality because we need to treat them as transparent in some contexts but not others. Structural-ness however wasn't being preserved during partial instantiation, which for the below testcase leads to the checking ICE same canonical type node for different types 'S<int>::P<U>' and 'pair<int, U>' when comparing those two types with comparing_dependent_aliases set (from alias_ctad_tweaks). This patch fixes this by making us preserve structural-ness for partially instantiated typedefs in general. PR c++/119379 gcc/cp/ChangeLog: * pt.cc (tsubst_decl) <case TYPE_DECL>: Preserve structural-ness of a partially instantiated typedef. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-alias24.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2025-03-22Darwin: We do not need libdl, it is provided in libSystem.Iain Sandoe1-1/+4
Darwin provides this support as part of libSystem which is always linked with user-space DSOs (including exes). gcc/ChangeLog: * config/darwin.h (DL_LIBRARY): New. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-22d: Bump front-end language version to v2.111.0-rc.1.Iain Buclaw2-2/+2
gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 032e24446b. * dmd/VERSION: Bump version to v2.111.0-rc.1.
2025-03-22d: Improve UFCS/property error messageIain Buclaw4-20/+36
Improves on the speller suggestions for UFCS by using the location of the suggested symbol, and considering that local functions aren't eligible for UFCS instead of making a nonsensical suggestion, such as "no property foo, did you mean foo?". gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 9d2f034398. Reviewed-on: https://github.com/dlang/dmd/pull/21046
2025-03-22d: Add C++23 to CppStdRevision enumIain Buclaw6-2/+10
D front-end changes: - The compiler now accepts `-fextern-std=c++23' gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 94950cae58. * d-lang.cc (d_handle_option): Add case for CppStdRevisionCpp23. * gdc.texi: Document -fextern-std=c++23. * lang.opt (fextern-std=): Add c++23. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 94950cae58. Reviewed-on: https://github.com/dlang/dmd/pull/21043
2025-03-22d: Indexing a cast(AA) yields no lvalue anymoreIain Buclaw3-1/+13
gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 8db14cf846. Reviewed-on: https://github.com/dlang/dmd/pull/21029
2025-03-22libphobos: Add module declaration to rt.invariantIain Buclaw1-2/+2
This prevents conflicts with a user-provided `invariant.d' module. gcc/d/ChangeLog: * runtime.def (INVARIANT): Update signature of run-time function. libphobos/ChangeLog: * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Rename rt/invariant.d to rt/invariant_.d. * libdruntime/Makefile.in: Regenerate. * libdruntime/rt/invariant.d: Move to... * libdruntime/rt/invariant_.d: ...here.
2025-03-22Daily bump.GCC Administrator10-1/+1903
2025-03-22Fix up some further cases of missing or extraneous spaces in diagnosticsJakub Jelinek5-5/+5
Given the recent PR119406 I've tried to grep for concatenated string literals without space at the end of one line and at the start of next line, unless it was obviously intentional. Furthermore, I've then looked through gcc.pot looking for 2 adjacent spaces and looking back if that wasn't the case of "something " " with spaces at both sides". Here is the result from that. I think just the c.opt change needs an explanation, the "" in the description is simply eaten up somewhere during the option processing and gcc -v --help before this patch was displaying -Wdeprecated-literal-operator Warn about deprecated space between and suffix in a user-defined literal operator. 2025-03-22 Jakub Jelinek <jakub@redhat.com> gcc/ * gimplify.cc (warn_switch_unreachable_and_auto_init_r): Add missing space in the middle of diagnostics. * tree-vect-stmts.cc (vectorizable_load): Add missing space in the middle of debug dump message. * sym-exec/sym-exec-state.cc (state::check_args_compatibility): Likewise. gcc/c-family/ * c.opt (Wdeprecated-literal-operator): Use \"\" rather than "" in option description. gcc/fortran/ * resolve.cc (resolve_procedure_expression): Remove extraneous space from the middle of diagnostics.
2025-03-21cobol, libgcobol: Currently libgcobol depends on libstdc++.Iain Sandoe1-1/+1
We need to add libstdc++ to link lines even when the link is not '-static' since libgcobol depends on libstdc++. gcc/cobol/ChangeLog: * gcobolspec.cc (lang_specific_driver): Add libstdc++ for any link line. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-21cobol, driver: Handle targets without HAVE_LD_STATIC_DYNAMIC.Iain Sandoe1-4/+6
This fixes a typo where libraries were not added for targets without HAVE_LD_STATIC_DYNAMIC. It also adds the libraries in this case; typically, a target without HAVE_LD_STATIC_DYNAMIC can take the -static-libgcobol and use that to drive a spec substitution viz: %{static-libgcobol:%:replace-outfile(-lgcobol libgcobol.a%s)} which needs both the library and -static-libgcobol to be present in the driver output. gcc/cobol/ChangeLog: * gcobolspec.cc (add_arg_lib): Fix typo. (lang_specific_driver): Arrange to append both -lgcobol and -static-libgcobol for targets without HAVE_LD_STATIC_DYNAMIC. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-21Update gcc de.po, fr.poJoseph Myers2-1085/+776
* de.po, fr.po: Update.
2025-03-21lra, v2: emit caller-save register spills before call insn [PR116028]Jakub Jelinek4-11/+54
Here is an updated version of Surya's PR116028 fix from August, which got reverted because it caused bootstrap failures on aarch64, later on bootstrap comparison errors there as well and problems on other targets as well. Original description: LRA emits insns to save caller-save registers in the inheritance/splitting pass. In this pass, LRA builds EBBs (Extended Basic Block) and traverses the insns in the EBBs in reverse order from the last insn to the first insn. When LRA sees a write to a pseudo (that has been assigned a caller-save register), and there is a read following the write, with an intervening call insn between the write and read, then LRA generates a spill immediately after the write and a restore immediately before the read. The spill is needed because the call insn will clobber the caller-save register. If there is a write insn and a call insn in two separate BBs but belonging to the same EBB, the spill insn gets generated in the BB containing the write insn. If the write insn is in the entry BB, then the spill insn that is generated in the entry BB prevents shrink wrap from happening. This is because the spill insn references the stack pointer and hence the prolog gets generated in the entry BB itself. This patch ensures the the spill insn is generated before the call insn instead of after the write. This also ensures that the spill occurs only in the path containing the call. The changes compared to the first r15-2810 version are: 1) the reason for aarch64 miscompilations and later on bootstrap comparison issues as can be seen on the pr118615.c testcase in the patch was that when curr_insn is a JUMP_INSN or some cases of CALL_INSNs, split_if_necessary is called with before_p true and if it is successful, the code set use_insn = PREV_INSN (curr_insn); instead of use_insn = curr_insn; and that use_insn is then what is passed to add_next_usage_insn; now, if the patch decides to emit the save instruction(s) before the first call after curr_insn in the ebb rather than before the JUMP_INSN/CALL_INSN, PREV_INSN (curr_insn) is some random insn before it, not anything related to the split_reg actions. If it is e.g. a DEBUG_INSN in one case vs. some unrelated other insn otherwise, that can affect further split_reg within the same function 2) as suggested by Surya in PR118615, it makes no sense to try to change behavior if the first call after curr_insn is in the same bb as curr_insn 3) split_reg is actually called sometimes from within inherit_in_ebb but sometimes from elsewhere; trying to use whatever last call to inherit_in_ebb saw last is a sure way to run into wrong-code issues, so instead of clearing the rtx var at the start of inherit_in_ebb it is now cleared at the end of it 4) calling the var latest_call_insn was weird, inherit_in_ebb walks the ebb backwards, so what the var contains is the first call insn within the ebb (after curr_insn) 5) the patch was using lra_process_new_insns (PREV_INSN (latest_call_insn), NULL, save, "Add save<-reg"); to emit the save insn before latest_call_insn. That feels quite weird given that latest_call_insn has explicit support for adding stuff before some insn or after some insn, adding something before some insn doesn't really need to be done as addition after PREV_INSN 6) some formatting nits + new testcase + removal of xfail even on arm32 Bootstrapped/regtested on x86_64-linux/i686-linux (my usual --enable-checking=yes,rtl,extra builds), aarch64-linux (normal default bootstrap) and our distro scratch build ({x86_64,i686,aarch64,powerpc64le,s390x}-linux --enable-checking=release LTO profiledbootstrap/regtest), I think Sam James tested on 32-bit arm too. On aarch64-linux this results in -FAIL: gcc.dg/pr10474.c scan-rtl-dump pro_and_epilogue "Performing shrink-wrapping" I admit I don't know the code well nor understood everything it is doing. I have some concerns: 1) I wonder if there is a guarantee that first_call_insn if non-NULL will be always in between curr_insn and usage_insn when call_save_p; I'd hope yes because if usage_insn is before first_call_insn in the ebb, presumably it wouldn't need to find call save regs because the range wouldn't cross any calls 2) I wonder whether it wouldn't be better instead of inserting the saves before first_call_insn insert it at the start of the bb containing that call (after labels of course); emitting it right before a call could mislead code looking for argument slot initialization of the call 3) even when avoiding the use_insn = PREV_INSN (curr_insn);, I wonder if it is ok to use use_insn equal to curr_insn rather than the insns far later where we actually inserted it, but primarily because I don't understand the code much; I think for the !before_p case it is doing similar thing on a shorter distance, the saves were emitted after curr_insn and we record it on curr_insn 2025-03-21 Surya Kumari Jangala <jskumari@linux.ibm.com> Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/116028 PR rtl-optimization/118615 * lra-constraints.cc (first_call_insn): New variable. (split_reg): Spill register before first_call_insn if call_save_p and the call is in a different bb in the ebb. (split_if_necessary): Formatting fix. (inherit_in_ebb): Set first_call_insn when handling a CALL_INSN. For successful split_if_necessary with before_p, only change use_insn if it emitted any new instructions before curr_insn. Clear first_call_insn before returning. * gcc.dg/ira-shrinkwrap-prep-1.c: Remove xfail for powerpc. * gcc.dg/pr10474.c: Remove xfail for powerpc and arm. * gcc.dg/pr118615.c: New test.
2025-03-21c++: add fixed test [PR119378]Patrick Palka1-0/+16
Fixed by r15-123 (specifically the change to set processing_template_decl when tsubsting UNBOUND_CLASS_TEMPLATE). PR c++/119378 gcc/testsuite/ChangeLog: * g++.dg/template/friend85.C: New test.
2025-03-21OpenMP: 'interop' construct - add ME support + target-independent libgompPaul-Antoine Arras21-32/+467
This patch partially enables use of the OpenMP interop construct by adding middle end support, mostly in the omplower pass, and in the target-independent part of the libgomp runtime. It follows up on previous patches for C, C++ and Fortran front ends support. The full interop feature requires another patch to enable foreign runtime support in libgomp plugins. gcc/ChangeLog: * builtin-types.def (BT_FN_VOID_INT_INT_PTR_PTR_PTR_INT_PTR_INT_PTR_UINT_PTR): New. * gimple-low.cc (lower_stmt): Handle GIMPLE_OMP_INTEROP. * gimple-pretty-print.cc (dump_gimple_omp_interop): New function. (pp_gimple_stmt_1): Handle GIMPLE_OMP_INTEROP. * gimple.cc (gimple_build_omp_interop): New function. (gimple_copy): Handle GIMPLE_OMP_INTEROP. * gimple.def (GIMPLE_OMP_INTEROP): Define. * gimple.h (gimple_build_omp_interop): Declare. (gimple_omp_interop_clauses): New function. (gimple_omp_interop_clauses_ptr): Likewise. (gimple_omp_interop_set_clauses): Likewise. (gimple_return_set_retval): Handle GIMPLE_OMP_INTEROP. * gimplify.cc (gimplify_scan_omp_clauses): Handle OMP_CLAUSE_INIT, OMP_CLAUSE_USE and OMP_CLAUSE_DESTROY. (gimplify_omp_interop): New function. (gimplify_expr): Replace sorry with call to gimplify_omp_interop. * omp-builtins.def (BUILT_IN_GOMP_INTEROP): Define. * omp-low.cc (scan_sharing_clauses): Handle OMP_CLAUSE_INIT, OMP_CLAUSE_USE and OMP_CLAUSE_DESTROY. (scan_omp_1_stmt): Handle GIMPLE_OMP_INTEROP. (lower_omp_interop_action_clauses): New function. (lower_omp_interop): Likewise. (lower_omp_1): Handle GIMPLE_OMP_INTEROP. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_clause_destroy): Make addressable. (c_parser_omp_clause_init): Make addressable. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_clause_init): Make addressable. gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_clauses): Make OMP_CLAUSE_DESTROY and OMP_CLAUSE_INIT addressable. * types.def (BT_FN_VOID_INT_INT_PTR_PTR_PTR_INT_PTR_INT_PTR_UINT_PTR): New. include/ChangeLog: * gomp-constants.h (GOMP_DEVICE_DEFAULT_OMP_61, GOMP_INTEROP_TARGET, GOMP_INTEROP_TARGETSYNC, GOMP_INTEROP_FLAG_NOWAIT): Define. libgomp/ChangeLog: * icv-device.c (omp_set_default_device): Check GOMP_DEVICE_DEFAULT_OMP_61. * libgomp-plugin.h (struct interop_obj_t): New. (enum gomp_interop_flag): New. (GOMP_OFFLOAD_interop): Declare. (GOMP_OFFLOAD_get_interop_int): Declare. (GOMP_OFFLOAD_get_interop_ptr): Declare. (GOMP_OFFLOAD_get_interop_str): Declare. (GOMP_OFFLOAD_get_interop_type_desc): Declare. * libgomp.h (_LIBGOMP_OMP_LOCK_DEFINED): Define. (struct gomp_device_descr): Add interop_func, get_interop_int_func, get_interop_ptr_func, get_interop_str_func, get_interop_type_desc_func. * libgomp.map: Add GOMP_interop. * libgomp_g.h (GOMP_interop): Declare. * target.c (resolve_device): Handle GOMP_DEVICE_DEFAULT_OMP_61. (omp_get_interop_int): Replace stub with actual implementation. (omp_get_interop_ptr): Likewise. (omp_get_interop_str): Likewise. (omp_get_interop_type_desc): Likewise. (struct interop_data_t): Define. (gomp_interop_internal): New function. (GOMP_interop): Likewise. (gomp_load_plugin_for_device): Load symbols for get_interop_int, get_interop_ptr, get_interop_str and get_interop_type_desc. * testsuite/libgomp.c-c++-common/interop-1.c: New test. gcc/testsuite/ChangeLog: * c-c++-common/gomp/interop-1.c: Remove dg-prune-output "sorry". * c-c++-common/gomp/interop-2.c: Likewise. * c-c++-common/gomp/interop-3.c: Likewise. * c-c++-common/gomp/interop-4.c: Remove dg-message "not supported". * g++.dg/gomp/interop-5.C: Likewise. * gfortran.dg/gomp/interop-4.f90: Likewise. * c-c++-common/gomp/interop-5.c: New test. * gfortran.dg/gomp/interop-5.f90: New test. Co-authored-by: Tobias Burnus <tburnus@baylibre.com>
2025-03-21Fortran: Fix typo in error message.Jerry DeLisle1-1/+1
PR fortran/119406 gcc/fortran/ChangeLog: * resolve.cc (resolve_locality_spec): Add space in error message.
2025-03-21Fortran: Fix typo in error message.Jerry DeLisle1-1/+1
PR fortran/119403 gcc/fortran/ChangeLog: * interface.cc (compare_parameter): Fix typo.
2025-03-21ipa: target clone and mangling alias [PR114992]Jason Merrill2-1/+21
Since the mangling of the second lambda changed (previously we counted all lambdas, now we only count lambdas with the same signature), we generate_mangling_alias for handler<lambda2> for backward compatibility. Since handler is COMDAT, resolve_alias puts the alias in the same comdat group as handler itself. Then create_dispatcher_calls tries to add the alias to the same comdat group as the dispatcher, but it's already in a same_comdat_group, so we ICE. It seems like we're just missing a remove_from_same_comdat_group before add_to_same_comdat_group. PR c++/114992 gcc/ChangeLog: * multiple_target.cc (create_dispatcher_calls): remove_from_same_comdat_group before add_to_same_comdat_group. gcc/testsuite/ChangeLog: * g++.target/i386/mangling-alias1.C: New test.
2025-03-21Fortran: Implement the F2018 reduce intrinsic [PR85836]Paul Thomas9-51/+774
2025-03-21 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/85836 * check.cc (get_ul_from_cst_cl): New function used in check_operation. (check_operation): New function used in check_reduce and check_co_reduce. (gfc_check_co_reduce): Use it. (gfc_check_reduce): New function. (gfc_check_rename): Add prototype for intrinsic with 6 arguments. * gfortran.h : Add isym id for reduce and prototype for f6. * intrinsic.cc (do_check): Add another argument expression and use it in the call to the six argument specific check. (add_sym_6): New function. (add_functions): Add the discription of the reduce intrinsic and add it to the intrinsic list. * intrinsic.h : Add prototypes for gfc_check_reduce and gfc_resolve_reduce. * iresolve.cc (generate_reduce_op_wrapper): Generate a wrapper subroutine for the 'operation' function to enable the library implementation to be type agnostic and use pointer arithmetic throughout. (gfc_resolve_reduce): New function. * trans-expr.cc (gfc_conv_procedure_call): Add flag for scalar reduce. Generate a return variable 'sr' for scalar reduce, pass its address to the library function and return it as the scalar result. * trans-intrinsic.cc (gfc_conv_intrinsic_function): Array valued reduce is called in same way as reshape. Fall through for call to the scalar version. gcc/testsuite/ PR fortran/85836 * gfortran.dg/reduce_1.f90: New test * gfortran.dg/reduce_2.f90: New test libgfortran/ PR libfortran/85836 * Makefile.am : Add reduce.c * Makefile.in : Regenerated * gfortran.map : Add _gfortran_reduce, _gfortran_reduce_scalar, _gfortran_reduce_c and _gfortran_reduce_scalar_c to the list. * intrinsics/reduce.c (reduce, reduce_scalar, reduce_c, reduce_scalar_c): New functions and prototypes
2025-03-21arm: testsuite: make unaligned-memcpy-*.c executable tests [PR91614]Richard Earnshaw4-55/+77
These tests have been looking for a very specific instruction sequence which has the tendency to be fairly unstable as a result. But what is more interesting is that the the tests must not contain instructions that can't be used for unaligned data, and whether or not the copy is executed correctly. So make these tests executable and scan the assembler only to confirm the absence of instructions that must not be used when the data is not aligned. These tests also used to be restricted to targets that support unaligned accesses (because you get very different code otherwise). But now we've made the tests executable and to check for the absence of problem instructions, just falling back to memcpy *is* an acceptable implementation. So remove the requirement for unaligned accesses. gcc/testsuite: PR target/91614 * gcc.target/arm/unaligned-memcpy-1.c: Make the test executable. Only scan for the absence of instructions that cannot access misaligned data. Remove constraint of having unaligned accesses. * gcc.target/arm/unaligned-memcpy-2.c: Likewise. * gcc.target/arm/unaligned-memcpy-3.c: Likewise. * gcc.target/arm/unaligned-memcpy-4.c: Likewise.
2025-03-21arm: testsuite: memcpy-aligned requires unaligned accessesRichard Earnshaw1-0/+1
This test is designed to check that if one of the operands is aligned (but the other isn't) we expand to a sensible sequence and bypass most of the overhead of doing a memcpy. But on targets without unaligned accessess, we still end up calling memcpy. It's then a lottery as to whether the prologue and epilogue code, plus the set-up for the memcpy itself, generate instructions that match the scan patterns. Since in those cases we're not actually testing what the test is looking for anyway, just skip the test on strict-alignment targets. gcc/testsuite: * gcc.target/arm/memcpy-aligned-1.c: Require unaligned accesses.
2025-03-21c++: fix return type of __cxa_bad_array_new_lengthJason Merrill1-3/+2
We were lying about the return type, but that's not necessary; we already need to handle a COND_EXPR where one side is void for THROW_EXPR. This fixes an execution failure on nvptx: error: Prototype doesn't match for '__cxa_throw_bad_array_new_length' gcc/cp/ChangeLog: * init.cc (throw_bad_array_new_length): Returns void.
2025-03-21C++: Adjust implicit '__cxa_bad_cast' prototype to realityThomas Schwinge1-2/+2
In 2001 Subversion r40924 (Git commit 52a11cbfcf0cfb32628b6953588b6af4037ac0b6) "IA-64 ABI Exception Handling", '__cxa_bad_cast' changed from 'void *' to 'void' return type: --- libstdc++-v3/libsupc++/exception_support.cc +++ /dev/null @@ -1,388 +0,0 @@ -[...] -// Helpers for rtti. Although these don't return, we give them return types so -// that the type system is not broken. -extern "C" void * -__cxa_bad_cast () -{ - [...] -} -[...] --- /dev/null +++ libstdc++-v3/libsupc++/unwind-cxx.h @@ -0,0 +1,163 @@ +[...] +extern "C" void __cxa_bad_cast (); +[...] --- /dev/null +++ libstdc++-v3/libsupc++/eh_aux_runtime.cc @@ -0,0 +1,56 @@ +[...] +extern "C" void +__cxa_bad_cast () +{ + [...] +} +[...] The implicit prototype in the C++ front end however wasn't likewise adjusted, and so for nvptx we generate code for 'void *' return type: // BEGIN GLOBAL FUNCTION DECL: __cxa_bad_cast .extern .func (.param .u64 %value_out) __cxa_bad_cast; { .param .u64 %value_in; call (%value_in),__cxa_bad_cast; trap; // (noreturn) exit; // (noreturn) ld.param.u64 %r30,[%value_in]; } ..., which is in conflict with the library code with 'void' return type: // BEGIN GLOBAL FUNCTION DECL: __cxa_bad_cast .visible .func __cxa_bad_cast; // BEGIN GLOBAL FUNCTION DEF: __cxa_bad_cast .visible .func __cxa_bad_cast { [...] } ..., and we thus get execution test FAIL for 'g++.dg/rtti/dyncast2.C': error : Prototype doesn't match for '__cxa_bad_cast' in 'input file 7 at offset 51437', first defined in 'input file 7 at offset 51437' nvptx-run: cuLinkAddData failed: device kernel image is invalid (CUDA_ERROR_INVALID_SOURCE, 300) With this patched, we get the expected: // BEGIN GLOBAL FUNCTION DECL: __cxa_bad_cast -.extern .func (.param .u64 %value_out) __cxa_bad_cast; +.extern .func __cxa_bad_cast; { -.param .u64 %value_in; -call (%value_in),__cxa_bad_cast; +call __cxa_bad_cast; trap; // (noreturn) exit; // (noreturn) -ld.param.u64 %r30,[%value_in]; } ..., and execution test PASS. gcc/cp/ * rtti.cc (throw_bad_cast): Adjust implicit '__cxa_bad_cast' prototype to reality.
2025-03-21Add 'g++.target/nvptx/alias-g++.dg_init_dtor2-2.C'Thomas Schwinge1-0/+33
... next to '-malias' variant: commit a1865fd33897bc6c6e0109df0a12ee73ce386315 "Add 'g++.target/nvptx/alias-g++.dg_init_dtor2-1.C'", to document what we're doing to '-mno-alias'. gcc/testsuite/ * g++.target/nvptx/alias-g++.dg_init_dtor2-2.C: New.
2025-03-21Add 'gcc.target/nvptx/alias-unsupported-1.c'Thomas Schwinge1-0/+9
... testing for the GCC/nvptx "alias definitions not supported" error diagnostic. gcc/testsuite/ * gcc.target/nvptx/alias-unsupported-1.c: New.
2025-03-21Fortran: Fix freeing procedure pointer components [PR119380]Andre Vehreschild2-1/+31
PR fortran/119380 gcc/fortran/ChangeLog: * trans-array.cc (structure_alloc_comps): Prevent freeing of procedure pointer components. gcc/testsuite/ChangeLog: * gfortran.dg/proc_ptr_comp_54.f90: New test.
2025-03-21gccrs: nr2.0: late: Better format PathInExpression resolutionArthur Cohen1-12/+6
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Improve formatting.
2025-03-21gccrs: derive(Clone): Add lang item typepaths failure testcases to nr2 excludeArthur Cohen2-0/+6
gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Add failing lang item typepaths tests. * rust/execute/torture/derive_macro4.rs: Mark Clone as lang item.
2025-03-21gccrs: derive(Clone): Implement derive clone for enum struct variantsArthur Cohen6-7/+180
gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): New function for deriving enum struct variants. (DeriveClone::visit_enum): Call into the new function. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: * rust/compile/derive_clone_enum1.rs: New test. * rust/compile/derive_clone_enum2.rs: New test. * rust/compile/derive_clone_enum3.rs: New test. * rust/execute/torture/derive_clone_enum1.rs: New test.
2025-03-21gccrs: derive(Clone): Implement clone for enum tuple variantsArthur Cohen2-4/+66
gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::variant_match_path): New function. (DeriveClone::clone_enum_identifier): Rename. (DeriveClone::clone_enum_tuple): New function. (DeriveClone::visit_enum): Visit tuple variants properly. * expand/rust-derive-clone.h: Declare new functions.
2025-03-21gccrs: ast-builder: Add new methods for building structsArthur Cohen2-2/+15
gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: Add new methods for constructing struct exprs. * ast/rust-ast-builder.h: Mention how to build tuple expressions.
2025-03-21gccrs: derive(Clone): Add deriving of simple enum variantsArthur Cohen2-2/+53
gcc/rust/ChangeLog: * expand/rust-derive-clone.cc: Clone enum identifier variants properly * expand/rust-derive-clone.h: Declare new functions used.
2025-03-21gccrs: derive(Clone): Improve existing testcaseArthur Cohen1-0/+3
gcc/testsuite/ChangeLog: * rust/compile/derive_macro4.rs: Mark Copy and Clone as lang items.
2025-03-21gccrs: derive(Clone): Add note about Clone::clone()Arthur Cohen1-4/+10
gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::clone_call): Mention using `clone_fn` lang item in the future.
2025-03-21gccrs: derive(Clone): Use lang item for PhantomData in CloneArthur Cohen1-1/+1
gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::visit_union): Create a lang item path instead of a regular path.
2025-03-21gccrs: ast-builder: Add new methods around type paths.Arthur Cohen2-3/+67
gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: New functions. * ast/rust-ast-builder.h: Declare them.
2025-03-21gccrs: derive(Copy): Use copy lang item when deriving Copy.Arthur Cohen1-6/+2
gcc/rust/ChangeLog: * expand/rust-derive-copy.cc: Use lang item path.
2025-03-21gccrs: derive(Clone): Mark PhantomData as a lang itemArthur Cohen1-4/+1
gcc/testsuite/ChangeLog: * rust/compile/derive_macro4.rs: Make PhantomData a lang item.
2025-03-21gccrs: derive(Clone): Manually generate AssertParamIsCopy struct for unionsArthur Cohen1-4/+34
gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::visit_union): Manually generate the struct used for asserting a union implements Copy.
2025-03-21gccrs: builder: Allow generating struct statementsArthur Cohen2-0/+46
gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::struct_struct): New function. * ast/rust-ast-builder.h (vec): New function.
2025-03-21gccrs: lang-items: Mark Clone trait as a lang item in testsuiteArthur Cohen4-4/+6
gcc/testsuite/ChangeLog: * rust/compile/derive_macro1.rs: Add #[lang = "clone"] to Clone trait. * rust/compile/derive_macro3.rs: Likewise. * rust/compile/derive_macro6.rs: Likewise. * rust/execute/torture/derive_macro3.rs: Likewise.
2025-03-21gccrs: ast-collector: Fix tuple struct pattern collectionArthur Cohen1-4/+1
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Visit tuple pattern items as separated by commas.
2025-03-21gccrs: ast-collector: Adapt to lang item type path segmentsArthur Cohen1-8/+15
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Fix collector to better handle lang item type path segments.
2025-03-21gccrs: mappings: Add get_lang_item_nodeArthur Cohen2-0/+11
This method errors out if the lang item has not been declared yet. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::get_lang_item_node): New. * util/rust-hir-map.h: New function.
2025-03-21gccrs: lang-item: Add LangItem::PrettyStringArthur Cohen2-0/+7
Which formats a lang item as it appears in source code. gcc/rust/ChangeLog: * util/rust-lang-item.cc (LangItem::PrettyString): New. * util/rust-lang-item.h: New.
2025-03-21gccrs: lang-items: Collect struct lang items.Arthur Cohen2-0/+10
gcc/rust/ChangeLog: * ast/rust-collect-lang-items.cc (CollectLangItems::visit): New. * ast/rust-collect-lang-items.h: New.
2025-03-21gccrs: lower: Properly lower non-generic lang item type path segments.Arthur Cohen1-26/+14
gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Adapt code to lang item type path segments.
2025-03-21gccrs: tychk: resolve lang item type paths properlyArthur Cohen1-9/+17
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Adapt code to handle lang item type paths.
2025-03-21gccrs: ast: Refactor how lang item paths are handled.Arthur Cohen26-546/+311
Lang item typepaths were not handled properly, and required a complete overhaul. All old classes that concerned lang item paths are now modified to use a simpler version of `AST::LangItemPath`, which has been removed. TypePath segments can now be lang items, as this is requied for having generic lang item paths such as PhantomData<T>. gcc/rust/ChangeLog: * ast/rust-path.h: Rework how lang item paths are represented. * ast/rust-path.cc: Likewise. * ast/rust-item.h: Likewise. * ast/rust-ast.cc: Likewise. * ast/rust-ast-collector.cc: Adapt to new lang item path system. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * expand/rust-derive-copy.cc: Likewise. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Likewise. (ASTLowerTypePath::visit): Likewise. * hir/rust-ast-lower-type.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-type.h: Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise. * resolve/rust-late-name-resolver-2.0.h: Likewise. * hir/tree/rust-hir-path.cc (TypePathSegment::TypePathSegment): Likewise. (TypePathSegmentGeneric::TypePathSegmentGeneric): Likewise. * hir/tree/rust-hir-path.h: Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Likewise. * ast/rust-ast-builder.cc: Likewise. * ast/rust-ast-builder.h: Likewise.
2025-03-21gccrs: collect-lang-items: Display attribute upon error finding itArthur Cohen1-1/+2
gcc/rust/ChangeLog: * ast/rust-collect-lang-items.cc (get_lang_item_attr): Show unknown attribute upon error.