aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2025-05-31Fortran: Fix c_associated argument checks.Jerry DeLisle6-37/+164
PR fortran/120049 gcc/fortran/ChangeLog: * check.cc (gfc_check_c_associated): Use new helper functions. Only call check_c_ptr_1 if optional c_ptr_2 tests succeed. (check_c_ptr_1): Handle only c_ptr_1 checks. (check_c_ptr_2): Expand checks for c_ptr_2 and handle cases where there is no derived pointer in the gfc_expr and check the inmod_sym_id only if it exists. Rephrase error message. * misc.cc (gfc_typename): Handle the case for BT_VOID rather than throw an internal error. gcc/testsuite/ChangeLog: * gfortran.dg/pr120049_a.f90: Update test directives. * gfortran.dg/pr120049_b.f90: Update test directives * gfortran.dg/pr120049_2.f90: New test. * gfortran.dg/c_f_pointer_tests_6.f90: Adjust dg-error directive. Co-Authored-By: Steve Kargl <kargl@gcc.gnu.org> (cherry picked from commit 42983ffde6612b7f8a4e7ab3e76fa8b0d136e854)
2025-05-31Type mismatch for passed external functionThomas Koenig2-1/+47
This obvious and simple patch fixes a 15/16 regression where the typespec of a global function was in the RESULT clause and not in the symbol itself. gcc/fortran/ChangeLog: PR fortran/120355 * interface.cc (compare_parameter): If the global function has a result clause, take typespec from there for the comparison against the dummy argument. gcc/testsuite/ChangeLog: PR fortran/120355 * gfortran.dg/interface_62.f90: New test. (cherry picked from commit 0e77309047a7b479c89f03dcaf2994e050d0f33e)
2025-05-31Daily bump.GCC Administrator4-1/+69
2025-05-30OpenMP: Fix ICE and other issues in C/C++ metadirective error recovery.Sandra Loosemore4-35/+89
The new testcase included in this patch used to ICE in gcc after diagnosing the first error, and in g++ it only diagnosed the error in the first metadirective, ignoring the second one. The solution is to make error recovery in the C front end more like that in the C++ front end, and remove the code in both front ends that previously tried to skip all the way over the following statement (instead of just to the end of the metadirective pragma) after an error. gcc/c/ChangeLog * c-parser.cc (c_parser_skip_to_closing_brace): New, copied from the equivalent function in the C++ front end. (c_parser_skip_to_end_of_block_or_statement): Pass false to the error flag. (c_parser_omp_context_selector): Immediately return error_mark_node after giving an error that the integer trait property is invalid, similarly to C++ front end. (c_parser_omp_context_selector_specification): Likewise handle error return from c_parser_omp_context_selector similarly to C++. (c_parser_omp_metadirective): Do not call c_parser_skip_to_end_of_block_or_statement after an error. gcc/cp/ChangeLog * parser.cc (cp_parser_omp_metadirective): Do not call cp_parser_skip_to_end_of_block_or_statement after an error. gcc/testsuite/ChangeLog * c-c++-common/gomp/declare-variant-2.c: Adjust patterns now that C and C++ now behave similarly. * c-c++-common/gomp/metadirective-error-recovery.c: New. (cherry picked from commit 33b65e4d1c83808b54cd6b3fc97ebacc522b125d)
2025-05-30OpenMP: Fix ICE in metadirective recovery after error [PR120180]Sandra Loosemore3-6/+30
It's not clear whether a metadirective in a loop nest is supposed to be valid, but GCC certainly shouldn't be ICE'ing after diagnosing it as an error. gcc/c/ChangeLog PR c/120180 * c-parser.cc (c_parser_omp_metadirective): Only consume the token if it is the expected close paren. gcc/cp/ChangeLog PR c/120180 * parser.cc (cp_parser_omp_metadirective): Only consume the token if it is the expected close paren. gcc/testsuite/ChangeLog PR c/120180 * c-c++-common/gomp/pr120180.c: New. (cherry picked from commit 65e0ed2310a1b0d1a3255583bbfb8a8d86c5aea5)
2025-05-30ChangeLog.omp bumpThomas Schwinge2-1/+10
2025-05-30Defuse 'RESULT_DECL' check in 'pass_nrv' (for offloading compilation) [PR119835]Thomas Schwinge1-7/+12
... to avoid running into ICEs per PR119835, until that's resolved properly. PR middle-end/119835 gcc/ * tree-nrv.cc (pass_nrv::execute): Defuse 'RESULT_DECL' check. libgomp/ * testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c: '#pragma GCC optimize "-fno-inline"'. * testsuite/libgomp.c-c++-common/target-abi-struct-1.c: New. * testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: Adjust. Co-authored-by: Richard Biener <rguenther@suse.de> (cherry picked from commit 543f7e1d59f0b6628e0de6610ad5e1cf7150090b)
2025-05-30testsuite: Add testcase for GCC 13 branch s390 bug [PR120480]Jakub Jelinek1-0/+11
This got broken with r13-9727 and fixed with either of r13-9729 or r13-9728. 2025-05-30 Jakub Jelinek <jakub@redhat.com> PR target/120480 * gcc.dg/pr120480.c: New test. (cherry picked from commit c13d5b939fee565047394475952878dc5394fb74)
2025-05-30Daily bump.GCC Administrator2-1/+9
2025-05-29aarch64: Enable newly implemented features for FUJITSU-MONAKAYuta Mukai1-1/+1
This patch enables newly implemented features in GCC (FAMINMAX, FP8FMA, FP8DOT2, FP8DOT4, LUT) for FUJITSU-MONAKA processor (-mcpu=fujitsu-monaka). 2025-05-23 Yuta Mukai <mukai.yuta@fujitsu.com> gcc/ChangeLog: * config/aarch64/aarch64-cores.def (fujitsu-monaka): Update ISA features. (cherry picked from commit 33ee574a7444b238005d89fdfdf2f21f50b1fc6e)
2025-05-29Daily bump.GCC Administrator1-1/+1
2025-05-28Daily bump.GCC Administrator3-1/+21
2025-05-27Fix IPA-SRA issue with reverse SSO on specific patternEric Botcazou5-1/+57
IPA-SRA generally works fine in the presence of reverse Scalar_Storage_Order by propagating the relevant flag onto the newly generated MEM_REFs. However we have been recently faced with a specific Ada pattern that it does not handle correctly: the 'Valid attribute applied to a floating-point component of an aggregate type with reverse Scalar_Storage_Order. The attribute is implemented by a call to a specific routine of the runtime that expects a pointer to the object so, in the case of a component with reverse SSO, the compiler first loads it from the aggregate to get back the native storage order, but it does the load using an array of bytes instead of the floating-point type to prevent the FPU from fiddling with the value, which yields in the .original dump file: *(character[1:4] *) &F2b = VIEW_CONVERT_EXPR<character[1:4]>(item.f); Of course that's a bit convoluted, but it does not seem that another method would be simpler or even work, and using VIEW_CONVERT_EXPR to toggle the SSO is supposed to be supported in any case (unlike aliasing or type punning). The attached patch makes it work. While the call to storage_order_barrier_p from IPA-SRA is quite natural (the regular SRA has it too), the tweak to the predicate itself is needed to handle the scalar->aggregate conversion, which is admittedly awkward but again without clear alternative. gcc/ * ipa-sra.cc (scan_expr_access): Also disqualify storage order barriers from splitting. * tree.h (storage_order_barrier_p): Also return false if the operand of the VIEW_CONVERT_EXPR has reverse storage order. gcc/testsuite/ * gnat.dg/sso19.adb: New test. * gnat.dg/sso19_pkg.ads, gnat.dg/sso19_pkg.adb: New helper.
2025-05-27doc: Fix typo in description of nonstring attributeJonathan Wakely1-1/+1
gcc/ChangeLog: * doc/extend.texi (Common Variable Attributes): Fix typo in description of nonstring. (cherry picked from commit 351e60095cfaa73b5ac69222d00e0cd4ae5725d4)
2025-05-27Daily bump.GCC Administrator3-1/+31
2025-05-26Merge branch 'releases/gcc-15' into devel/omp/gcc-15Tobias Burnus42-38/+558
Merge up to r15-9731-gd390c7e5bd0349 (26th May 2025)
2025-05-26c-c++-common/gomp/{attrs-,}metadirective-3.c: Fix expected result [PR118694]Tobias Burnus2-6/+8
With compilation for nvptx enabled, two issues showed up: (a) "error: 'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" See PR comment 9 why this is difficult to fix. Solution: Add dg-bogus and accept/expect the error for 'target offload_nvptx'. (b) The assumptions about the dump for 'target offload_nvptx' were wrong as the metadirective was already expanded to a OMP_NEXT_VARIANT construct such that no 'omp metadirective' was left in either case. Solution: Check that no 'omp metadirective' is left; additionally, expect either OMP_NEXT_VARIANT (when offload_nvptx is available) or no 'teams' directive at all (if not). gcc/testsuite/ChangeLog: PR middle-end/118694 * c-c++-common/gomp/attrs-metadirective-3.c: Change to never expect 'omp metadirective' in the dump. If !offload_nvptx, check that no 'teams' shows up in the dump; for offload_nvptx, expect OMP_NEXT_VARIANT and an error about directive between 'target' and 'teams'. * c-c++-common/gomp/metadirective-3.c: Likewise. (cherry picked from commit 5d6ed6d604ff949b650e48fa4eaed3ec8b6489c1)
2025-05-26OpenMP/C++: Avoid ICE for BIND_EXPR with empty BIND_EXPR_BLOCK [PR120413]Tobias Burnus2-4/+26
PR c++/120413 gcc/cp/ChangeLog: * semantics.cc (finish_omp_target_clauses_r): Handle BIND_EXPR with empty BIND_EXPR_BLOCK. gcc/testsuite/ChangeLog: * g++.dg/gomp/target-4.C: New test. (cherry picked from commit 45b849d05b733a25ec7ce612229084b8f4b86d3d)
2025-05-26Daily bump.GCC Administrator2-1/+8
2025-05-25MicroBlaze does not support speculative execution (CVE-2017-5753)Michael J. Eager1-0/+4
gcc/ PR target/86772 Tracking CVE-2017-5753 * config/microblaze/microblaze.cc (TARGET_HAVE_SPECULATION_SAFE_VALUE): Define to speculation_save_value_not_needed
2025-05-25Daily bump.GCC Administrator1-1/+1
2025-05-24Daily bump.GCC Administrator3-1/+47
2025-05-24c++/modules: Fix merge of TLS init functions [PR120363]Nathaniel Shead10-3/+82
The PR notes that we missed setting DECL_CONTEXT on the TLS init function; we missed this initially because this function is not created in header units, only named modules. I also noticed that 'DECL_CONTEXT (fn) = DECL_CONTEXT (var)' was incorrect: for class members, this ends up having the modules merging machinery treat the decl as a member function, which breaks when attempting to dedup against an existing completed class type. Instead we can just use the global_namespace as the context, because the name of the function is already mangled appropriately so that we'll match the correct duplicates. PR c++/120363 gcc/cp/ChangeLog: * decl2.cc (get_tls_init_fn): Set context as global_namespace. (get_tls_wrapper_fn): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/pr113292_a.H: Move to... * g++.dg/modules/tls-1_a.H: ...here. * g++.dg/modules/pr113292_b.C: Move to... * g++.dg/modules/tls-1_b.C: ...here. * g++.dg/modules/pr113292_c.C: Move to... * g++.dg/modules/tls-1_c.C: ...here. * g++.dg/modules/tls-2_a.C: New test. * g++.dg/modules/tls-2_b.C: New test. * g++.dg/modules/tls-2_c.C: New test. * g++.dg/modules/tls-3.h: New test. * g++.dg/modules/tls-3_a.H: New test. * g++.dg/modules/tls-3_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit 66e9a4f3083356b064cc64651edad466a56f762b)
2025-05-24c++/modules: Fix stream-in of member using-decls [PR120414]Nathaniel Shead3-1/+25
When streaming in a reference to a data member, we have an oversight where we did not consider USING_DECLs, despite otherwise handling them here the same as fields. This patch corrects that mistake. PR c++/120414 gcc/cp/ChangeLog: * module.cc (trees_in::tree_node): Allow reading a USING_DECL when streaming tt_data_member. gcc/testsuite/ChangeLog: * g++.dg/modules/using-31_a.C: New test. * g++.dg/modules/using-31_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit 43dddeef7a870ce4db7407f73660504b67a0a919)
2025-05-23Daily bump.GCC Administrator3-1/+23
2025-05-22Fortran: default-initialization and functions returning derived type [PR85750]Harald Anlauf7-13/+134
Functions with non-pointer, non-allocatable result and of derived type did not always get initialized although the type had default-initialization, and a derived type component had the allocatable or pointer attribute. Rearrange the logic when to apply default-initialization. PR fortran/85750 gcc/fortran/ChangeLog: * resolve.cc (resolve_symbol): Reorder conditions when to apply default-initializers. gcc/testsuite/ChangeLog: * gfortran.dg/alloc_comp_auto_array_3.f90: Adjust scan counts. * gfortran.dg/alloc_comp_class_3.f03: Remove bogus warnings. * gfortran.dg/alloc_comp_class_4.f03: Likewise. * gfortran.dg/allocate_with_source_14.f03: Adjust scan count. * gfortran.dg/derived_constructor_comps_6.f90: Likewise. * gfortran.dg/derived_result_5.f90: New test. (cherry picked from commit d31ab498b12ebbe4f50acb2aa240ff92c73f310c)
2025-05-22ChangeLog.omp bumpThomas Schwinge2-0/+22
2025-05-22'TYPE_EMPTY_P' vs. code offloading [PR120308]Thomas Schwinge5-3/+36
We've got 'gcc/stor-layout.cc:finalize_type_size': /* Handle empty records as per the x86-64 psABI. */ TYPE_EMPTY_P (type) = targetm.calls.empty_record_p (type); (Indeed x86_64 is still the only target to define 'TARGET_EMPTY_RECORD_P', calling 'gcc/tree.cc-default_is_empty_record'.) And so it happens that for an empty struct used in code offloaded from x86_64 host (but not powerpc64le host, for example), we get to see 'TYPE_EMPTY_P' in offloading compilation (where the offload targets (currently?) don't use it themselves, and therefore aren't prepared to handle it). For nvptx offloading compilation, this causes wrong code generation: 'ptxas [...] error : Call has wrong number of parameters', as nvptx code generation for function definition doesn't pay attention to this flag (say, in 'gcc/config/nvptx/nvptx.cc:pass_in_memory', or whereever else would be appropriate to handle that), but the generic code 'gcc/calls.cc:expand_call' via 'gcc/function.cc:aggregate_value_p' does pay attention to it, and we thus get mismatching function definition vs. function call. This issue apparently isn't a problem for GCN offloading, but I don't know if that's by design or by accident. Richard Biener: > It looks like TYPE_EMPTY_P is only used during RTL expansion for ABI > purposes, so computing it during layout_type is premature as shown here. > > I would suggest to simply re-compute it at offload stream-in time. (For avoidance of doubt, the additions to 'gcc.target/nvptx/abi-struct-arg.c', 'gcc.target/nvptx/abi-struct-ret.c' are not dependent on the offload streaming code changes, but are just to mirror the changes to 'libgomp.oacc-c-c++-common/abi-struct-1.c'.) PR lto/120308 gcc/ * lto-streamer-out.cc (hash_tree): Don't handle 'TYPE_EMPTY_P' for 'lto_stream_offload_p'. * tree-streamer-in.cc (unpack_ts_type_common_value_fields): Likewise. * tree-streamer-out.cc (pack_ts_type_common_value_fields): Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c: Add empty structure testing. gcc/testsuite/ * gcc.target/nvptx/abi-struct-arg.c: Add empty structure testing. * gcc.target/nvptx/abi-struct-ret.c: Likewise. (cherry picked from commit 9063810c86beee6274d745b91d8fb43a81c9683e)
2025-05-22ChangeLog.omp bumpTobias Burnus1-1/+1
2025-05-22Daily bump.GCC Administrator1-1/+1
2025-05-21Daily bump.GCC Administrator5-1/+91
2025-05-20Fortran: fix passing of inquiry ref of complex array to TRANSFER [PR102891]Harald Anlauf2-1/+53
PR fortran/102891 gcc/fortran/ChangeLog: * dependency.cc (gfc_ref_needs_temporary_p): Within an array reference, inquiry references of complex variables generally need a temporary. gcc/testsuite/ChangeLog: * gfortran.dg/transfer_array_subref.f90: New test. (cherry picked from commit 94fa992b60e53dcf807fc7055ab606d828b931d8)
2025-05-20tree-sra: Do not create stores into const aggregates (PR111873)Martin Jambor4-1/+52
This patch fixes (hopefully the) one remaining place where gimple SRA was still creating a load into const aggregates. It occurs when there is a replacement for a load but that replacement is not type compatible - typically because it is a single field structure. I have used testcases from duplicates because the original test-case no longer reproduces for me. gcc/ChangeLog: 2025-05-13 Martin Jambor <mjambor@suse.cz> PR tree-optimization/111873 * tree-sra.cc (sra_modify_expr): When processing a load which has a type-incompatible replacement, do not store the contents of the replacement into the original aggregate when that aggregate is const. gcc/testsuite/ChangeLog: 2025-05-13 Martin Jambor <mjambor@suse.cz> * gcc.dg/ipa/pr120044-1.c: New test. * gcc.dg/ipa/pr120044-2.c: Likewise. * gcc.dg/tree-ssa/pr114864.c: Likewise. (cherry picked from commit 9d039eff453f777c58642ff16178c1ce2a4be6ab)
2025-05-20ipa: Dump cgraph_node UID instead of order into ipa-clones dump fileMartin Jambor6-8/+8
Since starting from GCC 15 the order is not unique for any symtab_nodes but m_uid is, I believe we ought to dump the latter in the ipa-clones dump, if only so that people can reliably match entries about new clones to those about removed nodes (if any). This patch also contains a fixes to a few other places where we have so far dumped order to our ordinary dumps and which have been identified by Michal Jires. gcc/ChangeLog: 2025-05-16 Martin Jambor <mjambor@suse.cz> * cgraph.h (symtab_node): Make member function get_uid const. * cgraphclones.cc (dump_callgraph_transformation): Dump m_uid of the call graph nodes instead of order. * cgraph.cc (cgraph_node::remove): Likewise. * ipa-cp.cc (ipcp_lattice<valtype>::print): Likewise. * ipa-sra.cc (ipa_sra_summarize_function): Likewise. * symtab.cc (symtab_node::dump_base): Likewise. Co-Authored-By: Michal Jires <mjires@suse.cz> (cherry picked from commit 9fa534f0831892393885e64596a0d6ca8c4078b6)
2025-05-20Merge branch 'releases/gcc-15' into devel/omp/gcc-15Tobias Burnus60-340/+2079
Merge up to r15-9715-g911cfea5e59798 (May 20, 2025).
2025-05-20c++/modules: Fix ICE on merge of instantiation with partial spec [PR120013]Nathaniel Shead6-11/+72
When we import a pending instantiation that matches an existing partial specialisation, we don't find the slot in the entity map because for partial specialisations we register the TEMPLATE_DECL but for normal implicit instantiations we instead register the inner TYPE_DECL. Because the DECL_MODULE_ENTITY_P flag is set we correctly realise that it is in the entity map, but ICE when attempting to use that slot in partition handling. This patch fixes the issue by detecting this case and instead looking for the slot for the TEMPLATE_DECL. It doesn't matter that we never add a slot for the inner decl because we're about to discard it anyway. PR c++/120013 gcc/cp/ChangeLog: * module.cc (trees_in::install_entity): Handle re-registering the inner TYPE_DECL of a partial specialisation. gcc/testsuite/ChangeLog: * g++.dg/modules/partial-8.h: New test. * g++.dg/modules/partial-8_a.C: New test. * g++.dg/modules/partial-8_b.C: New test. * g++.dg/modules/partial-8_c.C: New test. * g++.dg/modules/partial-8_d.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit b0de7297f2b5670386472229ab795a577c288ecf)
2025-05-20c++/modules: Always mark tinfo vars as TREE_ADDRESSABLE [PR120350]Nathaniel Shead3-0/+16
We need to mark type info decls as addressable if we take them by reference; this is done by walking the declaration during parsing and marking the decl as needed. However, with modules we don't stream tinfo decls directly; rather we stream just their name and type and reconstruct them in the importer directly. This means that any addressable flags are not propagated, and we error because TREE_ADDRESSABLE is not set despite taking its address. But tinfo decls should always have TREE_ADDRESSABLE set, as any attempt to use the tinfo decl will go through build_address anyway. So this patch fixes the issue by eagerly marking the constructed decl as TREE_ADDRESSABLE so that modules gets this flag correctly set as well. PR c++/120350 gcc/cp/ChangeLog: * rtti.cc (get_tinfo_decl_direct): Mark TREE_ADDRESSABLE. gcc/testsuite/ChangeLog: * g++.dg/modules/tinfo-3_a.H: New test. * g++.dg/modules/tinfo-3_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit 9a6e5a437f0416627ee516f6ef5929cb30c5e498)
2025-05-20Daily bump.GCC Administrator2-1/+9
2025-05-19OpenMP/Fortran: Fix allocatable-component mapping of derived-type array compsTobias Burnus1-0/+20
The check whether the location expression in map clause has allocatable components was failing for some derived-type array expressions such as map(var%tiles(1)) as the compiler produced _4 = var.tiles; MEMREF(_4, _5); This commit now also handles this case. gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_omp_deep_mapping_do): Handle SSA_NAME if a def_stmt is available. libgomp/ChangeLog: * testsuite/libgomp.fortran/alloc-comp-4.f90: New test. (cherry picked from commit f99017c3125f4400cf6a098cf5b33d32fe3e6645)
2025-05-19Daily bump.GCC Administrator1-1/+1
2025-05-18Daily bump.GCC Administrator3-1/+20
2025-05-17Fortran: Fix ICE with use of c_associated.Jerry DeLisle3-16/+49
PR fortran/120049 gcc/fortran/ChangeLog: * check.cc (gfc_check_c_associated): Modify checks to avoid ICE and allow use, intrinsic :: iso_c_binding from a separate module file. gcc/testsuite/ChangeLog: * gfortran.dg/pr120049_a.f90: New test. * gfortran.dg/pr120049_b.f90: New test. (cherry picked from commit d0571638a6bad932b226ada98b167fa47a47d838)
2025-05-17Daily bump.GCC Administrator3-1/+18
2025-05-16ChangeLog.omp bumpSandra Loosemore1-1/+1
2025-05-16Alpha: Fix base block alignment calculation regressionMaciej W. Rozycki3-13/+150
In determination of base block alignment we only examine a COMPONENT_REF tree node at hand without ever checking if its ultimate alignment has been reduced by the combined offset going back to the outermost object. Consequently cases have been observed where quadword accesses have been produced for a memory location referring a nested struct member only aligned to the longword boundary, causing emulation to trigger. Address this issue by recursing into COMPONENT_REF tree nodes until the outermost one has been reached, which is supposed to be a MEM_REF one, accumulating the offset as we go, fixing a commit e0dae4da4c45 ("Alpha: Also use tree information to get base block alignment") regression. Bail out and refrain from using tree information for alignment if we end up at something different or we are unable to calculate the offset at any point. gcc/ * config/alpha/alpha.cc (alpha_get_mem_rtx_alignment_and_offset): Recurse into COMPONENT_REF nodes. gcc/testsuite/ * gcc.target/alpha/memcpy-nested-offset-long.c: New file. * gcc.target/alpha/memcpy-nested-offset-quad.c: New file. (cherry picked from commit 1dd769b3d0d9251649dcb645d7ed6c4ba2202306)
2025-05-16Daily bump.GCC Administrator5-1/+40
2025-05-15c++: unifying specializations of non-primary tmpls [PR120161]Patrick Palka2-3/+21
Here unification of P=Wrap<int>::type, A=Wrap<long>::type wrongly succeeds ever since r14-4112 which made the RECORD_TYPE case of unify no longer recurse into template arguments for non-primary templates (since they're a non-deduced context) and so the int/long mismatch that makes the two types distinct goes unnoticed. In the case of (comparing specializations of) a non-primary template, unify should still go on to compare the types directly before returning success. PR c++/120161 gcc/cp/ChangeLog: * pt.cc (unify) <case RECORD_TYPE>: When comparing specializations of a non-primary template, still perform a type comparison. gcc/testsuite/ChangeLog: * g++.dg/template/unify13.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit 0c430503f2849ebb20105695b8ad40d43d797c7b)
2025-05-15ChangeLog.omp bumpSandra Loosemore7-0/+2388
2025-05-15OpenMP: need_device_ptr and need_device_addr support for adjust_argsSandra Loosemore8-39/+201
This patch adds support for the "need_device_addr" modifier to the "adjust args" clause for the "declare variant" directive, and extends/re-works the support for "need_device_ptr" as well. This patch builds on waffl3x's recently posted patch, "OpenMP: C/C++ adjust-args numeric ranges", here. https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681806.html In C++, "need_device_addr" supports mapping reference arguments to device pointers. In Fortran, it similarly supports arguments passed by reference, the default for the language, in contrast to "need_device_ptr" which is used to map arguments of c_ptr type. The C++ support is straightforward, but Fortran has some additional wrinkles involving arrays passed by descriptor (a new descriptor must be constructed with a pointer to the array data which is the only part mapped to the device), plus special cases for passing optional arguments and a whole array instead of a reference to its first element. gcc/cp/ChangeLog * parser.cc (cp_finish_omp_declare_variant): Adjust error messages. gcc/fortran/ChangeLog * trans-openmp.cc (gfc_trans_omp_declare_variant): Disallow polymorphic and optional arguments with need_device_addr for now, but don't reject need_device_addr entirely. gcc/ChangeLog * gimplify.cc (modify_call_for_omp_dispatch): Rework logic for need_device_ptr and need_device_addr adjustments. gcc/testsuite/ChangeLog * c-c++-common/gomp/adjust-args-10.c: Ignore the new sorry since the lack of proper diagnostic is already xfail'ed. * g++.dg/gomp/adjust-args-1.C: Adjust output patterns. * g++.dg/gomp/adjust-args-17.C: New. * gcc.dg/gomp/adjust-args-3.c: New. * gfortran.dg/gomp/adjust-args-14.f90: Don't expect this to fail now. libgomp/ChangeLog * libgomp.texi: Mark need_device_addr as supported. * testsuite/libgomp.c++/need-device-ptr.C: New. * testsuite/libgomp.c-c++-common/dispatch-3.c: New. * testsuite/libgomp.fortran/adjust-args-array-descriptor.f90: New. * testsuite/libgomp.fortran/need-device-ptr.f90: New. Co-Authored-By: Tobias Burnus <tburnus@baylibre.com>
2025-05-15OpenMP: C/C++ adjust-args numeric rangeswaffl3x39-434/+4914
Add support for OpenMP parameter-lists in an adjust_args clause, more specifically, numeric ranges and parameter indices. Many bugs are also fixed along the way. Most of the fixes rely on the changes to handling of clause arguments and can't reasonably be split out, while most of the changes that fix PR119602 came as a side effect of properly handling numeric ranges with dependent bounds so it makes sense to include it here. Variadic arguments with an incorrect type are not currently diagnosed, but handling for them is otherwise functional. It is unclear how references to pointers are supposed to be handled, so for now we sorry for that case. PR c++/119659 PR c++/118859 PR c++/119601 PR c++/119602 PR c++/119775 gcc/c/ChangeLog: * c-parser.cc (c_omp_numeric_ranges_always_overlap): New function. (c_parser_omp_parm_list): New function. (c_finish_omp_declare_variant): Use c_parser_omp_parm_list instead of c_parser_omp_variable_list. Refactor, change format of "omp declare variant variant args" attribute. gcc/cp/ChangeLog: PR c++/119659 PR c++/118859 PR c++/119601 PR c++/119602 PR c++/119775 * cp-tree.h (finish_omp_parm_list): New declaration. (finish_omp_adjust_args): New declaration. * decl.cc (omp_declare_variant_finalize_one): Refactor and change attribute unpacking, use finish_omp_parm_list and finish_omp_adjust_args, refactor append_args diagnostics, add nbase_parms to append_args attribute, remove special handling for member functions. * parser.cc (cp_parser_direct_declarator): Don't pass parms. (cp_parser_late_return_type_opt): Remove parms parameter. (cp_parser_omp_parm_list): New function. (cp_finish_omp_declare_variant): Remove parms parameter. Add NULL_TREE instead of nbase_args to append_args_tree. Refactor, use cp_parser_omp_parm_list not cp_parser_omp_var_list_no_open, handle "need_device_addr" and remove handling and diagnostics of parm list arguments that are done too early. Change format of unnamed variant attribute. (cp_parser_late_parsing_omp_declare_simd): Remove parms parameter. * pt.cc (tsubst_attribute): Copy "omp declare variant base" nodes, substitute parm list numeric range bounds. * semantics.cc (finish_omp_parm_list): New function. (finish_omp_adjust_args): New function. gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_declare_variant): Change format of "omp declare variant variant args" attribute. gcc/ChangeLog: * gimplify.cc (modify_call_for_omp_dispatch): Refactor and change attribute unpacking. For adjust_args variadic functions, expand numeric ranges with relative bounds. Refactor argument adjustment. libgomp/ChangeLog: * libgomp.texi: Set 'adjust args' variadic arguments support to Y. gcc/testsuite/ChangeLog: * c-c++-common/gomp/pr118579.c: Change error text. * g++.dg/gomp/adjust-args-1.C: Fix error text, add dg-* directives. * g++.dg/gomp/adjust-args-2.C: Add dg-* directives. * g++.dg/gomp/append-args-1.C: Add dg-* directives. * gcc.dg/gomp/adjust-args-1.c: Fix error text, add dg-* directives. * gcc.dg/gomp/append-args-1.c: Fix error text, add dg-* directives. * c-c++-common/gomp/adjust-args-7.c: New test. * c-c++-common/gomp/adjust-args-8.c: New test. * c-c++-common/gomp/adjust-args-9.c: New test. * c-c++-common/gomp/adjust-args-10.c: New test. * c-c++-common/gomp/adjust-args-11.c: New test. * c-c++-common/gomp/adjust-args-12.c: New test. * c-c++-common/gomp/adjust-args-13.c: New test. * c-c++-common/gomp/adjust-args-14.c: New test. * c-c++-common/gomp/adjust-args-15.c: New test. * g++.dg/gomp/adjust-args-5.C: New test. * g++.dg/gomp/adjust-args-6.C: New test. * g++.dg/gomp/adjust-args-7.C: New test. * g++.dg/gomp/adjust-args-8.C: New test. * g++.dg/gomp/adjust-args-9.C: New test. * g++.dg/gomp/adjust-args-10.C: New test. * g++.dg/gomp/adjust-args-11.C: New test. * g++.dg/gomp/adjust-args-12.C: New test. * g++.dg/gomp/adjust-args-13.C: New test. * g++.dg/gomp/adjust-args-14.C: New test. * g++.dg/gomp/adjust-args-15.C: New test. * g++.dg/gomp/adjust-args-16.C: New test. * g++.dg/gomp/append-args-9.C: New test. * g++.dg/gomp/append-args-10.C: New test. * g++.dg/gomp/append-args-11.C: New test. * g++.dg/gomp/append-args-omp-interop-t.h: New header. Signed-off-by: Waffl3x <waffl3x@baylibre.com>