]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 months agoChangeLog.omp bump
Tobias Burnus [Fri, 6 Jun 2025 14:58:25 +0000 (16:58 +0200)] 
ChangeLog.omp bump

2 months agoOpenMP: Add omp_get_initial_device/omp_get_num_devices builtins
Tobias Burnus [Fri, 6 Jun 2025 14:22:06 +0000 (16:22 +0200)] 
OpenMP: Add omp_get_initial_device/omp_get_num_devices builtins

By adding omp_get_initial_device and omp_get_num_devices builtins for
C, C++, and Fortran, the following can be achieved:
* By making them pure, multiple calls can be avoiding in some cases.
* Some comparisons can be optimized at compile time.

omp_get_initial_device will be converted to omp_get_num_devices for
consistency; note that OpenMP 6 also permits omp_initial_device (== -1)
as value.

If GCC has not been configure for offloading, either intrinsic will
leads to 0 - and on the offload side, -1 (= omp_initial_device) is
returned for omp_initial_device.

gcc/fortran/ChangeLog:

* f95-lang.cc (ATTR_PURE_NOTHROW_LIST): Define.
* trans-expr.cc (get_builtin_fn): Handle omp_get_num_devices
and omp_get_intrinsic_device.
* gfortran.h (gfc_option_t): Add disable_omp_... for them.
* options.cc (gfc_handle_option): Handle them with
-fno-builtin-.

gcc/ChangeLog:

* gimple-fold.cc (gimple_fold_builtin_omp_get_initial_device,
gimple_fold_builtin_omp_get_num_devices): New.
(gimple_fold_builtin): Call them.
* omp-builtins.def (BUILT_IN_OMP_GET_INITIAL_DEVICE): Add
(BUILT_IN_OMP_GET_NUM_DEVICES): Make uservisible + pure.

libgomp/ChangeLog:

* libgomp.texi (omp_get_num_devices, omp_get_intrinsic_device):
Document builtin handling.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/omp_get_num_devices_initial_device-2.c: New test.
* c-c++-common/gomp/omp_get_num_devices_initial_device.c: New test.
* gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90: New test.
* gfortran.dg/gomp/omp_get_num_devices_initial_device.f90: New test.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
(cherry picked from commit 387209938d2c476a67966c6ddbdbf817626f24a2)

2 months agobuiltins.def: Enable OpenMP/OpenACC builtins also with -fno-nonansi-builtins
Tobias Burnus [Fri, 6 Jun 2025 13:57:50 +0000 (15:57 +0200)] 
builtins.def: Enable OpenMP/OpenACC builtins also with -fno-nonansi-builtins

The flags -std=c.. and -std=c++.. imply -fno-nonansi-builtins, which disabled
the OpenMP/OpenACC intrinsics - but -fopenmp/-fopenacc builtin use should be
rather othogonal to the user's choice between -std=c... and -std=gnuc...

gcc/ChangeLog:

* builtins.def (DEF_GOACC_BUILTIN_COMPILER, DEF_GOMP_BUILTIN_COMPILER):
Set NONANSI_P = false to enable those also with -fno-nonansi-builtins.

(cherry picked from commit 214b5d66c54613463a96aa2c7202bc32f628dad6)

2 months agolibgomp.c/target-map-zero-sized-3.c: Fix code for non-USM offload [PR120530]
Tobias Burnus [Fri, 6 Jun 2025 13:15:03 +0000 (15:15 +0200)] 
libgomp.c/target-map-zero-sized-3.c: Fix code for non-USM offload [PR120530]

A mapping clause was missing, causing the code to fail with offloading
when a host pointer was not device accessible.

libgomp/ChangeLog:

PR target/120530
* testsuite/libgomp.c/target-map-zero-sized-3.c (main): Add missing
map clause; remove unused variable.

(cherry picked from commit 16c742e1079e838b920a1b215af17828da7c6365)

2 months agoMerge branch 'releases/gcc-15' into devel/omp/gcc-15
Tobias Burnus [Fri, 6 Jun 2025 13:47:31 +0000 (15:47 +0200)] 
Merge branch 'releases/gcc-15' into devel/omp/gcc-15

Merge up to r15-9790-ga69ab79c1abaa4 (June 6, 2025)

2 months agogcn: Update --with-arch= for newer archs
Tobias Burnus [Thu, 5 Jun 2025 08:36:21 +0000 (10:36 +0200)] 
gcn: Update --with-arch= for newer archs

Replace hard-coded list of supported devices by directly checking
config/gcn/gcn-devices.def.

gcc/ChangeLog:

* config.gcc (--with-{arch,tune}): Use .def file to validate gcn
processor names.
* doc/install.texi (amdgcn*-*-*): Update list of devices supported
by --with-arch/--with-tune.

(cherry picked from commit 61a6430cf663e3c980c2ee966f094fea7d99f8e7)

2 months agolibstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]
Patrick Palka [Fri, 6 Jun 2025 13:34:17 +0000 (09:34 -0400)] 
libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]

The const lvalue operator[] overload wasn't properly forwarding the key
type to the generic overload, causing a hard error for const keys.

Rather than correcting the forwarded type this patch just makes the
non-template overloads call try_emplace directly instead.  That way we
can remove the non-standard same_as constraint on the generic overload
and match the spec more closely.

PR libstdc++/120432

libstdc++-v3/ChangeLog:

* include/std/flat_map (flat_map::operator[]): Make the
non-template overloads call try_emplace directly.  Remove
non-standard same_as constraint on the template overload.
* testsuite/23_containers/flat_map/1.cc (test08): New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit 91ed3248ce26aaaee4d7471aa4edbc07b3f1a90e)

2 months agolibstdc++: Fix format call in formatting with empty specs for durations.
Tomasz Kamiński [Wed, 4 Jun 2025 09:05:11 +0000 (11:05 +0200)] 
libstdc++: Fix format call in formatting with empty specs for durations.

This patches fixes an obvious error, where the output iterator argument was
missing for call to format_to, when duration with custom representation types
are used.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (__formatter_chrono:_M_s): Add missing
__out argument to format_to call.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit ac0a04b7a254fb8e1d8d7088336bcb4375807b1e)

2 months agotree-optimization/120357 - ICE with early break vectorization
Richard Biener [Fri, 30 May 2025 12:11:47 +0000 (14:11 +0200)] 
tree-optimization/120357 - ICE with early break vectorization

When doing early break vectorization of a loop with a conditional
reduction the epilog creation code is confused as to before which exit
to insert the conditional reduction induction IV update.  The
following make sure this is done before the main IV exit.

PR tree-optimization/120357
* tree-vect-loop.cc (vect_create_epilog_for_reduction): Create
the conditional reduction induction IV increment before the
main IV exit.

* gcc.dg/vect/vect-early-break_136-pr120357.c: New testcase.

(cherry picked from commit dce4da51ab66c3abb84448326910cd42f6fe2499)

2 months agotree-optimization/120341 - stores into STRING_CSTs can trap
Richard Biener [Fri, 30 May 2025 11:47:55 +0000 (13:47 +0200)] 
tree-optimization/120341 - stores into STRING_CSTs can trap

The following fixes conditional store elimination and store motion
so they consider stores to STRING_CSTs as trapping.

PR tree-optimization/120341
* tree-ssa-loop-im.cc (can_sm_ref_p): STRING_CSTs are readonly.
* tree-ssa-phiopt.cc (cond_store_replacement): Likewise.

* gcc.dg/torture/pr120341-1.c: New testcase.
* gcc.dg/torture/pr120341-2.c: Likewise.

(cherry picked from commit 02c58bc4b0885f5b6f50033da35768ebe6c4a030)

2 months agortl-optimization/120182 - wrong-code with RTL DSE and constant addresses
Richard Biener [Fri, 9 May 2025 06:38:45 +0000 (08:38 +0200)] 
rtl-optimization/120182 - wrong-code with RTL DSE and constant addresses

