aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2024-06-20ada: Rewrite generic formal/actual matchingBob Duff6-1183/+1485
...in preparation for implementing type inference for generic parameters. The main change is to do the "matching" computation early, and produce a *constant* data structure (Gen_Assocs_Rec) to represent the matching between each triple of unanalyzed formal, analyzed formal, and corresponding actual. This will allow us to look at that data structure more than once, which will be necessary for type inference. Matching_Actual is removed; Match_Assocs is added. Other changes include removal of global variables, splitting out processing into subprograms, adding assertions, comment corrections, and other general cleanups. gcc/ada/ * expander.ads: Minor comment fixes. * nlists.ads: Misc comment improvements. * sem_aux.ads (First_Discriminant): Improve comment. * sem_ch12.adb: Misc cleanups. (Associations): New package containing type Gen_Assocs_Rec to represent matchings, and function Match_Assocs to create the Gen_Assocs_Rec constant. (Analyze_Associations): Call Match_Assocs, and other major changes related to that. * sem_ch12.ads: Minor comment fixes. * sem_ch3.adb: Minor comment fixes.
2024-06-20ada: Replace "All" argument to Extensions_Allowed pragma with "All_Extensions"Steve Baird7-30/+36
The argument to pragma Extensions_Allowed to enable all extensions is no longer "All", but instead "All_Extensions". gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Update documentation. * doc/gnat_rm/implementation_defined_pragmas.rst: Update documentation. * errout.adb (Error_Msg_GNAT_Extension): Update error message text. * par-prag.adb: Update pragma parsing. This includes changing the the name of the Check_Arg_Is_On_Or_Off formal parameter All_OK_Too to All_Extensions_OK_Too. * sem_prag.adb (Analyze_Pragma): In analyzing an Extensions_Allowed pragma, replace uses of Name_All with Name_All_Extensions; update a comment to reflect this. * snames.ads-tmpl: Add Name_All_Extensions declaration. * gnat_rm.texi: Regenerate.
2024-06-20ada: Crash on selected component of formal derived type in generic instanceGary Dismukes1-18/+19
The compiler crashes on an instantiation of a generic child unit G1.GC that has a formal private extension P_Ext of a private type P declared in the parent G1 whose full type has a component C, when analyzing a selected component ACC.C whose prefix is of an access type coming from an instantiation of another generic G2 where the designated type is the formal type P_Ext (coming in from a formal type of G2). gcc/ada/ * sem_ch4.adb (Try_Selected_Component_In_Instance): Reverse if_statement clauses so that the testing for the special case of extensions of private types in instance bodies is done first, followed by the testing for the case of a parent type that's a generic actual type. In the extension case, apply Base_Type to the type actual in the test of Used_As_Generic_Actual, and add a test of Present (Parent_Subtype (Typ)).
2024-06-20ada: Fix inlining of fixed-lower-bound array for GNATproveYannick Moy2-5/+17
Inlining in GNATprove may fail on a call to a subprogram with a formal of an array type with fixed lower bound (a GNAT extension), because the appropriate conversion is not used. Fix it. Also fix the function that inserts an unchecked conversion, in cases where it could skip sliding due to the target type having fixed lower bound. gcc/ada/ * inline.adb (Establish_Actual_Mapping_For_Inlined_Call): In the case of formal with a fixed lower bounds, insert appropriate conversion like in the case of a constrained type. * tbuild.adb (Unchecked_Convert_To): Do not skip the conversion when it may involve sliding due to a type with fixed lower bound.
2024-06-20ada: Fix assertion failure during analysis of instantiation of formal packageEric Botcazou1-1/+2
It's an assertion on the name of an instance of a generic child unit and it needs to cope with a renaming of the unit. gcc/ada/ * sem_ch12.adb (Instantiate_Formal_Package): Accept renamings of a generic parent that is a child unit for the abbreviated instance.
2024-06-20ada: Fix composition of primitive equality for untagged records with variant ↵Eric Botcazou1-28/+22
part In Ada 2012, primitive equality operators of untagged record types compose like those of tagged record types, but this has never been implemented for untagged record types with a variant part. gcc/ada/ * exp_ch4.adb (Expand_Composite_Equality): In the untagged record case, always look for a user-defined equality operator in Ada 2012.
2024-06-20ada: New pragma to default all interrupts to system.Doug Rupp15-779/+904
New pragma Interrupts_System_By_Default defaults all interrupts/signals to system (which will inhibit the installation of default signal handlers). Note this changes the ALI format: it optionally adds an identifier to the 'P' line (similar to pragma Unreserve_All_Interrupts). As per comment in lib-writ spec regarding new modifiers, adding modifiers to the P line is always safe. Also note this does not introduce a bootstrap problem because the compiler and binder do not set the underlying _gl global nor do they use this pragma. gcc/ada/ * ali.ads (Interrupts_Default_To_System): New boolean. (Interrupts_Default_To_System_Specified): New boolean. * ali.adb (Interrupts_Default_To_System_Specified): Initialize. (Interrupts_Default_To_System): Initialize. (Scan_ALI): Processing for "ID". * bindgen.adb: Coallesce comments on interrupt settings to ... (Gen_Adainit): Import Interrupts_Default_To_System flag and set if pragma specified. (Gen_Output_File_Ada): Generate Local_Interrupt_States according to pragma. * init.c: ... here. [vxworks] (__gnat_install_handler): Test for interrupt_state. (__gl_interrupts_default_to_system): New global flag. (__gnat_get_interrupt_State): return interrupt state according to new global flag. * lib-writ.ads: Document "ID". * lib-writ.adb: Write out "ID". * opt.ads (Interrupts_System_By_Default): New boolean, defaulted to False. * par-prag.adb (Pragma_Interrupts_System_By_Default): New. * sem_prag.adb (Pragma_Interrupts_System_By_Default): Handle it. (Pragma_Interrupts_System_By_Default): Default it. * snames.ads-tmpl (Name_Interrupts_System_By_Default): New name. (Pragma_Interrupts_System_By_Default): New * libgnarl/s-intman__posix.adb (Initialize): Ensure the Keep_Unmasked signal is sigset-able. * doc/gnat_rm/implementation_defined_pragmas.rst: Document pragma Interrupts_System_By_Default. * doc/gnat_ugn/the_gnat_compilation_model.rst (Configuration pragmas): Add Interrupts_System_By_Default. (Partition-Wide Settings): Mention pragma Interrupts_System_By_Default. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Fix bogus error with "=" operator on array of private unchecked unionEric Botcazou2-20/+14
The code is legal and, therefore, must be accepted by the compiler, but it must raise Program_Error at run time due to operands not having inferable discriminants and a warning be given at compile time (RM B.3.3(22-23)). gcc/ada/ * exp_ch4.adb (Expand_Array_Equality.Component_Equality): Copy the Comes_From_Source flag from the original test to the new one, and remove obsolete code dealing with unchecked unions. * sem_util.adb (Has_Inferable_Discriminants): Return False for an incomplete or private nominal subtype.
2024-06-20ada: Fix crash on real literal in declare expression of expression functionEric Botcazou1-2/+3
The problem is that the freeze node of the type to which the real literal is resolved is placed inside the expression function instead of outside. gcc/ada/ * freeze.adb (Freeze_Expression): Also attach pending freeze nodes to the parent in the case of an internal block in a spec expression.
2024-06-20ada: Enforce strict alignment for array types with aliased componentEric Botcazou2-13/+22
This was initially implemented as part of AI12-001 but immediately disabled because it breaks Florist on 32-bit platforms. However, it is possible to reenable it in almost all cases without affecting Florist, and the -gnatd_l switch can now be used to disable it again. gcc/ada/ * debug.adb (d_l): Document new usage for the compiler. * freeze.adb (Check_Strict_Alignment): Set the Strict_Alignment flag on array types with aliased component, except if the component size is equal to the storage unit or the -gnatd_l switch is specified.
2024-06-20ada: Update Bit Ordering references in GNAT Reference ManualEric Botcazou4-28/+24
They are still tailored to Ada 95 while the level of recommended support for Bit Ordering was changed in Ada 2005. gcc/ada/ * doc/gnat_rm/implementation_advice.rst (Representation Clauses): Remove >> marker and add end of sentence after code-block directive. (RM 13.5.3(7-8)): Update to Ada 2005 wording. * doc/gnat_rm/implementation_defined_characteristics.rst (RM 13.5.3(5)): Likewise. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Add documentation for Subprogram_Variant aspect and pragmaPiotr Trojanek4-655/+738
For completeness, the GNAT Reference Manual should document aspects and pragmas that are specific to SPARK and described in the SPARK User's Guide. gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst (Aspect Subprogram_Variant): Refer to SPARK User's Guide. * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Subprogram_Variant): Document syntax to satisfy the convention; refer to SPARK User's Guide for semantics. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Streamline propagation of controlled flags on typesEric Botcazou7-101/+113
The front-end maintains a set of 4 flags on (base) types that are used to parameterize the implementation of controlled operations, and these flags need to be propagated through composition and derivation. This is done on a per-flag basis in the current implementation with a few loopholes. This introduces a Propagate_Controlled_Flags routine to that effect, which is modeled on the existing Propagate_Concurrent_Flags routine, and is used in most cases to do the propagation. This also removes the handling of the Finalize_Storage_Only flag from Inherit_Aspects_At_Freeze_Point, since the associated aspect does not exist (only the pragma does). gcc/ada/ * freeze.adb (Freeze_Array_Type): Call Propagate_Controlled_Flags to propagate the controlled flags from the component to the array. (Freeze_Record_Type): Propagate the Finalize_Storage_Only flag from the components to the record. * sem_ch3.adb (Analyze_Private_Extension_Declaration): Do not call Propagate_Concurrent_Flags here but... (Array_Type_Declaration): Tidy and call Propagate_Controlled_Flags to propagate the controlled flags from the component to the array. (Build_Derived_Private_Type): Do not propagate the controlled flags manually here but... (Build_Derived_Record_Type): ...call Propagate_Controlled_Flags to propagate the controlled flags from parent to derived type. (Build_Derived_Type): Likewise. (Copy_Array_Base_Type_Attributes): Call Propagate_Controlled_Flags to copy the controlled flags. (Record_Type_Definition): Streamline the propagation of the Finalize_Storage_Only flag from the components to the record. * sem_ch7.adb (Preserve_Full_Attributes): Use Full_Base and call Propagate_Controlled_Flags to copy the controlled flags. * sem_ch9.adb (Analyze_Protected_Definition): Use canonical idiom to compute Has_Controlled_Component. (Analyze_Protected_Type_Declaration): Minor tweak. * sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): Do not deal with Finalize_Storage_Only here. * sem_util.ads (Propagate_Controlled_Flags): New declaration. * sem_util.adb (Propagate_Controlled_Flags): New procedure.
2024-06-20ada: Remove redundant conditions from freezing codePiotr Trojanek2-8/+7
Code cleanup; behavior is unaffected. gcc/ada/ * freeze.adb (Check_Current_Instance): This routine is only called with parameter E being a type entity, so there is no need to check for types just before the equality with E. * sem_ch13.adb (Analyze_Aspect_Specifications): Regroup condition to avoid unnecessary evaluation. (Check_Aspect_At_End_Of_Declarations): If In_Instance is true, then the routine exits early.
2024-06-20ada: Fix style in freezing codePiotr Trojanek2-8/+6
Code cleanup; semantics is unaffected. gcc/ada/ * freeze.adb (Find_Aspect_No_Parts): Tune whitespace. * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Fix style.
2024-06-20ada: Remove Max_Entry_Queue_Depth pragma/aspectEric Botcazou8-47/+6
It was implemented apparently because a very early version of AI12-0164 that standardizes GNAT's Max_Queue_Length opted for the subtly different moniker, but later versions of the AI use Max_Entry_Queue_Length instead. gcc/ada/ * aspects.ads (Aspect_Id): Remove Aspect_Max_Entry_Queue_Depth. (global arrays): Remove entry for it. * exp_ch9.adb (Expand_N_Protected_Type_Declaration): Remove reference to pragma Max_Entry_Queue_Depth in comment. * par-prag.adb (Prag): Remove handling of Pragma_Max_Entry_Queue_Depth. * sem_ch13.adb (Analyze_Aspect_Specifications): Remove reference to aspect Max_Entry_Queue_Depth in comment. (Analyze_Aspect_Specifications): Remove processing of aspect Max_Entry_Queue_Depth. (Check_Aspect_At_Freeze_Point): Likewise. * sem_prag.ads (Find_Related_Declaration_Or_Body): Remove reference to pragma Max_Entry_Queue_Depth in comment. * sem_prag.adb (Analyze_Pragma): Remove processing of pragma Max_Entry_Queue_Depth. (Sig_Flags): Remove entry for Pragma_Max_Entry_Queue_Depth. * sem_util.adb (Get_Max_Queue_Length): Remove handling of pragma Max_Entry_Queue_Depth. (Has_Max_Queue_Length): Likewise. * snames.ads-tmpl (Name_Max_Entry_Queue_Depth): Move back from pragmas section to others section. (Pragma_Id): Remove Pragma_Max_Entry_Queue_Depth.
2024-06-20ada: Couple of minor fixes in GNAT Reference ManualEric Botcazou4-31/+30
The Storage_Model pragma no longer exists. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst (Pragma Storage_Model): Rename to Storage Model. * doc/gnat_rm/implementation_defined_aspects.rst: Alphabetize. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Add Dump_Buffers hooks for code coverageRonan Desplanques1-0/+7
The purpose of this patch is to make it possible to set up code coverage for the GNAT front end in gnat1 using GNATcoverage. It is not obvious how to have GNATcoverage instrument gnat1's main function, and since the front end has a clear entry point (Gnat1drv), we add manual instrumentation annotations there. gcc/ada/ * gnat1drv.adb (Gnat1drv): Add coverage instrumentation annotations.
2024-06-20ada: Do not compute Has_Controlled_Component twice during freezingEric Botcazou3-42/+7
The Has_Controlled_Component flag is computed twice during freezing when expansion is enabled: in Freeze_Array_Type and Expand_Freeze_Array_Type for array types, and in Freeze_Record_Type and Expand_Freeze_Record_Type for record types. This removes the latter computation in both cases, as well as moves the computation of concurrent flags from the latter to the former places, which happens to plug a loophole in the detection of errors when the No_Task_Parts aspect is specified on peculiar types. gcc/ada/ * exp_ch3.adb (Expand_Freeze_Array_Type): Do not propagate the concurrent flags and the Has_Controlled_Component flag here. (Expand_Freeze_Record_Type): Likewise. * freeze.adb (Freeze_Array_Type): Propagate the concurrent flags. (Freeze_Record_Type): Likewise. * sem_util.adb (Has_Some_Controlled_Component): Adjust comment.
2024-06-20ada: Fix minor issues in commentsEric Botcazou1-11/+10
gcc/ada/ * mutably_tagged.ads: Fix minor issues in comments throughout.
2024-06-20ada: Document -gnatd_w for CCGRichard Kenner1-1/+3
gcc/ada/ * debug.adb: Add documentation for -gnatd_w.
2024-06-20ada: Change messages for -gnatw.v to warningsViljar Indus3-23/+21
Previously this switch was emitting only info messages which was both confusing in terms of the name of the switch that was used internally and externally. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update documentation for -gnatw.v. * sem_ch13.adb: Convert all -gnatw.v related messages to warnings. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Convert -gnatw.n messages to warningsViljar Indus3-12/+14
Previously the messages produced by this warning switch were info messages that were suppressed with the same methods as regular warnings. Since info messages are now separated as a completely different class of messages then these messages should be converted back to warnings in order for the previous pragma based suppression methods to work. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update documentation for -gnatw.n switch. * exp_util.adb: Convert info messages into warnings. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Add switch for suppressing info messagesViljar Indus5-244/+297
Add a separate switch -gnatis to suppress info messages separately from warning messages that are controlled by -gnatws. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add entry for -gnatis. * errout.adb (Error_Msg_Internal): Stop printing info messages if -gnatis was used. * opt.ads: Add Info_Suppressed flag to track whether info messages should be suppressed. * switch-c.adb: Add parsing for -gnatis. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Treat Info-Warnings as Info messagesViljar Indus4-76/+96
There was a general concept of info messages being a subset of warnings. However that is no longer the case. Messages with an info insertion character should be treated just as info messages. gcc/ada/ * atree.ads: Remove Warning_Info_Messages. * errout.adb: Remove various places where Warning_Info_Messages was used. * erroutc.adb: Remove various places where Warning_Info_Messages was used. Create Error_Msg_Object objects with only an info attribute if the message contained both info and warning insertion characters. New method Has_Switch_Tag for detecting if a message should have an error tag. * errutil.adb: Create Error_Msg_Object objects with only an info attribute if the message contained both info and warning insertion characters.
2024-06-20ada: Update documentation for 'SuperJustin Squirek4-491/+497
This patch moves the documentation for 'Super from gnat language extensions to experimental language extensions. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Add entry for 'Super. * doc/gnat_rm/implementation_defined_attributes.rst: Remove entry for 'Super. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Improve preprocessor error handling.Steve Baird2-2/+10
In some cases, gnatprep would correctly emit an error message and then incorrectly exit with a return code of zero, indicating success. In some cases, a correct message about an error detected by the integrated preprocessor would be accompanied by an incorrect message indicating that a source file could not be found. gcc/ada/ * gprep.adb (Process_Files.Process_One_File): When calling OS_Exit in an error path, pass in a Status parameter of 1 instead of 0 (because 0 indicates success). * lib-load.adb (Load_Main_Source): Do not emit a message about a missing source file if other error messages were generated by calling Load_Source_File; the file isn't missing - it failed preprocessing.
2024-06-20ada: Fix list of attributes defined by Ada 2022Piotr Trojanek2-12/+3
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_Impl_Def): Remove Object_Size.
2024-06-15Daily bump.GCC Administrator1-0/+232
2024-06-14ada: Do not include target-specific makefile fragmentsEric Botcazou1-6/+0
They are unused in this context. gcc/ada/ * gcc-interface/Makefile.in (tmake_file): Remove all references.
2024-06-14ada: Fix return mechanism reported by -gnatRmEric Botcazou1-7/+27
The return mechanism of functions is reported when the -gnatRm switch is specified, but it is incorrect when the result type is not a by-reference type in the language sense but is nevertheless returned by reference. gcc/ada/ * gcc-interface/decl.cc: Include function.h. (gnat_to_gnu_param): Minor comment tweaks. (gnat_to_gnu_subprog_type): Take into account the default for the computation of the return mechanism. Give a warning if a by-copy specified mechanism cannot be honored.
2024-06-14ada: Skip subprogram body entities inside scopesYannick Moy1-0/+8
Entities of kind E_Subprogram_Body, used on bodies of subprograms for which there is a separate declaration, have been added in the entities linked from a scope in order to get the representation information on their enclosed object and type declarations. Skip these entities in gigi. gcc/ada/ * gcc-interface/trans.cc (elaborate_all_entities_for_package) (process_freeze_entity): Skip entities of kind E_Subprogram_Body.
2024-06-14ada: Do not create null GCC thunksEric Botcazou1-10/+19
This prevents Gigi from creating null GCC thunks, i.e. thunks that have all their internal parameters set to zero, replacing them with aliases. They can arise in degenerate cases and null thunks would trip on an assertion in former_thunk_p when they are later optimized. gcc/ada/ PR ada/109817 * gcc-interface/trans.cc (maybe_make_gnu_thunk): Create an alias instead of a null thunk.
2024-06-14ada: Typo and indentation fixMarc Poulhiès4-7/+7
Fixes typo in comments and 2 instances of bad indentation. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Typo fix. (gnat_to_gnu_component_type): Indent fix. * gcc-interface/gigi.h (build_call_alloc_dealloc): Typo fix. * gcc-interface/utils.cc (make_dummy_type): Typo fix. * gcc-interface/utils2.cc (gnat_protect_expr): Indent fix.
2024-06-14ada: Fix parts of classification of aspectsEric Botcazou2-62/+101
Many aspects are (correctly) marked as GNAT-specific but nevertheless not listed in the Implementation_Defined_Aspect array, so this aligns the two sides and also removes Default_Initial_Condition and Object_Size from the list, since they are defined in Ada 2022. This also moves No_Controlled_Parts and No_Task_Parts to the subclass of boolean aspects, and completes the list of nonoverridable aspects defined in Ada 2022. gcc/ada/ * aspects.ads (Aspect_Id): Alphabetize, remove the GNAT tag from Default_Initial_Condition and Object_Size, move No_Controlled_Parts and No_Task_Parts to boolean subclass. (Nonoverridable_Aspect_Id): Add missing Ada 2022 aspects. (Implementation_Defined_Aspect): Add all missing aspects, remove Max_Entry_Queue_Length and Object_Size (Aspect_Argument): Remove specific entries for No_Controlled_Parts and No_Task_Parts, list boolean aspects last. (Is_Representation_Aspect ): Move boolean aspects last. (Aspect_Names): Alphabetize. * sem_ch13.adb (Analyze_Aspect_Disable_Controlled): Adjust. (Analyze_Aspect_Specifications): Move around processing for No_Controlled_Parts and No_Task_Parts. (Check_Aspect_At_Freeze_Point): Remove specific entries for No_Controlled_Parts and No_Task_Parts
2024-06-14ada: Bad tree built for Obj.Discrim_Dep_Component'Loop_Entry in assertionSteve Baird1-7/+18
The Etype for an N_Selected_Component node usually should not match the Etype of the referenced component if the component is subject to a discriminant-dependent constraint. Instead Build_Actual_Subtype_Of_Component should be called. Fix a case where this rule was not being followed (because B_A_S_O_C is not called during preanalysis of a component selection), resulting in a tree that confused CodePeer because the subtype was wrong. gcc/ada/ * exp_attr.adb (Expand_Loop_Entry_Attribute): Ensure that Etype of the saved expression is set correctly.
2024-06-14ada: Simplify handling of VxWorks-specific error codes for ENOENTJerome Guitton1-7/+20
These error codes were defined on older versions of VxWorks (5, 6, 7 SR0540) and now they are either not defined or they fallback to ENOENT. To handle these cases without using complex tests against vxworks versions, leverage on __has_include and provide a fallback to ENOENT if these error codes are not defined. gcc/ada/ * sysdep.c (S_dosFsLib_FILE_NOT_FOUND, S_nfsLib_NFSERR_NOENT): New macros, falback to ENOENT when not already defined. (__gnat_is_file_not_found_error): Use these new macros to remove tests against VxWorks flavors.
2024-06-14ada: Minor tweak in SnamesEric Botcazou1-4/+1
gcc/ada/ * snames.ads-tmpl (Name_Present): Move to Repinfo section.
2024-06-14ada: Add prototype for mutably tagged typesJustin Squirek30-130/+1235
This patch implements mutably tagged types via the new Size'Class aspect. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Add documentation for mutably tagged type feature. * aspects.ads: Add registration for 'Size'Class. * einfo.ads: Add documentation for new components Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type. * exp_aggr.adb (Gen_Assign): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Contains_Mutably_Tagged_Type): New subprogram. (Convert_To_Positional): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Is_Static_Element): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Expand_Array_Aggregate): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Expand_Record_Aggregate): Force mutably tagged records to be expanded into assignments. * exp_ch3.adb (Build_Array_Init_Proc): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Simple_Initialization_OK): Disallow simple initialization for class-wide equivalent types. (Build_Init_Statements): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Expand_Freeze_Array_Type): Ignore building of record init procs for mutably tagged types. (Expand_N_Full_Type_Declaration): Replace mutably tagged type declarations with their associated class-wide equivalent types. (Default_Initialize_Object): Add special handling for mutably tagged types. * exp_ch4.adb (Expand_N_Allocator): Add initialization for mutably tagged types. (Expand_Record_Equality): Generate mutably tagged unchecked conversions. * exp_ch5.adb (Expand_N_Assignment_Statement): Generate a special assignment case for class-wide equivalent types which does tag assignments and ignores certain checks. * exp_ch6.adb (Expand_Call_Helper): Propagate constrained extra formal actuals for mutably tagged types. * exp_ch7.adb (Make_Init_Call): Handle mutably tagged type initialization. * exp_util.adb (Make_CW_Equivalent_Type): Modify to handle mutably tagged objects which contain no initialization expression. (Make_Subtype_From_Expr): Modify call to Make_CW_Equivalent_Type. * exp_util.ads (Make_CW_Equivalent_Type): Move declaration from body to spec. * freeze.adb (Size_Known): No longer return false automatically when a class-wide type is encountered. (Freeze_Entity): Ignore error messages about size not being known for mutably tagged types. * gen_il-fields.ads: Register new fields Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type. * gen_il-gen-gen_entities.adb: Register new fields Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type for type entities. * mutably_tagged.adb, mutably_tagged.ads (Corresponding_Mutably_Tagged_Type): New subprogram. (Depends_On_Mutably_Tagged_Ext_Comp): New subprogram. (Get_Corresponding_Mutably_Tagged_Type_If_Present): New subprogram. (Get_Corresponding_Tagged_Type_If_Present): New subprogram. (Is_Mutably_Tagged_Conversion): New subprogram. (Is_Mutably_Tagged_CW_Equivalent_Type): New subprogram. (Make_Mutably_Tagged_Conversion): New subprogram. (Make_CW_Size_Compile_Check): New subprogram. (Make_Mutably_Tagged_CW_Check): New subprogram. * sem_aggr.adb (Resolve_Array_Aggregate): Skip tag checks for class-wide equivalent types. (Resolve_Aggr_Expr): Assume associated mutably tagged type when class-wide equivalent type is encountered. * sem_attr.adb (Analyze_Attribute): Allow 'Tag on mutably tagged types. (Resolve_Attribute): Detect errors for dependence of mutably tagged extension type component. * sem_ch12.adb (Instantiate_Object): Detect errors for dependence of mutably tagged extension type component. * sem_ch13.adb (Analyze_One_Aspect): Propagate 'Size'Class to class-wide type. (Analyze_Attribute_Definition_Clause): Add handling of 'Size'Class by generating class-wide equivalent types and checking for illegal uses. * sem_ch2.adb (Analyze_Identifier): Generate unchecked conversion for class-wide equivalent types. * sem_ch3.adb (Analyze_Component_Declaration): Avoid unconstrained errors on mutably tagged types. (Analyze_Object_Declaration): Rewrite declarations of mutably tagged types to use class-wide equivalent types. (Array_Type_Declaration): Modify arrays of mutably tagged types to use their corresponding class-wide equivalent types. (Derived_Type_Declaration): Add various checks for mutably tagged derived types. * sem_ch4.adb (Analyze_Allocator): Replace reference to mutably tagged type with cooresponding tagged type. (Process_Indexed_Component): Generate unchecked conversion for class-wide equivalent type. (Analyze_One_Call): Generate unchecked conversion for class-wide equivalent types. (Analyze_Selected_Component): Assume reference to class-wide equivalent type is associated mutably tagged type. (Analyze_Type_Conversion): Generate unchecked conversion for class-wide equivalent type. * sem_ch5.adb (Analyze_Assignment): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Analyze_Iterator_Specification): Detect errors for dependence of mutably tagged extension type component. * sem_ch6.adb (Create_Extra_Formals): Add code to generate extra formal for mutably tagged types to signal if they are constrained. * sem_ch8.adb (Analyze_Object_Renaming): Detect error on renaming of mutably tagged extension type component. (Analyze_Renaming_Primitive_Operation): Detect error on renaming of mutably tagged extension type component. * sem_res.adb (Resolve_Actuals): Allow class-wide arguments on class-wide equivalent types. (Valid_Conversion): Assume associated mutably tagged type when class-wide equivalent type is encountered. * sem_util.adb (Is_Fully_Initialized_Type): Flag mutably tagged types as fully initialized. (Needs_Simple_Initalization): Flag class-wide equivalent types as needing initialization. * gnat_rm.texi: Regenerate. * gcc-interface/Make-lang.in: Add entry for mutably_tagged.o.
2024-06-14ada: Crash checking accessibility level on private typeJustin Squirek1-1/+5
This patch fixes an issue in the compiler whereby calculating a static accessibility level on a private type with an access discriminant resulted in a compile time crash when No_Dynamic_Accessibility_Checks is enabled. gcc/ada/ * accessibility.adb: (Accessibility_Level): Replace call Get_Full_View with call to Full_View since Get_Full_View only works with incomplete types.
2024-06-14ada: Minor tweaks to processing of Aggregate aspectEric Botcazou3-15/+15
The main one is to give the error for Aggregate applied to array types from Analyze_Aspects_At_Freeze_Point instead of Check_Aspect_At_Freeze_Point, as for the other aspects. The message is also changed to be more direct. gcc/ada/ * aspects.ads (Operational_Aspect): Alphabetize. * sem_ch13.ads (Analyze_Aspects_At_Freeze_Point): Fix description. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point) <Aggregate>: Give the error for array types here instead of... (Analyze_Aspect_Specifications) <Aggregate>: Adjust comment. (Check_Aspect_At_Freeze_Point) <Aggregate>: ...here.
2024-06-14ada: Missing initialization of multidimensional array using slidingJavier Miranda1-21/+33
When a multidimensional array is initialized with an array aggregate, and inner dimensions of the array are initialized with array subaggregates using sliding, the code generated by the compiler does not initialize the inner dimensions of the array. gcc/ada/ * exp_aggr.adb (Must_Slide): Add missing support for multidimensional arrays.
2024-06-14ada: Couple of small cleanups in semantic analysis of aspectsEric Botcazou3-60/+58
The first cleanup is to expose a consistent interface from Sem_Ch13 for the analysis of aspects at various points of the program. The second cleanup is to fix the awkward implementation of the analysis of the specification for the aspects Stable_Properties, Designated_Storage_Model, Storage_Model_Type and Aggregate, which are always delayed, and the incorrect placement of that of the aspect Local_Restrictions, which is never delayed. gcc/ada/ * freeze.adb (Freeze_All): Call Check_Aspects_At_End_Of_Declarations to perform the visibility check for aspects. * sem_ch13.ads (Check_Aspects_At_End_Of_Declarations): Declare. (Check_Aspect_At_Freeze_Point): Move to... (Check_Aspect_At_End_Of_Declarations): Move to... * sem_ch13.adb (Check_Aspect_At_Freeze_Point): ...here. (Check_Aspect_At_End_Of_Declarations): ...here. (Analyze_Aspect_Specifications): Remove peculiar processing for Stable_Properties, Designated_Storage_Model, Storage_Model_Type and Aggregate. Move that of Local_Restrictions around. Reset Aitem at the beginning of the loop for each aspect. (Check_Aspects_At_End_Of_Declarations): New procedure.
2024-06-14ada: Allow implicit dereferenced for uses of 'SuperJustin Squirek1-0/+1
This patch modifies the experimental 'Super attribute to allow an access-valued prefix to be equivalent to Prefix.all'Super. gcc/ada/ * sem_attr.adb: (Analyze_Attribute): Add check for dereference.
2024-06-14ada: Remove unused name of aspect from SnamesEric Botcazou1-1/+0
gcc/ada/ * snames.ads-tmpl (Name_Storage_Model): Delete.
2024-06-14Daily bump.GCC Administrator1-0/+261
2024-06-13Revert "map packed field type to unpacked for debug info"Alexandre Oliva1-4/+0
This reverts commit ea5c9f25241ae0658180afbcad7f4e298352f561.
2024-06-13ada: Compiler goes into loopSteve Baird1-1/+4
In some cases that are difficult to characterize, the compiler fails an assertion check (if the compiler is built with assertions enabled) or loops forever (if assertions are not enabled). One way this can happen is if Exp_Util.Insert_Actions is called with an N_Itype_Reference node as its first parameter. This, in turn, can happen when an instance of Exp_Attr.Expand_N_Attribute_Reference.Built_And_Insert_Type_Attr_Subp calls Insert_Action (which will call Insert_Actions). gcc/ada/ * exp_util.adb (Insert_Actions): Code was relying on an incorrect assumption that an N_Itype_Reference cannot occur in declaration list or a statement list. Fix the code to handle this case.
2024-06-13ada: Remove -gnatdJ switchViljar Indus9-220/+22
Using -gnatdJ with various other switches was error prone. Remove this switch since the primary users of this mode GNATCheck and Codepeer no longer need it. gcc/ada/ * debug.adb: Remove mentions of -gnatdJ. * errout.adb: Remove printing subprogram names to JSON. * erroutc.adb: Remove printing subprogram names in messages. * erroutc.ads: Remove Node and Subprogram_Name_Ptr used for -gnatdJ. * errutil.adb: Remove Node used for -gnatdJ * gnat1drv.adb: Remove references of -gnatdJ and Include_Subprgram_In_Messages. * opt.ads: Remove Include_Subprgram_In_Messages * par-util.adb: Remove behavior related to Include_Subprgram_In_Messages. * sem_util.adb: Remove Subprogram_Name used for -gnatdJ
2024-06-13ada: Fix segmentation fault on slice of array with Unbounded_String componentEric Botcazou2-24/+93
This fixes a regression introduced by the overhaul of the implementation of finalization. When the first subtype of an array type is declared as constrained, the Finalize_Address primitive of the base type synthesized by the compiler is tailored to this first subtype, which means that this primitive cannot be used for other subtypes of the array type, which may for example be generated when an aggregate is assigned to a slice of an object of the first subtype. The straightforward solution would be to synthesize the Finalize_Address primitive for the base type instead, but its clean implementation would require changing the way allocators are implemented to always allocate the bounds alongside the data, which may turn out to be delicate. This instead changes the compiler to synthesize a local Finalize_Address primitive in the problematic cases, which should be rare in practice, and also contains a fixlet for Find_Last_Init, which fails to get to the base type again in the indirect case and, therefore, mishandles array subtypes. gcc/ada/ * exp_ch7.adb (Attach_Object_To_Master_Node): Fix formatting. (Build_Finalizer.Process_Object_Declaration): Synthesize a local Finalize_Address primitive if the object's subtype is an array that has a constrained first subtype and is not this first subtype. * exp_util.adb (Find_Last_Init): Get again to the base type in the indirect case.