Age | Commit message (Collapse) | Author | Files | Lines |
|
The previous fix was not robust enough in the presence of transient scopes.
gcc/ada/ChangeLog:
* exp_ch4.adb (Insert_Conditional_Object_Declaration): Deal with a
transient scope being created around the declaration.
* freeze.adb (Freeze_Entity): Do not call Freeze_Static_Object for
a renaming declaration.
|
|
The comment incorrectly mentions decimal fixed point.
gcc/ada/ChangeLog:
* libgnat/s-vafi32.ads: Fix head description.
* libgnat/s-vafi64.ads: Likewise.
* libgnat/s-vafi128.ads: Likewise.
|
|
Walks all trees (not just the main unit), deals with switches and
flags. Doesn't check much of anything yet (asserts that "unused" nodes
are not present).
Move decisions (what tree(s) to check, what switches enable checking)
from the caller to the body of VAST.
gcc/ada/ChangeLog:
* vast.adb: Initial implementation.
* vast.ads: Rename procedure. Remove parameter; body should decide
what to do.
* lib.ads (ipu): Minor: Rewrite comment for brevity, and because
of an inconvenient misspelling.
(Num_Units): Not used; remove.
(Remove_Unit): Minor: Remove "Currently" (which was current a decade
ago from) comment.
* lib.adb (Num_Units): Not used; remove.
* debug_a.adb (Debug_A_Entry): Fix bug: Use Write_Name_For_Debug,
so this won't crash on the Error node.
* debug.adb: Document -gnatd_V and -gnatd_W compiler switches.
* exp_ch6.adb (Validate_Subprogram_Calls): Remove redundant check for
Serious_Errors_Detected. (We turn off code gen when errors are
detected.)
* frontend.adb: Move decisions into VAST body.
* namet.ads (Present): Remove unnecessary overriding; these are
inherited by the derived types.
* namet.adb (Present): Likewise.
|
|
The compiler fails with a Storage_Error when compiling a container aggregate
for a Map type coming from an instantiation of Ada.Containers.Ordered_Maps
that specifies an enumeration type for the Key_Type formal.
gcc/ada/ChangeLog:
* exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos
to Entity (Expr) rather than Expr.
|
|
gcc/ada/ChangeLog:
* sem_ch3.adb (Find_Type_Of_Object): Fix comment.
|
|
"Typ" is typically used to name constants that are entity IDs for types.
Before this patch, a constant local to Analyze_Component_Declaration
designating a syntactic subtype indication had that name. This patch
renames it to "Ind".
Code cleanup; behavior is unaffected.
gcc/ada/ChangeLog:
* sem_ch3.adb (Analyze_Component_Declaration): Rename constant.
|
|
Before this patch, Constrain_Array had a feature where it could be
passed Empty for the first actual and would then create an Itype itself.
There was only one use of this feature and it was unnecessary, so this
patch removes it.
gcc/ada/ChangeLog:
* sem_ch3.adb (Constrain_Array): Simplify.
(Process_Subtype): Adjust.
|
|
Root_Type does not return the same type for the private and the full view of
a derived private tagged type when both derive from an interface type.
gcc/ada/ChangeLog:
* sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find
the root type of an aggregate of a derived tagged type.
|
|
This patch fixes a bug in System.Stack_Usage.Tasking.Compute_All_Tasks
where it would attempt to read the stack of threads that had already
completed.
gcc/ada/ChangeLog:
* libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks.
|
|
Some pragma nodes like the ones for Assertion_Policy are
replaced by a Null_Statement. This is not taken into account
when analyzing if the pragma is a configuration pragma.
gcc/ada/ChangeLog:
* sem_prag.adb (Is_Configuration_Pragma): Check that nodes
preceding the pragma are pragma nodes or originally were
pragma nodes.
|
|
Even though the issue is not user-visible, it's a (minor) departure from the
specification of the procedure.
gcc/ada/ChangeLog:
* libgnat/s-valued.adb (Integer_to_Decimal): Add Extra parameter and
use its value to call Bad_Value on boundary values.
(Scan_Decimal): Adjust call to Integer_to_Decimal.
(Value_Decimal): Likewise.
|
|
Before this patch, Process_Subtype looked at the parent of its argument
to determine whether it was called in a context where it was OK for the
subtype mark to refer to the incomplete view of a type. This patch adds
a new formal so that it becomes the responsibility of the caller in
order to make the code simpler overall.
The only change in the behavior of the compiler is that the messages
emitted in some error situations with the -gnatf switch are slightly
different.
gcc/ada/ChangeLog:
* sem_ch3.ads (Process_Subtype): New formal.
* sem_ch3.adb (Process_Subtype): Likewise.
(Analyze_Subtype_Declaration, Access_Type_Declaration): Use new
formal.
|
|
Process_Subtype calls itself in some error situations. This recursive
call was not updated together with the recent addition of the
Excludes_Null formal. This does not matter in practice because there can
never be both a null exclusion and another constraint at the same time,
but this patch updates the call anyway to make the situation clearer.
gcc/ada/ChangeLog:
* sem_ch3.adb (Process_Subtype): Fix recursive call.
|
|
Block_Node is the name of an entity field, so the change renames local
variables with this name for the sake of clarity.
gcc/ada/ChangeLog:
* par-ch5.adb (P_Declare_Statement): Rename local variable.
(P_Begin_Statement): Likewise.
|
|
With the current representation of GNAT AST the entity fields are not reused.
gcc/ada/ChangeLog:
* einfo.ads (Overridden_Operation, Static_Initialization): Remove
comments about a reused entity field.
|
|
This patch removes parentheses and vertical alignment that misleadingly
suggested the presence of function calls where there weren't any.
gcc/ada/ChangeLog:
* sem_ch3.adb (Process_Subtype): Tweak formatting.
|
|
This patch adds an assertion that checks that expanded code does not
contain erroneous access subtype definitions.
gcc/ada/ChangeLog:
* sem_ch3.adb (Process_Subtype): Add assertion.
|
|
gcc/ada/ChangeLog:
* sem_ch3.adb (Process_Subtype): Factorize initialization of variable.
|
|
|
|
Attempting to use a fixed-lower-bound array type (or subtype) as
an actual parameter for a formal unconstrained array type was being
rejected by the compiler (complaining about the index type of the
actual not matching the index type of the formal type). The compiler
was improperly testing the actual's FLB range and finding that it didn't
statically match the index type of the formal array type; it should
instead test the underlying index type of the FLB type or subtype.
gcc/ada/ChangeLog:
* sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index,
set Etype of the newly created itype's Scalar_Range from the index's Etype.
* sem_ch12.adb (Validate_Array_Type_Instance): If the actual subtype is
a fixed-lower-bound type, then check again the Etype of its Scalar_Range.
|
|
In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified
for a formal array type, but they were wrongly accepted on any formal type.
Also, we don't need to check if the corresponding pragmas appear in Ada 2022
mode, because generic formal parameters can't have explicit representation
pragmas in any Ada version and can only have aspects since Ada 2022.
gcc/ada/ChangeLog:
* sem_prag.adb (Analyze_Pragma): Fix conditions for legality checks on
formal type declarations.
|
|
In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified
for a formal array type, but then they need to be set on the base type entity.
Otherwise we get an assertion failure in debug build and wrong legality errors
in production builds.
gcc/ada/ChangeLog:
* sem_prag.adb (Analyze_Pragma): If pragmas apply to a formal array
type, then set the flags on the base type.
|
|
This patch factorizes two if statements together in the body of
Process_Subtype, to improve readability.
gcc/ada/ChangeLog:
* sem_ch3.adb (Process_Subtype): Clarify code.
|
|
Before this patch, Process_Subtype looked at the parent of its argument
to determine whether it was called in a context that excluded null. This
patch replaces this lookup with a new formal parameter to
Process_Subtype, and updates the calls to it accordingly.
gcc/ada/ChangeLog:
* sem_ch3.ads (Process_Subtype): Add formal.
* sem_ch3.adb (Process_Subtype): Use new formal.
(Analyze_Subtype_Declaration, Array_Type_Declaration,
Build_Derived_Access_Type): Pass new actual.
* sem_ch4.adb (Find_Type_Of_Object): Likewise.
|
|
This patch migrates the handling of "premature usage" type of error to
the Is_Self_Hidden mechanism.
gcc/ada/ChangeLog:
* sem_ch6.adb (Set_Formal_Mode): Extend profile. Move parts of the
body…
(Process_Formals): … here. Move call to Set_Formal_Mode earlier. Call
Set_Is_Not_Self_Hidden in second traversal.
|
|
When a container aggregate for a Bounded_Vector type involves an iterated
association that is assigned to a vector object whose capacity (as defined
by the Capacity discriminant) is less than the number of elements of the
aggregate, Constraint_Error should be raised due to failing a discriminant
check on the assignment. But the compiler fails to do proper expansion,
plus omits the check, and instead creates a temporary whose capacity is
bounded by that of the target vector of the assignment. It attempts to
assign all elements of the aggregate to the temporary, resulting in
a failure on a call to the Replace_Element operation that assigns past
the length of the temporary vector (which can result in a Storage_Error
due to a segment violation).
This is fixed by ensuring that the temporary object is declared with
an unconstrained base subtype rather than the assignment target's
constrained subtype.
gcc/ada/ChangeLog:
* exp_aggr.adb (Expand_Container_Aggregate): Use the Base_Type of the
subtype provided by the context as the subtype of the temporary object
initialized by the aggregate.
|
|
P_Qualified_Simple_Name and P_Function_Name contain essentially the same
code, except that P_Function_Name does not error out on an operator symbol
that is followed by something else than a dot.
This deletes P_Function_Name and changes P_Qualified_Simple_Name[_Resync]
to not error out either in this case, with the only consequence that the
error message given for:
generic
type T is private;
function "&" (A, B : String) return String;
procedure Proc is new "&" (Integer);
is now identical to the one given for:
generic
type T is private;
function "&" (A, B : String) return String;
function Func is new "&" (Integer);
namely:
q.ads:7:12: error: operator symbol not allowed for generic subprogram
gcc/ada/ChangeLog:
* par-ch4.adb (P_Function_Name): Delete body.
(P_Qualified_Simple_Name_Resync): Do not raise Error_Resync on an
operator symbol followed by something else than a dot.
* par-ch6.adb (P_Subprogram): Do not call P_Function_Name.
* par.adb (P_Function_Name): Delete declaration.
|
|
Before this patch, the calls to set the proper Ekind of component
entities were delayed in order to catch "premature usage" type of
errors. This patch moves those calls to the natural place, at the
beginning of Analyze_Component_Declaration, and makes premature usage
error dectection use the newer Is_Self_Hidden mechanism.
The motivation for this patch is to accomodate future removals of
operations on E_Void entities.
gcc/ada/ChangeLog:
* sem.adb (Analyze): Adapt to new Ekinds.
* sem_ch3.adb (Analyze_Component_Declaration): Set Ekind early.
(Is_Visible_Component, Record_Type_Definition): Adjust.
|
|
gcc/ada/ChangeLog:
* sem.adb (Analyze): Fix comment.
|
|
P_Qualified_Simple_Name and P_Qualified_Simple_Name_Resync contain exactly
the same code, so this change makes the former call the latter.
gcc/ada/ChangeLog:
* par-ch4.adb (P_Name): Remove obsolete references in comments.
(P_Qualified_Simple_Name): Call P_Qualified_Simple_Name_Resync.
(P_Qualified_Simple_Name_Resync): Adjust a couple of comments.
|
|
pre/post
The revised handling of inherited class-wide pre/postconditions (for
properly implementing the rules of RM 6.1.1(7/5)) broke two SPARK tests
(N709-001__contracts and V516-041__private_ownership). This change fixes
that, by refining the test for detecting formal parameters used as actuals
in calls to primitive functions, as well as adding handling for 'Result
attributes given as actuals in such calls.
gcc/ada/ChangeLog:
* exp_util.adb (Call_To_Parent_Dispatching_Op_Must_Be_Mapped): Replace
test of Covers with test of Is_Controlling_Formal. Add handling for
'Result actuals. Remove Actual_Type and its uses.
|
|
The selector_name of a selected_component always points to an identifier than
is an object name, i.e. specifically, name of a component or discriminant.
There is no need to examine this.
Code cleanup; behavior is unaffected.
gcc/ada/ChangeLog:
* sem_util.adb (Is_Name_Reference): Remove check for selector_name of a
selected_component; reuse existing code for indexed components and
slices.
(Statically_Names_Object): Remove dead code.
|
|
Namely E_Constant and E_Variable entities.
gcc/ada/ChangeLog:
* einfo.ads (Overlays_Constant): Define in constants and variables.
* gen_il-gen-gen_entities.adb (Entity_Kind): Move Overlays_Constant
semantic flag to...
(Constant_Or_Variable_Kind): ...here.
* sem_util.adb (Note_Possible_Modification): Add guard.
|
|
A previous change (commit 33eebd96d27fa2b29cec79f55167a11aaf7f4802)
removed code in Analyze_Object_Renaming that tranformed renamings
into object declarations. This reinstates that code.
Removing the code causes failures in
gnatbugs-large/2023/gnat-435_deep_blue_capital.
Ideally, we SHOULD remove that transformation at some point,
but that will require further changes.
gcc/ada/ChangeLog:
* exp_ch6.adb: (Make_Build_In_Place_Call_In_Object_Declaration):
Deal with renamings transformed into object declarations.
* sem_ch8.adb (Analyze_Object_Renaming):
Reinstate transformation of a renaming into
an object declaration.
|
|
Setting the proper Ekind on object entities was once needed to catch
cases of premature usages. The introduction of Is_Self_Hidden changed
that, so this patch replaces the Mutate_Ekind calls in the natural
place.
gcc/ada/ChangeLog:
* sem_ch3.adb (Analyze_Object_Declaration): Call Mutate_Ekind earlier.
|
|
Before this patch, the constant mark of object declarations was stripped
in some error situations. This behavior is currently not useful so this
patch removes it.
gcc/ada/ChangeLog:
* sem_ch3.adb (Analyze_Object_Declaration): Tweak error handling.
|
|
Syntax for the Abstract_State contract is the same as for extended aggregates,
but conceptually they are completely different. This patch specializes error
messages emitted on syntax errors for these constructs.
gcc/ada/ChangeLog:
* par-ch13.adb (Get_Aspect_Specifications): Save and restore flag while
parsing aspect Abstract_State.
* par-ch2.adb (P_Pragma): Same while parsing pragma Abstract_State.
* par-ch4.adb (P_Aggregate_Or_Paren_Expr): Specialize error message
for contract Abstract_State and extended aggregate.
* par.adb (Inside_Abstract_State): Add new context flag.
|
|
Before this patch, Build_Static_Dispatch_Tables was called on generic
package bodies. While this has not been proved to cause any actual bug,
it was clearly inappropriate and also useless, so this patch removes
those calls.
gcc/ada/ChangeLog:
* sem_ch10.adb (Analyze_Compilation_Unit): Check for generic bodies.
* exp_disp.adb (Build_Dispatch_Tables): Likewise.
|
|
Fix crash occurring when overlay applies to protected component and expansion
is disabled, e.g. because of semantic checking mode (switch -gnatc) or because
the compiler is running in GNATprove mode.
Also, simply pick the type of overlaid object from the attribute prefix itself.
gcc/ada/ChangeLog:
* sem_util.adb (Find_Overlaid_Entity): Don't call Etype on empty Ent;
tune style; move computation of Overl_Typ out of the loop.
|
|
Add documentation to pragmas Ada_83, Ada_95, Ada_05, Ada_12,
and Ada_2022: when placed before a library level package
specification they are not propagated to the corresponding
package body; they must be added explicitly to the package
body.
gcc/ada/ChangeLog:
* doc/gnat_rm/implementation_defined_pragmas.rst: Adding
documentation.
* doc/gnat_ugn/the_gnat_compilation_model.rst: ditto.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
|
|
This patch removes a test for a condition that can never be false.
gcc/ada/ChangeLog:
* sem_attr.adb (Analyze_Attribute): Remove test.
|
|
This patch removes a special exemption in Enter_Name. That exemption was
preceded by a comment which described what situations it was supposed to
be required for, but it was unnecessary even in those situations.
gcc/ada/ChangeLog:
* sem_util.adb (Enter_Name): Remove special handling.
|
|
This patch removes a comment that misleadingly presented a condition as
being met only in rare situations, while it's in fact satisfied in very
basic cases such as simple object declarations.
gcc/ada/ChangeLog:
* sem_util.adb (Enter_Name): Remove comment.
|
|
In the case of "X : T := F (...);", where T is a constrained
discriminated tagged subtype, perform a constraint check
after F returns. The result of F is allocated by the callee
on the secondary stack in this case.
Note that there are still missing checks for some build-in-place
calls.
gcc/ada/ChangeLog:
* exp_ch6.adb: Remove a couple of "???" suggesting something that
we will likely never do.
(Make_Build_In_Place_Call_In_Object_Declaration):
When a constraint check is needed, do the check.
Do it at the call site for now.
The check is still missing in the untagged case,
because the caller allocates in that case.
* sem_ch8.adb (Analyze_Object_Renaming):
Remove obsolete transformation of a renaming into
an object declaration. Given that we also (sometimes) tranform
object declarations into renamings, this transformation was
adding complexity; the new code in
Make_Build_In_Place_Call_In_Object_Declaration above
would need to explicitly avoid the run-time check in the case of
renamings, because renamings are supposed to ignore the nominal
subtype. Anyway, it is no longer needed.
* exp_ch3.adb (Expand_N_Object_Declaration): Rewrite comment;
it IS clear how to do it, but we haven't done it right yet.
|
|
This patch removes a leftover reference to the concept of node extension
and a note about aspect specification that's been incorrect since at
least the latest rework of aspect specification representation.
gcc/ada/ChangeLog:
* atree.ads (Copy_Node): Fix comment.
|
|
When attribute Valid is applied to a private type, we used the signedness of
its implementation base type which wrongly included negative values.
gcc/ada/ChangeLog:
* exp_attr.adb (Expand_N_Attribute_Reference): When expanding attribute
Valid, use signedness from the validated view, not from its base type.
|
|
In the case where the overlaid object is nested in a record or is an
array element as in:
for Foo'Address use Item.Nested_Item'Address;
or for Foo'Address use Item (Bar)'Address;
the compiler was not emitting a warning in case of differing
Scalar_Storage_Order values.
gcc/ada/ChangeLog:
* sem_util.adb (Find_Overlaid_Entity): Add extra parameter to
extract the type being overlaid.
(Note_Possible_Modification): Adjust call to Find_Overlaid_Entity.
(Ultimate_Overlaid_Entity): Likewise.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Likewise.
* sem_util.ads (Find_Overlaid_Entity): Add extra parameter to
extract the type being overlaid.
* freeze.adb (Check_Address_Clause): Likewise.
|
|
GNAT was incorrectly implementing the Ada rules for resolving calls to
primitive functions within inherited class-wide pre- and postconditions,
as specified in RM22 6.1.1 (relating to AI12-0113). Only function calls
that involve formals of the associated primitive subprogram should be
treated using the "(notional) formal derived type" rules. In particular,
calls that are tag-indeterminate (for example, "F(G)") should not be mapped
to call the corresponding primitives of the derived type (they should still
call the primitives of the ancestor type). The fix for this involves a new
predicate function that recursively traverses calls to determine the calls
that satisfy the criteria for mapping. These changes also completely remove
the mapping of formals that was done in Contracts.Merge_Class_Conditions
(in Inherit_Condition), since the mapping will be done later anyway by
Build_Class_Wide_Expression, and the earlier mapping interferes with that.
Note: The utility function Sem_Util.Check_Parents is no longer called
after removal of the single call to it from contracts.adb, but it's being
retained (along with the generic subprograms in Atree that it depends on)
for possible use in VAST.
gcc/ada/ChangeLog:
* contracts.adb (Inherit_Condition): Remove Assoc_List and its uses
along with function Check_Condition, since mapping of formals will
effectively be done in Build_Class_Wide_Expression (by Replace_Entity).
* exp_util.adb (Replace_Entity): Only rewrite entity references in
function calls that qualify according to the result of calling the
new function Call_To_Parent_Dispatching_Op_Must_Be_Mapped.
(Call_To_Parent_Dispatching_Op_Must_Be_Mapped): New function that
determines whether a function call to a primitive of Par_Subp
associated tagged type needs to be mapped (according to whether
it has any actuals that reference controlling formals of the
primitive).
|
|
This patch removes a comment that was made incorrect by the introduction
of Is_Self_Hidden.
gcc/ada/ChangeLog:
* sem_ch3.adb (Analyze_Object_Declaration): Remove comment.
|
|
gcc/ada/ChangeLog:
* sem_util.ads (Current_Entity_In_Scope): Add example in comment.
|