RTL DSE forms store groups from unique invariant bases but that is
confused when presented with constant addresses where it assigns
one store group per unique address.  That causes it to not consider
0x101:QI to alias 0x100:SI.  Constant accesses can really alias
to every object, in practice they appear for I/O and for access
to objects fixed via linker scripts for example.  So simply avoid
registering a store group for them.

PR rtl-optimization/120182
* dse.cc (canon_address): Constant addresses have no
separate store group.

* gcc.dg/torture/pr120182.c: New testcase.

(cherry picked from commit b9434c3db900d5d037fdf2f64149b82800ceadf8)

2 months agoFix gcc.dg/tree-ssa/ssa-dom-thread-7.c for aarch64
Richard Biener [Thu, 1 May 2025 11:56:25 +0000 (13:56 +0200)] 
Fix gcc.dg/tree-ssa/ssa-dom-thread-7.c for aarch64

So on another machine with a cross I see 17 jumps threaded, so adjusted
like that.

PR tree-optimization/120003
* gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust aarch64 expected
thread2 number of threads.

(cherry picked from commit aa6f1df4ec46a20d2292291b192d3331e51b59f8)

2 months agotree-optimization/120003 - missed jump threading
Richard Biener [Wed, 30 Apr 2025 09:52:17 +0000 (11:52 +0200)] 
tree-optimization/120003 - missed jump threading

The following allows the entry and exit block of a jump thread path
to be equal, which can easily happen when there isn't a forwarder
on the interesting edge for an FSM thread conditional.  We just
don't want to enlarge the path from such a block.

PR tree-optimization/120003
* tree-ssa-threadbackward.cc (back_threader::find_paths_to_names):
Allow block re-use but do not enlarge the path beyond such a
re-use.

* gcc.dg/tree-ssa/ssa-thread-23.c: New testcase.
* gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust.

(cherry picked from commit 1a13684dfc7286139064f7d7341462c9995cbd1c)

2 months agotree-optimization/119960 - failed external SLP promotion
Richard Biener [Tue, 29 Apr 2025 11:23:41 +0000 (13:23 +0200)] 
tree-optimization/119960 - failed external SLP promotion

The following addresses a too conservative sanity check of SLP nodes
we want to promote external.  The issue lies in code generation
for such external which relies on get_later_stmt to figure an
insert location.  But get_later_stmt relies on the ability to
totally order stmts, specifically implementation-wise that they
are all from the same BB, which is what is verified at the moment.

The patch changes this to require stmts to be orderable by
dominance queries.  For simplicity and seemingly enough for the
testcase in PR119960, this handles the case of two distinct BBs.

PR tree-optimization/119960
* tree-vect-slp.cc (vect_slp_can_convert_to_external):
Handle cases where defs from multiple BBs are ordered
by their dominance relation.

* gcc.dg/vect/bb-slp-pr119960-1.c: New testcase.

(cherry picked from commit cc74e2f2b39b6debbef1787a087abad2108e95dd)

2 months agotree-optimization/116352 - amend previous fix
Richard Biener [Thu, 8 May 2025 08:56:16 +0000 (10:56 +0200)] 
tree-optimization/116352 - amend previous fix

The previous fix restricted external vector builds to defs from
the same basic-block.  That turns out too restrictive so we have
to mitigate the original issue in a different way which is
restricting it to the original case where all defs are in the
same basic-block.

PR tree-optimization/116352
* tree-vect-slp.cc (vect_build_slp_tree_2): When compressing
operands from a two-operator node make sure the resulting
operation does not mix defs from different basic-blocks.

(cherry picked from commit 1e8bd720b1a618a39e2a41eec05e935c32d295f3)

2 months agotree-optimization/119960 - add validity checking to SLP scheduling
Richard Biener [Tue, 29 Apr 2025 13:08:52 +0000 (15:08 +0200)] 
tree-optimization/119960 - add validity checking to SLP scheduling

The following adds checks that when we search for a vector stmt
insert location we arrive at one where all required operand defs
are dominating the insert location.  At the moment any such
failure only blows up during SSA verification.

There's the long-standing issue that we do not verify there
exists a valid schedule of the SLP graph from BB vectorization
into the existing CFG.  We do not have the ability to insert
vector stmts on the dominance frontier "end", nor to insert
LC PHIs that would be eventually required.

This should be done all differently, computing the schedule
during analysis and failing if we can't schedule.

PR tree-optimization/119960
* tree-vect-slp.cc (vect_schedule_slp_node): Sanity
check dominance check on operand defs.

(cherry picked from commit 5f44fcdfe18e72f2900d2757375843e88d32c535)

2 months agotree-optimization/119960 - fix and guard get_later_stmt
Richard Biener [Tue, 29 Apr 2025 12:52:27 +0000 (14:52 +0200)] 
tree-optimization/119960 - fix and guard get_later_stmt

The following makes get_later_stmt handle stmts from different
basic-blocks in the case they are orderd and otherwise asserts.

* tree-vectorizer.h (get_later_stmt): Robustify against
stmts in different BBs, assert when they are unordered.

(cherry picked from commit a6cfde60d8c744b31b147022e797bbcc371ae092)

2 months agoFix regression from x86 multi-epilogue tuning
Richard Biener [Wed, 14 May 2025 14:36:29 +0000 (16:36 +0200)] 
Fix regression from x86 multi-epilogue tuning

With the avx512_two_epilogues tuning enabled for zen4 and zen5
the gcc.target/i386/vect-epilogues-5.c testcase below regresses
and ends up using AVX2 sized vectors for the masked epilogue
rather than AVX512 sized vectors.  The following patch rectifies
this and adds coverage for the intended behavior.

* config/i386/i386.cc (ix86_vector_costs::finish_cost):
Do not suggest a first epilogue mode for AVX512 sized
main loops with X86_TUNE_AVX512_TWO_EPILOGUES as that
interferes with using a masked epilogue.

* gcc.target/i386/vect-epilogues-1.c: New testcase.
* gcc.target/i386/vect-epilogues-2.c: Likewise.
* gcc.target/i386/vect-epilogues-3.c: Likewise.
* gcc.target/i386/vect-epilogues-4.c: Likewise.
* gcc.target/i386/vect-epilogues-5.c: Likewise.

(cherry picked from commit 75c7f90bfe6fa8e6c1a70b784e98a3412861646d)

2 months agoDaily bump.
GCC Administrator [Fri, 6 Jun 2025 00:24:58 +0000 (00:24 +0000)] 
Daily bump.

2 months agoChangeLog.omp bump
Sandra Loosemore [Thu, 5 Jun 2025 15:06:43 +0000 (15:06 +0000)] 
ChangeLog.omp bump

2 months agoOpenMP: Fix regressions in metadirective-target-device-2.c [PR120518]
Sandra Loosemore [Wed, 4 Jun 2025 04:03:03 +0000 (04:03 +0000)] 
OpenMP: Fix regressions in metadirective-target-device-2.c [PR120518]

My previous patch that added a CLEANUP_POINT_EXPR around the device_num
selector expression in the C++ front end broke the testcase
c-c++-common/gomp/metadirective-target-device-2.c on offload targets.
It confused the code in omp_device_num_check that tries to bypass error
checking and do early resolution when the expression is a call to one
of the OpenMP library functions.  The solution is to make that code smart
enough to look inside a CLEANUP_POINT_EXPR.

gcc/ChangeLog
PR c++/120518
* omp-general.cc (omp_device_num_check): Look inside a
CLEANUP_POINT_EXPR when trying to optimize special cases.

(cherry picked from commit 9788a1e24822226b55dd1ab521e34bfaf9f4974d)

2 months agoOpenMP: Handle more cases in user/condition selector
Sandra Loosemore [Mon, 2 Jun 2025 03:26:42 +0000 (03:26 +0000)] 
OpenMP: Handle more cases in user/condition selector

