From 76d16fbd802a10faabf63945dd34f351aea087dc Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Fri, 16 May 2025 17:13:51 +0200 Subject: ipa: Dump cgraph_node UID instead of order into ipa-clones dump file 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 * 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::print): Likewise. * ipa-sra.cc (ipa_sra_summarize_function): Likewise. * symtab.cc (symtab_node::dump_base): Likewise. Co-Authored-By: Michal Jires (cherry picked from commit 9fa534f0831892393885e64596a0d6ca8c4078b6) --- gcc/cgraph.cc | 2 +- gcc/cgraph.h | 2 +- gcc/cgraphclones.cc | 4 ++-- gcc/ipa-cp.cc | 2 +- gcc/ipa-sra.cc | 2 +- gcc/symtab.cc | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'gcc') diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 6ae6a97..48646de 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -1879,7 +1879,7 @@ cgraph_node::remove (void) clone_info *info, saved_info; if (symtab->ipa_clones_dump_file && symtab->cloned_nodes.contains (this)) fprintf (symtab->ipa_clones_dump_file, - "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), order, + "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), get_uid (), DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl), DECL_SOURCE_COLUMN (decl)); diff --git a/gcc/cgraph.h b/gcc/cgraph.h index abde770..45119e3 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -493,7 +493,7 @@ public: static inline void checking_verify_symtab_nodes (void); /* Get unique identifier of the node. */ - inline int get_uid () + inline int get_uid () const { return m_uid; } diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc index bf5bc41..3c9c642 100644 --- a/gcc/cgraphclones.cc +++ b/gcc/cgraphclones.cc @@ -324,11 +324,11 @@ dump_callgraph_transformation (const cgraph_node *original, { fprintf (symtab->ipa_clones_dump_file, "Callgraph clone;%s;%d;%s;%d;%d;%s;%d;%s;%d;%d;%s\n", - original->asm_name (), original->order, + original->asm_name (), original->get_uid (), DECL_SOURCE_FILE (original->decl), DECL_SOURCE_LINE (original->decl), DECL_SOURCE_COLUMN (original->decl), clone->asm_name (), - clone->order, DECL_SOURCE_FILE (clone->decl), + clone->get_uid (), DECL_SOURCE_FILE (clone->decl), DECL_SOURCE_LINE (clone->decl), DECL_SOURCE_COLUMN (clone->decl), suffix); diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index a8ff3c8..7ce9ba7 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -292,7 +292,7 @@ ipcp_lattice::print (FILE * f, bool dump_sources, bool dump_benefits) else fprintf (f, " [scc: %i, from:", val->scc_no); for (s = val->sources; s; s = s->next) - fprintf (f, " %i(%f)", s->cs->caller->order, + fprintf (f, " %i(%f)", s->cs->caller->get_uid (), s->cs->sreal_frequency ().to_double ()); fprintf (f, "]"); } diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc index 1331ba49..88bfae9 100644 --- a/gcc/ipa-sra.cc +++ b/gcc/ipa-sra.cc @@ -4644,7 +4644,7 @@ ipa_sra_summarize_function (cgraph_node *node) { if (dump_file) fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (), - node->order); + node->get_uid ()); gcc_obstack_init (&gensum_obstack); loaded_decls = new hash_set; diff --git a/gcc/symtab.cc b/gcc/symtab.cc index fe9c031..fc1155f 100644 --- a/gcc/symtab.cc +++ b/gcc/symtab.cc @@ -989,10 +989,10 @@ symtab_node::dump_base (FILE *f) same_comdat_group->dump_asm_name ()); if (next_sharing_asm_name) fprintf (f, " next sharing asm name: %i\n", - next_sharing_asm_name->order); + next_sharing_asm_name->get_uid ()); if (previous_sharing_asm_name) fprintf (f, " previous sharing asm name: %i\n", - previous_sharing_asm_name->order); + previous_sharing_asm_name->get_uid ()); if (address_taken) fprintf (f, " Address is taken.\n"); -- cgit v1.1 From c1db46f7e51d4a546ca536f7f10e548f02e5cc12 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 14 May 2025 12:08:24 +0200 Subject: tree-sra: Do not create stores into const aggregates (PR111873) 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 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 * 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) --- gcc/testsuite/gcc.dg/ipa/pr120044-1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.dg/ipa/pr120044-2.c | 17 +++++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr114864.c | 15 +++++++++++++++ gcc/tree-sra.cc | 4 +++- 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/ipa/pr120044-1.c create mode 100644 gcc/testsuite/gcc.dg/ipa/pr120044-2.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr114864.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-1.c b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c new file mode 100644 index 0000000..f9fee3e --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting -fno-inline" } */ + +struct a { + int b; +} const c; +void d(char p, struct a e) { + while (e.b) + ; +} +static unsigned short f(const struct a g) { + d(g.b, g); + return g.b; +} +int main() { + return f(c); +} diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-2.c b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c new file mode 100644 index 0000000..5130791 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting -fno-ipa-cp" } */ + +struct a { + int b; +} const c; +void d(char p, struct a e) { + while (e.b) + ; +} +static unsigned short f(const struct a g) { + d(g.b, g); + return g.b; +} +int main() { + return f(c); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c new file mode 100644 index 0000000..cd9b94c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -fno-tree-dce -fno-tree-fre" } */ + +struct a { + int b; +} const c; +void d(const struct a f) {} +void e(const struct a f) { + f.b == 0 ? 1 : f.b; + d(f); +} +int main() { + e(c); + return 0; +} diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc index 302b73e..4b6daf7 100644 --- a/gcc/tree-sra.cc +++ b/gcc/tree-sra.cc @@ -4205,8 +4205,10 @@ sra_modify_expr (tree *expr, bool write, gimple_stmt_iterator *stmt_gsi, } else { - gassign *stmt; + if (TREE_READONLY (access->base)) + return false; + gassign *stmt; if (access->grp_partial_lhs) repl = force_gimple_operand_gsi (stmt_gsi, repl, true, NULL_TREE, true, -- cgit v1.1 From 6683c729663299cdcc401248dce63ea16fc8357e Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Tue, 6 May 2025 20:59:48 +0200 Subject: Fortran: fix passing of inquiry ref of complex array to TRANSFER [PR102891] 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) --- gcc/fortran/dependency.cc | 6 ++- .../gfortran.dg/transfer_array_subref.f90 | 48 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/transfer_array_subref.f90 (limited to 'gcc') diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc index 57c0c49..aa8a57a 100644 --- a/gcc/fortran/dependency.cc +++ b/gcc/fortran/dependency.cc @@ -944,8 +944,12 @@ gfc_ref_needs_temporary_p (gfc_ref *ref) types), not in characters. */ return subarray_p; - case REF_COMPONENT: case REF_INQUIRY: + /* Within an array reference, inquiry references of complex + variables generally need a temporary. */ + return subarray_p; + + case REF_COMPONENT: break; } diff --git a/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 new file mode 100644 index 0000000..b480dff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 @@ -0,0 +1,48 @@ +! { dg-do run } +! { dg-additional-options "-O2 -fdump-tree-optimized" } +! +! PR fortran/102891 - passing of inquiry ref of complex array to TRANSFER + +program main + implicit none + integer, parameter :: dp = 8 + + type complex_wrap1 + complex(dp) :: z(2) + end type complex_wrap1 + + type complex_wrap2 + complex(dp), dimension(:), allocatable :: z + end type complex_wrap2 + + type(complex_wrap1) :: x = complex_wrap1([ (1, 2), (3, 4) ]) + type(complex_wrap2) :: w + + w%z = x%z + + ! The following statements should get optimized away... + if (size (transfer ( x%z%re ,[1.0_dp])) /= 2) error stop 1 + if (size (transfer ((x%z%re),[1.0_dp])) /= 2) error stop 2 + if (size (transfer ([x%z%re],[1.0_dp])) /= 2) error stop 3 + if (size (transfer ( x%z%im ,[1.0_dp])) /= 2) error stop 4 + if (size (transfer ((x%z%im),[1.0_dp])) /= 2) error stop 5 + if (size (transfer ([x%z%im],[1.0_dp])) /= 2) error stop 6 + + ! ... while the following may not: + if (any (transfer ( x%z%re ,[1.0_dp]) /= x%z%re)) stop 7 + if (any (transfer ( x%z%im ,[1.0_dp]) /= x%z%im)) stop 8 + + if (size (transfer ( w%z%re ,[1.0_dp])) /= 2) stop 11 + if (size (transfer ((w%z%re),[1.0_dp])) /= 2) stop 12 + if (size (transfer ([w%z%re],[1.0_dp])) /= 2) stop 13 + if (size (transfer ( w%z%im ,[1.0_dp])) /= 2) stop 14 + if (size (transfer ((w%z%im),[1.0_dp])) /= 2) stop 15 + if (size (transfer ([w%z%im],[1.0_dp])) /= 2) stop 16 + + if (any (transfer ( w%z%re ,[1.0_dp]) /= x%z%re)) stop 17 + if (any (transfer ( w%z%im ,[1.0_dp]) /= x%z%im)) stop 18 + + deallocate (w%z) +end program main + +! { dg-final { scan-tree-dump-not "_gfortran_error_stop_numeric" "optimized" } } -- cgit v1.1 From 7e580225e57086e335a16f9258d0401a21e468ef Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 21 May 2025 00:24:51 +0000 Subject: Daily bump. --- gcc/ChangeLog | 25 +++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/cp/ChangeLog | 17 +++++++++++++++++ gcc/fortran/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 91 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c214df..c47e692 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2025-05-20 Martin Jambor + + Backported from master: + 2025-05-14 Martin Jambor + + 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. + +2025-05-20 Martin Jambor + + Backported from master: + 2025-05-16 Martin Jambor + Michal Jires + + * 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::print): Likewise. + * ipa-sra.cc (ipa_sra_summarize_function): Likewise. + * symtab.cc (symtab_node::dump_base): Likewise. + 2025-05-16 Maciej W. Rozycki Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4ea9877..2427fe6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250520 +20250521 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae663cd..e1c573f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2025-05-20 Nathaniel Shead + + Backported from master: + 2025-05-20 Nathaniel Shead + + PR c++/120013 + * module.cc (trees_in::install_entity): Handle re-registering + the inner TYPE_DECL of a partial specialisation. + +2025-05-20 Nathaniel Shead + + Backported from master: + 2025-05-20 Nathaniel Shead + + PR c++/120350 + * rtti.cc (get_tinfo_decl_direct): Mark TREE_ADDRESSABLE. + 2025-05-15 Patrick Palka Backported from master: diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3116650..5054e4c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2025-05-20 Harald Anlauf + + Backported from master: + 2025-05-10 Harald Anlauf + + PR fortran/102891 + * dependency.cc (gfc_ref_needs_temporary_p): Within an array + reference, inquiry references of complex variables generally + need a temporary. + 2025-05-19 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c8b0bad..ed5148a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,41 @@ +2025-05-20 Harald Anlauf + + Backported from master: + 2025-05-10 Harald Anlauf + + PR fortran/102891 + * gfortran.dg/transfer_array_subref.f90: New test. + +2025-05-20 Martin Jambor + + Backported from master: + 2025-05-14 Martin Jambor + + * gcc.dg/ipa/pr120044-1.c: New test. + * gcc.dg/ipa/pr120044-2.c: Likewise. + * gcc.dg/tree-ssa/pr114864.c: Likewise. + +2025-05-20 Nathaniel Shead + + Backported from master: + 2025-05-20 Nathaniel Shead + + PR c++/120013 + * 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. + +2025-05-20 Nathaniel Shead + + Backported from master: + 2025-05-20 Nathaniel Shead + + PR c++/120350 + * g++.dg/modules/tinfo-3_a.H: New test. + * g++.dg/modules/tinfo-3_b.C: New test. + 2025-05-17 Jerry DeLisle Backported from master: -- cgit v1.1 From 8c4b23611a73ac788e32d707c266bc37b0153146 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 22 May 2025 00:23:47 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2427fe6..7a70610 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250521 +20250522 -- cgit v1.1 From 6fb3dd1de63e48a0cc465973f9de24f680c3fde5 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Thu, 15 May 2025 21:07:07 +0200 Subject: Fortran: default-initialization and functions returning derived type [PR85750] 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) --- gcc/fortran/resolve.cc | 8 +- .../gfortran.dg/alloc_comp_auto_array_3.f90 | 4 +- gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03 | 3 +- gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03 | 5 +- .../gfortran.dg/allocate_with_source_14.f03 | 2 +- .../gfortran.dg/derived_constructor_comps_6.f90 | 2 +- gcc/testsuite/gfortran.dg/derived_result_5.f90 | 123 +++++++++++++++++++++ 7 files changed, 134 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/derived_result_5.f90 (limited to 'gcc') diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 1db886e..1fb16ca 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -17970,16 +17970,16 @@ skip_interfaces: || (a->dummy && !a->pointer && a->intent == INTENT_OUT && sym->ns->proc_name->attr.if_source != IFSRC_IFBODY)) apply_default_init (sym); + else if (a->function && !a->pointer && !a->allocatable && !a->use_assoc + && sym->result) + /* Default initialization for function results. */ + apply_default_init (sym->result); else if (a->function && sym->result && a->access != ACCESS_PRIVATE && (sym->ts.u.derived->attr.alloc_comp || sym->ts.u.derived->attr.pointer_comp)) /* Mark the result symbol to be referenced, when it has allocatable components. */ sym->result->attr.referenced = 1; - else if (a->function && !a->pointer && !a->allocatable && !a->use_assoc - && sym->result) - /* Default initialization for function results. */ - apply_default_init (sym->result); } if (sym->ts.type == BT_CLASS && sym->ns == gfc_current_ns diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90 index 2af089e..d0751f3 100644 --- a/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90 +++ b/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90 @@ -25,6 +25,6 @@ contains allocate (array(1)%bigarr) end function end -! { dg-final { scan-tree-dump-times "builtin_malloc" 3 "original" } } +! { dg-final { scan-tree-dump-times "builtin_malloc" 4 "original" } } ! { dg-final { scan-tree-dump-times "builtin_free" 3 "original" } } -! { dg-final { scan-tree-dump-times "while \\(1\\)" 4 "original" } } +! { dg-final { scan-tree-dump-times "while \\(1\\)" 5 "original" } } diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03 index 0753e33..8202d78 100644 --- a/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03 +++ b/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03 @@ -45,11 +45,10 @@ contains type(c), value :: d end subroutine - type(c) function c_init() ! { dg-warning "not set" } + type(c) function c_init() end function subroutine sub(d) type(u), value :: d end subroutine end program test_pr58586 - diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03 index 4a55d73..9ff38e3 100644 --- a/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03 +++ b/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03 @@ -51,14 +51,14 @@ contains type(t), value :: d end subroutine - type(c) function c_init() ! { dg-warning "not set" } + type(c) function c_init() end function class(c) function c_init2() ! { dg-warning "not set" } allocatable :: c_init2 end function - type(c) function d_init(this) ! { dg-warning "not set" } + type(c) function d_init(this) class(d) :: this end function @@ -102,4 +102,3 @@ program test_pr58586 call add_c(oe%init()) deallocate(oe) end program - diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 b/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 index fd2db74..36c1245 100644 --- a/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 @@ -210,5 +210,5 @@ program main call v%free() deallocate(av) end program -! { dg-final { scan-tree-dump-times "__builtin_malloc" 22 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_malloc" 23 "original" } } ! { dg-final { scan-tree-dump-times "__builtin_free" 29 "original" } } diff --git a/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90 b/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90 index bdfa47b..406e031 100644 --- a/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90 +++ b/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90 @@ -129,5 +129,5 @@ contains prt_spec = name end function new_prt_spec3 end program main -! { dg-final { scan-tree-dump-times "__builtin_malloc" 15 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_malloc" 16 "original" } } ! { dg-final { scan-tree-dump-times "__builtin_free" 33 "original" } } diff --git a/gcc/testsuite/gfortran.dg/derived_result_5.f90 b/gcc/testsuite/gfortran.dg/derived_result_5.f90 new file mode 100644 index 0000000..1ba4d19 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/derived_result_5.f90 @@ -0,0 +1,123 @@ +! { dg-do run } +! { dg-additional-options "-O2 -Wreturn-type" } +! +! PR fortran/85750 - default-initialization and functions returning derived type + +module bar + implicit none + type ilist + integer :: count = 42 + integer, pointer :: ptr(:) => null() + end type ilist + + type jlist + real, allocatable :: a(:) + integer :: count = 23 + end type jlist + +contains + + function make_list(i) + integer, intent(in) :: i + type(ilist), dimension(2) :: make_list + make_list(i)%count = i + end function make_list + + function make_list_res(i) result(list) + integer, intent(in) :: i + type(ilist), dimension(2) :: list + list(i)%count = i + end function make_list_res + + function make_jlist(i) + integer, intent(in) :: i + type(jlist), dimension(2) :: make_jlist + make_jlist(i)%count = i + end function make_jlist + + function make_jlist_res(i) result(list) + integer, intent(in) :: i + type(jlist), dimension(2) :: list + list(i)%count = i + end function make_jlist_res + + function empty_ilist() + type(ilist), dimension(2) :: empty_ilist + end function + + function empty_jlist() + type(jlist), dimension(2) :: empty_jlist + end function + + function empty_ilist_res() result (res) + type(ilist), dimension(2) :: res + end function + + function empty_jlist_res() result (res) + type(jlist), dimension(2) :: res + end function + +end module bar + +program foo + use bar + implicit none + type(ilist) :: mylist(2) = ilist(count=-2) + type(jlist), allocatable :: yourlist(:) + + mylist = ilist(count=-1) + if (any (mylist%count /= [-1,-1])) stop 1 + mylist = empty_ilist() + if (any (mylist%count /= [42,42])) stop 2 + mylist = ilist(count=-1) + mylist = empty_ilist_res() + if (any (mylist%count /= [42,42])) stop 3 + + allocate(yourlist(1:2)) + if (any (yourlist%count /= [23,23])) stop 4 + yourlist = jlist(count=-1) + if (any (yourlist%count /= [-1,-1])) stop 5 + yourlist = empty_jlist() + if (any (yourlist%count /= [23,23])) stop 6 + yourlist = jlist(count=-1) + yourlist = empty_jlist_res() + if (any (yourlist%count /= [23,23])) stop 7 + + mylist = make_list(1) + if (any (mylist%count /= [1,42])) stop 11 + mylist = make_list(2) + if (any (mylist%count /= [42,2])) stop 12 + mylist = (make_list(1)) + if (any (mylist%count /= [1,42])) stop 13 + mylist = [make_list(2)] + if (any (mylist%count /= [42,2])) stop 14 + + mylist = make_list_res(1) + if (any (mylist%count /= [1,42])) stop 21 + mylist = make_list_res(2) + if (any (mylist%count /= [42,2])) stop 22 + mylist = (make_list_res(1)) + if (any (mylist%count /= [1,42])) stop 23 + mylist = [make_list_res(2)] + if (any (mylist%count /= [42,2])) stop 24 + + yourlist = make_jlist(1) + if (any (yourlist%count /= [1,23])) stop 31 + yourlist = make_jlist(2) + if (any (yourlist%count /= [23,2])) stop 32 + yourlist = (make_jlist(1)) + if (any (yourlist%count /= [1,23])) stop 33 + yourlist = [make_jlist(2)] + if (any (yourlist%count /= [23,2])) stop 34 + + yourlist = make_jlist_res(1) + if (any (yourlist%count /= [1,23])) stop 41 + yourlist = make_jlist_res(2) + if (any (yourlist%count /= [23,2])) stop 42 + yourlist = (make_jlist_res(1)) + if (any (yourlist%count /= [1,23])) stop 43 + yourlist = [make_jlist_res(2)] + if (any (yourlist%count /= [23,2])) stop 44 + + deallocate (yourlist) +end program foo -- cgit v1.1 From fd2a11eb2deb4be498a9d000c0a41446c14672df Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 23 May 2025 00:24:13 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 13 +++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7a70610..809477a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250522 +20250523 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5054e4c..b95f7ee 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2025-05-22 Harald Anlauf + + Backported from master: + 2025-05-15 Harald Anlauf + + PR fortran/85750 + * resolve.cc (resolve_symbol): Reorder conditions when to apply + default-initializers. + 2025-05-20 Harald Anlauf Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ed5148a..bc7903b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2025-05-22 Harald Anlauf + + Backported from master: + 2025-05-15 Harald Anlauf + + PR fortran/85750 + * 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. + 2025-05-20 Harald Anlauf Backported from master: -- cgit v1.1 From 2486d94bc45a9815395a36cc6dc1e9e3219a74b7 Mon Sep 17 00:00:00 2001 From: Nathaniel Shead Date: Sat, 24 May 2025 00:51:49 +1000 Subject: c++/modules: Fix stream-in of member using-decls [PR120414] 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 Reviewed-by: Jason Merrill (cherry picked from commit 43dddeef7a870ce4db7407f73660504b67a0a919) --- gcc/cp/module.cc | 3 ++- gcc/testsuite/g++.dg/modules/using-31_a.C | 18 ++++++++++++++++++ gcc/testsuite/g++.dg/modules/using-31_b.C | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/modules/using-31_a.C create mode 100644 gcc/testsuite/g++.dg/modules/using-31_b.C (limited to 'gcc') diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index f8fa7f1..e66f725 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -10522,7 +10522,8 @@ trees_in::tree_node (bool is_use) res = lookup_field_ident (ctx, u ()); if (!res - || TREE_CODE (res) != FIELD_DECL + || (TREE_CODE (res) != FIELD_DECL + && TREE_CODE (res) != USING_DECL) || DECL_CONTEXT (res) != ctx) res = NULL_TREE; } diff --git a/gcc/testsuite/g++.dg/modules/using-31_a.C b/gcc/testsuite/g++.dg/modules/using-31_a.C new file mode 100644 index 0000000..75bd872 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/using-31_a.C @@ -0,0 +1,18 @@ +// PR c++/120414 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi m } + +export module m; + +template +struct Base { + static constexpr int base_static_mbr_n = n; +}; + +template +struct Derived : Base { + using Base::base_static_mbr_n; + static constexpr int go(int x = base_static_mbr_n) { return x; } +}; + +template struct Derived<1>; diff --git a/gcc/testsuite/g++.dg/modules/using-31_b.C b/gcc/testsuite/g++.dg/modules/using-31_b.C new file mode 100644 index 0000000..e913a77 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/using-31_b.C @@ -0,0 +1,5 @@ +// PR c++/120414 +// { dg-additional-options "-fmodules" } + +module m; +static_assert(Derived<1>::go() == 1); -- cgit v1.1 From a8f62a9b32668ea77da721cdc8b9403e507637af Mon Sep 17 00:00:00 2001 From: Nathaniel Shead Date: Thu, 22 May 2025 22:16:22 +1000 Subject: c++/modules: Fix merge of TLS init functions [PR120363] 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 Reviewed-by: Jason Merrill (cherry picked from commit 66e9a4f3083356b064cc64651edad466a56f762b) --- gcc/cp/decl2.cc | 3 ++- gcc/testsuite/g++.dg/modules/pr113292_a.H | 34 ------------------------- gcc/testsuite/g++.dg/modules/pr113292_b.C | 13 ---------- gcc/testsuite/g++.dg/modules/pr113292_c.C | 13 ---------- gcc/testsuite/g++.dg/modules/tls-1_a.H | 34 +++++++++++++++++++++++++ gcc/testsuite/g++.dg/modules/tls-1_b.C | 13 ++++++++++ gcc/testsuite/g++.dg/modules/tls-1_c.C | 13 ++++++++++ gcc/testsuite/g++.dg/modules/tls-2_a.C | 12 +++++++++ gcc/testsuite/g++.dg/modules/tls-2_b.C | 5 ++++ gcc/testsuite/g++.dg/modules/tls-2_c.C | 11 ++++++++ gcc/testsuite/g++.dg/modules/tls-3.h | 42 +++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/modules/tls-3_a.H | 4 +++ gcc/testsuite/g++.dg/modules/tls-3_b.C | 4 +++ 13 files changed, 140 insertions(+), 61 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/modules/pr113292_a.H delete mode 100644 gcc/testsuite/g++.dg/modules/pr113292_b.C delete mode 100644 gcc/testsuite/g++.dg/modules/pr113292_c.C create mode 100644 gcc/testsuite/g++.dg/modules/tls-1_a.H create mode 100644 gcc/testsuite/g++.dg/modules/tls-1_b.C create mode 100644 gcc/testsuite/g++.dg/modules/tls-1_c.C create mode 100644 gcc/testsuite/g++.dg/modules/tls-2_a.C create mode 100644 gcc/testsuite/g++.dg/modules/tls-2_b.C create mode 100644 gcc/testsuite/g++.dg/modules/tls-2_c.C create mode 100644 gcc/testsuite/g++.dg/modules/tls-3.h create mode 100644 gcc/testsuite/g++.dg/modules/tls-3_a.H create mode 100644 gcc/testsuite/g++.dg/modules/tls-3_b.C (limited to 'gcc') diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index a137e88..bceaf78 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -4026,6 +4026,7 @@ get_tls_init_fn (tree var) SET_DECL_LANGUAGE (fn, lang_c); TREE_PUBLIC (fn) = TREE_PUBLIC (var); DECL_ARTIFICIAL (fn) = true; + DECL_CONTEXT (fn) = FROB_CONTEXT (global_namespace); DECL_COMDAT (fn) = DECL_COMDAT (var); DECL_EXTERNAL (fn) = DECL_EXTERNAL (var); if (DECL_ONE_ONLY (var)) @@ -4085,7 +4086,7 @@ get_tls_wrapper_fn (tree var) TREE_PUBLIC (fn) = TREE_PUBLIC (var); DECL_ARTIFICIAL (fn) = true; DECL_IGNORED_P (fn) = 1; - DECL_CONTEXT (fn) = DECL_CONTEXT (var); + DECL_CONTEXT (fn) = FROB_CONTEXT (global_namespace); /* The wrapper is inline and emitted everywhere var is used. */ DECL_DECLARED_INLINE_P (fn) = true; if (TREE_PUBLIC (var)) diff --git a/gcc/testsuite/g++.dg/modules/pr113292_a.H b/gcc/testsuite/g++.dg/modules/pr113292_a.H deleted file mode 100644 index 90ece2e..0000000 --- a/gcc/testsuite/g++.dg/modules/pr113292_a.H +++ /dev/null @@ -1,34 +0,0 @@ -// PR c++/113292 -// { dg-additional-options "-fmodule-header" } -// { dg-module-cmi {} } - -struct test { - static const test& get_instance() { - return instance; - } - static thread_local test instance; -}; - - -template -struct test_template { - static const test_template& get_instance() { - return instance; - } - static thread_local test_template instance; - - template - static const test_template& get_template_instance() { - return template_instance; - } - - template - static thread_local test_template template_instance; -}; - -template -thread_local test_template test_template::instance; - -template -template -thread_local test_template test_template::template_instance; diff --git a/gcc/testsuite/g++.dg/modules/pr113292_b.C b/gcc/testsuite/g++.dg/modules/pr113292_b.C deleted file mode 100644 index fc582a5..0000000 --- a/gcc/testsuite/g++.dg/modules/pr113292_b.C +++ /dev/null @@ -1,13 +0,0 @@ -// PR c++/113292 -// { dg-additional-options "-fmodules-ts" } - -import "pr113292_a.H"; - -// provide a definition of 'instance' so things link -thread_local test test::instance; - -void instantiate() { - auto& instance = test::get_instance(); - auto& t_instance = test_template::get_instance(); - auto& tt_instance = test_template::get_template_instance(); -}; diff --git a/gcc/testsuite/g++.dg/modules/pr113292_c.C b/gcc/testsuite/g++.dg/modules/pr113292_c.C deleted file mode 100644 index b5acf79..0000000 --- a/gcc/testsuite/g++.dg/modules/pr113292_c.C +++ /dev/null @@ -1,13 +0,0 @@ -// PR c++/113292 -// { dg-module-do link } -// { dg-require-effective-target tls_runtime } -// { dg-add-options tls } -// { dg-additional-options "-fmodules-ts" } - -import "pr113292_a.H"; - -int main() { - auto& instance = test::get_instance(); - auto& t_instance = test_template::get_instance(); - auto& tt_instance = test_template::get_template_instance(); -} diff --git a/gcc/testsuite/g++.dg/modules/tls-1_a.H b/gcc/testsuite/g++.dg/modules/tls-1_a.H new file mode 100644 index 0000000..90ece2e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-1_a.H @@ -0,0 +1,34 @@ +// PR c++/113292 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +struct test { + static const test& get_instance() { + return instance; + } + static thread_local test instance; +}; + + +template +struct test_template { + static const test_template& get_instance() { + return instance; + } + static thread_local test_template instance; + + template + static const test_template& get_template_instance() { + return template_instance; + } + + template + static thread_local test_template template_instance; +}; + +template +thread_local test_template test_template::instance; + +template +template +thread_local test_template test_template::template_instance; diff --git a/gcc/testsuite/g++.dg/modules/tls-1_b.C b/gcc/testsuite/g++.dg/modules/tls-1_b.C new file mode 100644 index 0000000..941bff2 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-1_b.C @@ -0,0 +1,13 @@ +// PR c++/113292 +// { dg-additional-options "-fmodules-ts" } + +import "tls-1_a.H"; + +// provide a definition of 'instance' so things link +thread_local test test::instance; + +void instantiate() { + auto& instance = test::get_instance(); + auto& t_instance = test_template::get_instance(); + auto& tt_instance = test_template::get_template_instance(); +}; diff --git a/gcc/testsuite/g++.dg/modules/tls-1_c.C b/gcc/testsuite/g++.dg/modules/tls-1_c.C new file mode 100644 index 0000000..4568413 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-1_c.C @@ -0,0 +1,13 @@ +// PR c++/113292 +// { dg-module-do link } +// { dg-require-effective-target tls_runtime } +// { dg-add-options tls } +// { dg-additional-options "-fmodules-ts" } + +import "tls-1_a.H"; + +int main() { + auto& instance = test::get_instance(); + auto& t_instance = test_template::get_instance(); + auto& tt_instance = test_template::get_template_instance(); +} diff --git a/gcc/testsuite/g++.dg/modules/tls-2_a.C b/gcc/testsuite/g++.dg/modules/tls-2_a.C new file mode 100644 index 0000000..2efae6c --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-2_a.C @@ -0,0 +1,12 @@ +// PR c++/120363 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi M } + +export module M; + +export struct test { + static inline const int& get_instance() { + return instance; + } + static thread_local int instance; +}; diff --git a/gcc/testsuite/g++.dg/modules/tls-2_b.C b/gcc/testsuite/g++.dg/modules/tls-2_b.C new file mode 100644 index 0000000..af3e709 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-2_b.C @@ -0,0 +1,5 @@ +// PR c++/120363 +// { dg-additional-options "-fmodules" } + +module M; +thread_local int test::instance; diff --git a/gcc/testsuite/g++.dg/modules/tls-2_c.C b/gcc/testsuite/g++.dg/modules/tls-2_c.C new file mode 100644 index 0000000..4489516 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-2_c.C @@ -0,0 +1,11 @@ +// PR c++/120363 +// { dg-module-do link } +// { dg-require-effective-target tls_runtime } +// { dg-add-options tls } +// { dg-additional-options "-fmodules" } + +import M; + +int main() { + auto& instance = test::get_instance(); +} diff --git a/gcc/testsuite/g++.dg/modules/tls-3.h b/gcc/testsuite/g++.dg/modules/tls-3.h new file mode 100644 index 0000000..6f4a236 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-3.h @@ -0,0 +1,42 @@ +inline thread_local int tla; +inline int& get_tla() { + return tla; +} + +static thread_local int tlb; +static int& get_tlb() { + return tlb; +} + +struct test { + static const test& get_instance() { + return instance; + } + static thread_local test instance; +}; + +template +struct test_template { + static const test_template& get_instance() { + return instance; + } + static thread_local test_template instance; + + template + static const test_template& get_template_instance() { + return template_instance; + } + + template + static thread_local test_template template_instance; +}; + +template +thread_local test_template test_template::instance; + +template +template +thread_local test_template test_template::template_instance; + +template struct test_template; +template const test_template& test_template::get_template_instance(); diff --git a/gcc/testsuite/g++.dg/modules/tls-3_a.H b/gcc/testsuite/g++.dg/modules/tls-3_a.H new file mode 100644 index 0000000..beef907 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-3_a.H @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +#include "tls-3.h" diff --git a/gcc/testsuite/g++.dg/modules/tls-3_b.C b/gcc/testsuite/g++.dg/modules/tls-3_b.C new file mode 100644 index 0000000..ab77b1e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tls-3_b.C @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodules -fno-module-lazy" } + +#include "tls-3.h" +import "tls-3_a.H"; -- cgit v1.1 From 18f937f013b79f4280c66b05fa793a0780955081 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 24 May 2025 00:23:11 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/cp/ChangeLog | 18 ++++++++++++++++++ gcc/testsuite/ChangeLog | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 809477a..cc6fc26 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250523 +20250524 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e1c573f..59bc179 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,21 @@ +2025-05-23 Nathaniel Shead + + Backported from master: + 2025-05-23 Nathaniel Shead + + PR c++/120363 + * decl2.cc (get_tls_init_fn): Set context as global_namespace. + (get_tls_wrapper_fn): Likewise. + +2025-05-23 Nathaniel Shead + + Backported from master: + 2025-05-23 Nathaniel Shead + + PR c++/120414 + * module.cc (trees_in::tree_node): Allow reading a USING_DECL + when streaming tt_data_member. + 2025-05-20 Nathaniel Shead Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bc7903b..750a1b9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,31 @@ +2025-05-23 Nathaniel Shead + + Backported from master: + 2025-05-23 Nathaniel Shead + + PR c++/120363 + * 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. + +2025-05-23 Nathaniel Shead + + Backported from master: + 2025-05-23 Nathaniel Shead + + PR c++/120414 + * g++.dg/modules/using-31_a.C: New test. + * g++.dg/modules/using-31_b.C: New test. + 2025-05-22 Harald Anlauf Backported from master: -- cgit v1.1 From 65c2baf9f12e50063566a5736a8f4f5b44a29437 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 25 May 2025 00:24:49 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cc6fc26..87d53b3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250524 +20250525 -- cgit v1.1 From 4ac1fb51c7b780159837e951bd893954d7d8803a Mon Sep 17 00:00:00 2001 From: "Michael J. Eager" Date: Sun, 25 May 2025 09:25:27 -0700 Subject: MicroBlaze does not support speculative execution (CVE-2017-5753) gcc/ PR target/86772 Tracking CVE-2017-5753 * config/microblaze/microblaze.cc (TARGET_HAVE_SPECULATION_SAFE_VALUE): Define to speculation_save_value_not_needed --- gcc/config/microblaze/microblaze.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc') diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc index fc223fb..4b7f0a1 100644 --- a/gcc/config/microblaze/microblaze.cc +++ b/gcc/config/microblaze/microblaze.cc @@ -239,6 +239,10 @@ section *sdata2_section; #define TARGET_HAVE_TLS true #endif +/* MicroBlaze does not do speculative execution. */ +#undef TARGET_HAVE_SPECULATION_SAFE_VALUE +#define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed + /* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */ static bool microblaze_const_double_ok (rtx op, machine_mode mode) -- cgit v1.1 From afa69f83c6f95ff4e3a2f84eb8aed46cd65d3cb6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 26 May 2025 00:23:39 +0000 Subject: Daily bump. --- gcc/ChangeLog | 7 +++++++ gcc/DATESTAMP | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c47e692..d7e8702 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2025-05-25 Michael J. Eager + + 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-20 Martin Jambor Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 87d53b3..dbf258b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250525 +20250526 -- cgit v1.1 From 9c8e20a8425f123abd54261d03af5a956d4d01c6 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 26 May 2025 17:58:07 +0200 Subject: OpenMP/C++: Avoid ICE for BIND_EXPR with empty BIND_EXPR_BLOCK [PR120413] 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) --- gcc/cp/semantics.cc | 8 ++++---- gcc/testsuite/g++.dg/gomp/target-4.C | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/gomp/target-4.C (limited to 'gcc') diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index a10ef34..804c22d 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -10543,10 +10543,10 @@ finish_omp_target_clauses_r (tree *tp, int *walk_subtrees, void *ptr) if (TREE_CODE (t) == BIND_EXPR) { - tree block = BIND_EXPR_BLOCK (t); - for (tree var = BLOCK_VARS (block); var; var = DECL_CHAIN (var)) - if (!data->local_decls.contains (var)) - data->local_decls.add (var); + if (tree block = BIND_EXPR_BLOCK (t)) + for (tree var = BLOCK_VARS (block); var; var = DECL_CHAIN (var)) + if (!data->local_decls.contains (var)) + data->local_decls.add (var); return NULL_TREE; } diff --git a/gcc/testsuite/g++.dg/gomp/target-4.C b/gcc/testsuite/g++.dg/gomp/target-4.C new file mode 100644 index 0000000..80fc9df --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/target-4.C @@ -0,0 +1,22 @@ +// { dg-do compile { target c++11 } } +// PR c++/120413 + +struct S +{ + S() {} + ~S() {} +}; + +struct array +{ + S _arr[1]; +}; + +int main() +{ +#pragma omp target + { + array arr{}; + } + return 0; +} -- cgit v1.1 From d390c7e5bd03490485a0b036add096e2e8b811b9 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 26 May 2025 19:50:40 +0200 Subject: c-c++-common/gomp/{attrs-,}metadirective-3.c: Fix expected result [PR118694] 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) --- gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c | 7 ++++--- gcc/testsuite/c-c++-common/gomp/metadirective-3.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c index 31dd054..803bf0a 100644 --- a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c +++ b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c @@ -9,7 +9,7 @@ f (int x[], int y[], int z[]) { int i; - [[omp::sequence (directive (target map(to: x, y) map(from: z)), + [[omp::sequence (directive (target map(to: x, y) map(from: z)), /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */ directive (metadirective when (device={arch("nvptx")}: teams loop) default (parallel loop)))]] @@ -20,5 +20,6 @@ f (int x[], int y[], int z[]) /* If offload device "nvptx" isn't supported, the front end can eliminate that alternative and not produce a metadirective at all. Otherwise this won't be resolved until late. */ -/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */ -/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */ +/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */ +/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */ +/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-3.c b/gcc/testsuite/c-c++-common/gomp/metadirective-3.c index 0ac0d1d..b6c1601 100644 --- a/gcc/testsuite/c-c++-common/gomp/metadirective-3.c +++ b/gcc/testsuite/c-c++-common/gomp/metadirective-3.c @@ -8,7 +8,7 @@ f (int x[], int y[], int z[]) { int i; - #pragma omp target map(to: x, y) map(from: z) + #pragma omp target map(to: x, y) map(from: z) /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */ #pragma omp metadirective \ when (device={arch("nvptx")}: teams loop) \ default (parallel loop) @@ -19,5 +19,6 @@ f (int x[], int y[], int z[]) /* If offload device "nvptx" isn't supported, the front end can eliminate that alternative and not produce a metadirective at all. Otherwise this won't be resolved until late. */ -/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */ -/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */ +/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */ +/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */ +/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */ -- cgit v1.1