aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog32
-rw-r--r--gcc/ChangeLog.omp9
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/DATESTAMP.omp2
-rw-r--r--gcc/cgraph.cc2
-rw-r--r--gcc/cgraph.h2
-rw-r--r--gcc/cgraphclones.cc4
-rw-r--r--gcc/config/microblaze/microblaze.cc4
-rw-r--r--gcc/cp/ChangeLog35
-rw-r--r--gcc/cp/decl2.cc3
-rw-r--r--gcc/cp/module.cc3
-rw-r--r--gcc/cp/semantics.cc8
-rw-r--r--gcc/fortran/ChangeLog19
-rw-r--r--gcc/fortran/dependency.cc6
-rw-r--r--gcc/fortran/resolve.cc8
-rw-r--r--gcc/ipa-cp.cc2
-rw-r--r--gcc/ipa-sra.cc2
-rw-r--r--gcc/symtab.cc4
-rw-r--r--gcc/testsuite/ChangeLog79
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-3.c7
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-4.C22
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-1_a.H (renamed from gcc/testsuite/g++.dg/modules/pr113292_a.H)0
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-1_b.C (renamed from gcc/testsuite/g++.dg/modules/pr113292_b.C)2
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-1_c.C (renamed from gcc/testsuite/g++.dg/modules/pr113292_c.C)2
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-2_a.C12
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-2_b.C5
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-2_c.C11
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-3.h42
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-3_a.H4
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-3_b.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/using-31_a.C18
-rw-r--r--gcc/testsuite/g++.dg/modules/using-31_b.C5
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120044-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120044-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr114864.c15
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_class_3.f033
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_class_4.f035
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_source_14.f032
-rw-r--r--gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/derived_result_5.f90123
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_array_subref.f9048
-rw-r--r--gcc/tree-nrv.cc19
-rw-r--r--gcc/tree-sra.cc4
45 files changed, 580 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4c214df..d7e8702 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,35 @@
+2025-05-25 Michael J. Eager <eager@eagercon.com>
+
+ 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 <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-14 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.
+
+2025-05-20 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-16 Martin Jambor <mjambor@suse.cz>
+ Michal Jires <mjires@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.
+
2025-05-16 Maciej W. Rozycki <macro@orcam.me.uk>
Backported from master:
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index eaeb97f..b832b2a 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,12 @@
+2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR middle-end/119835
+ * tree-nrv.cc (pass_nrv::execute): Defuse 'RESULT_DECL' check.
+
2025-05-22 Thomas Schwinge <tschwinge@baylibre.com>
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 4ea9877..dbf258b 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250520
+20250526
diff --git a/gcc/DATESTAMP.omp b/gcc/DATESTAMP.omp
index 7a70610..ac27433 100644
--- a/gcc/DATESTAMP.omp
+++ b/gcc/DATESTAMP.omp
@@ -1 +1 @@
-20250522
+20250530
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/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)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ae663cd..59bc179 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,38 @@
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120363
+ * decl2.cc (get_tls_init_fn): Set context as global_namespace.
+ (get_tls_wrapper_fn): Likewise.
+
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120414
+ * module.cc (trees_in::tree_node): Allow reading a USING_DECL
+ when streaming tt_data_member.
+
+2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ 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 <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120350
+ * rtti.cc (get_tinfo_decl_direct): Mark TREE_ADDRESSABLE.
+
2025-05-15 Patrick Palka <ppalka@redhat.com>
Backported from master:
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index d019d4d..4195c08 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -4031,6 +4031,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))
@@ -4090,7 +4091,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/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/cp/semantics.cc b/gcc/cp/semantics.cc
index 32d4511..f1523ed 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -11819,10 +11819,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/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 3116650..b95f7ee 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,22 @@
+2025-05-22 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-15 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/85750
+ * resolve.cc (resolve_symbol): Reorder conditions when to apply
+ default-initializers.
+
+2025-05-20 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-10 Harald Anlauf <anlauf@gmx.de>
+
+ 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 <tburnus@baylibre.com>
Backported from master:
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/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 9d31062..5b0fe03 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/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<valtype>::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<tree>;
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");
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c8b0bad..750a1b9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,82 @@
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ 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 <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ 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 <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-15 Harald Anlauf <anlauf@gmx.de>
+
+ 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 <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-10 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/102891
+ * gfortran.dg/transfer_array_subref.f90: New test.
+
+2025-05-20 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-14 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.
+
+2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ 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 <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ 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 <jvdelisle@gcc.gnu.org>
Backported from master:
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 } } } } */
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;
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr113292_a.H b/gcc/testsuite/g++.dg/modules/tls-1_a.H
index 90ece2e..90ece2e 100644
--- a/gcc/testsuite/g++.dg/modules/pr113292_a.H
+++ b/gcc/testsuite/g++.dg/modules/tls-1_a.H
diff --git a/gcc/testsuite/g++.dg/modules/pr113292_b.C b/gcc/testsuite/g++.dg/modules/tls-1_b.C
index fc582a5..941bff2 100644
--- a/gcc/testsuite/g++.dg/modules/pr113292_b.C
+++ b/gcc/testsuite/g++.dg/modules/tls-1_b.C
@@ -1,7 +1,7 @@
// PR c++/113292
// { dg-additional-options "-fmodules-ts" }
-import "pr113292_a.H";
+import "tls-1_a.H";
// provide a definition of 'instance' so things link
thread_local test test::instance;
diff --git a/gcc/testsuite/g++.dg/modules/pr113292_c.C b/gcc/testsuite/g++.dg/modules/tls-1_c.C
index b5acf79..4568413 100644
--- a/gcc/testsuite/g++.dg/modules/pr113292_c.C
+++ b/gcc/testsuite/g++.dg/modules/tls-1_c.C
@@ -4,7 +4,7 @@
// { dg-add-options tls }
// { dg-additional-options "-fmodules-ts" }
-import "pr113292_a.H";
+import "tls-1_a.H";
int main() {
auto& instance = test::get_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 <typename T>
+struct test_template {
+ static const test_template& get_instance() {
+ return instance;
+ }
+ static thread_local test_template instance;
+
+ template <typename U>
+ static const test_template& get_template_instance() {
+ return template_instance<U>;
+ }
+
+ template <typename U>
+ static thread_local test_template template_instance;
+};
+
+template <typename T>
+thread_local test_template<T> test_template<T>::instance;
+
+template <typename T>
+template <typename U>
+thread_local test_template<T> test_template<T>::template_instance;
+
+template struct test_template<int>;
+template const test_template<int>& test_template<int>::get_template_instance<int>();
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";
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 <int n>
+struct Base {
+ static constexpr int base_static_mbr_n = n;
+};
+
+template <int n>
+struct Derived : Base<n> {
+ using Base<n>::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);
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/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
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" } }
diff --git a/gcc/tree-nrv.cc b/gcc/tree-nrv.cc
index 180ce39..3be97af 100644
--- a/gcc/tree-nrv.cc
+++ b/gcc/tree-nrv.cc
@@ -167,16 +167,21 @@ pass_nrv::execute (function *fun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
- tree ret_val;
if (greturn *return_stmt = dyn_cast <greturn *> (stmt))
{
- /* In a function with an aggregate return value, the
- gimplifier has changed all non-empty RETURN_EXPRs to
- return the RESULT_DECL. */
- ret_val = gimple_return_retval (return_stmt);
- if (ret_val)
- gcc_assert (ret_val == result);
+ /* We cannot perform NRV optimizations in a function with an
+ aggregate return value if there is a return that does not
+ return RESULT_DECL. We used to assert this scenario doesn't
+ happen: the gimplifier has changed all non-empty RETURN_EXPRs
+ to return the RESULT_DECL. However, per PR119835 we may run
+ into this scenario for offloading compilation, and therefore
+ gracefully bail out. */
+ if (tree ret_val = gimple_return_retval (return_stmt))
+ {
+ if (ret_val != result)
+ return 0;
+ }
}
else if (gimple_has_lhs (stmt)
&& gimple_get_lhs (stmt) == result)
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,