Tobias had noted that the C front end was not treating C23 constexprs
as constant in the user/condition selector property, which led to
missed opportunities to resolve metadirectives at parse time.
Additionally neither C nor C++ was permitting the expression to have
pointer or floating-point type -- the former being a common idiom in
other C/C++ conditional expressions.  By using the existing front-end
hooks for the implicit conversion to bool in conditional expressions,
we also get free support for using a C++ class object that has a bool
conversion operator in the user/condition selector.

gcc/c/ChangeLog
* c-parser.cc (c_parser_omp_context_selector): Call
convert_lvalue_to_rvalue and c_objc_common_truthvalue_conversion
on the expression for OMP_TRAIT_PROPERTY_BOOL_EXPR.

gcc/cp/ChangeLog
* cp-tree.h (maybe_convert_cond): Declare.
* parser.cc (cp_parser_omp_context_selector): Call
maybe_convert_cond and fold_build_cleanup_point_expr on the
expression for OMP_TRAIT_PROPERTY_BOOL_EXPR.
* pt.cc (tsubst_omp_context_selector): Likewise.
* semantics.cc (maybe_convert_cond): Remove static declaration.

gcc/testsuite/ChangeLog
* c-c++-common/gomp/declare-variant-2.c: Update expected output.
* c-c++-common/gomp/metadirective-condition-constexpr.c: New.
* c-c++-common/gomp/metadirective-condition.c: New.
* c-c++-common/gomp/metadirective-error-recovery.c: Update expected
output.
* g++.dg/gomp/metadirective-condition-class.C: New.
* g++.dg/gomp/metadirective-condition-template.C: New.

(cherry picked from commit 08c299a410b9314957e48a87f5bf50a4c034b744)

2 months agoada: Spurious compilation error with repeated loop index
Javier Miranda [Thu, 6 Feb 2025 09:40:57 +0000 (09:40 +0000)] 
ada: Spurious compilation error with repeated loop index

When multiple for-loop statements in the same scope use the
same index name to iterate through container elements, the
compiler reports a spurious error indicating a conflict
between index names.

gcc/ada/ChangeLog:

* exp_ch7.adb (Process_Object_Declaration): Avoid generating
duplicate names for master nodes.

2 months agoada: Exception-raising loop incorrectly eliminated
Steve Baird [Thu, 30 Jan 2025 21:28:50 +0000 (13:28 -0800)] 
ada: Exception-raising loop incorrectly eliminated

If the body of a loop includes a raise statement then the loop should not be
considered to be free of side-effects and therefore eligible for elimination
by the compiler.

gcc/ada/ChangeLog:

* sem_util.adb
(Side_Effect_Free_Statements): Return False if the statement list
includes an explicit (i.e. Comes_From_Source) raise statement.

2 months agoada: Fix crash on access to protected return
Ronan Desplanques [Mon, 27 Jan 2025 11:04:41 +0000 (12:04 +0100)] 
ada: Fix crash on access to protected return

The generation of the check mandated by Ada issue AI05-0073 was not done
handled properly for protected types when used through subtypes. This
patch fixes the issue.

gcc/ada/ChangeLog:

* exp_ch4.adb (Tagged_Membership): Fix for protected types.

2 months agoada: Tweak caching of streaming subprograms
Ronan Desplanques [Fri, 31 Jan 2025 09:40:42 +0000 (10:40 +0100)] 
ada: Tweak caching of streaming subprograms

gcc/ada/ChangeLog:

* exp_attr.adb (Interunit_Ref_OK): Tweak categorization of compilation
units.

2 months agoada: Implement built-in-place expansion of two-pass array aggregates
Eric Botcazou [Fri, 24 Jan 2025 09:26:13 +0000 (10:26 +0100)] 
ada: Implement built-in-place expansion of two-pass array aggregates

These are array aggregates containing only component associations that are
iterated with iterator specifications, as per RM 4.3.3(20.2/5-20.4/5).

It is implemented for the array aggregates that are used to initialize an
object, as specified by RM 7.6(17.2/3-17.3/3) for immutably limited types
and types that need finalization, but for all types like other aggregates.

gcc/ada/ChangeLog:

* exp_aggr.adb (Build_Two_Pass_Aggr_Code): New function containing
most of the code initially present in Two_Pass_Aggregate_Expansion.
(Two_Pass_Aggregate_Expansion): Remove redundant N parameter.
Implement built-in-place expansion for (static) object declarations
and allocators, using Build_Two_Pass_Aggr_Code for the main work.
(Expand_Array_Aggregate): Adjust Two_Pass_Aggregate_Expansion call.
Replace Etype (N) by Typ in a couple of places.
* exp_ch3.adb (Expand_Freeze_Array_Type): Remove special case for
two-pass array aggregates.
(Expand_N_Object_Declaration): Do not adjust the object when it is
initialized by a two-pass array aggregate.
* exp_ch4.adb (Expand_Allocator_Expression): Apply the processing
used for container aggregates to two-pass array aggregates.
* exp_ch6.adb (Validate_Subprogram_Calls): Skip calls present in
initialization expressions of N_Object_Declaration nodes that have
No_Initialization set.
* sem_ch3.adb (Analyze_Object_Declaration): Detect the cases of an
array originally initialized by an aggregate consistently.

2 months agoada: Reject Valid_Value arguments originating from Standard
Viljar Indus [Mon, 20 Jan 2025 13:10:22 +0000 (15:10 +0200)] 
ada: Reject Valid_Value arguments originating from Standard

The constraint for Valid_Value not applying to types from Standard
should also apply to all types derived from those types.

gcc/ada/ChangeLog:

* doc/gnat_rm/implementation_defined_attributes.rst: Update the
documentation for Valid_Value.
* sem_attr.adb (Analyze_Attribute): Reject types where
the root type originates from Standard.
* gnat_rm.texi: Regenerate.

2 months agoada: Error about assignment to limited target on aggregate with "for of" iterator
Gary Dismukes [Sat, 18 Jan 2025 01:11:12 +0000 (01:11 +0000)] 
ada: Error about assignment to limited target on aggregate with "for of" iterator

The compiler reports a spurious error about an assignment to a limited
object on an aggregate of a array type with limited components that has
an association with a "for of" iterator. This is fixed by arranging to
have the Assignment_OK flag set on the indexed_names generated by the
expander for initializing the aggregate object.

gcc/ada/ChangeLog:

* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Change call to Make_Assignment
for the indexed aggregate object to call Change_Make_OK_Assignment instead.

2 months agoada: Fix buffer overflow for function call returning discriminated limited record
Eric Botcazou [Wed, 15 Jan 2025 19:37:48 +0000 (20:37 +0100)] 
ada: Fix buffer overflow for function call returning discriminated limited record

This occurs when the discriminated limited record type is declared with
default values for its discriminants, is not controlled, and the context
of the call is anonymous, i.e. the result of the call is not assigned
to an object.  In this case, a temporary is created to hold the result
of the call, with the default values of the discriminants, but the result
may have different values for the discriminants and, in particular, may
be larger than the temporary, which leads to a buffer overflow.

This problem does not occur when the context is an object declaration, so
the fix just makes sure that the expansion in an anonymous context always
uses the model of an object declaration.  It requires a minor tweak to the
helper function Entity_Of of the Sem_Util package.

gcc/ada/ChangeLog:

* exp_ch6.adb (Expand_Actuals): Remove obsolete comment.
(Make_Build_In_Place_Call_In_Anonymous_Context): Always use a proper
object declaration initialized with the function call in the cases
where a temporary is needed, with Assignment_OK set on it.
* sem_util.adb (Entity_Of): Deal with rewritten function call first.

2 months agoada: Fix compile-time failure due to duplicated attribute subprograms.
Steve Baird [Mon, 13 Jan 2025 22:18:26 +0000 (14:18 -0800)] 
ada: Fix compile-time failure due to duplicated attribute subprograms.

