Age | Commit message (Collapse) | Author | Files | Lines |
|
r15-353-gd7bb8eaade3cd3aa70715c8567b4d7b08098e699
|
|
|
|
This makes it possible to remove clauses from the Accessibility package.
gcc/ada/
* accessibility.adb: Remove clauses for Exp_Ch3.
* exp_ch3.ads (Init_Proc_Level_Formal): Move declaration to...
* exp_ch3.adb (Init_Proc_Level_Formal): Move body to...
* exp_util.ads (Init_Proc_Level_Formal): ...here.
(Inside_Init_Proc): Alphabetize.
* exp_util.adb (Init_Proc_Level_Formal): ...here.
|
|
The removed code is no longer needed (and causes assertion failures).
Most likely it should have been using the Split_PPC flag.
gcc/ada/
* sem_util.adb (Is_Potentially_Unevaluated): Remove code for
recovering the original structure of expressions with AND THEN.
|
|
Recent change for attribute Object_Size caused spurious errors when
restriction No_Implementation_Attributes is active and attribute
Object_Size is introduced by expansion of dispatching operations.
Temporarily revert that change for a further investigation.
gcc/ada/
* sem_attr.adb (Attribute_22): Remove Put_Image and Object_Size.
* sem_attr.ads (Attribute_Imp_Def): Restore Object_Size.
|
|
Now that what was previously called "finalization master" has been renamed
into "finalization collection" in the front-end, we can also rename what was
initially called "finalization scope master" into "finalization master".
These entities indeed drive the finalization of all the objects that require
it, directly for (statically) declared objects or indirectly for dynamically
allocated objects (that is to say, through finalization collections).
gcc/ada/
* exp_ch7.adb: Adjust the description of finalization management.
(Build_Finalizer): Rename scope master into master throughout.
* rtsfind.ads (RE_Id): Replace RE_Finalization_Scope_Master with
RE_Finalization_Master.
(RE_Unit_Table): Replace entry for RE_Finalization_Scope_Master with
entry for RE_Finalization_Master.
* libgnat/s-finpri.ads (Finalization_Scope_Master): Rename into...
(Finalization_Master): ...this.
(Attach_Object_To_Master): Adjust to above renaming.
(Chain_Node_To_Master): Likewise.
(Finalize_Master): Likewise.
* libgnat/s-finpri.adb (Attach_Object_To_Master): Likewise.
(Chain_Node_To_Master): Likewise.
(Finalize_Master): Likewise.
|
|
The former can easily be removed while the latter cannot.
gcc/ada/
* libgnat/s-imaged.ads (System.Image_D): Add Uns formal parameter.
* libgnat/s-imaged.adb: Add with clauses for System.Image_I,
System.Value_I_Spec and System.Value_U_Spec.
(Uns_Spec): New instance of System.Value_U_Spec.
(Int_Spec): New instance of System.Value_I_Spec.
(Image_I): New instance of System.Image_I.
(Set_Image_Integer): New renaming.
(Set_Image_Decimal): Replace 'Image with call to Set_Image_Integer.
* libgnat/s-imde32.ads (Uns32): New subtype.
(Impl): Pass Uns32 as second actual paramter to Image_D.
* libgnat/s-imde64.ads (Uns64): New subtype.
(Impl): Pass Uns64 as second actual paramter to Image_D.
* libgnat/s-imde128.ads (Uns128): New subtype.
(Impl): Pass Uns128 as second actual paramter to Image_D.
* libgnat/s-imagef.adb (Set_Image_Fixed): Document bounds for the
A, D and AF local constants.
|
|
Recognize references to attributes Put_Image and Object_Size as
language-defined in Ada 2022 and implementation-defined in earlier
versions of Ada. Other attributes listed in Ada 2022 RM, K.2 and
currently implemented in GNAT are correctly categorized.
This change only affects code with restriction
No_Implementation_Attributes.
gcc/ada/
* sem_attr.adb (Attribute_22): Add Put_Image and Object_Size.
* sem_attr.ads (Attribute_Imp_Def): Remove Object_Size.
|
|
When iterating over Aspect_Specifications, we can use First/Next
directly even if the Aspect_Specifications returns a No_List or
the list has no items.
Code cleanup.
gcc/ada/
* aspects.adb (Copy_Aspects): Style fix.
* contracts.adb (Analyze_Contracts): Style fix.
(Save_Global_References_In_Contract): Remove extra guards.
* par_sco.adb (Traverse_Aspects): Move guard to the caller and
make it consistent with Save_Global_References_In_Contract.
* sem_ch12.adb (Has_Contracts): Remove extra guards.
* sem_ch3.adb (Delayed_Aspect_Present, Get_Partial_View_Aspect,
Check_Duplicate_Aspects): Likewise.
* sem_disp.adb (Check_Dispatching_Operation): Likewise.
|
|
If a pragma Compile_Time_Warning triggers, and the pragma
is later removed because it is dead code, then the compiler
can return a bad exit code. This causes gprbuild to report
"*** compilation phase failed".
This is because Total_Errors_Detected, which is declared as Nat,
goes negative, causing Constraint_Error. In assertions-off mode,
the Constraint_Error is not detected, but the compiler nonetheless
reports a bad exit code.
This patch prevents that negative count.
gcc/ada/
* errout.adb (Output_Messages): Protect against the total going
negative.
|
|
Remove flag Split_PPC and all its uses.
gcc/ada/
* contracts.adb (Append_Enabled_Item): Remove use of Split_PPC;
simplify.
* gen_il-fields.ads (Opt_Field_Enum): Remove flag definition.
* gen_il-gen-gen_nodes.adb (N_Aspect_Specification, N_Pragma):
Remove Split_PPC flags.
* gen_il-internals.adb (Image): Remove use of Split_PPC.
* par_sco.adb (Traverse_Aspects): Likewise.
* sem_ch13.adb (Make_Aitem_Pragma): Likewise.
* sem_ch6.adb (List_Inherited_Pre_Post_Aspects): Likewise.
* sem_prag.adb (Analyze_Pre_Post_Condition, Analyze_Pragma,
Find_Related_Declaration_Or_Body): Likewise.
* sem_util.adb (Applied_On_Conjunct): Likewise.
* sinfo.ads: Remove flag documentation.
* treepr.adb (Image): Remove use of Split_PPC.
|
|
We split expressions of pre/post aspects into individual conjuncts and
emit messages with their precise location when they fail at runtime.
This was done when processing the aspects and caused inefficiency when
the original expression had to be recovered to detects uses of 'Old that
changed in Ada 2022. This patch moves splitting to expansion.
Conceptually, splitting in expansion is easy, but we need to take care
of locations for inherited pre/post contracts. Previously the location
string was generated while splitting the aspect into pragmas and then
it was manipulated when inheriting the pragmas. Now the location string
is built when installing the Pre'Class check and when splitting the
expression in expansion.
gcc/ada/
* exp_ch6.adb (Append_Message): Build the location string from
scratch and not rely on the one produced while splitting the
aspect into pragmas.
* exp_prag.adb (Expand_Pragma_Check): Split pre/post checks in
expansion.
* sem_ch13.adb (Analyze_Aspect_Specification): Don't split
pre/post expressions into conjuncts; don't add message with
location to the corresponding pragma.
* sem_prag.adb (Build_Pragma_Check_Equivalent): Inherited
pragmas no longer have messages that would need to be updated.
* sinput.adb (Build_Location_String): Adjust to keep previous
messages while using with inherited pragmas.
|
|
Code cleanup.
gcc/ada/
* contracts.adb (Inherit_Subprogram_Contract): Fix style.
* sem_ch5.adb (Analyze_Iterator_Specification): Likewise.
|
|
Code cleanup; semantics is unaffected.
gcc/ada/
* sem_util.adb (Has_No_Output): Iteration with
First_Formal/Next_Formal involves Entity_Ids.
|
|
Pramga Lock_Free must be recognized as implementation-defined.
gcc/ada/
* sem_prag.adb (Analyze_Pragma): When processing pragma
Lock_Free, check if restriction No_Implementation_Pragmas is
enabled.
|
|
Flag Is_Expanded_Contract was introduced together with N_Contract field
(when implementing freezing of contracts), but was never actually used.
gcc/ada/
* gen_il-fields.ads (Opt_Field_Enum):
Remove Is_Expanded_Contract from the list of flags.
* gen_il-gen-gen_nodes.adb (N_Contract): Remove
Is_Expanded_Contract from the list of N_Contract fields.
* sinfo.ads (Is_Expanded_Contract): Remove comments for the flag
and its single occurrence in N_Contract.
|
|
Code cleanup following a fix for aspect Exclusive_Functions; semantics
is unaffected.
gcc/ada/
* exp_ch9.adb (Build_Protected_Subprogram_Body,
Build_Protected_Subprogram_Call_Cleanup): Reuse refactored
routine.
* sem_util.adb
(Has_Enabled_Aspect): Refactored repeated code.
(Is_Static_Function): Reuse refactored routine.
* sem_util.ads (Has_Enabled_Aspect):
New query routine refactored from repeated code.
|
|
Extend implementation of RM 9.5.1(7/4), which now applies also to
protected function if the protected type has aspect Exclusive_Functions.
gcc/ada/
* exp_ch9.adb (Build_Protected_Subprogram_Call_Cleanup): If
aspect Exclusive_Functions is present then the cleanup of a
protected function now services queued entries, just like the
cleanup of a protected procedure.
|
|
This patch rewrites Append_Entity_Name, both for maintainability and to
improve user messages. The main issue was that the recursion stopped
when the enclosing scope is the wrapper created in case of
postconditions with 'Old. This caused different results depending
on the enabling/disabling of assertions. Instead of stopping,
we now skip things that the user shouldn't see; there is useful
information in more-outer scope names.
Simplify the code. We had a nested procedure, which called itself
recursively, and also was mutually recursive with the outer procedure.
Avoid testing Is_Internal_Name of the Chars, which seems too fragile.
'R' is used for subprogram instances, but for example "SR" is used for
TSS_Stream_Read, so removing 'R' works only by accident.
Instead, base the test for subprogram instances on normal Einfo
queries.
The new version of Append_Entity_Name produces different (and better)
results in many cases, but this fact is not apparent in most test cases,
because they don't raise unhandled exceptions or do other things that
involve printing the entity name.
The comment:
-- Otherwise nothing to output (happens in unnamed block statements)
is removed; there are many cases other than block statements that
reached that part of the code.
gcc/ada/
* sem_util.ads (Append_Entity_Name): Fix comment to reflect new
semantics. The comment said, "The qualification stops at an
enclosing scope has no source name (block or loop)." There seems
to be no reason for stopping; instead, we should SKIP things with
no source name. And the "loop" part was wrong.
* sem_util.adb (Append_Entity_Name): Do not stop the recursion;
skip to next-outer scope instead. Misc cleanup/simplification.
|
|
This replaces a few remaining references to "master" by "collection" and
makes a couple of additional tweaks in comments.
gcc/ada/
* libgnat/s-finpri.adb (Finalize): Replace "master" by "collection"
in comments and add a comment about the form of the loop.
* libgnat/s-stposu.adb (Allocate_Any_Controlled): Tweak comment.
|
|
This change replaces finalization masters with finalization collections in
most cases, that is to say, when they implement a list of objects created
by allocators of a given access type; indeed the moniker is overloaded in
the front-end, e.g. Sem_Util.Is_Master determines if a node "constitutes
a finalization master" but is not affected by the change.
This is mostly a renaming at this stage, toward something more in keeping
with the terminology used in the RM 7.6.1 clause and no functional changes:
although it gets rid of the rest of the System.Finalization_Masters unit,
the functionalities are reimplemented in the System.Finalization_Primitives
unit in terms of collections with only minor adjustments.
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Remove s-finmas$(objext).
* einfo.ads (Anonymous_Masters): Rename into Anonymous_Collections.
(Finalization_Master): Rename into Finalization_Collection.
* gen_il-fields.ads (Opt_Field_Enum): Replace Anonymous_Masters
with Anonymous_Collections; and Finalization_Master with
Finalization_Collection.
* gen_il-gen-gen_entities.adb (Access_Kind): Likewise.
(E_Function): Likewise.
(E_Procedure): Likewise.
(E_Package): Likewise.
(E_Subprogram_Body): Likewise.
* exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Adjust to renamings.
(Freeze_Type): Likewise.
(Stream_Operation_OK): Remove obsolete test.
* exp_ch4.adb (Expand_Allocator_Expression): Adjust to renamings.
(Expand_N_Allocator): Likewise.
* exp_ch6.ads (BIP_Formal_Kind): Replace BIP_Finalization_Master
with BIP_Collection.
(Needs_BIP_Finalization_Master): Rename into...
(Needs_BIP_Collection): ...this.
* exp_ch6.adb (BIP_Finalization_Master_Suffix): Delete.
(BIP_Collection_Suffix): New constant string.
(Add_Finalization_Master_Actual_To_Build_In_Place_Call): Rename to
(Add_Collection_Actual_To_Build_In_Place_Call): ...this and adjust.
(BIP_Formal_Suffix): Replace BIP_Finalization_Master alternative
with BIP_Collection alternative.
(BIP_Suffix_Kind): Replace test on BIP_Finalization_Master_Suffix
with test on BIP_Collection_Suffix.
(Is_Build_In_Place_Entity): Likewise.
(Make_Build_In_Place_Call_In_Allocator): Call Needs_BIP_Collection
and Add_Collection_Actual_To_Build_In_Place_Call.
(Make_Build_In_Place_Call_In_Anonymous_Context): Likewise.
(Make_Build_In_Place_Call_In_Assignment): Likewise.
(Make_Build_In_Place_Call_In_Object_Declaration): Likewise.
(Needs_BIP_Finalization_Master): Rename into...
(Needs_BIP_Collection): ...this.
(Needs_BIP_Alloc_Form): Call Needs_BIP_Collection.
* exp_ch7.ads (Build_Anonymous_Master): Rename into...
(Build_Anonymous_Collection): ...this.
(Build_Finalization_Master): Rename into...
(Build_Finalization_Collection): ...this.
* exp_ch7.adb (Allows_Finalization_Master): Rename into...
(Allows_Finalization_Collection): ...this.
(Build_BIP_Cleanup_Stmts): Adjust to renamings.
(Build_Anonymous_Master): Rename into...
(Build_Anonymous_Collection): ...this. Adjust to renamings.
(Build_Finalization_Master): Rename into...
(Build_Finalization_Collection): ...this. Adjust to renamings.
(Build_Finalizer): Adjust comment to renamings.
* exp_ch13.adb (Expand_N_Free_Statement): Adjust to renamings.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Likewise.
(Requires_Cleanup_Actions): Adjust comment to renamings.
* freeze.adb (Freeze_All): Likewise.
* rtsfind.ads (RTU_Id): Remove System_Finalization_Masters.
(RE_Id): Remove RE_Finalization_Master & RE_Finalization_Master_Ptr
add RE_Finalization_Collection & RE_Finalization_Collection_Ptr.
Adjust RE_Add_Offset_To_Address and RE_Finalization_Scope_Master.
(RE_Unit_Table): Remove entries for RE_Finalization_Master &
RE_Finalization_Master_Ptr, add ones for RE_Finalization_Collection
& RE_Finalization_Collection_Ptr. Also adjust those of
RE_Add_Offset_To_Address and RE_Finalization_Scope_Master.
* sem_ch3.adb (Access_Type_Declaration): Adjust to renamings.
* sem_ch6.adb (Create_Extra_Formals): Likewise.
* sem_util.adb (Designated_Subtype_Mark): Likewise.
* libgnat/s-finpri.ads: Add clauses for Ada.Finalization and
System.Storage_Elements.
(Finalization_Collection): New limited controlled type.
(Finalization_Collection_Ptr): Likewise.
(Initialize): New overriding procedure.
(Finalize): Likewise.
(Finalization_Started): Likewise.
(Collection_Node): New type.
(Collection_Node_Ptr): Likewise.
(Attach_Node_To_Collection): New procedure.
(Detach_Node_From_Collection): Likewise.
(Header_Size): New function.
(Add_Offset_To_Address): Likewise.
* libgnat/s-finpri.adb (Add_Offset_To_Address): New function.
(Attach_Node_To_Collection): New procedure.
(Detach_Node_From_Collection): Likewise.
(Finalization_Started): Likewise.
(Finalize): New overriding procedure.
(Header_Size): New function.
(Initialize): New overriding procedure.
* libgnat/s-spsufi.ads (Finalize_And_Deallocate): Adjust comment.
* libgnat/s-spsufi.adb: Remove clause for Finalization_Masters and
add clause for Finalization_Primitives.
(Finalize_And_Deallocate): Finalize the Collection component.
* libgnat/s-stposu.ads: Remove clause for Finalization_Masters and
add clause for Finalization_Primitives.
(Root_Subpool): Replace Master component with Collection.
(Allocate_Any_Controlled): Replace Context_Master parameter with
Context_Collection parameter.
* libgnat/s-stposu.adb: Remove clauses for Finalization_Masters and
add clauses for Finalization_Primitives.
(Address_To_FM_Node_Ptr): Delete.
(To_Collection_Node_Ptr): New instance of Ada.Unchecked_Conversion.
(Adjust_Controlled_Dereference): Adjust comment to renamings.
(Allocate_Any_Controlled): Replace Context_Master parameter with
Context_Collection parameter. Adjust to renamings.
(Deallocate_Any_Controlled): Adjust to renamings.
(Print_Subpool): Likewise.
* libgnat/s-finmas.ads: Delete.
* libgnat/s-finmas.adb: Likewise.
|
|
The VxWorks 7 API to use hardware interrupts is the VxBus subsystem.
GNAT API still provides bindings for the deprecated (VxWorks 6) routines.
A direct consequence of this change is that Attach_Handler cannot be
used anymore (the VxBus subsystem should be used instead).
This patch removes all the functions that are not supported by VxWorks 7
anymore.
To warn for the usage of Attach_Handler, it adds the 'Obsolescent'
pragma to to this routine so the comiler will advise the user if this
function is called directly or through a pragma.
gcc/ada/
* Makefile.rtl: remove i-vxinco.* from the build
* doc/gnat_rm/the_gnat_library.rst: Remove i-vxinco.ads from
the units documentation.
* impunit.adb: Remove i-vxinco from the list of available units
in GNATstudio.
* libgnarl/i-vxinco.adb: Remove.
* libgnarl/i-vxinco.ads: Ditto.
* libgnarl/s-interr__vxworks.adb: enrich comment
* libgnarl/s-vxwext__kernel.ads: fix comment
* libgnat/i-vxwork.ads: Remove deprecated interrupt connections
API, as well as an example.
* libgnat/i-vxwork__x86.ads: Ditto and add the paragma
Obscolescent to Attach_Handler
* gnat_rm.texi: Regenerate.
|
|
The coupling came from the build-in-place protocol but is now unnecessary
because the storage pool reference is always passed along with the master
reference in this protocol. No functional changes.
gcc/ada/
* exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Use the BIPstoragepool
formal parameter to retrieve the pool in the presence of a master.
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Always pass
a pool reference along with the master reference.
(Make_Build_In_Place_Call_In_Object_Declaration): Likewise.
* exp_ch7.adb (Build_BIP_Cleanup_Stmts): Use the BIPstoragepool
formal parameter to retrieve the pool in the presence of a master.
(Create_Anonymous_Master): Do not call Set_Base_Pool.
(Build_Finalization_Master): Likewise.
* rtsfind.ads (RE_Id): Remove RE_Base_Pool and RE_Set_Base_Pool.
(RE_Unit_Table): Remove associated entries.
* libgnat/s-finmas.ads: Remove clause for System.Storage_Pools.
(Any_Storage_Pool_Ptr): Delete.
(Finalization_Master): Remove Base_Pool component.
(Base_Pool): Delete.
(Set_Base_Pool): Likewise.
* libgnat/s-finmas.adb (Base_Pool): Likewise.
(Set_Base_Pool): Likewise.
(Print_Master): Do not print Base_Pool.
|
|
This avoids creating Null nodes when they are not used in the end and makes
the implementation of Add_Finalization_Master_Actual_To_Build_In_Place_Call
more consistent with that of its sibling routines. No functional changes.
gcc/ada/
* exp_ch6.adb (Add_Unconstrained_Actuals_To_Build_In_Place_Call):
Rename Pool_Actual into Pool_Exp and use Empty as default value.
(Add_Finalization_Master_Actual_To_Build_In_Place_Call): Change the
names of the first two parameters and use a simpler code structure.
(Make_Build_In_Place_Call_In_Allocator): Rename the local variable
for the pool actual and set it to Empty if it is not used.
(Make_Build_In_Place_Call_In_Object_Declaration): Rename the local
variable for the master actual.
|
|
The resolution made some time ago had been that a dynamic allocation for
a limited type that needs finalization with a function call as expression
always needs to be done in the called function, even if the limited type
has a known size. But the fix implementing this resolution was dropped
inadvertently at some point.
The change also contains a small tweak for Expand_N_Object_Declaration
and a small related cleanup in the finalization machinery.
gcc/ada/
* exp_ch3.adb (Expand_N_Object_Declaration): In the case of a
return object of a BIP function that needs finalization, save
the assignment statement made to initialize it, if any.
* exp_ch6.ads (BIP_Formal_Kind): Adjust description.
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Make a
couple of adjustments to the commentary.
(Needs_BIP_Alloc_Form): Also return true if the function needs
a BIP_Finalization_Master parameter.
* exp_ch7.adb (Build_BIP_Cleanup_Stmts): Remove now always true
test on Needs_BIP_Alloc_Form.
(Attach_Object_To_Master_Node): Remove duplication in comment.
|
|
Fix crash on ACATS test B38003B introduced by a recent cleanup of
per-object constraints.
gcc/ada/
* sem_util.adb (Get_Index_Bounds): Guard against missing Entity,
which happens on illegal constrained type declaration.
|
|
The pragma is consistenly rejected for the alignment of array types because
Eval_Attribute does not evaluate it even if it is known.
gcc/ada/
* sem_attr.adb (Eval_Attribute): Treat Alignment like Component_Size
for array types.
|
|
Move case statement pattern matching out of the curated language extension
set and into the extended set.
gcc/ada/
* sem_case.adb: Replace all tests of Core_Extensions_Allowed with
corresponding tests of All_Extensions_Allowed.
* sem_ch5.adb: Likewise.
* doc/gnat_rm/gnat_language_extensions.rst: update documentation.
* gnat_rm.texi: Regenerate.
|
|
This occurs with an instantiation of Ada.Containers.Vectors in a nested
package on an access-to-class-wide type declared with the Put_Image aspect
because of too late a freezing for the internal renaming generated for the
Put_Image procedure.
The change freezes this renaming immediately in this particular case; this
is similar to a trick used in Build_Array_Put_Image_Procedure.
gcc/ada/
* sem_ch13.adb (New_Put_Image_Subprogram): In the nondeferred case
coming from an aspect and for a type with delaying freezing, also
freeze the subprogram immediately.
|
|
Code cleanup; behavior is unaffected.
gcc/ada/
* libgnat/a-direct.adb (Start_Search_Internal): Combine subtype
and object declaration.
* libgnat/g-dirope.adb (Read): Replace convoluted unchecked
conversion with an overlay.
|
|
Array assignments are likely more efficient than element-by-element
copying; in particular, they avoid constraints checks in every iteration
of a loop (when the runtime is compiled with checks enabled).
A cleanup and improvement opportunity spotted while working on improved
detection of uninitialised local scalar objects.
gcc/ada/
* libgnat/g-dirope.adb (Read): Use null-excluding,
access-to-constant type; replace element-by-element copy with
array assignments.
|
|
The compiler was crashing on container aggregates for the List type
coming from an instantiation of Ada.Containers.Doubly_Linked_Lists
when the aggregate has more than one iterated_element_association
with nonstatic range bounds. As part of addressing this, it was
noticed that there were also somewhat related problems with container
aggregates associated with the Ada.Containers.Bounded_Doubly_Linked_Lists
generic (and likely others like it) and mishandling of certain cases of
indexed aggregates, and those are also addressed by this set of changes.
In the case of container aggregates with at least one association with
a nonstatic range, the total length of the aggregate is determined by
expansion actions of Aggregate_Size.
gcc/ada/
* exp_aggr.adb (Expand_Container_Aggregate): Move determination of
whether the aggregate is an indexed aggregate earlier in the
procedure. Test Is_Indexed_Aggregate as a criterion for generating
a call to the container type's New_Indexed function, add proper
computation of bounds to pass in to the function, and remove later
code for generating such a call. Add and improve comments.
(Aggregate_Size): Remove special treatment of case where there is
exactly one component association, and instead loop over all
component associations to determine whether any of them have a
nonstatic length. If there is at least one such nonstatic
association, return -1.
(Build_Siz_Exp): Accumulate a sum of the sizes of each of the
component associations in Siz_Exp (which will only be used if
there any associations that are of Nkind
N_Iterated_Component_Association with a nonstatic range).
(Expand_Range_Component): Fix typos in the procedure's spec
comment and block comment.
|
|
2024-05-13 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/113363
* trans-array.cc (gfc_array_init_size): Use the expr3 dtype so
that the correct element size is used.
* trans-expr.cc (gfc_conv_procedure_call): Remove restriction
that ss and ss->loop be present for the finalization of class
array function results.
(trans_class_assignment): Use free and malloc, rather than
realloc, for character expressions assigned to unlimited poly
entities.
* trans-stmt.cc (gfc_trans_allocate): Build a correct rhs for
the assignment of an unlimited polymorphic 'source'.
gcc/testsuite/
PR fortran/113363
* gfortran.dg/pr113363.f90: New test.
|
|
This reverts commit 9ba01240864ac446052d97692e2199539b7c76d8.
It is not needed at all:
asm volatile ("fmadd.d %w0, %1, %2" : "+f"(a) : "f"(b), "f"(c))
is OK for us.
|
|
ChangeLog:
* MAINTAINERS: Add myself.
|
|
gcc/fortran/ChangeLog:
* primary.cc (gfc_match_varspec): Replace 'ref' argument to
is_inquiry_ref() by NULL when the result is not needed to avoid
a memleak.
|
|
Examining the code generated for the following C snippet on a
raspberry pi:
int popcount_lut8(unsigned *buf, int n)
{
int cnt=0;
unsigned int i;
do {
i = *buf;
cnt += lut[i&255];
cnt += lut[i>>8&255];
cnt += lut[i>>16&255];
cnt += lut[i>>24];
buf++;
} while(--n);
return cnt;
}
I was surprised to see following instruction sequence generated by the
compiler:
mov r5, r2, lsr #8
uxtb r5, r5
This sequence can be performed by a single ARM instruction:
uxtb r5, r2, ror #8
The attached patch allows GCC's combine pass to take advantage of ARM's
uxtb with rotate functionality to implement the above zero_extract, and
likewise to use the sxtb with rotate to implement sign_extract. ARM's
uxtb and sxtb can only be used with rotates of 0, 8, 16 and 24, and of
these only the 8 and 16 are useful [ror #0 is a nop, and extends with
ror #24 can be implemented using regular shifts], so the approach here
is to add the six missing but useful instructions as 6 different
define_insn in arm.md, rather than try to be clever with new predicates.
Later ARM hardware has advanced bit field instructions, and earlier
ARM cores didn't support extend-with-rotate, so this appears to only
benefit armv6 era CPUs (e.g. the raspberry pi).
Patch posted:
https://gcc.gnu.org/legacy-ml/gcc-patches/2018-01/msg01339.html
Approved by Kyrill Tkachov:
https://gcc.gnu.org/legacy-ml/gcc-patches/2018-01/msg01881.html
2024-05-12 Roger Sayle <roger@nextmovesoftware.com>
Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>
* config/arm/arm.md (*arm_zeroextractsi2_8_8, *arm_signextractsi2_8_8,
*arm_zeroextractsi2_8_16, *arm_signextractsi2_8_16,
*arm_zeroextractsi2_16_8, *arm_signextractsi2_16_8): New.
2024-05-12 Roger Sayle <roger@nextmovesoftware.com>
Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>
* gcc.target/arm/extend-ror.c: New test.
|
|
And an improvement to using slli.uw...
I recently added the ability to use slli.uw in the synthesis path. That
code was conditional on the right justified constant being a LUI_OPERAND
after sign extending from bit 31 to bit 63.
That code is working fine, but could be improved. Specifically there's
no reason it shouldn't work for LUI+ADDI under the same circumstances.
So rather than testing the sign extended, right justified constant is a
LUI_OPERAND, we can just test that the right justified constant has
precisely 32 leading zeros.
gcc/
* config/riscv/riscv.cc (riscv_build_integer_1): Use slli.uw more.
gcc/testsuite
* gcc.target/riscv/synthesis-5.c: New test.
|
|
Overnight testing showed a small number of cases where constant synthesis was
doing something dumb. Specifically generating more instructions than the
number of bits set in the constant.
It was a minor goof in the recent bseti code. In the code to first figure out
what bits LUI could set, I included one bit outside the space LUI operates.
For some dumb reason I kept thinking in terms of 11 low bits belonging to addi,
but it's actually 12 bits. The net is what we thought should be a single LUI
for costing turned into LUI+ADDI.
I didn't let the test run to completion, but over the course of 12 hours it
found 9 cases. Given we know that the triggers all have 0x800 set, I bet we
could likely find more, but I doubt it's that critical to cover every possible
constant that regressed.
gcc/
* config/riscv/riscv.cc (riscv_build_integer_1): Fix thinko in testing
when lui can be used to set several bits in bseti path.
gcc/testsuite
* gcc.target/riscv/synthesis-4.c: New test
|
|
The new cygming.opt.urls and mingw.opt.urls in the
gcc/config/mingw/cygming.opt.urls directory need to generated by make
regenerate-opt-urls in the gcc subdirectory. They still contained
references to the gcc/config/i386 directory from which they were
copied.
Fixes: 1f05dfc131c7 ("Reuse MinGW from i386 for AArch64")
Fixes: e8d003736e6c ("Rename "x86 Windows Options" to "Cygwin and MinGW Options"")
gcc/ChangeLog:
* config/mingw/cygming.opt.urls: Regenerate.
* config/mingw/mingw.opt.urls: Likewise.
|
|
2024-05-12 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/84006
PR fortran/100027
PR fortran/98534
* iresolve.cc (gfc_resolve_transfer): Emit a TODO error for
unlimited polymorphic mold.
* trans-expr.cc (gfc_resize_class_size_with_len): Use the fold
even if a block is not available in which to fix the result.
(trans_class_assignment): Enable correct assignment of
character expressions to unlimited polymorphic variables using
lhs _len field and rse string_length.
* trans-intrinsic.cc (gfc_conv_intrinsic_storage_size): Extract
the class expression so that the unlimited polymorphic class
expression can be used in gfc_resize_class_size_with_len to
obtain the storage size for character payloads. Guard the use
of GFC_DECL_SAVED_DESCRIPTOR by testing for DECL_LANG_SPECIFIC
to prevent the ICE. Also, invert the order to use the class
expression extracted from the argument.
(gfc_conv_intrinsic_transfer): In same way as 'storage_size',
use the _len field to obtaining the correct length for arg 1.
Add a branch for the element size in bytes of class expressions
with provision to make use of the unlimited polymorphic _len
field. Again, the class references are explicitly identified.
'mold_expr' was already declared. Use it instead of 'arg'. Do
not fix 'dest_word_len' for deferred character sources because
reallocation on assign makes use of it before it is assigned.
gcc/testsuite/
PR fortran/84006
PR fortran/100027
* gfortran.dg/storage_size_7.f90: New test.
PR fortran/98534
* gfortran.dg/transfer_class_4.f90: New test.
|
|
gcc/fortran/ChangeLog:
PR fortran/115039
* expr.cc (gfc_traverse_expr): An inquiry ref does not constitute
a dependency and cannot collide with a symbol.
gcc/testsuite/ChangeLog:
PR fortran/115039
* gfortran.dg/statement_function_5.f90: New test.
|
|
Outputs the S_COMPILE3 symbol in the CodeView .debug$S debug section.
The DEBUG_S_SYMBOLS block added here makes up pretty much everything
that isn't data structures or line numbers; we add the S_COMPILE3 symbol
here to start it off.
This is a descriptive bit, the most interesting part of which is the
version of the compiler used.
gcc/
* dwarf2codeview.cc (DEBUG_S_SYMBOLS): Define.
(S_COMPILE3, CV_CFL_80386, CV_CFL_X64): Likewise.
(CV_CFL_C, CV_CFL_CXX): Likewise.
(SYMBOL_START_LABEL, SYMBOL_END_LABEL): Likewise.
(start_processor, language_constant): New functions.
(write_compile3_symbol, write_codeview_symbols): Likewise.
(codeview_debug_finish): Call write_codeview_symbols.
|
|
Outputs the DEBUG_S_LINES block in the CodeView .debug$S section, which
maps between line numbers and addresses.
You'll need a fairly recent version of GAS for the .secidx directive to
be recognized.
gcc/
* dwarf2codeview.cc (DEBUG_S_LINES, LINE_LABEL): Define.
(END_FUNC_LABEL): Likewise.
(struct codeview_line, codeview_line_block): New structures.
(codeview_function): Likewise.
(line_label_num, func_label_num, funcs, last_func): New variables.
(last_filename, last_file_id): Likewise.
(codeview_source_line, write_line_numbers): New functions.
(codeview_switch_text_section, codeview_end_epilogue): Likewise.
(codeview_debug_finish): Call write_line_numbers.
* dwarf2codeview.h (codeview_source_line): Prototype.
(codeview_switch_text_secction, codeview_end_epilogue): Likewise.
* dwarf2out.cc (dwarf2_end_epilogue): Add codeview support.
(dwarf2out_switch_text_section): Likewise.
(dwarf2out_source_line): Likewise.
* opts.cc (finish_options): Handle codeview debugging symbols.
|
|
Outputs the file name and MD5 hash of the main source file into the
CodeView .debug$S section, along with that of any #include'd files.
gcc/
* dwarf2codeview.cc (DEBUG_S_STRINGTABLE): Define.
(DEBUG_S_FILECHKSMS, CHKSUM_TYPE_MD5, HASH_SIZE): Likewise.
(codeview_string, codeview_source_file): New structures.
(struct string_hasher): New class for codeview_string hashing.
(files, last_file, num_files, string_offset): New variables.
(strings_hstab, strings, last_string): Likewise.
(add_string, codevie_start_source_file): New functions.
(write_strings_tabe, write_soruce_files): Likewise.
(codeview_debug_finish): Call new functions.
* dwarf2codeview.h (codeview_start_source_file): Prototype.
* dwarf2out.cc (dwarf2out_start_source_file): Handle codeview.
|
|
This patch and the following add initial support for Microsoft's
CodeView debugging format, as used by MSVC, to mingw targets.
Note that you will need a recent version of binutils for this to be
useful. The best way to view the output is to run Microsoft's
cvdump.exe, found in their microsoft-pdb repo on GitHub, against the
object files.
gcc/
* Makefile.in (OBJS): Add dwarf2codeview.o.
(GTFILES): Add dwarf2codeview.cc
* config/i386/cygming.h (CODEVIEW_DEBUGGING_INFO): Define.
* dwarf2codeview.cc: New file.
* dwarf2codeview.h: New file.
* dwarf2out.cc: Include dwarf2codeview.h.
(dwarf2out_finish): Call codeview_debug_finish as needed.
* flag-types.h (DINFO_TYPE_CODEVIEW): Add enum member.
(CODEVIEW_DEBUG): Define.
* flags.h (codeview_debuginfo_p): Proottype.
* opts.cc (debug_type_names): Add codeview.
(debug_type_masks): Add CODEVIEW_DEBUG.
(df_set_names): Add codeview.
(codeview_debuginfo_p): New function.
(dwarf_based_debuginfo_p): Add CODEVIEW clause.
(set_debug_level): Handle CODEVIEW_DEBUG.
* toplev.cc (process_options): Handle codeview.
gcc/testsuite
* gcc.dg/debug/codeview/codeview-1.c: New test.
* gcc.dg/debug/codeview/codeview.exp: New testsuite driver.
|
|
When recognizing bit counting idiom, include pattern "x * 2"
for "x << 1", and "x / 2" for "x >> 1" (given x is unsigned).
gcc/ChangeLog:
PR tree-optimization/114760
* tree-ssa-loop-niter.cc (is_lshift_by_1): New function
to check if STMT is equivalent to x << 1.
(is_rshift_by_1): New function to check if STMT is
equivalent to x >> 1.
(number_of_iterations_cltz): Enhance the identification
of logical shift by one.
(number_of_iterations_cltz_complement): Enhance the
identification of logical shift by one.
gcc/testsuite/ChangeLog:
PR tree-optimization/114760
* gcc.dg/tree-ssa/pr114760-1.c: New test.
* gcc.dg/tree-ssa/pr114760-2.c: New test.
|
|
The canonical way to indicate that a range operator is unsupported is
to return false, which has the sematic meaning of VARYING. This patch
cleans up a few default virtuals that were trying harder to set
VARYING manually.
gcc/ChangeLog:
* range-op-ptr.cc (range_operator::fold_range): Return false.
|
|
The trap in the range-op dispatch code is really an internal debugging
aid, and only a temporary one for a few weeks while the dust settles.
This patch turns it off by default, allowing problematic passes to
turn it on for analysis.
gcc/ChangeLog:
* range-op.cc (TRAP_ON_UNHANDLED_POINTER_OPERATORS): New
(range_op_handler::fold_range): Use it.
(range_op_handler::op1_range): Same.
(range_op_handler::op2_range): Same.
(range_op_handler::lhs_op1_relation): Same.
(range_op_handler::lhs_op2_relation): Same.
(range_op_handler::op1_op2_relation): Same.
|
|
This patch implements built-in trait for std::is_nothrow_invocable.
gcc/cp/ChangeLog:
* cp-trait.def: Define __is_nothrow_invocable.
* constraint.cc (diagnose_trait_expr): Handle
CPTK_IS_NOTHROW_INVOCABLE.
* semantics.cc (trait_expr_value): Likewise.
(finish_trait_expr): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/ext/has-builtin-1.C: Test existence of
__is_nothrow_invocable.
* g++.dg/ext/is_nothrow_invocable.C: New test.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Jason Merrill <jason@redhat.com>
|