aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2025-06-30ada: Fix missing rounding in System.Value_R.Scan_Raw_RealEric Botcazou1-11/+36
The extra digit returned by the function is supposed to be rounded, either by Scan_Integral_Digits or by Scan_Decimal_Digits, but that is not the case when it is the last digit read by Scan_Integral_Digits. The problem is fixed by rounding it in Scan_Decimal_Digits in this case. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits): Also pretend that the precision limit was just reached if it was already reached. (Scan_Integral_Digits): Add Extra_Rounded out parameter, set it to False on entry and to True when Extra is rounded. (Scan_Raw_Real): New Extra_Rounded local variable. Pass it in the calls to Scan_Integral_Digits. If it is True, pass a dummy extra digit to Scan_Decimal_Digits.
2025-06-30ada: Ignore ghost predicate in Ada.Strings.SuperboundedClaire Dross1-4/+5
Add an assertion policy to ignore the ghost predicates in Ada.Strings.Superbounded. gcc/ada/ChangeLog: * libgnat/a-strsup.ads: Ignore Ghost_Predicate in the assertion policy.
2025-06-30ada: Array aggregates of mutably tagged objectsJavier Miranda8-74/+287
When an array of mutably tagged class-wide types is initialized with an array aggregate, the compiler erroneously rejects it reporting that the type of the aggregate cannot be a class-wide type. In addition, Program_Error is not raised at runtime on array type or record type objects when they have mutably tagged abstract class-wide type components that are initialized by default. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Record_Aggregate): Adjust the code to handle mutably tagged class-wide types since they don't have discriminants, but all class-wide types are considered to have unknown discriminants. Initialize mutably tagged class-wide type components calling their IP subprogram. * exp_aggr.adb (Gen_Assign): Handle mutably tagged class-wide type components that have an initializing qualified expression, and mutably tagged class-wide components default initialization. (Gen_Loop): Handle mutably tagged class-wide types. (Gen_Assign): ditto. (Build_Record_Aggr_Code): Default initialization of mutably tagged class-wide types is performed by their IP subprogram. * exp_ch3.adb (Init_Component): Generate code to raise Program_Error in the IP subprogram of arrays when the type of their components is a mutably tagged abstract class-wide type. (Build_Init_Procedure): ditto for the init procedure of record types. (Build_Init_Statements): Ensure that the type of the expression initializing a mutably class-wide tagged type component is frozen. (Requires_Init_Proc): Mutably tagged class-wide types require the init-proc since it takes care of their default initialization. * sem_util.adb (Needs_Simple_Initialization): Mutably tagged class-wide types don't require simple initialization. * types.ads (PE_Abstract_Type_Component): New reason for Program_Error. * types.h (PE_Abstract_Type_Component): ditto. * exp_ch11.adb (Get_RT_Exception_Name): Handle new reason for Program_Error. * libgnat/a-except.adb (Rcheck_PE_Abstract_Type_Component): New subprogram.
2025-06-30ada: Sort subprogram declaration in alphabetic orderPiotr Trojanek1-21/+21
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_util.ads (Get_Enclosing_Object, Get_Enum_Lit_From_Pos, Is_Universal_Numeric_Type): Reorder declarations.
2025-06-30ada: Ignore unchecked type conversions while getting enclosing objectPiotr Trojanek1-1/+3
This patch both makes GNAT emit warnings on unused assignments where previously they were suppressed for obscure reasons and synchronizes routine Get_Enclosing_Object with a similar routine in GNATprove (which differs in handling of explicit dereferences). gcc/ada/ChangeLog: * sem_util.adb (Get_Enclosing_Object): Traverse unchecked type conversions since they from the compiler and should be transparent for semantic reasoning.
2025-06-30ada: Fix Itype-related predicate check omissions (part 2).Steve Baird1-0/+19
Add to the previous fix for this issue to better handle cases where GNATProve calls Einfo.Utils.Predicate_Function, passing in an Itype. gcc/ada/ChangeLog: * einfo-utils.adb (Predicate_Function): Look through an Itype if that takes us to another subtype of the same type.
2025-06-30ada: Filling in gaps in handling of inherited Pre/Post'Class aspectsGary Dismukes2-52/+156
The initial set of changes for doing proper mapping of calls to primitive functions in Pre/Post'Class aspects inherited by derived types was not handling some cases (such as when formals are referenced as part of dereferences, certain aspects such as 'Old and 'Access, and conditional and declare expressions), and mishandling other cases (such as nested function calls). This set of changes attempts to properly address those cases. It also includes a change to suppress unneeded (and sometimes wrong) accessibility checks on conversions of actual parameters of a derived type to the parent type when passing them on calls to parent primitives (encountered while developing these changes). gcc/ada/ChangeLog: * exp_util.adb (Must_Map_Call_To_Parent_Primitive): Change function name (was Call_To_Parent_Dispatching_Op_Must_Be_Mapped). Move logic for attributes and dereferences, plus testing for controlled formals, into new function Expr_Has_Ctrl_Formal_Ref. Add handling for access attributes, multiple levels of attributes/dereferences, conditional_expressions, and declare_expressions. Properly account for function calls with multiple operands and enclosing calls. (Expr_Has_Ctrl_Formal_Ref): New function to determine whether an expression is a reference to a controlling formal or has a prefix that is such a reference. (Is_Controlling_Formal_Ref): New function in Expr_Has_Ctrl_Formal_Ref to determine if a node is a direct reference to a controlling formal. * freeze.adb (Build_DTW_Body): Create an unchecked conversion instead of a regular type conversion for converting actuals in calls to parent inherited primitives that are wrapped for inherited pre/postconditions. Avoids generating unnecessary checks (such as accessibility checks on conversions for anonymous access formals).
2025-06-30ada: Tune name and commend document of a ghost utility routinePiotr Trojanek3-42/+40
Detection of ghost entities work similarly for names of objects (in assignment statements) and for names of subprograms (in subprogram calls). Tune routine name and its comment to match this similarity. gcc/ada/ChangeLog: * sem_util.ads (Get_Enclosing_Ghost_Entity): Rename spec. * sem_util.adb (Get_Enclosing_Ghost_Object): Rename body; reorder alphabetically; adapt recursive call. * ghost.adb: Adapt calls to Get_Enclosing_Ghost_Object.
2025-06-30ada: Fix detection of ghost objects in unusual procedure callsPiotr Trojanek1-30/+4
When name of a called procedure involves unusual constructs, e.g. type conversions (like in "Typ (Obj).all"), we must look at the outermost construct to decide whether the name denotes a ghost entity. gcc/ada/ChangeLog: * ghost.adb (Ghost_Entity): Remove; use Get_Enclosing_Ghost_Object instead; adapt callers.
2025-06-30ada: Fix bogus error for pragma No_Component_Reordering on record typeEric Botcazou1-8/+9
This happens when the record type has an incomplete declaration before its full declaration and is fixed by calling Find_Type appropriately. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pragma) <Pragma_No_Component_Reordering>: Call Find_Type on the first argument of the pragma.
2025-06-30ada: Remove redundant `gnatls -l` switchTonu Naks1-39/+0
gcc/ada/ChangeLog: * gnatls.adb: remove -l switch
2025-06-30ada: 'Size'Class and interface types documentationSteve Baird2-157/+234
Update GNAT RM documentation of the Size'Class aspect. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Update documentation for mutably tagged types and the Size'Class aspect. * gnat_rm.texi: Regenerate.
2025-06-30ada: Fix detection of ghost objects in assignment statementsPiotr Trojanek3-58/+38
Remove duplicated and inconsistent code for detecting ghost objects on the left-hand side of assignment statements. Fix detection in the presence of attribute references (e.g. "X'Access.all"), function calls (e.g. "F.all"), qualified expressions (e.g. "T'(new Integer'(0)).all") and unchecked type conversions (which come from expansion). gcc/ada/ChangeLog: * ghost.adb (Whole_Object_Ref): Remove; use Get_Enclosing_Ghost_Object instead. (Is_Ghost_Assignment): Handle more than object identifiers. (Mark_And_Set_Ghost_Assignment): Likewise. * sem_util.adb (Get_Enclosing_Ghost_Object): Detect more expressions as ghost references; rename to better match the intended meaning. * sem_util.ads (Get_Enclosing_Ghost_Object): Rename; adjust comment.
2025-06-30ada: Fix fallout of latest change to aggregate expansionEric Botcazou1-1/+3
It exposed a small loophole in the Backend_Processing_Possible predicate. gcc/ada/ChangeLog: * exp_aggr.adb (Backend_Processing_Possible.Component_Check): Return False for delayed conditional expressions.
2025-06-30ada: Elide copy for calls as values of nonlimited by-reference componentsEric Botcazou6-65/+131
...in aggregates. This prevents a temporary from being created on the primary stack to hold the result of the function calls before it is copied to the component of the aggregate in the nonlimited by-reference case. This requires a small tweak to Check_Function_Writable_Actuals to avoid giving a spurious error in a specific case. gcc/ada/ChangeLog: * exp_aggr.ads (Parent_Is_Regular_Aggregate): New predicate. * exp_aggr.adb (In_Place_Assign_OK.Safe_Component): Implement more accurate criterion for function calls. (Convert_To_Assignments): Use Parent_Is_Regular_Aggregate predicate. (Expand_Array_Aggregate): Likewise. Remove obsolete comment. (Initialize_Component): Do not adjust when the expression is a naked function call and Back_End_Return_Slot is True. (Parent_Is_Regular_Aggregate): New predicate. * exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Add test of Back_End_Return_Slot in conjunction with a function call. * exp_ch4.adb (Expand_Allocator_Expression): Likewise. Use the Is_Container_Aggregate predicate to detect container aggregates. (Expand_N_Case_Expression): Delay the expansion if the parent is a regular aggregate and the type should not be copied. (Expand_N_If_Expression): Likewise. (New_Assign_Copy): New function. * exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out when the parent is a regular aggregate. * sem_util.adb (Check_Function_Writable_Actuals): Do not take into account attribute references created by the compiler.
2025-06-30ada: use pointer decay for socket address type compatibilityAlexandre Oliva1-6/+6
GCC 14 is stricter about type conversions. Taking the address of an array and decaying the array to a pointer to its first element yield the same address, but the types are no longer considered compatible. The socket data structures want decayed pointers rather than addresses of arrays, so drop the '&'s. gcc/ada/ChangeLog: * socket.c [__vxworks] (__gnat_gethostbyname): Drop excess '&'. (__gnat_gethostbyaddr): Likewise.
2025-06-30ada: include header to declare isalpha in adaintAlexandre Oliva1-0/+1
A vxworks-specific part of adaint.c calls isalpha without including ctype.h. gcc-14 rejects calls of undeclared functions. Include the required header file when compiling for vxworks. gcc/ada/ChangeLog: * adaint.c [__vxworks]: Include ctype.h.
2025-06-30ada: Record type Put_Image procedures omitting discriminant valuesSteve Baird1-14/+41
If a type T has a partial view with a known_discriminant_part and no user-specified Put_Image aspect specification, then the output generated by T'Put_Image would incorrectly omit the discriminant values. gcc/ada/ChangeLog: * exp_put_image.adb (Build_Record_Put_Image_Procedure): If Discriminant_Specifications takes us from the full view of a type to an (intentionally) unanalyzed subtree, then instead find discriminant entities by calling Discriminant_Specifications on the partial view of the type.
2025-06-30ada: Fix crash on nested access-to-subprogram typesRonan Desplanques3-11/+11
This patch fixes a crash on some subprograms with anonymous access-to-subprogram parameters by removing delayed freezing of subprograms in some cases where it wasn't necessary. The -gnatD output for itypes is also improved. gcc/ada/ChangeLog: * sem_ch6.adb (Check_Delayed_Subprogram, Possible_Freeze): Restrict cases where freezing is delayed. * sem_ch6.ads (Check_Delayed_Subprogram): Improve documentation comment. * sprint.adb (Write_Itype): Improve output.
2025-06-30ada: Remove redundant condition in test of System.Val_Real.Integer_To_RealEric Botcazou2-8/+9
The second condition of the conjunction is redundant with the first. gcc/ada/ChangeLog: * libgnat/s-valrea.adb (Integer_to_Real): Rename to... (Integer_To_Real): ...this. Remove the second condition of the conjunction in the test for the zero value. (Scan_Real): Adjust to above renaming. (Value_Real): Likewise. * libgnat/s-valuer.ads (Scan_Raw_Real): Add note about Val.
2025-06-30ada: Fix a couple of typos in the sanitizers for AdaJose Ruiz2-8/+5
gcc/ada/ChangeLog: * doc/gnat_ugn/gnat_and_program_execution.rst: Fix a couple of minor formatting issues. * gnat_ugn.texi: Regenerate.
2025-06-30ada: Add entity chain debug printing subprogramsRonan Desplanques2-0/+72
This patchs adds two pn-like subprograms that print entity chains. gcc/ada/ChangeLog: * treepr.ads (Print_Entity_Chain, pec, rpec): New subprograms. * treepr.adb (Print_Entity_Chain, pec, rpec): Likewise.
2025-06-30ada: Fix typo in commentRonan Desplanques1-1/+1
gcc/ada/ChangeLog: * atree.ads (Parent_Or_List_Containing): Fix typo.
2025-06-30ada: Tweak handling of Parent field in Print_NodeRonan Desplanques1-2/+2
Before this patch, Print_Node failed to honor its Prefix_Char formal parameter when printing the Parent field. This had no consequences because Prefix_Char was only used to print members of Nlists, and those don't have a parent in the tree. But this patch fixes it anyway in preparation for new debug printing features. gcc/ada/ChangeLog: * treepr.adb (Print_Node): Tweak Parent field printing.
2025-06-30ada: Document sanitizers for AdaJose Ruiz2-2/+4
gcc/ada/ChangeLog: * doc/gnat_ugn/gnat_and_program_execution.rst: Add the documentation about using sanitizers with Ada code. * gnat_ugn.texi: Regenerate.
2025-06-30ada: Document sanitizers for AdaJose Ruiz2-173/+787
gcc/ada/ChangeLog: * doc/gnat_ugn/gnat_and_program_execution.rst: Add the documentation about using sanitizers with Ada code. * gnat_ugn.texi: Regenerate.
2025-06-30ada: Remove dead branch from Get_Enclosing_ObjectPiotr Trojanek1-8/+1
The dead branch in routine Get_Enclosing_Object was most likely some experiment from the early days of GNATprove. This routine is meant to be called with the LHS of an assignment statement where an implicit dereference is always rewritten into explicit one, regardless if code is generated. gcc/ada/ChangeLog: * sem_util.adb (Get_Enclosing_Object): Remove dead code.
2025-06-30ada: Fix Itype-related predicate check omissions.Steve Baird3-3/+118
Clean up problematic interactions between Itype subtypes and predicates, which were causing required predicate checks to be (incorrectly) omitted. gcc/ada/ChangeLog: * einfo-utils.adb (Predicate_Function): Improve handling of a case where a predicate specified for a subtype of a partial view of a type was incorrectly ignored. (Set_Predicate_Function): If the attribute has already been set to the same value, then do nothing (instead of raising P_E). * sem_ch13.adb (Build_Predicate_Function): Add new function Has_Source_Predicate. If a subtype inherits a predicate but also has its own explicitly specified predicate, then avoid misinterpreting the presence of the function built for the inherited predicate to mean that no additional predicate function is needed. * sem_util.adb (Build_Subtype): In the case where we are given a constrained record or array subtype and we need to construct a different subtype, subject to a different constraint, the subtype_mark of the constructed subtype needs to reference an unconstrained subtype (because a new constraint is going to be imposed). If the Predicated_Parent attribute of the given subtype is present and refers to a suitable unconstrained subtype, then use that subtype instead of setting the Predicated_Parent attribute on a new node (and performing the associated attribute copying).
2025-06-30ada: Fix internal error on Ghost aspect applied to Big_IntegersEric Botcazou1-0/+7
That's a regression introduced by the rewrite of the finalization machinery, in the form of dangling references to Master_Node entities remaining in the tree after the removal of the ignored Ghost code. gcc/ada/ChangeLog: * exp_ch7.adb (Process_Transient_In_Scope): Bail out if the object is an ignored ghost entity.
2025-06-30ada: Fix internal error on expression function called for default expressionEric Botcazou1-13/+17
This happens for the default expression of a controlled component when an aggregate is used for the record type, because of a freeze node generated for the expression within an artificial block that is needed to implement the cleanup actions attached to the assignment of the component. This is fixed by extending the special treatment applied to freeze nodes by Insert_Actions, in the case of loops generated for aggregates, to the case of blocks generated for aggregates. gcc/ada/ChangeLog: * exp_util.adb (Insert_Actions): Extend special treatment applied to freeze nodes to the case of blocks generated for aggregates.
2025-06-30ada: Adjust comparisons in if-statements according to coding styleJohannes Kliemann2-3/+3
The Ada coding style requires the use of short circuit forms in if-statements. Use this form consistently for all if-statements. gcc/ada/ChangeLog: * libgnat/s-valuer.adb: Switch missing if-statements to short-circuit form. * libgnat/i-cpoint.adb: Ditto.
2025-06-29Daily bump.GCC Administrator1-0/+6
2025-06-28Fix compilation of concatenation with illegal character constantEric Botcazou1-2/+9
This fixes an error recovery issue, whereby the compilation of a string concatenation with an illegal character constant hangs. gcc/ada/ PR ada/120854 * sem_eval.adb (Get_String_Val): Be prepared for an integer literal after a serious error is detected, and raise PE on other nodes. gcc/testsuite/ * gnat.dg/concat6.adb: New test.
2025-06-28Daily bump.GCC Administrator1-0/+5
2025-06-26diagnostics: make 5 more fields of diagnostic_context privateDavid Malcolm1-1/+1
No functional change intended. gcc/ada/ChangeLog: * gcc-interface/misc.cc (gnat_init): Use diagnostic_context::set_internal_error_callback. gcc/c-family/ChangeLog: * c-opts.cc (c_common_diagnostics_set_defaults): Use diagnostic_context::set_permissive_option. gcc/cp/ChangeLog: * error.cc (cxx_initialize_diagnostics): Use diagnostic_context::set_adjust_diagnostic_info_callback. gcc/ChangeLog: * diagnostic.h (diagnostic_context::set_permissive_option): New. (diagnostic_context::set_fatal_errors): New. (diagnostic_context::set_internal_error_callback): New. (diagnostic_context::set_adjust_diagnostic_info_callback): New. (diagnostic_context::inhibit_notes): New. (diagnostic_context::m_opt_permissive): Make private. (diagnostic_context::m_fatal_errors): Likewise. (diagnostic_context::m_internal_error): Likewise. (diagnostic_context::m_adjust_diagnostic_info): Likewise. (diagnostic_context::m_inhibit_notes_p): Likewise. (diagnostic_inhibit_notes): Delete. * opts.cc (common_handle_option): Use diagnostic_context::set_fatal_errors. * toplev.cc (internal_error_function): Use diagnostic_context::set_internal_error_callback. (general_init): Likewise. (process_options): Use diagnostic_context::inhibit_notes. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-06-23Daily bump.GCC Administrator1-0/+17
2025-06-23Ada: Replace hardcoded GNAT commands for GNAT toolsNicolas Boulenguez1-8/+9
This replaces the hardcoded gnat{make,link,bind,ls} commands with expansion of the GNAT{MAKE,BIND} variables computed by the configure machinery, during the build of the GNAT tools. The default GNATMAKE_FOR_HOST duplicates the default GNATMAKE, and someone setting GNATMAKE in the toplevel configuration may want it applied for all host compilations. Direct assignment of GNATMAKE_FOR_HOST keeps working. gcc/ada/ PR ada/120106 * gcc-interface/Make-lang.in: Set GNAT{MAKE,BIND,LINK_LS}_FOR_HOST from GNAT{MAKE,BIND} instead of using hardcoded commands. gnattools/ PR ada/120106 * configure.ac: Remove ACX_NONCANONICAL_HOST and add ACX_PROG_GNAT. * configure: Regenerate. * Makefile.in: Do not substitute host_noncanonical but substitute GNATMAKE and GNATBIND. Set GNAT{MAKE,BIND,LINK_LS}_FOR_HOST from GNAT{MAKE,BIND} instead of using hardcoded commands.
2025-06-23Ada: Remove obsolete stuff in Makefile fragmentEric Botcazou1-10/+0
gcc/ada/ * Make-generated.in: Remove obsolete stuff.
2025-06-23Ada: Introduce GNATMAKE_FOR_BUILD Makefile variableNicolas Boulenguez2-4/+6
This gets rid of the hardcoded 'gnatmake' command used during the build. / PR ada/120106 * Makefile.tpl: Add GNATMAKE_FOR_BUILD to {HOST,BASE_TARGET}_EXPORTS * Makefile.in: Regenerate. * configure.ac: Set the default and substitute the variable. * configure: Regenerate. gcc/ada/ PR ada/120106 * Make-generated.in: Use GNATMAKE_FOR_BUILD instead of gnatmake. * gcc-interface/Makefile.in: Likewise.
2025-06-18Daily bump.GCC Administrator1-0/+5
2025-06-17Ada: Fix assertion failure on problematic container aggregateEric Botcazou1-4/+6
This is an assertion failure on code using a container aggregate in the primitives referenced by the Aggregate aspect, which cannot work. gcc/ada/ PR ada/120665 * sem_aggr.adb (Resolve_Container_Aggregate): Use robust guards. gcc/testsuite/ * gnat.dg/specs/aggr8.ads: New test.
2025-06-12Daily bump.GCC Administrator1-0/+172
2025-06-12ada: Fix code size increase with pragma Aggregate_Individually_AssignEric Botcazou1-1/+19
The problem is that individual assignments have to preserve the other bits of the target, in other words the original semantics of aggregates, where the anonymous object is entirely constructed, is partially lost. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Generate a zero-initialization for the anonymous object of a small aggregate allocated on the stack. (inline_status_for_subprog): Minor tweak.
2025-06-12ada: Update bug-box textsTonu Naks2-7/+7
gcc/ada/ChangeLog: * comperr.adb: update support instructions * switch.adb: update support instructions
2025-06-12ada: Fix reference to RM clause in commentRonan Desplanques1-1/+1
The implicit declarations for labels are defined in 5.1 (12), not 5.1 (3). gcc/ada/ChangeLog: * sinfo.ads: Fix RM reference.
2025-06-12ada: Reuse local constant when handling External_InitializationPiotr Trojanek1-1/+1
Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_ch3.adb (Apply_External_Initialization): Reuse local constant.
2025-06-12ada: Fix documentation of Generalized Finalization extensionEric Botcazou2-260/+163
The current documentation does not reflect the implementation present in the compiler and contains various other inaccuracies. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst (Generalized Finalization): Document the actual implementation. (No_Raise): Move to separate section. * gnat_rm.texi: Regenerate.
2025-06-12ada: Apply tweak for machine-code-based coverageRonan Desplanques1-1/+7
gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Raw_Real): Apply tweak.
2025-06-12ada: Fix support e-mail addressesTonu Naks2-3/+3
gcc/ada/ChangeLog: * comperr.adb: replace report@ with support@ * gnatcmd.adb: replace report@ with support@
2025-06-12ada: Fix wrong visibility over discriminantsRonan Desplanques1-4/+12
This patch fixes an issue where the compiler was incorrectly allowing references to discriminants of the ancestor type in private type extensions. gcc/ada/ChangeLog: * sem_ch3.adb (Build_Derived_Private_Type): Fix test. (Build_Derived_Record_Type): Adjust error recovery paths.