For a given type, and for certain attributes (the 4 streaming attributes
and, for Ada2022, the Put_Image attribute), the compiler needs to keep track
of whether a subprogram has already been generated for the given
type/attribute pair. In some cases this was being done incorrectly;
the compiler ended up generating duplicate subprograms (with the same
name), resulting in compilation failures. This could occur if the prefix
of an attribute reference denoted a subtype (more precisely, a non-first
subtype). This includes the case of a subtype declaration that is implicitly
introduced by the compiler to capture the binding between a formal type
in a generic and the corresponding actual type in an instantiation.

gcc/ada/ChangeLog:

* exp_attr.adb (Expand_N_Attribute_Reference): When accessing the
maps declared in package Cached_Attribute_Ops, the key value
passed to Get or to Set should never be the entity node for a
subtype. Use the entity of the corresponding type declaration
instead.

2 months agoada: Avoid calling Resolve with Stand.Any_Fixed as the expected type
Steve Baird [Fri, 10 Jan 2025 21:15:18 +0000 (13:15 -0800)] 
ada: Avoid calling Resolve with Stand.Any_Fixed as the expected type

When we call Resolve for an expression, we pass in the expected type
for that expression. In the absence of semantic errors, that expected type
should never be any of the "Any_xxx" types declared in stand.ads (e.g.,
Any_Array, Any_Numeric, Any_Real). In particular, it should never be Any_Fixed.
Fix a case in which this rule was being violated.

gcc/ada/ChangeLog:

* sem_res.adb
(Set_Mixed_Mode_Operand): If we are about to call Resolve
passing in Any_Fixed as the expected type, then instead pass in
the fixed point type of the other operand (i.e., B_Typ).

2 months agoada: Compiler crash on array aggregate association iterating over function result
Gary Dismukes [Fri, 10 Jan 2025 22:39:52 +0000 (22:39 +0000)] 
ada: Compiler crash on array aggregate association iterating over function result

The compiler triggers a bug box when compiling an array aggregate with
an iterated_component_association that iterates over another array object,
failing when trying to retrieve a Choices field, which isn't an allowed
field for N_Iterated_Component_Association nodes. This occurs in procedure
Check_Function_Writable_Actuals, which wasn't accounting for the iterated
association forms.

gcc/ada/ChangeLog:

* sem_util.adb (Check_Function_Writable_Actuals): Add handling for
N_Iterated_Component_Association and N_Iterated_Element_Association.
Fix a typo in an RM reference (6.4.1(20/3) => 6.4.1(6.20/3)).
(Collect_Expression_Ids): New procedure factoring code for collecting
identifiers from expressions of aggregate associations.
(Handle_Association_Choices): New procedure factoring code for handling
id collection for expressions of aggregate associations with multiple
choices. Removed redundant test of Box_Present from original code.

2 months agoFix crash with constant initializer caused by IPA
Eric Botcazou [Thu, 5 Jun 2025 11:20:26 +0000 (13:20 +0200)] 
Fix crash with constant initializer caused by IPA

The testcase compiled with -O2 -gnatn makes the compiler crash in
vect_can_force_dr_alignment_p during SLP vectorization:

  if (decl_in_symtab_p (decl)
      && !symtab_node::get (decl)->can_increase_alignment_p ())
    return false;

because symtab_node::get (decl) returns a null node.  The phenomenon occurs
for a pair of twin symbols listed like so in .cgraph:

Opt7_Pkg.T12b/17 (Opt7_Pkg.T12b)
  Type: variable definition analyzed
  Visibility: semantic_interposition external public artificial
  Aux: @0x44d45e0
  References:
  Referring: opt7_pkg__enum_name_table/13 (addr) opt7_pkg__enum_name_table/13
(addr)
  Availability: not-ready
  Varpool flags: initialized read-only const-value-known

Opt7_Pkg.T8b/16 (Opt7_Pkg.T8b)
  Type: variable definition analyzed
  Visibility: semantic_interposition external public artificial
  Aux: @0x7f9fda3fff00
  References:
  Referring: opt7_pkg__enum_name_table/13 (addr) opt7_pkg__enum_name_table/13
(addr)
  Availability: not-ready
  Varpool flags: initialized read-only const-value-known

with:

opt7_pkg__enum_name_table/13 (Opt7_Pkg.Enum_Name_Table)
  Type: variable definition analyzed
  Visibility: semantic_interposition external public
  Aux: @0x44d45e0
  References: Opt7_Pkg.T8b/16 (addr) Opt7_Pkg.T8b/16 (addr) Opt7_Pkg.T12b/17
(addr) Opt7_Pkg.T12b/17 (addr)
  Referring: opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
opt7_pkg__image/2 (read) opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
opt7_pkg__image/2 (read) opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
  Availability: not-ready
  Varpool flags: initialized read-only const-value-known

being the crux of the matter.

What happens is that symtab_remove_unreachable_nodes leaves the last symbol
in kind of a limbo state: in .remove_symbols, we have:

opt7_pkg__enum_name_table/13 (Opt7_Pkg.Enum_Name_Table)
  Type: variable
  Body removed by symtab_remove_unreachable_nodes
  Visibility: externally_visible semantic_interposition external public
  References:
  Referring: opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
  Availability: not_available
  Varpool flags: initialized read-only const-value-known

This means that the "body" (DECL_INITIAL) of the symbol has been disregarded
during reachability analysis, causing the first two symbols to be discarded:

Reclaiming variables: Opt7_Pkg.T12b/17 Opt7_Pkg.T8b/16

but the DECL_INITIAL is explicitly preserved for later constant folding,
which makes it possible to retrofit the DECLs corresponding to the first
two symbols in the GIMPLE IR and ultimately leads to the crash.

gcc/
* tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return
false if the variable has no symtab node.

gcc/testsuite/
* gnat.dg/specs/opt7.ads: New test.
* gnat.dg/specs/opt7_pkg.ads: New helper.
* gnat.dg/specs/opt7_pkg.adb: Likewise.

2 months agoDaily bump.
GCC Administrator [Thu, 5 Jun 2025 00:26:06 +0000 (00:26 +0000)] 
Daily bump.

2 months agoChangeLog.omp bump
Thomas Schwinge [Wed, 4 Jun 2025 17:49:24 +0000 (19:49 +0200)] 
ChangeLog.omp bump

2 months agoAvoid SIGSEGV in nvptx 'mkoffload' for voluminous PTX code
Thomas Schwinge [Mon, 26 May 2025 11:31:54 +0000 (13:31 +0200)] 
Avoid SIGSEGV in nvptx 'mkoffload' for voluminous PTX code

In commit 50be486dff4ea2676ed022e9524ef190b92ae2b1
"nvptx: libgomp+mkoffload.cc: Prepare for reverse offload fn lookup", some
additional tracking of the PTX code was added, and this assumes that
potentially every single character of PTX code needs to be tracked as a new
chunk of PTX code.  That's problematic if we're dealing with voluminous PTX
code (for example, non-trivial C++ code), and the 'file_idx' 'alloca'tion then
causes stack overflow.  For example:

    FAIL: libgomp.c++/target-std__valarray-1.C (test for excess errors)
    UNRESOLVED: libgomp.c++/target-std__valarray-1.C compilation failed to produce executable

    lto-wrapper: fatal error: [...]/build-gcc/gcc//accel/nvptx-none/mkoffload terminated with signal 11 [Segmentation fault], core dumped

gcc/
* config/nvptx/mkoffload.cc (process): Use an 'auto_vec' for
'file_idx'.

(cherry picked from commit 01044e0ee27093a3990996578b15f6ab69ed3395)

2 months agoFortran: ICE due to missing locus with data statement for coarray [PR99838]
Harald Anlauf [Tue, 3 Jun 2025 18:48:31 +0000 (20:48 +0200)] 
Fortran: ICE due to missing locus with data statement for coarray [PR99838]

PR fortran/99838

gcc/fortran/ChangeLog:

* data.cc (gfc_assign_data_value): For a new initializer use the
location from the constructor as fallback.

gcc/testsuite/ChangeLog:

* gfortran.dg/coarray_data_2.f90: New test.

