Age | Commit message (Collapse) | Author | Files | Lines |
|
In the case of an assignment where the type of its left hand side
is an indexable container that has indexable container components
(for example a container vector of container vectors), and both
indexable containers have Constant_Indexing and Variable_Indexing
aspects, the left hand side of the assignment is erroneously
interpreted as constant indexing. The error results in spurious
compile-time error messages saying that the left hand side of
the assignment must be a variable.
gcc/ada/ChangeLog:
* sem_ch4.adb (Constant_Indexing_OK): Add missing support for
RM 4.1.6(13/3), and improve performance to avoid climbing more
than needed. Add documentation.
(Try_Indexing_Function): New subprogram.
(Expr_Matches_In_Formal): Added new formals.
(Handle_Selected_Component): New subprogram.
(Has_IN_Mode): New subprogram.
(Try_Container_Indexing): Add documentation, code reorganization
and extend its functionality to improve its support for prefixed
notation calls.
|
|
The problem is that the Entity field is accessed for a node without one.
gcc/ada/ChangeLog:
* sem_ch10.adb (Install_Siblings.In_Context): Add missing guard.
|
|
At library level the object must be allocated statically and with its bounds
when its nominal subtype is an unconstrained array type.
gcc/ada/ChangeLog:
* exp_ch4.adb (Insert_Conditional_Object_Declaration): Make sure the
object is allocated properly by the code generator at library level.
|
|
In some cases, a generic containing a use of a unary operator successfully
compiles but the compiler incorrectly rejects the corresponding use in
an instantiation.
gcc/ada/ChangeLog:
* sem_ch4.adb
(Find_Unary_Types): Because we reanalyze names in an instance,
we sometimes have to take steps to filter out extraneous name
resolution candidates that happen to be visible at the point of the
instance declaration. Remove some code that appears to have been
written with this in mind. This is done for two reasons. First, the
code sometimes doesn't work (possibly because the In_Instance test
is not specific enough - it probably should be testing to see whether
we are in an instance of the particular generic in which the result
of calling Corresponding_Generic_Type was declared) and causes correct
code to be rejected. Second, the code seems to no longer be necessary
(possibly because of subsequent fixes in this area which are not
specific to unary operators).
|
|
The problem is that an itype duplicated through Duplicate_Subexpr_No_Checks
ends up in a different scope than its source. It is fixed by adding a new
formal parameter New_Scope to the function and forwarding it in the call to
the New_Copy_Tree function.
gcc/ada/ChangeLog:
* exp_aggr.adb (Expand_Record_Aggregate): Use the named form for the
second actual parameter in the call to Duplicate_Subexpr.
* exp_attr.adb (Expand_Size_Attribute): Likewise.
* exp_ch5.adb (Expand_Assign_Array): Likewise.
(Expand_Assign_Array_Bitfield): Likewise.
(Expand_Assign_Array_Bitfield_Fast): Likewise.
* exp_util.ads (Duplicate_Subexpr): Add New_Scope formal parameter.
(Duplicate_Subexpr_No_Checks): Likewise.
(Duplicate_Subexpr_Move_Checks): Likewise.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Pass Proc_Id as the
actual for New_Scope in the calls to Duplicate_Subexpr_No_Checks.
(Duplicate_Subexpr): Add New_Scope formal parameter and forward it
in the call to New_Copy_Tree.
(Duplicate_Subexpr_No_Checks): Likewise.
(Duplicate_Subexpr_Move_Checks): Likewise.
|
|
With a recent change we are now validity checking objects of private scalar
types, but need to handle private scalar types whose public view is limited.
gcc/ada/ChangeLog:
* checks.adb (Insert_Valid_Check): Set flag Assignment_OK in the object
declaration inserted for the validity checks.
|
|
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)
|
|
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)
|
|
Merge up to r15-9790-ga69ab79c1abaa4 (June 6, 2025)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
|
|
|
|
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)
|
|
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)
|
|
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.
|
|
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.
|
|
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.
|
|
gcc/ada/ChangeLog:
* exp_attr.adb (Interunit_Ref_OK): Tweak categorization of compilation
units.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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).
|
|
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.
|
|
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.
|
|
|
|
|
|
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)
|
|
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)
|
|
|
|
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)
|
|
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)
|
|
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)
|
|
|
|
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.
|
|
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)
|
|
Merge up to r15-9755-g21e0a742e7b70d (2nd July 2025)
|
|
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)
|
|
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)
|