(cherry picked from commit 0768ec0d32f570b1db13ca41b0a1506275c44053)

2 months agoDaily bump.
GCC Administrator [Wed, 4 Jun 2025 00:27:33 +0000 (00:27 +0000)] 
Daily bump.

2 months agoFortran: parameter inquiries of constant complex arrays [PR102599,PR114022]
Harald Anlauf [Fri, 30 May 2025 17:25:15 +0000 (19:25 +0200)] 
Fortran: parameter inquiries of constant complex arrays [PR102599,PR114022]

PR fortran/102599
PR fortran/114022

gcc/fortran/ChangeLog:

* expr.cc (simplify_complex_array_inquiry_ref): Helper function for
simplification of inquiry references (%re/%im) of constant complex
arrays.
(find_inquiry_ref): Use it for handling %re/%im inquiry references
of complex arrays.
(scalarize_intrinsic_call): Fix frontend memleak.
* primary.cc (gfc_match_varspec): When the reference is NULL, the
previous simplification has succeeded in evaluating inquiry
references also of arrays.

gcc/testsuite/ChangeLog:

* gfortran.dg/inquiry_type_ref_8.f90: New test.

(cherry picked from commit 490072b927dac2f57e541b0ee680896e23c5d998)

2 months agoFortran: fix regression introduced by commit r16-914-g787a8dec1acedf
Harald Anlauf [Tue, 27 May 2025 21:08:54 +0000 (23:08 +0200)] 
Fortran: fix regression introduced by commit r16-914-g787a8dec1acedf

A last-minute cleanup before patch submission reordered a change
that should not have happened.  This fixes it.

PR fortran/101735

gcc/fortran/ChangeLog:

* primary.cc (gfc_match_varspec): Correct order of logic.

(cherry picked from commit 74a2281ae18c6dbbc640f0c79f7138a495ef8f0c)

2 months agoFortran: fix parsing of type parameter inquiries of substrings [PR101735]
Harald Anlauf [Tue, 27 May 2025 17:23:16 +0000 (19:23 +0200)] 
Fortran: fix parsing of type parameter inquiries of substrings [PR101735]

Handling of type parameter inquiries of substrings failed to due either
parsing issues or not following or handling reference chains properly.

PR fortran/101735

gcc/fortran/ChangeLog:

* expr.cc (find_inquiry_ref): If an inquiry reference applies to
a substring, use that, and calculate substring length if needed.
* primary.cc (extend_ref): Also handle attaching to end of
reference chain for appending.
(gfc_match_varspec): Discrimate between arrays of character and
substrings of them.  If a substring is taken from a character
component of a derived type, get the proper typespec so that
inquiry references work correctly.
(gfc_match_rvalue): Handle corner case where we hit a seemingly
dangling '%' and missed an inquiry reference. Try another match.

gcc/testsuite/ChangeLog:

* gfortran.dg/inquiry_type_ref_7.f90: New test.

(cherry picked from commit 787a8dec1acedf5561c8ee43bed0b3653fca150d)

2 months agoDaily bump.
GCC Administrator [Tue, 3 Jun 2025 00:24:38 +0000 (00:24 +0000)] 
Daily bump.

2 months agoc++: lambda this capture and requires [PR120123]
Jason Merrill [Fri, 30 May 2025 22:27:45 +0000 (18:27 -0400)] 
c++: lambda this capture and requires [PR120123]

We shouldn't need to be within the lambda body to look through it to the
enclosing non-static member function.

This change is a small subset of r16-970.

PR c++/120123

gcc/cp/ChangeLog:

* lambda.cc (nonlambda_method_basetype): Look through lambdas
even when current_class_ref is null.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-lambda24.C: New test.

2 months agofortran: Fix debug info for unsigned(kind=1) and unsigned(kind=4) [PR120193]
Jakub Jelinek [Sat, 10 May 2025 19:20:09 +0000 (21:20 +0200)] 
fortran: Fix debug info for unsigned(kind=1) and unsigned(kind=4) [PR120193]

As the following testcase shows, debug info for unsigned(kind=1)
and unsigned(kind=4) vars is wrong while unsigned(kind=2), unsigned(kind=8)
and unsigned(kind=16) look right.
Instead of objects having unsigned(kind=1) type they have character(kind=1)
and instead of unsigned(kind=4) they have character(kind=4).
This means in gdb e.g. unsigned(kind=1) :: a(2) variable initialized to
97 will print as 'aa' rather than (97, 97) etc.
While there can be just one unsigned_char_type_node and one
unsigned_type_node type, each can have arbitrary number of variants
(e.g. consider C
typedef unsigned char uc;
where uc is a variant type to unsigned char) or even distinct types
with different TYPE_MAIN_VARIANT.

The following patch uses a variant of the character(kind=4) type
for unsigned(kind=4) and a distinct type based on character(kind=1)
type for unsigned(kind=1).  The reason for the latter is that
unsigned_char_type_node has TYPE_STRING_FLAG set on it, so it has
DW_AT_encoding DW_ATE_unsigned_char rather than DW_ATE_unsigned and
so the debugger then likes to print it as characters rather than numbers.
That is IMHO in Fortran desirable for character(kind=1) but not for
unsigned(kind=1).  I've made sure TYPE_CANONICAL of the unsigned(kind=1)
type is still character(kind=1), so they are considered compatible by
the middle-end also e.g. for aliasing etc.

2025-05-10  Jakub Jelinek  <jakub@redhat.com>

PR fortran/120193
* trans-types.cc (gfc_init_types): For flag_unsigned use
build_distinct_type_copy or build_variant_type_copy from
gfc_character_types[index_char] if index_char > -1 instead of
gfc_character_types[index_char] or
gfc_build_unsigned_type (&gfc_unsigned_kinds[index]).

* gfortran.dg/guality/pr120193.f90: New test.

(cherry picked from commit 512371d786e70d27dbaef38d60e9036c11f458c6)

2 months agoMerge branch 'releases/gcc-15' into devel/omp/gcc-15
Tobias Burnus [Mon, 2 Jun 2025 06:11:59 +0000 (08:11 +0200)] 
Merge branch 'releases/gcc-15' into devel/omp/gcc-15

Merge up to r15-9755-g21e0a742e7b70d (2nd July 2025)

2 months agoFortran: Fix handling of parsed format strings.
Jerry DeLisle [Sat, 31 May 2025 15:57:22 +0000 (08:57 -0700)] 
Fortran: Fix handling of parsed format strings.

Previously parsed strings with errors were being cached such
that subsequent use of the format string were not being
checked for errors.

PR libfortran/119856

libgfortran/ChangeLog:

* io/format.c (parse_format_list): Set the fmt->error
message for missing comma.
(parse_format): Do not cache the parsed format string
if a previous error ocurred.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr119856.f90: New test.

(cherry picked from commit 5ff48aabf76c8913c013f233d3f42bb217a16e7b)

2 months agoFortran: Adjust handling of optional comma in FORMAT.
Jerry DeLisle [Wed, 28 May 2025 14:56:12 +0000 (07:56 -0700)] 
Fortran: Adjust handling of optional comma in FORMAT.

This change adjusts the error messages for optional commas
in format strings to give a warning at compile time unless
-std=legacy is used. This is more consistant with the
runtime library. A missing comma separator should not be
encouraged as it is non-standard fortran.

PR fortran/119856

gcc/fortran/ChangeLog:

* io.cc: Set missing comma error checks to STD_STD_LEGACY.

gcc/testsuite/ChangeLog:

* gfortran.dg/comma_format_extension_1.f: Update dg-options to
"-std=legacy".
* gfortran.dg/comma_format_extension_3.f: Likewise.
* gfortran.dg/continuation_13.f90: Likewise.

(cherry picked from commit e2bf0b3910de7e65363435f0a7fa606e2448a677)

2 months agoDaily bump.
GCC Administrator [Mon, 2 Jun 2025 00:22:54 +0000 (00:22 +0000)] 
Daily bump.

2 months agolibstdc++: Compare keys and values separately in flat_map::operator==
Patrick Palka [Thu, 29 May 2025 14:12:23 +0000 (10:12 -0400)] 
libstdc++: Compare keys and values separately in flat_map::operator==

Instead of effectively doing a zipped comparison of the keys and values,
compare them separately to leverage the underlying containers' optimized
equality implementations.

libstdc++-v3/ChangeLog:

* include/std/flat_map (_Flat_map_impl::operator==): Compare
keys and values separately.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit ad96f0344adfc847874b34b43f30371979ae9963)

2 months agolibstdc++: Fix tuple/pair confusion with std::erase_if(flat_map) [PR120465]
Patrick Palka [Thu, 29 May 2025 14:11:57 +0000 (10:11 -0400)] 
libstdc++: Fix tuple/pair confusion with std::erase_if(flat_map) [PR120465]

std::erase_if for flat_map/multimap is implemented via ranges::erase_if
over a zip_view of the keys and values, the value_type of which is a
tuple, but the given predicate needs to be called with a pair (flat_map's
value_type).  So use a projection to convert the tuple into a suitable
pair.

PR libstdc++/120465

libstdc++-v3/ChangeLog:

* include/std/flat_map (_Flat_map_impl::_M_erase_if): Use a
projection with ranges::remove_if to pass a pair instead of
a tuple to the predicate.
* testsuite/23_containers/flat_map/1.cc (test07): Strengthen
to expect the argument passed to the predicate is a pair.
* testsuite/23_containers/flat_multimap/1.cc (test07): Likewise.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit 589b27ec5769410e036df57645ff1eb7c765f692)

2 months agoDaily bump.
GCC Administrator [Sun, 1 Jun 2025 00:24:48 +0000 (00:24 +0000)] 
Daily bump.

2 months agoFortran: Fix c_associated argument checks.
Jerry DeLisle [Tue, 20 May 2025 02:41:16 +0000 (19:41 -0700)] 
Fortran: Fix c_associated argument checks.

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)

2 months agoType mismatch for passed external function
Thomas Koenig [Fri, 30 May 2025 11:31:58 +0000 (13:31 +0200)] 
Type mismatch for passed external function

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)

2 months agoDaily bump.
GCC Administrator [Sat, 31 May 2025 00:24:57 +0000 (00:24 +0000)] 
Daily bump.

2 months agoOpenMP: Fix ICE and other issues in C/C++ metadirective error recovery.
Sandra Loosemore [Mon, 26 May 2025 19:21:48 +0000 (19:21 +0000)] 
OpenMP: Fix ICE and other issues in C/C++ metadirective error recovery.

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)

2 months agoOpenMP: Fix ICE in metadirective recovery after error [PR120180]
Sandra Loosemore [Sat, 24 May 2025 03:21:18 +0000 (03:21 +0000)] 
OpenMP: Fix ICE in metadirective recovery after error [PR120180]

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)

2 months agoMerge commit 'c153150b8a05878191de2ee16c0cce7d526f3c46' into HEAD
Thomas Schwinge [Fri, 30 May 2025 13:06:20 +0000 (15:06 +0200)] 
Merge commit 'c153150b8a05878191de2ee16c0cce7d526f3c46' into HEAD

2 months agoChangeLog.omp bump
Thomas Schwinge [Fri, 30 May 2025 13:04:37 +0000 (15:04 +0200)] 
ChangeLog.omp bump

2 months agoChangeLog.omp bump
Thomas Schwinge [Fri, 30 May 2025 13:03:59 +0000 (15:03 +0200)] 
ChangeLog.omp bump

2 months agoXFAIL 'libgomp.c++/target-flex-{300,60,61,62,81}.C'
Thomas Schwinge [Fri, 30 May 2025 07:30:36 +0000 (09:30 +0200)] 
XFAIL 'libgomp.c++/target-flex-{300,60,61,62,81}.C'

... which run into:

    [...]/libgomp.c++/target-flex-300.C: In function 'bool test(std::size_t)':
    [...]/libgomp.c++/target-flex-300.C:25:11: sorry, unimplemented: unsupported map expression '<lambda closure object>test(std::size_t)::<lambda(int)>()'

... etc., due to other OG15 changes.

libgomp/
* testsuite/libgomp.c++/target-flex-300.C: XFAIL.
* testsuite/libgomp.c++/target-flex-60.C: Likewise.
* testsuite/libgomp.c++/target-flex-61.C: Likewise.
* testsuite/libgomp.c++/target-flex-62.C: Likewise.
* testsuite/libgomp.c++/target-flex-81.C: Likewise.

2 months agoAdd 'libgomp.c++/target-valarray-1.C'
Thomas Schwinge [Wed, 30 Apr 2025 09:29:08 +0000 (11:29 +0200)] 
Add 'libgomp.c++/target-valarray-1.C'

libgomp/
* testsuite/libgomp.c++/target-std__valarray-1.C: New.
* testsuite/libgomp.c++/target-std__valarray-1.output: Likewise.

(cherry picked from commit 2ffada0296c95898a68bdb67ced738fe788df93a)

2 months agolibgomp: Add testcases for concurrent access to standard C++ containers on offload...
Thomas Schwinge [Fri, 30 May 2025 09:37:46 +0000 (11:37 +0200)] 
libgomp: Add testcases for concurrent access to standard C++ containers on offload targets, a number of USM variants

libgomp/
* testsuite/libgomp.c++/target-std__array-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__array-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__deque-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__list-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__list-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__map-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__map-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__multiset-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__set-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__set-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__span-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__span-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Adjust.
* testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: New.
* testsuite/libgomp.c++/target-std__vector-concurrent.C: Adjust.

(cherry picked from commit 83ca283853f195a08d2f758580a369bc6a076122)

2 months agolibgomp: Add testcases for concurrent access to standard C++ containers on offload...
Kwok Cheung Yeung [Thu, 8 May 2025 19:41:16 +0000 (20:41 +0100)] 
libgomp: Add testcases for concurrent access to standard C++ containers on offload targets

libgomp/

* testsuite/libgomp.c++/target-std__array-concurrent.C: New.
* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__deque-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__flat_map-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__flat_set-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__list-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__map-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__multiset-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__set-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__span-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__unordered_map-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__unordered_set-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__vector-concurrent.C: Likewise.

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
(cherry picked from commit a811d1d72261da58196ccec253fd2bdb10e999db)

2 months agolibgomp: Add testcases for the standard C++ math library on offload targets
Kwok Cheung Yeung [Wed, 21 May 2025 11:59:58 +0000 (12:59 +0100)] 
libgomp: Add testcases for the standard C++ math library on offload targets

libgomp/

* testsuite/libgomp.c++/target-std__cmath.C: New.
* testsuite/libgomp.c++/target-std__complex.C: Likewise.
* testsuite/libgomp.c++/target-std__numbers.C: Likewise.

(cherry picked from commit fbcd0ad41f7cc801664da1e583f6bcad1eb02a08)

2 months agoAdd 'libgomp.c++/target-flex-[...].C' test cases
Waffl3x [Mon, 26 May 2025 08:38:27 +0000 (02:38 -0600)] 
Add 'libgomp.c++/target-flex-[...].C' test cases

libgomp/ChangeLog:

* testsuite/libgomp.c++/target-flex-10.C: New test.
* testsuite/libgomp.c++/target-flex-100.C: New test.
* testsuite/libgomp.c++/target-flex-101.C: New test.
* testsuite/libgomp.c++/target-flex-11.C: New test.
* testsuite/libgomp.c++/target-flex-12.C: New test.
* testsuite/libgomp.c++/target-flex-2000.C: New test.
* testsuite/libgomp.c++/target-flex-2001.C: New test.
* testsuite/libgomp.c++/target-flex-2002.C: New test.
* testsuite/libgomp.c++/target-flex-2003.C: New test.
* testsuite/libgomp.c++/target-flex-30.C: New test.
* testsuite/libgomp.c++/target-flex-300.C: New test.
* testsuite/libgomp.c++/target-flex-31.C: New test.
* testsuite/libgomp.c++/target-flex-32.C: New test.
* testsuite/libgomp.c++/target-flex-33.C: New test.
* testsuite/libgomp.c++/target-flex-41.C: New test.
* testsuite/libgomp.c++/target-flex-60.C: New test.
* testsuite/libgomp.c++/target-flex-61.C: New test.
* testsuite/libgomp.c++/target-flex-62.C: New test.
* testsuite/libgomp.c++/target-flex-70.C: New test.
* testsuite/libgomp.c++/target-flex-80.C: New test.
* testsuite/libgomp.c++/target-flex-81.C: New test.
* testsuite/libgomp.c++/target-flex-90.C: New test.
* testsuite/libgomp.c++/target-flex-common.h: New test.

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
(cherry picked from commit 28a5bc2d4f7ae345234a15e22fd65cfad851cf04)

2 months agoDefuse 'RESULT_DECL' check in 'pass_nrv' (for offloading compilation) [PR119835]
Thomas Schwinge [Wed, 28 May 2025 16:40:31 +0000 (18:40 +0200)] 
Defuse 'RESULT_DECL' check in 'pass_nrv' (for offloading compilation) [PR119835]

... 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)

2 months agotestsuite: Add testcase for GCC 13 branch s390 bug [PR120480]
Jakub Jelinek [Fri, 30 May 2025 12:35:12 +0000 (14:35 +0200)] 
testsuite: Add testcase for GCC 13 branch s390 bug [PR120480]

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)

2 months agolibgomp: Add OpenACC's acc_memcpy_device{,_async} routines [PR93226]
Tobias Burnus [Thu, 29 May 2025 20:47:06 +0000 (22:47 +0200)] 
libgomp: Add OpenACC's acc_memcpy_device{,_async} routines [PR93226]

libgomp/ChangeLog:

PR libgomp/93226
* libgomp-plugin.h (GOMP_OFFLOAD_openacc_async_dev2dev): New
prototype.
* libgomp.h (struct acc_dispatch_t): Add dev2dev_func.
(gomp_copy_dev2dev): New prototype.
* libgomp.map (OACC_2.6.1): New; add acc_memcpy_device{,_async}.
* libgomp.texi (acc_memcpy_device): New.
* oacc-mem.c (memcpy_tofrom_device): Change to take from/to
device boolean; use memcpy not memmove; add early return if
size == 0 or same device + same ptr.
(acc_memcpy_to_device, acc_memcpy_to_device_async,
acc_memcpy_from_device, acc_memcpy_from_device_async): Update.
(acc_memcpy_device, acc_memcpy_device_async): New.
* openacc.f90 (acc_memcpy_device, acc_memcpy_device_async):
Add interface.
* openacc_lib.h (acc_memcpy_device, acc_memcpy_device_async):
Likewise.
* openacc.h (acc_memcpy_device, acc_memcpy_device_async): Add
prototype.
* plugin/plugin-gcn.c (GOMP_OFFLOAD_openacc_async_host2dev):
Update comment.
(GOMP_OFFLOAD_openacc_async_dev2host): Update call.
(GOMP_OFFLOAD_openacc_async_dev2dev): New.
* plugin/plugin-nvptx.c (cuda_memcpy_dev_sanity_check): New.
(GOMP_OFFLOAD_dev2dev): Call it.
(GOMP_OFFLOAD_openacc_async_dev2dev): New.
* target.c (gomp_copy_dev2dev): New.
(gomp_load_plugin_for_device): Load dev2dev and async_dev2dev.
* testsuite/libgomp.oacc-c-c++-common/acc_memcpy_device-1.c: New test.
* testsuite/libgomp.oacc-fortran/acc_memcpy_device-1.f90: New test.

(cherry picked from commit f4aa6b5a8d63050f5d61fcec222ed87be4c0a266)

2 months agoDaily bump.
GCC Administrator [Fri, 30 May 2025 00:24:31 +0000 (00:24 +0000)] 
Daily bump.

2 months agoaarch64: Enable newly implemented features for FUJITSU-MONAKA
Yuta Mukai [Fri, 23 May 2025 04:51:11 +0000 (04:51 +0000)] 
aarch64: Enable newly implemented features for FUJITSU-MONAKA

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)

2 months agoDaily bump.
GCC Administrator [Thu, 29 May 2025 00:23:48 +0000 (00:23 +0000)] 
Daily bump.

2 months agolibgomp.fortran/metadirective-1.f90: Expect 'error:' for nvptx compile [PR118694]
Tobias Burnus [Wed, 28 May 2025 13:14:14 +0000 (15:14 +0200)] 
libgomp.fortran/metadirective-1.f90: Expect 'error:' for nvptx compile [PR118694]

This should have been part of commit r16-838-gb3d07ec7ac2ccd or
r16-883-g5d6ed6d604ff94 - all showing the same issue:
'!$omp target' followed by a metadirective with 'teams'; if
the metadirective cannot be early resolved, a diagnostic
error is shown about using directives between 'target' and
'teams'.

While the message is misleading, the problem is that the
host invokes 'target' differently when 'teams' is present;
in this case, host fallback + amdgcn offload require the
no-teams case, nvptx offload the teams case such that it
only can be resolved at runtime.

Mark the error as 'dg-bogus + xfail' to silence the FAIL,
when nvptx offloading is compiled for. (If not, the
metadirective can be resolved early during compilation.)

libgomp/ChangeLog:

PR middle-end/118694
* testsuite/libgomp.fortran/metadirective-1.f90: xfail when
compiling (also) for nvptx offloading as an error is then expected.

(cherry picked from commit 5b2e7afb135aa10e17e51b891d4b2c85ee541ade)

2 months agoDaily bump.
GCC Administrator [Wed, 28 May 2025 00:24:39 +0000 (00:24 +0000)] 
Daily bump.

2 months agoFix IPA-SRA issue with reverse SSO on specific pattern
Eric Botcazou [Tue, 27 May 2025 17:42:17 +0000 (19:42 +0200)] 
Fix IPA-SRA issue with reverse SSO on specific pattern

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.

2 months agodoc: Fix typo in description of nonstring attribute
Jonathan Wakely [Tue, 27 May 2025 08:11:58 +0000 (09:11 +0100)] 
doc: Fix typo in description of nonstring attribute

gcc/ChangeLog:

* doc/extend.texi (Common Variable Attributes): Fix typo in
description of nonstring.

(cherry picked from commit 351e60095cfaa73b5ac69222d00e0cd4ae5725d4)

2 months agolibstdc++: Fix PSTL test iterators
Jonathan Wakely [Tue, 20 May 2025 12:18:52 +0000 (13:18 +0100)] 
libstdc++: Fix PSTL test iterators

These were fixed upstream by:
https://github.com/uxlfoundation/oneDPL/pull/534
https://github.com/uxlfoundation/oneDPL/pull/546

libstdc++-v3/ChangeLog:

* testsuite/util/pstl/test_utils.h (ForwardIterator::operator++):
Fix return type.
(BidirectionalIterator::operator++): Likewise.
(BidirectionalIterator::operator--): Likewise.

(cherry picked from commit c0a2526f099dfa52df5daa1432ff583ae6af0d5f)

2 months agolibstdc++: Fix vector(from_range_t, R&&) for exceptions [PR120367]
Jonathan Wakely [Wed, 21 May 2025 14:29:02 +0000 (15:29 +0100)] 
libstdc++: Fix vector(from_range_t, R&&) for exceptions [PR120367]

Because this constructor delegates to vector(a) the object has been
fully constructed and the destructor will run if an exception happens.
That means we need to set _M_finish == _M_start so that the destructor
doesn't try to destroy any elements.

libstdc++-v3/ChangeLog:

PR libstdc++/120367
* include/bits/stl_vector.h (_M_range_initialize): Initialize
_M_impl._M_finish.
* testsuite/23_containers/vector/cons/from_range.cc: Check with
a type that throws on construction.
exceptions during construction.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
(cherry picked from commit 04f2be72b1deecd6c6d454e000cfc0cb16db957c)

2 months agoAVR: target/120442 - Support f7_fdim / fdiml in LibF7.
Georg-Johann Lay [Tue, 27 May 2025 10:03:13 +0000 (12:03 +0200)] 
AVR: target/120442 - Support f7_fdim / fdiml in LibF7.

Add Support for fdiml.
PR target/120442
libgcc/config/avr/libf7/
* libf7-common.mk (LIBF_C_PARTS, m_ddd): Add fdim.
* libf7.h (f7_fdim): New proto.
* libf7.c (f7_fdim): New function.
* f7renames.sh (f7_fdim): Add rename.
* f7-wraps.h: Rebuild
* f7-renames.h: Rebuild

(cherry picked from commit 6045de6596d09f3cf7ae3f552b56d7e5df17a899)

2 months agoAVR: target/120441 - Fix f7_exp for |x| ≥ 512.
Georg-Johann Lay [Tue, 27 May 2025 07:43:57 +0000 (09:43 +0200)] 
AVR: target/120441 - Fix f7_exp for |x| ≥ 512.

f7_exp limited exponents to 512, but 1023 * ln2 ≈ 709,
hence 1024 is a correct limit.

libgcc/config/avr/libf7/
PR target/120441
* libf7.c (f7_exp): Limit aa->expo to 10 (not to 9).

(cherry picked from commit 672569cee76a1927d14b5eb754a5ff0b9cee1bc8)

2 months agoDaily bump.
GCC Administrator [Tue, 27 May 2025 00:26:29 +0000 (00:26 +0000)] 
Daily bump.

2 months agoMerge branch 'releases/gcc-15' into devel/omp/gcc-15
Tobias Burnus [Mon, 26 May 2025 17:59:34 +0000 (19:59 +0200)] 
Merge branch 'releases/gcc-15' into devel/omp/gcc-15

Merge up to r15-9731-gd390c7e5bd0349 (26th May 2025)

2 months agoc-c++-common/gomp/{attrs-,}metadirective-3.c: Fix expected result [PR118694]
Tobias Burnus [Mon, 26 May 2025 17:50:40 +0000 (19:50 +0200)] 
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)

2 months agolibgomp.c-c++-common/metadirective-1.c: Expect 'error:' for nvptx compile [PR118694]
Tobias Burnus [Fri, 23 May 2025 09:30:48 +0000 (11:30 +0200)] 
libgomp.c-c++-common/metadirective-1.c: Expect 'error:' for nvptx compile [PR118694]

OpenMP's 'target teams' is strictly coupled with 'teams'; if the latter
exists, the kernel is launched in directly with multiple teams. Thus,
the host has to know whether the teams construct exists or not. For

   #pragma omp target
     #pragma omp metadirective when (device={arch("nvptx")}: teams loop)

it is simple when 'nvptx' offloading is not supported, otherwise it depends
on the default device at runtime as the user code asks for a single team for
host fallback and gcn offload and multiple for nvptx offload.

In any case, this commit ensures that no FAIL is printed, whatever a
future solution might look like. Instead of a dg-bogus combined with an
'xfail offload_target_nvptx', one an also argue that a dg-error for
'target offload_target_nvptx' would be more appropriate.

libgomp/ChangeLog:

PR middle-end/118694
* testsuite/libgomp.c-c++-common/metadirective-1.c: xfail when
compiling (also) for nvptx offloading as an error is then expected.

(cherry picked from commit b3d07ec7ac2ccd935a79b29e1a0e2eb16225286a)

2 months agoOpenMP/C++: Avoid ICE for BIND_EXPR with empty BIND_EXPR_BLOCK [PR120413]
Tobias Burnus [Mon, 26 May 2025 15:58:07 +0000 (17:58 +0200)] 
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)

2 months agoDaily bump.
GCC Administrator [Mon, 26 May 2025 00:23:39 +0000 (00:23 +0000)] 
Daily bump.

2 months agoMicroBlaze does not support speculative execution (CVE-2017-5753)
Michael J. Eager [Sun, 25 May 2025 16:25:27 +0000 (09:25 -0700)] 
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

2 months agoDaily bump.
GCC Administrator [Sun, 25 May 2025 00:24:49 +0000 (00:24 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 24 May 2025 00:23:11 +0000 (00:23 +0000)] 
Daily bump.

2 months agoc++/modules: Fix merge of TLS init functions [PR120363]
Nathaniel Shead [Thu, 22 May 2025 12:16:22 +0000 (22:16 +1000)] 
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 <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 66e9a4f3083356b064cc64651edad466a56f762b)

2 months agoc++/modules: Fix stream-in of member using-decls [PR120414]
Nathaniel Shead [Fri, 23 May 2025 14:51:49 +0000 (00:51 +1000)] 
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 <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 43dddeef7a870ce4db7407f73660504b67a0a919)

2 months agoDaily bump.
GCC Administrator [Fri, 23 May 2025 00:24:13 +0000 (00:24 +0000)] 
Daily bump.

2 months agoFortran: default-initialization and functions returning derived type [PR85750]
Harald Anlauf [Thu, 15 May 2025 19:07:07 +0000 (21:07 +0200)] 
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)

2 months agoChangeLog.omp bump
Thomas Schwinge [Thu, 22 May 2025 16:15:14 +0000 (18:15 +0200)] 
ChangeLog.omp bump

2 months ago'TYPE_EMPTY_P' vs. code offloading [PR120308]
Thomas Schwinge [Thu, 15 May 2025 16:11:16 +0000 (18:11 +0200)] 
'TYPE_EMPTY_P' vs. code offloading [PR120308]

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)

2 months agoAdd 'libgomp.c-c++-common/target-abi-struct-1-O0.c', 'libgomp.oacc-c-c++-common/abi...
Thomas Schwinge [Thu, 15 May 2025 16:10:05 +0000 (18:10 +0200)] 
Add 'libgomp.c-c++-common/target-abi-struct-1-O0.c', 'libgomp.oacc-c-c++-common/abi-struct-1.c'

libgomp/
* testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: New.
* testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c: Likewise.

(cherry picked from commit 45efda05c47f770a617b44cf85713a696bcf0384)

2 months agoGCN, nvptx offloading: Restrain 'WARNING: program timed out.' while in 'dynamic_cast...
Thomas Schwinge [Fri, 9 May 2025 12:49:03 +0000 (14:49 +0200)] 
GCN, nvptx offloading: Restrain 'WARNING: program timed out.' while in 'dynamic_cast'" [PR119692]

PR target/119692
libgomp/
* testsuite/libgomp.c++/pr119692-1-4.C: '{ dg-timeout 10 }'.
* testsuite/libgomp.c++/pr119692-1-5.C: Likewise.
* testsuite/libgomp.c++/target-exceptions-bad_cast-1.C: Likewise.
* testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: Likewise.
* testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C: Likewise.
* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise.

(cherry picked from commit b5f48e7872db30b8f174cb2c497868a358bf75d6)

2 months agoChangeLog.omp bump
Tobias Burnus [Thu, 22 May 2025 15:10:44 +0000 (17:10 +0200)] 
ChangeLog.omp bump

2 months agogit_repository.py: Fix handling of --last-commit with merges
Tobias Burnus [Thu, 22 May 2025 15:06:38 +0000 (17:06 +0200)] 
git_repository.py: Fix handling of --last-commit with merges

contrib/ChangeLog:

* gcc-changelog/git_update_version.py (update_current_branch): Fix
handling of merges.
* gcc-changelog/git_repository.py (parse_git_revisions): Skip over
merge commits for merges from exclude branch.

2 months agoDaily bump.
GCC Administrator [Thu, 22 May 2025 00:23:47 +0000 (00:23 +0000)] 
Daily bump.