aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2024-11-13Daily bump.GCC Administrator1-0/+829
2024-11-12ada: Typo fix in commentMarc Poulhiès1-1/+1
gcc/ada/ChangeLog: * gcc-interface/Makefile.in: Remove extra 'with'.
2024-11-12ada: Compile time crash on limited object in extended returnsquirek1-5/+17
This patch fixes an error in the compiler whereby using an extended return on an object of limited tagged type which extends a tagged protected type may lead to a compile-time crash. gcc/ada/ChangeLog: * exp_ch3.adb (Build_Assignment): Add condition to fetch corresponding record types for concurrent tagged types.
2024-11-12ada: Fix spurious error on iterated component association with large index typeEric Botcazou1-12/+19
This is only for the Ada 2022 form of the iterated component association. gcc/ada/ChangeLog: * exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use a type sized from the index type to compute the length. Simplify and remove useless calls to New_Copy_Tree for this computation.
2024-11-12ada: Include design documentation within runtime sourcesPat Bernardi233-334/+1465
The existing design documentation, required when generating the Software Architecture Design Specification and Software Component Design Specification documents for the light and light-tasking runtimes, has been included directly within runtime sources. gcc/ada/ChangeLog: * libgnarl/a-dynpri.ads: Add design annotations. * libgnarl/a-reatim.ads: Likewise. * libgnarl/a-synbar.ads: Likewise. * libgnarl/a-taside.ads: Likewise. * libgnarl/s-tarest.ads: Likewise. * libgnarl/s-tasinf.ads: Likewise. * libgnarl/s-taspri__posix.ads: Likewise. * libgnarl/s-tpobmu.ads: Likewise. * libgnat/a-assert.ads: Likewise. * libgnat/a-comlin.ads: Likewise. * libgnat/a-nbnbig.ads: Likewise. * libgnat/a-nubinu.ads: Likewise. * libgnat/a-numeri.ads: Likewise. * libgnat/a-unccon.ads: Likewise. * libgnat/a-uncdea.ads: Likewise. * libgnat/ada.ads: Likewise. * libgnat/g-debuti.ads: Likewise. * libgnat/g-sestin.ads: Likewise. * libgnat/g-souinf.ads: Likewise. * libgnat/gnat.ads: Likewise. * libgnat/i-cexten.ads: Likewise. * libgnat/i-cexten__128.ads: Likewise. * libgnat/i-cstrin.adb: Likewise. * libgnat/i-cstrin.ads: Likewise. * libgnat/interfac__2020.ads: Likewise. * libgnat/machcode.ads: Likewise. * libgnat/s-addope.ads: Likewise. * libgnat/s-aridou.ads: Likewise. * libgnat/s-arit32.ads: Likewise. * libgnat/s-arit64.ads: Likewise. * libgnat/s-assert.ads: Likewise. * libgnat/s-atacco.ads: Likewise. * libgnat/s-atocou.ads: Likewise. * libgnat/s-atocou__builtin.adb: Likewise. * libgnat/s-atopri.ads: Likewise. * libgnat/s-bitops.ads: Likewise. * libgnat/s-boarop.ads: Likewise. * libgnat/s-bytswa.ads: Likewise. * libgnat/s-carsi8.ads: Likewise. * libgnat/s-carun8.ads: Likewise. * libgnat/s-casi16.ads: Likewise. * libgnat/s-casi32.ads: Likewise. * libgnat/s-casi64.ads: Likewise. * libgnat/s-caun16.ads: Likewise. * libgnat/s-caun32.ads: Likewise. * libgnat/s-caun64.ads: Likewise. * libgnat/s-exnint.ads: Likewise. * libgnat/s-exnllf.ads: Likewise. * libgnat/s-exnlli.ads: Likewise. * libgnat/s-expint.ads: Likewise. * libgnat/s-explli.ads: Likewise. * libgnat/s-expllu.ads: Likewise. * libgnat/s-expmod.ads: Likewise. * libgnat/s-exponn.ads: Likewise. * libgnat/s-expont.ads: Likewise. * libgnat/s-exponu.ads: Likewise. * libgnat/s-expuns.ads: Likewise. * libgnat/s-fatflt.ads: Likewise. * libgnat/s-fatgen.ads: Likewise. * libgnat/s-fatlfl.ads: Likewise. * libgnat/s-fatllf.ads: Likewise. * libgnat/s-flocon.ads: Likewise. * libgnat/s-geveop.ads: Likewise. * libgnat/s-imageb.ads: Likewise. * libgnat/s-imaged.ads: Likewise. * libgnat/s-imagef.ads: Likewise. * libgnat/s-imagei.ads: Likewise. * libgnat/s-imagen.ads: Likewise. * libgnat/s-imageu.ads: Likewise. * libgnat/s-imagew.ads: Likewise. * libgnat/s-imde128.ads: Likewise. * libgnat/s-imde32.ads: Likewise. * libgnat/s-imde64.ads: Likewise. * libgnat/s-imen16.ads: Likewise. * libgnat/s-imen32.ads: Likewise. * libgnat/s-imenu8.ads: Likewise. * libgnat/s-imfi32.ads: Likewise. * libgnat/s-imfi64.ads: Likewise. * libgnat/s-imgbiu.ads: Likewise. * libgnat/s-imgboo.ads: Likewise. * libgnat/s-imgcha.ads: Likewise. * libgnat/s-imgint.ads: Likewise. * libgnat/s-imgllb.ads: Likewise. * libgnat/s-imglli.ads: Likewise. * libgnat/s-imgllu.ads: Likewise. * libgnat/s-imgllw.ads: Likewise. * libgnat/s-imgrea.ads: Likewise. * libgnat/s-imguns.ads: Likewise. * libgnat/s-imguti.ads: Likewise. * libgnat/s-imgwiu.ads: Likewise. * libgnat/s-maccod.ads: Likewise. * libgnat/s-multip.ads: Likewise. * libgnat/s-pack03.ads: Likewise. * libgnat/s-pack05.ads: Likewise. * libgnat/s-pack06.ads: Likewise. * libgnat/s-pack07.ads: Likewise. * libgnat/s-pack09.ads: Likewise. * libgnat/s-pack10.ads: Likewise. * libgnat/s-pack100.ads: Likewise. * libgnat/s-pack101.ads: Likewise. * libgnat/s-pack102.ads: Likewise. * libgnat/s-pack103.ads: Likewise. * libgnat/s-pack104.ads: Likewise. * libgnat/s-pack105.ads: Likewise. * libgnat/s-pack106.ads: Likewise. * libgnat/s-pack107.ads: Likewise. * libgnat/s-pack108.ads: Likewise. * libgnat/s-pack109.ads: Likewise. * libgnat/s-pack11.ads: Likewise. * libgnat/s-pack110.ads: Likewise. * libgnat/s-pack111.ads: Likewise. * libgnat/s-pack112.ads: Likewise. * libgnat/s-pack113.ads: Likewise. * libgnat/s-pack114.ads: Likewise. * libgnat/s-pack115.ads: Likewise. * libgnat/s-pack116.ads: Likewise. * libgnat/s-pack117.ads: Likewise. * libgnat/s-pack118.ads: Likewise. * libgnat/s-pack119.ads: Likewise. * libgnat/s-pack12.ads: Likewise. * libgnat/s-pack120.ads: Likewise. * libgnat/s-pack121.ads: Likewise. * libgnat/s-pack122.ads: Likewise. * libgnat/s-pack123.ads: Likewise. * libgnat/s-pack124.ads: Likewise. * libgnat/s-pack125.ads: Likewise. * libgnat/s-pack126.ads: Likewise. * libgnat/s-pack127.ads: Likewise. * libgnat/s-pack13.ads: Likewise. * libgnat/s-pack14.ads: Likewise. * libgnat/s-pack15.ads: Likewise. * libgnat/s-pack17.ads: Likewise. * libgnat/s-pack18.ads: Likewise. * libgnat/s-pack19.ads: Likewise. * libgnat/s-pack20.ads: Likewise. * libgnat/s-pack21.ads: Likewise. * libgnat/s-pack22.ads: Likewise. * libgnat/s-pack23.ads: Likewise. * libgnat/s-pack24.ads: Likewise. * libgnat/s-pack25.ads: Likewise. * libgnat/s-pack26.ads: Likewise. * libgnat/s-pack27.ads: Likewise. * libgnat/s-pack28.ads: Likewise. * libgnat/s-pack29.ads: Likewise. * libgnat/s-pack30.ads: Likewise. * libgnat/s-pack31.ads: Likewise. * libgnat/s-pack33.ads: Likewise. * libgnat/s-pack34.ads: Likewise. * libgnat/s-pack35.ads: Likewise. * libgnat/s-pack36.ads: Likewise. * libgnat/s-pack37.ads: Likewise. * libgnat/s-pack38.ads: Likewise. * libgnat/s-pack39.ads: Likewise. * libgnat/s-pack40.ads: Likewise. * libgnat/s-pack41.ads: Likewise. * libgnat/s-pack42.ads: Likewise. * libgnat/s-pack43.ads: Likewise. * libgnat/s-pack44.ads: Likewise. * libgnat/s-pack45.ads: Likewise. * libgnat/s-pack46.ads: Likewise. * libgnat/s-pack47.ads: Likewise. * libgnat/s-pack48.ads: Likewise. * libgnat/s-pack49.ads: Likewise. * libgnat/s-pack50.ads: Likewise. * libgnat/s-pack51.ads: Likewise. * libgnat/s-pack52.ads: Likewise. * libgnat/s-pack53.ads: Likewise. * libgnat/s-pack54.ads: Likewise. * libgnat/s-pack55.ads: Likewise. * libgnat/s-pack56.ads: Likewise. * libgnat/s-pack57.ads: Likewise. * libgnat/s-pack58.ads: Likewise. * libgnat/s-pack59.ads: Likewise. * libgnat/s-pack60.ads: Likewise. * libgnat/s-pack61.ads: Likewise. * libgnat/s-pack62.ads: Likewise. * libgnat/s-pack63.ads: Likewise. * libgnat/s-pack65.ads: Likewise. * libgnat/s-pack66.ads: Likewise. * libgnat/s-pack67.ads: Likewise. * libgnat/s-pack68.ads: Likewise. * libgnat/s-pack69.ads: Likewise. * libgnat/s-pack70.ads: Likewise. * libgnat/s-pack71.ads: Likewise. * libgnat/s-pack72.ads: Likewise. * libgnat/s-pack73.ads: Likewise. * libgnat/s-pack74.ads: Likewise. * libgnat/s-pack75.ads: Likewise. * libgnat/s-pack76.ads: Likewise. * libgnat/s-pack77.ads: Likewise. * libgnat/s-pack78.ads: Likewise. * libgnat/s-pack79.ads: Likewise. * libgnat/s-pack80.ads: Likewise. * libgnat/s-pack81.ads: Likewise. * libgnat/s-pack82.ads: Likewise. * libgnat/s-pack83.ads: Likewise. * libgnat/s-pack84.ads: Likewise. * libgnat/s-pack85.ads: Likewise. * libgnat/s-pack86.ads: Likewise. * libgnat/s-pack87.ads: Likewise. * libgnat/s-pack88.ads: Likewise. * libgnat/s-pack89.ads: Likewise. * libgnat/s-pack90.ads: Likewise. * libgnat/s-pack91.ads: Likewise. * libgnat/s-pack92.ads: Likewise. * libgnat/s-pack93.ads: Likewise. * libgnat/s-pack94.ads: Likewise. * libgnat/s-pack95.ads: Likewise. * libgnat/s-pack96.ads: Likewise. * libgnat/s-pack97.ads: Likewise. * libgnat/s-pack98.ads: Likewise. * libgnat/s-pack99.ads: Likewise. * libgnat/s-parame.ads: Likewise. * libgnat/s-rident.ads: Likewise. * libgnat/s-spark.ads: Likewise. * libgnat/s-spcuop.ads: Likewise. * libgnat/s-stoele.ads: Likewise. * libgnat/s-traent.ads: Likewise. * libgnat/s-unstyp.ads: Likewise. * libgnat/s-vaispe.ads: Likewise. * libgnat/s-valspe.ads: Likewise. * libgnat/s-vauspe.ads: Likewise. * libgnat/s-veboop.ads: Likewise. * libgnat/s-vector.ads: Likewise. * libgnat/s-vs_int.ads: Likewise. * libgnat/s-vs_lli.ads: Likewise. * libgnat/s-vs_llu.ads: Likewise. * libgnat/s-vs_uns.ads: Likewise. * libgnat/s-vsllli.ads: Likewise. * libgnat/text_io.ads: Likewise. * libgnat/unchconv.ads: Likewise. * libgnat/unchdeal.ads: Likewise. * s-pack.ads.tmpl: Likewise.
2024-11-12ada: Make sure not to access past the end of bit-packed arraysEric Botcazou121-7939/+53704
The code generated for the routines of the run-time library that implement support for bit-packed arrays with non-power-of-2 component sizes turns out to be problematic for the Address Sanitizer and the CHERI architecture, as it may access past the end of bit-packed arrays in specific cases. No functional changes. gcc/ada/ChangeLog: * s-pack.adb.tmpl: Add '7' suffix to all existing constructs and add variants with suffixes ranging from '0' to '6'. (Get_@@): Dereference the address as a record object whose accessed component is always the last. (GetU_@@): Likewise. (Set_@@): Likewise. (SetU_@@): Likewise. * libgnat/s-pack03.adb: Regenerate. * libgnat/s-pack05.adb: Likewise. * libgnat/s-pack06.adb: Likewise. * libgnat/s-pack07.adb: Likewise. * libgnat/s-pack09.adb: Likewise. * libgnat/s-pack10.adb: Likewise. * libgnat/s-pack100.adb: Likewise. * libgnat/s-pack101.adb: Likewise. * libgnat/s-pack102.adb: Likewise. * libgnat/s-pack103.adb: Likewise. * libgnat/s-pack104.adb: Likewise. * libgnat/s-pack105.adb: Likewise. * libgnat/s-pack106.adb: Likewise. * libgnat/s-pack107.adb: Likewise. * libgnat/s-pack108.adb: Likewise. * libgnat/s-pack109.adb: Likewise. * libgnat/s-pack11.adb: Likewise. * libgnat/s-pack110.adb: Likewise. * libgnat/s-pack111.adb: Likewise. * libgnat/s-pack112.adb: Likewise. * libgnat/s-pack113.adb: Likewise. * libgnat/s-pack114.adb: Likewise. * libgnat/s-pack115.adb: Likewise. * libgnat/s-pack116.adb: Likewise. * libgnat/s-pack117.adb: Likewise. * libgnat/s-pack118.adb: Likewise. * libgnat/s-pack119.adb: Likewise. * libgnat/s-pack12.adb: Likewise. * libgnat/s-pack120.adb: Likewise. * libgnat/s-pack121.adb: Likewise. * libgnat/s-pack122.adb: Likewise. * libgnat/s-pack123.adb: Likewise. * libgnat/s-pack124.adb: Likewise. * libgnat/s-pack125.adb: Likewise. * libgnat/s-pack126.adb: Likewise. * libgnat/s-pack127.adb: Likewise. * libgnat/s-pack13.adb: Likewise. * libgnat/s-pack14.adb: Likewise. * libgnat/s-pack15.adb: Likewise. * libgnat/s-pack17.adb: Likewise. * libgnat/s-pack18.adb: Likewise. * libgnat/s-pack19.adb: Likewise. * libgnat/s-pack20.adb: Likewise. * libgnat/s-pack21.adb: Likewise. * libgnat/s-pack22.adb: Likewise. * libgnat/s-pack23.adb: Likewise. * libgnat/s-pack24.adb: Likewise. * libgnat/s-pack25.adb: Likewise. * libgnat/s-pack26.adb: Likewise. * libgnat/s-pack27.adb: Likewise. * libgnat/s-pack28.adb: Likewise. * libgnat/s-pack29.adb: Likewise. * libgnat/s-pack30.adb: Likewise. * libgnat/s-pack31.adb: Likewise. * libgnat/s-pack33.adb: Likewise. * libgnat/s-pack34.adb: Likewise. * libgnat/s-pack35.adb: Likewise. * libgnat/s-pack36.adb: Likewise. * libgnat/s-pack37.adb: Likewise. * libgnat/s-pack38.adb: Likewise. * libgnat/s-pack39.adb: Likewise. * libgnat/s-pack40.adb: Likewise. * libgnat/s-pack41.adb: Likewise. * libgnat/s-pack42.adb: Likewise. * libgnat/s-pack43.adb: Likewise. * libgnat/s-pack44.adb: Likewise. * libgnat/s-pack45.adb: Likewise. * libgnat/s-pack46.adb: Likewise. * libgnat/s-pack47.adb: Likewise. * libgnat/s-pack48.adb: Likewise. * libgnat/s-pack49.adb: Likewise. * libgnat/s-pack50.adb: Likewise. * libgnat/s-pack51.adb: Likewise. * libgnat/s-pack52.adb: Likewise. * libgnat/s-pack53.adb: Likewise. * libgnat/s-pack54.adb: Likewise. * libgnat/s-pack55.adb: Likewise. * libgnat/s-pack56.adb: Likewise. * libgnat/s-pack57.adb: Likewise. * libgnat/s-pack58.adb: Likewise. * libgnat/s-pack59.adb: Likewise. * libgnat/s-pack60.adb: Likewise. * libgnat/s-pack61.adb: Likewise. * libgnat/s-pack62.adb: Likewise. * libgnat/s-pack63.adb: Likewise. * libgnat/s-pack65.adb: Likewise. * libgnat/s-pack66.adb: Likewise. * libgnat/s-pack67.adb: Likewise. * libgnat/s-pack68.adb: Likewise. * libgnat/s-pack69.adb: Likewise. * libgnat/s-pack70.adb: Likewise. * libgnat/s-pack71.adb: Likewise. * libgnat/s-pack72.adb: Likewise. * libgnat/s-pack73.adb: Likewise. * libgnat/s-pack74.adb: Likewise. * libgnat/s-pack75.adb: Likewise. * libgnat/s-pack76.adb: Likewise. * libgnat/s-pack77.adb: Likewise. * libgnat/s-pack78.adb: Likewise. * libgnat/s-pack79.adb: Likewise. * libgnat/s-pack80.adb: Likewise. * libgnat/s-pack81.adb: Likewise. * libgnat/s-pack82.adb: Likewise. * libgnat/s-pack83.adb: Likewise. * libgnat/s-pack84.adb: Likewise. * libgnat/s-pack85.adb: Likewise. * libgnat/s-pack86.adb: Likewise. * libgnat/s-pack87.adb: Likewise. * libgnat/s-pack88.adb: Likewise. * libgnat/s-pack89.adb: Likewise. * libgnat/s-pack90.adb: Likewise. * libgnat/s-pack91.adb: Likewise. * libgnat/s-pack92.adb: Likewise. * libgnat/s-pack93.adb: Likewise. * libgnat/s-pack94.adb: Likewise. * libgnat/s-pack95.adb: Likewise. * libgnat/s-pack96.adb: Likewise. * libgnat/s-pack97.adb: Likewise. * libgnat/s-pack98.adb: Likewise. * libgnat/s-pack99.adb: Likewise.
2024-11-12ada: Fix assertion failure on null aggregate in generic with pragma Ada_2022Eric Botcazou1-1/+1
This happens when the unit is instantiated in a non-Ada 2022 unit. gcc/ada/ChangeLog: PR ada/114127 * sem_aggr.adb (Is_Null_Aggregate): Replace test on Ada_Version with test on Nkind.
2024-11-12ada: Get rid of N_Unchecked_Expression nodeEric Botcazou18-125/+23
This node is used in a single place in the front-end: it wraps the newly built N_Indexed_Component nodes on the left-hand side of assignments generated to elaborate array aggregates, and its effect is to disable range checks for the expressions of these nodes. Most of the code in the front-end does not expect to encounter it at all, which leads to weird effects when this actually happens after changes are made to the processing of array aggregates. This change replaces the node by the Kill_Range_Check flag already present on N_Unchecked_Type_Conversion, but with a slightly adjusted semantics. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Array_Aggr_Code.Gen_Assign): Do not call Checks_Off on the newly built N_Indexed_Component node but instead set Kill_Range_Check on it. * exp_ch4.ads (Expand_N_Unchecked_Expression): Delete. * exp_ch4.adb (Expand_N_Indexed_Component): Remove handling of N_Unchecked_Expression. (Expand_N_Unchecked_Expression): Delete. (Expand_N_Unchecked_Type_Conversion): Propagate the Assignment_OK flag and rewrite the node manually. * exp_util.adb (Insert_Actions): Remove handling of N_Unchecked_Expression. (Side_Effect_Free): Likewise. * expander.adb (Expand): Likewise. * gen_il-gen-gen_nodes.adb (N_Indexed_Component): Add flag Kill_Range_Check for the purpose of semantics. (N_Unchecked_Expression): Delete. * gen_il-internals.ads (Type_Frequency): Remove entry for N_Unchecked_Expression. * gen_il-types.ads (Opt_Type_Enum): Remove N_Unchecked_Expression. * pprint.adb (Expression_Image): Remove handling of N_Unchecked_Expression. * sem.adb (Analyze): Likewise. * sem_ch4.ads (Analyze_Unchecked_Expression): Delete. * sem_ch4.adb (Analyze_Unchecked_Expression): Likewise. * sem_res.adb (Resolve_Unchecked_Expression): Likewise. (Resolve): Remove handling of N_Unchecked_Expression. (Resolve_Indexed_Component): Do not call Apply_Scalar_Range_Check on the expressions if Kill_Range_Check is set on the node. * sem_util.adb (Is_Non_Preelaborable_Construct): Remove handling of N_Unchecked_Expression. * sinfo.ads (Kill_Range_Check): Document it for N_Indexed_Component. (Unchecked Expression): Delete specification. * sprint.adb (Sprint_Node_Actual): Remove handling of N_Unchecked_Expression. * tbuild.ads (Checks_Off): Delete. * tbuild.adb (Checks_Off): Likewise.
2024-11-12ada: Fix internal error on invalid prefix with assertions enabledEric Botcazou1-1/+1
This happens for example with: package Q3 is type Types is (One, Two); end Q3; with Q3; package P3 is Kind : Q3.Types := Q3.Types.One; end P3; and prevents the error from being given. gcc/ada/ChangeLog: PR ada/112979 * sem_ch8.adb (Find_Selected_Component): Try to recognize the object operation notation only if the selector is a subprogram.
2024-11-12ada: Fix assertion failure on illegal use of aspect Type_InvariantEric Botcazou1-4/+12
The illegal use is on a type derived from a formal private type, e.g.: generic type T is private; package G is type D is new T with Type_Invariant => True; end G; gcc/ada/ChangeLog: PR ada/113037 * sem_prag.adb (Analyze_Pragma) <Pragma_Invariant>: Reject types that are derived from formal private types.
2024-11-12ada: Fix unexpected Program_Error raised in the parser on mismatched []Eric Botcazou1-1/+2
This happens for example with: A : constant array (Natural range <>) of String := [ "xor" [; The problem is that the left bracket token is incorrectly classified as a name extension, but there is no handler in the Scan_Name_Extension_OK part of P_Name in Par.Ch4. gcc/ada/ChangeLog: PR ada/112821 * scans.ads (Token_Type): Remove Tok_Left_Bracket from Namext.
2024-11-12ada: Fix internal error on instantiation of package with a nested ghost packageEric Botcazou2-12/+17
The instantiation triggers an internal error in Gigi because of a dangling ghost entity created by the finalization machinery. gcc/ada/ChangeLog: PR ada/114300 * exp_ch7.adb (Attach_Object_To_Master_Node): Propagate the Is_Ignored_Ghost_Entity flag from the finalization procedure. (Build_Finalizer.Process_Declarations): Move up the test on Is_Ignored_Ghost_Entity. * exp_util.adb (Requires_Cleanup_Actions): Likewise.
2024-11-12ada: Fix premature finalization of anonymous access result from library functionEric Botcazou2-7/+25
In GNAT's implementation, the finalization of controlled objects created through anonymous access types occurs when the enclosing library unit goes out of scope if this is safe, and never occurs otherwise. The case of a function that is a library unit with an anonymous access result type falls in the second category for the anonymous access result type itself and, therefore, finalization cannot take place for it. gcc/ada/ChangeLog: PR ada/55725 * exp_ch6.adb (Add_Collection_Actual_To_Build_In_Place_Call): Be prepared for no collection if the access type is anonymous. * exp_ch7.adb (Build_Anonymous_Collection): Return early for the anonymous access result type of a library function.
2024-11-12ada: Accept SPARK.Big_Integers.Big_Integer where Big_Integer is acceptedPiotr Trojanek4-1/+26
For certification of a light SPARK runtime libraries we now accept expressions of type SPARK.Big_Integers.Big_Integer in subprogram and loop variants. gcc/ada/ChangeLog: * exp_util.adb (Make_Variant_Comparison): Accept new types in expansion. * rtsfind.adb (Get_Unit_Name): Support SPARK.Big_Integers. * rtsfind.ads (RTU_Id, RE_Id, RE_Unit_Table): Support new type and its enclosing unit. * sem_prag.adb (Analyze_Pragma): Support new type in pragma Loop_Variant. (Analyze_Subprogram_Variant_In_Decl_Part): Support new type in aspect Subprogram_Variant.
2024-11-12ada: Make Interrupt and Attach Handlers Obsolescent in VXWorksViljar Indus3-1/+285
In order to trigger an obsolescent feature warning in VXWorks if either the pragma or aspect of Interrupt_Handler or Attach_Handler is used, the spec of the Register_Interrupt_Handler method needs to be marked as obsolescent in a VXWorks specific version of the file. gcc/ada/ChangeLog: * libgnarl/s-interr__vxworks.ads (new): A VXWorks specific version of the file where Register_Interrupt_Handler is marked with the Obsolescent pragma. * libgnarl/s-interr__vxworks.adb: Remove pragma Obsoloescent that had no effect. * Makefile.rtl: Add entries for using the libgnarl/s-interr__vxworks.ads file.
2024-11-12ada: Fix bogus error for delta aggregate as expression functionEric Botcazou1-0/+1
The compiler correctly accepts the other forms of aggregates. gcc/ada/ChangeLog: PR ada/113868 * par-ch6.adb (P_Subprogram) <Scan_Body_Or_Expression_Function>: Add delta aggregate alongside the other forms of aggregates.
2024-11-12ada: Remove couple of irregular calls to Resolve_Aggr_ExprEric Botcazou1-32/+12
The function is supposed to be passed an expression, but it is passed the enclosing N_Component_Association node in a couple of cases, only to give an error that can as well be given in the caller, at the cost of bypasses to disable most of its processing. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Array_Aggregate): In the case of an others choice with a box, do not call Resolve_Aggr_Exp and give the error for a multidimensional array directly. (Resolve_Aggr_Expr): Remove bypasses for above case.
2024-11-12ada: Allow file mapping for System's specRonan Desplanques3-19/+34
Before this patch, it was never allowed to use pragma Source_File_Name for the spec of System, allegedly because Targparm.Get_Target_Parameters is called before configuration pragmas are processed. Using a mapping file was allowed but did not work correctly. This patch makes mapping files loading happen before the call to Get_Target_Parameters so mapping file can set the file name of System. Also, pragma Source_File_Name is allowed if it confirms a mapping that was previously given in a mapping file, to accommodate GPRbuild that uses both pragmas and mapping files. gcc/ada/ChangeLog: * frontend.adb (Frontend): Move call to Fmap.Initialize ... * gnat1drv.adb (Gnat1drv): ... here. Look up Fmap when loading System. * par-prag.adb (Prag): Allow pragma Source_File_Name for System when it confirms an existing mapping.
2024-11-12ada: Fix markup typosRichard Kenner3-5/+5
gcc/ada/ChangeLog: * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix minor markup errors. * doc/gnat_ugn/gnat_utility_programs.rst: Likewise. * gnat_ugn.texi: Regenerate.
2024-11-12ada: Remove use of overlays in implementation of System.Pack_N unitsEric Botcazou121-1432/+2453
The implementation uses an overlay between an address and an access value, which is convoluted. This changes it to use a direct conversion instead. No functional changes (and no changes to generated code at -O2). gcc/ada/ChangeLog: * s-pack.adb.tmpl: Add "with System.Address_To_Access_Conversions". (Cluster_Ref): Delete. (AAC): New instance of System.Address_To_Access_Conversions. (Rev_Cluster_Ref): Delete. (Rev_ACC): New instance of System.Address_To_Access_Conversions. (ClusterU_Ref): Delete. (AACU): New instance of System.Address_To_Access_Conversions. (Rev_ClusterU_Ref): Delete. (Rev_ACCU): New instance of System.Address_To_Access_Conversions. (Get_@@): Use a direct address-to-access conversion. (GetU_@@): Likewise. (Set_@@): Likewise. (SetU_@@): Likewise. * libgnat/s-pack03.adb: Regenerate. * libgnat/s-pack05.adb: Likewise. * libgnat/s-pack06.adb: Likewise. * libgnat/s-pack07.adb: Likewise. * libgnat/s-pack09.adb: Likewise. * libgnat/s-pack10.adb: Likewise. * libgnat/s-pack100.adb: Likewise. * libgnat/s-pack101.adb: Likewise. * libgnat/s-pack102.adb: Likewise. * libgnat/s-pack103.adb: Likewise. * libgnat/s-pack104.adb: Likewise. * libgnat/s-pack105.adb: Likewise. * libgnat/s-pack106.adb: Likewise. * libgnat/s-pack107.adb: Likewise. * libgnat/s-pack108.adb: Likewise. * libgnat/s-pack109.adb: Likewise. * libgnat/s-pack11.adb: Likewise. * libgnat/s-pack110.adb: Likewise. * libgnat/s-pack111.adb: Likewise. * libgnat/s-pack112.adb: Likewise. * libgnat/s-pack113.adb: Likewise. * libgnat/s-pack114.adb: Likewise. * libgnat/s-pack115.adb: Likewise. * libgnat/s-pack116.adb: Likewise. * libgnat/s-pack117.adb: Likewise. * libgnat/s-pack118.adb: Likewise. * libgnat/s-pack119.adb: Likewise. * libgnat/s-pack12.adb: Likewise. * libgnat/s-pack120.adb: Likewise. * libgnat/s-pack121.adb: Likewise. * libgnat/s-pack122.adb: Likewise. * libgnat/s-pack123.adb: Likewise. * libgnat/s-pack124.adb: Likewise. * libgnat/s-pack125.adb: Likewise. * libgnat/s-pack126.adb: Likewise. * libgnat/s-pack127.adb: Likewise. * libgnat/s-pack13.adb: Likewise. * libgnat/s-pack14.adb: Likewise. * libgnat/s-pack15.adb: Likewise. * libgnat/s-pack17.adb: Likewise. * libgnat/s-pack18.adb: Likewise. * libgnat/s-pack19.adb: Likewise. * libgnat/s-pack20.adb: Likewise. * libgnat/s-pack21.adb: Likewise. * libgnat/s-pack22.adb: Likewise. * libgnat/s-pack23.adb: Likewise. * libgnat/s-pack24.adb: Likewise. * libgnat/s-pack25.adb: Likewise. * libgnat/s-pack26.adb: Likewise. * libgnat/s-pack27.adb: Likewise. * libgnat/s-pack28.adb: Likewise. * libgnat/s-pack29.adb: Likewise. * libgnat/s-pack30.adb: Likewise. * libgnat/s-pack31.adb: Likewise. * libgnat/s-pack33.adb: Likewise. * libgnat/s-pack34.adb: Likewise. * libgnat/s-pack35.adb: Likewise. * libgnat/s-pack36.adb: Likewise. * libgnat/s-pack37.adb: Likewise. * libgnat/s-pack38.adb: Likewise. * libgnat/s-pack39.adb: Likewise. * libgnat/s-pack40.adb: Likewise. * libgnat/s-pack41.adb: Likewise. * libgnat/s-pack42.adb: Likewise. * libgnat/s-pack43.adb: Likewise. * libgnat/s-pack44.adb: Likewise. * libgnat/s-pack45.adb: Likewise. * libgnat/s-pack46.adb: Likewise. * libgnat/s-pack47.adb: Likewise. * libgnat/s-pack48.adb: Likewise. * libgnat/s-pack49.adb: Likewise. * libgnat/s-pack50.adb: Likewise. * libgnat/s-pack51.adb: Likewise. * libgnat/s-pack52.adb: Likewise. * libgnat/s-pack53.adb: Likewise. * libgnat/s-pack54.adb: Likewise. * libgnat/s-pack55.adb: Likewise. * libgnat/s-pack56.adb: Likewise. * libgnat/s-pack57.adb: Likewise. * libgnat/s-pack58.adb: Likewise. * libgnat/s-pack59.adb: Likewise. * libgnat/s-pack60.adb: Likewise. * libgnat/s-pack61.adb: Likewise. * libgnat/s-pack62.adb: Likewise. * libgnat/s-pack63.adb: Likewise. * libgnat/s-pack65.adb: Likewise. * libgnat/s-pack66.adb: Likewise. * libgnat/s-pack67.adb: Likewise. * libgnat/s-pack68.adb: Likewise. * libgnat/s-pack69.adb: Likewise. * libgnat/s-pack70.adb: Likewise. * libgnat/s-pack71.adb: Likewise. * libgnat/s-pack72.adb: Likewise. * libgnat/s-pack73.adb: Likewise. * libgnat/s-pack74.adb: Likewise. * libgnat/s-pack75.adb: Likewise. * libgnat/s-pack76.adb: Likewise. * libgnat/s-pack77.adb: Likewise. * libgnat/s-pack78.adb: Likewise. * libgnat/s-pack79.adb: Likewise. * libgnat/s-pack80.adb: Likewise. * libgnat/s-pack81.adb: Likewise. * libgnat/s-pack82.adb: Likewise. * libgnat/s-pack83.adb: Likewise. * libgnat/s-pack84.adb: Likewise. * libgnat/s-pack85.adb: Likewise. * libgnat/s-pack86.adb: Likewise. * libgnat/s-pack87.adb: Likewise. * libgnat/s-pack88.adb: Likewise. * libgnat/s-pack89.adb: Likewise. * libgnat/s-pack90.adb: Likewise. * libgnat/s-pack91.adb: Likewise. * libgnat/s-pack92.adb: Likewise. * libgnat/s-pack93.adb: Likewise. * libgnat/s-pack94.adb: Likewise. * libgnat/s-pack95.adb: Likewise. * libgnat/s-pack96.adb: Likewise. * libgnat/s-pack97.adb: Likewise. * libgnat/s-pack98.adb: Likewise. * libgnat/s-pack99.adb: Likewise.
2024-11-12ada: Remove obsolete ??? comment about Assignment_OK flagEric Botcazou1-4/+2
The flagged use has apparently disappeared for long. gcc/ada/ChangeLog: * sinfo.ads (Assignment_OK): Remove obsolete ??? comment.
2024-11-12ada: Get rid of Kill_Range_Checks flag on entitiesEric Botcazou6-35/+11
This flag is set in a single context, namely semantic analysis of record type definitions, to avoid generating spurious range checks from it, and a large testing campaign showed that, in practice, it makes a difference in a single case, namely an access-to-constrained-array component with a default expression, for example: type Acc_String is access all String (1 .. 100); type Rec (D : Positive) is record A : Acc_String := new String (1 .. D); end record; Now there is another mechanism implemented in Process_Range_Expr_In_Decl to avoid generating spurious range checks, which does not work in this specific case but can be made to work with a small tweak to Denotes_Discriminant. gcc/ada/ChangeLog: * checks.adb (Range_Checks_Suppressed): Remove test on the Kill_Range_Checks flag. * einfo.ads (Kill_Range_Checks): Delete. * gen_il-fields.ads (Opt_Field_Enum): Remove Kill_Range_Checks. * gen_il-gen-gen_entities.adb (Entity_Kind): Likewise. * sem_ch3.adb (Record_Type_Declaration): Do not set the Kill_Range_Checks flag. * sem_util.adb (Denotes_Discriminant): In a default expression, also return True for a discriminal.
2024-11-12ada: Improve message for misused implicitly-defined preprocessor symbol.Steve Baird1-2/+9
If the -u option is specified, then otherwise-undefined preprocessor symbols are implicitly defined to be False. If such an implicitly-defined symbol is then incorrectly used in a context that requires an integer value, the resulting error message should not incorrectly state that the symbol is undefined. gcc/ada/ChangeLog: * prep.adb (Expression): Improve error message text when an implicitly-defined Boolean-valued symbol is used in a context that requires an integer value.
2024-11-12ada: Flatten Is_Build_In_Place_Aggregate_Return predicateEric Botcazou1-25/+10
The predicate is passed an aggregate node and goes up its parent chain, but that's unnecessary because Convert_To_Assignments has already done so in the case of a record aggregate and Expand_Array_Aggregate does not fully support intermediate conditional expressions yet. gcc/ada/ChangeLog: * exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): Directly test the node and remove dead code for extended return statements.
2024-11-12ada: Set correct minimum stack size for aarch64-linuxJohannes Kliemann2-0/+83
The minimum stack size defined by PTHREAD_STACK_MIN defined on AArch64 Linux is 131072 bytes. Add a separate version for this target to reflect that value. Previously the x86-64 value of 16384 bytes was used. gcc/ada/ChangeLog: * Makefile.rtl: Use libgnat/s-parame__aarch64-linux.adb for s-parame.adb on aarch64-linux. * libgnat/s-parame__aarch64-linux.adb: Add file.
2024-11-12ada: Detect sharing of external file in inconsistent read-write modesPiotr Trojanek5-6/+11
When opening files with "shared=yes", as described in GNAT RM 11.10, Sharing Files, we now prevent sharing a single file in inconsistent read-write modes. gcc/ada/ChangeLog: * doc/gnat_rm/the_implementation_of_standard_i_o.rst (Shared Files): Add trailing period. * libgnat/s-ficobl.ads (AFCB): Reflect new behavior in comment. * libgnat/s-fileio.adb (Open): Detect inconsistent sharing, just like we do in System.File_IO.Reset. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-11-12ada: Spurious error on abstract primitive with access formalssquirek1-1/+14
This patch fixes an issue in the compiler whereby using anonymous access types as abstract overridden subprogram formals for a derived abtract type may lead to compile-time errors. gcc/ada/ChangeLog: * accessibility.adb (Type_Access_Level): Add handling for subprogram aliases.
2024-11-12ada: Missing runtime tag check on mutably tagged objectssquirek1-2/+30
This patch fixes an issue in the compiler whereby assigning to a non-existant mutably tagged object component failed to result in the expected run-time exception. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Type_Conversion): Add special runtime check generation for mutably tagged objects.
2024-11-12ada: GNAT Calendar Support for 64-bit Unix TimeDouglas B Rupp4-7/+146
The Epochalypse of 2038 will require the use of 64-bit time_t and tv_sec (aka time in seconds from the Unix Epoch). The subprograms in Ada calendar are self contained but nevertheless will malfunction if a 64-bit integer type and calculations aren't used. Add 64-bit versions and mark the old ones with pragma Obsolescent. gcc/ada/ChangeLog: * libgnat/a-calcon.adb (To_Ada_Time) (To_Duration) (To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent. (To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64) (To_Unix_Time_64): New. * libgnat/a-calcon.ads (To_Ada_Time) (To_Duration) (To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent. (To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64) (To_Unix_Time_64): New. * libgnat/a-calend.adb (To_Ada_Time) (To_Duration) (To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent. (To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64) (To_Unix_Time_64): New. * libgnat/a-calend.ads (To_Ada_Time) (To_Duration) (To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent. (To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64) (To_Unix_Time_64): New.
2024-11-12ada: Fix internal error on nested iterated component associationsEric Botcazou3-77/+91
The problem is that Insert_Actions gets confused as to where it should insert actions coming from within an N_Iterated_Component_Association, because some actions may be generated during semantic analysis and some others during expansion. Instead of another ad-hoc fix, this change extends the processing done for N_Component_Association, that is to say waiting for the Loop_Actions field to be set during expansion before inserting actions in there. This in turn requires semantic analysis to stop generating actions for N_Iterated_Component_Association nodes. The current processing is a little unstable: - for container aggregates, Resolve_Iterated_Association preanalyzes a copy of the expression, - for delta aggregates, Resolve_Delta_Array_Aggregate fully analyzes a copy of the expression, - for array aggregate, Resolve_Aggr_Expr entirely skips the analysis. The change implements a preanalysis of a copy of the expression using Copy_Separate_Tree, which should be sufficient since the expression is supposed to be unanalyzed at this point, recursively in the context of N_Iterated_Component_Association nodes. gcc/ada/ChangeLog: PR ada/117018 * exp_aggr.adb (Build_Array_Aggr_Code): Do not expect the Loop_Actions field to be already present on association nodes. * exp_util.adb (Insert_Actions): For association nodes, insert into the Loop_Actions field only if it is already present. * sem_aggr.adb (Resolve_Array_Aggregate): Add Iterated parameter. (Resolve_Aggregate): Adjust calls to Resolve_Array_Aggregate. (Resolve_Aggr_Expr): Add Iterated_Elmt defaulted parameter and a default for Single_Elmt. Adjust call to Resolve_Array_Aggregate. Preanalyze a copy of the expression in an iteration context. (Resolve_Iterated_Component_Association): Pass Iterated_Elmt as True to Resolve_Aggr_Expr and remove processing of Loop_Actions. Do not check incorrect use of dynamically tagged expression in an iteration context. (Resolve_Iterated_Association): Use Copy_Separate_Tree instead of New_Copy_Tree and set the Parent field of the result. (Resolve_Delta_Array_Aggregate): Likewise. Only preanalyze the copy instead of analyzing it.
2024-11-12ada: Add documentation about GNAT LLVM to GNAT User's GuideRichard Kenner5-557/+801
Also be consistent on spelling of "back end". gcc/ada/ChangeLog: * doc/gnat_ugn/about_this_guide.rst: Add information about GNAT LLVM. Be consistent about spelling of "back end". * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Likewise. * doc/gnat_ugn/gnat_and_program_execution.rst: Be consistent about spelling of "back end". * doc/gnat_ugn/the_gnat_compilation_model.rst: Likewise. * gnat_ugn.texi: Regenerate.
2024-11-12ada: Fix compilation failure due to style warningEric Botcazou1-1/+1
gcc/ada/ChangeLog: * mdll.adb (Build_Dynamic_Library): Fix indentation.
2024-11-12ada: Rework GNATdll shared library relocation support.Pascal Obry1-152/+21
The code has been simplified to use a single way to create a DLL. The relocation support is based on whether the base address for the DLL is passed to the final linker step or not. gcc/ada/ChangeLog: * mdll.adb: Use the same procedure to create relocatable or non relocatable DLL. The only difference is wether the base address is passed to the final linker. If no base-address is given the DLL is relocatable.
2024-11-12ada: The Library_Unit field was used for all sorts of different purposes, ↵squirek1-2/+2
which led to confusing code. This patch further refines the previous work to fix several cases. gcc/ada/ChangeLog: * inline.adb (In_Main_Unit_Or_Subunit): Use Other_Comp_Unit instead of Spec_Or_Body_Lib_Unit. (Must_Inline): Use Other_Comp_Unit instead of Spec_Or_Body_Lib_Unit.
2024-11-12ada: Elide the copy in aggregate returns for nonlimited typesEric Botcazou4-36/+48
This implements elision of the copy operation for aggregate returns, i.e. simple return statements whose expression is an aggregate, in the case of nonlimited by-reference types (the copy operation is already elided for limited types), which comprise controlled and tagged types. This is the copy operation in the called function, that is to say the copy from the anonymous object built for the aggregate to the anonymous return object. The implementation simply extends that of limited types, which rewrites the simple return statement as an extended return statement internally and then leverages the built-in-place implementation of return objects for these statements. gcc/ada/ChangeLog: * exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): Also return True for functions returning on the secondary stack or returning a by-reference type if the back end exposes its return slot. (Expand_Array_Aggregate): Call Is_Build_In_Place_Aggregate_Return to spot aggregates to be built in place. * exp_ch3.adb (Make_Allocator_For_Return): Add missing condition in assertion pragma deduced from Expand_Subtype_From_Expr. * exp_ch6.adb (Expand_Simple_Function_Return): Rewrite the statement as an extended return statement if the expression is an aggregate whose expansion is delayed. Properly relocate the expression in this case. * sem_ch6.adb: Add clauses for Exp_Aggr. (Analyze_Function_Return): Do not apply the predicate check to an aggregate whose expansion is delayed. Extended the processing of case expressions to all conditional expressions.
2024-11-12ada: Add Ada coverage instrumentation supportRonan Desplanques1-0/+54
gcc/ada/ChangeLog: * gnat2.gpr: New file.
2024-11-12ada: Implement built-in-place expansion of container aggregatesEric Botcazou3-148/+285
It is implemented for container aggregates that are used to initialize an object, as specified by RM 7.6(17.2/3-17.3/3) for immutably limited types and types that need finalization, but for all types like other aggregates. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Delta_Array_Aggregate): Move declaration. (Expand_Delta_Record_Aggregate): Likewise. (Expand_Container_Aggregate): Likewise. Move implementation to Build_Container_Aggr_Code. Implement built-in-place expansion for object declarations and allocators. (Build_Container_Aggr_Code): New function containing most of the code of the original Expand_Container_Aggregate. Do not build a temporary for the size calculation. Minor formatting tweaks. (Expand_N_Aggregate): Add comment. * exp_ch4.adb (Expand_Allocator_Expression): Detect the case of a container aggregate as qualified expression. Do not apply the predicate check on entry in this case and rewrite the allocator. * exp_ch7.adb (Build_Finalizer.Process_Object_Declaration): Deal with Last_Aggregate_Assignment first to compute the attachment point (as already done in Attach_Object_To_Master_Node).
2024-11-12ada: Remove obsolete workaround for back-end limitationEric Botcazou3-34/+0
This avoids a strange discrepancy in the handling of constants vs variables. gcc/ada/ChangeLog: * sem_aux.ads (Has_Unconstrained_Elements): Delete. * sem_aux.adb (Has_Unconstrained_Elements): Likewise. * sem_ch3.adb (Analyze_Object_Declaration): Remove obsolete code.
2024-11-12ada: sem.adb.process_bodies_in_context: check if spec has lib body before useGhjuvan Lacambre1-18/+23
Inspector testing shows that calling Body_Lib_Unit on Spec can sometimes fail due to the following assertion failing: pragma Assert (Unit (N) in N_Lib_Unit_Declaration_Id | N_Lib_Unit_Renaming_Declaration_Id); Indeed, Unit (N) may sometimes be an N_Subprogram_Body instead of an N_Lib_Unit_Declaration_Id. gcc/ada/ChangeLog: * sem.adb (Process_Bodies_In_Context): check that Spec's unit is an N_Lib_Unit_Declaration_Id.
2024-11-12ada: Fix weird error in Ada.Numerics.Discrete_Random with Component_AlignmentEric Botcazou1-7/+6
The problem arises when an instance of Ada.Numerics.Discrete_Random is covered by a pragma Component_Alignment with a non-default alignment. gcc/ada/ChangeLog: * exp_ch5.adb (Expand_Assign_Array): Make Act_Rhs a constant and do not recompute it, as well as R_Type, when there is a change of representation. Move comment about the RHS from here to... (Expand_N_Assignment_Statement): ...here.
2024-11-12ada: add xspack.py and corresponding templates.Marc Poulhiès3-0/+415
xspack.py is used to generate libgnat/s-pack* files. gcc/ada/ChangeLog: * xspack.py: New * s-pack.ads.tmpl: New. * s-pack.adb.tmpl: New.
2024-11-05Daily bump.GCC Administrator1-0/+326
2024-11-04ada: Move special case for null string literal from frontend to backendPiotr Trojanek1-2/+12
Previously the lower bound of string literals indexed by non-static integer types was artificially set to 1 in the frontend. This was to avoid an overflow in calculation of a null string size by the GCC backend, which was causing an excessively large binary object file. However, setting the lower bound to 1 was problematic for GNATprove, which could not easily retrieve the lower bound of string literals. This patch avoids the overflow in GCC by recognizing null string literal subtypes in Gigi. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Recognize null string literal subtypes and set their bounds to 1 .. 0.
2024-11-04ada: Remove special case for the size of a string literal subtypePiotr Trojanek1-6/+2
Apparently we no longer need to ignore string literal subtypes case when validating size of a type entity. Code cleanup; behavior appears to be unaffected. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Remove special case for string literal subtypes.
2024-11-04ada: Fix ancient typo in process_declsEric Botcazou1-6/+2
It has gone unnoticed for decades because it changes nothing in practice. gcc/ada/ChangeLog: * gcc-interface/trans.cc (process_decls): Remove tests on Nkind that contain a typo and would be redundant if written correctly.
2024-11-04ada: Split Library_Unit using multiple wrappersBob Duff29-295/+542
The Library_Unit field was used for all sorts of different purposes, which led to confusing code. This patch splits Library_Unit into much more specific wrapper subprograms that should be called instead of [Set_]Library_Unit. Predicates and pragmas Assert are used to catch misuses of these. We document the semantics, especially "surprising" cases (e.g. internally-generated with clauses can refer to package bodies). This change does not fix gigi, codepeer, spark, or llvm to use the new wrappers; so far, they are used only in the GNAT front end. gcc/ada/ChangeLog: * sinfo.ads (Library_Unit): Rewrite documentation. Note that the "??? not (always) true..." comment was not true; the Subunit_Parent never points to the spec. (N_Compilation_Unit): Improve documentation. The Aux_ node was not created to solve the mentioned problems; it was created because the size of nodes was limited. Misc doc improvements. * sinfo-utils.ads: Add new wrappers for Library_Unit field. Use subtypes with predicates for the parameters. (First_Real_Statement): Still used in codepeer. * sinfo-utils.adb: Add new wrappers for Library_Unit field, with suitable assertions. * sem_prag.adb: Use new field wrapper names. (Matching_Name): New name for Same_Name to avoid potential confusion with the other function with the same name (Sem_Util.Same_Name), which is also called in this same file. (Matching_Convention): Change Same_Convention to match Matching_Name. * sem_util.ads (Same_Name): Improve comments; the old comment implied that it works for all names, which was not true. * sem_util.adb: Use new field wrapper names. * gen_il-gen.adb: Rename N_Unit_Body to be N_Lib_Unit_Body. Plain "unit" is ambiguous in Ada (library unit, compilation unit, program unit, etc). Add new union types N_Lib_Unit_Declaration and N_Lib_Unit_Renaming_Declaration. * gen_il-gen-gen_nodes.adb (Compute_Ranges): Raise exception earlier (it is already raised later, in Verify_Type_Table). Add a comment explaining why it might be raised. * gen_il-types.ads: Rename N_Unit_Body to be N_Lib_Unit_Body, and add new N_Lib_Unit_Declaration and N_Lib_Unit_Renaming_Declaration. * einfo.ads: Fix obsolete comment (was left over from before the "variable-sized nodes"). * exp_ch7.adb: Use new field wrapper names. * exp_disp.adb: Use new field wrapper names. * exp_unst.adb: Use new field wrapper names. * exp_util.adb: Use new field wrapper names. * fe.h: Add new field wrapper names. These are currently not used in gigi, but this change prepares for using them in gigi. * inline.adb: Use new field wrapper names. * lib.adb: Use new field wrapper names. Comment improvements. * lib-load.adb: Use new field wrapper names. Minor cleanup. * lib-writ.adb: Use new field wrapper names. * live.adb: Use new field wrapper names. * par-load.adb: Use new field wrapper names. Comment improvements. Minor cleanup. * rtsfind.adb: Use new field wrapper names. * sem.adb: Use new field wrapper names. * sem_ch10.adb: Use new field wrapper names. Comment improvements. Minor cleanup. * sem_ch12.adb: Use new field wrapper names. * sem_ch7.adb: Use new field wrapper names. * sem_ch8.adb: Use new field wrapper names. * sem_elab.adb: Use new field wrapper names. Comment improvements. * errout.adb (Output_Source_Line): Fix blowup in some obscure cases, where List_Pragmas is not fully set up.
2024-11-04ada: Improve Unbounded_Wide_String performanceNicolas Roche2-46/+127
Improve performance of iteration using Element function. Improve performance of Append. gcc/ada/ChangeLog: * libgnat/a-stwiun__shared.adb: Restructure code to inline only the most common cases. Remove whenever possible runtime checks. * libgnat/a-stwiun__shared.ads: Add Inline => True to Append variants and Element.
2024-11-04ada: Improve performance of Unbounded_Wide_Wide_StringNicolas Roche2-47/+130
Improve performance of iteration using Element function. Improve performance of Append. gcc/ada/ChangeLog: * libgnat/a-stzunb__shared.adb: Restructure code to inline only the most common cases. Remove whenever possible runtime checks. * libgnat/a-stzunb__shared.ads: Add Inline => True to Append variants and Element.
2024-11-04ada: Improve Unbounded_String performanceNicolas Roche2-49/+134
Improve performance of iteration using Element function. Improve performance of Append. gcc/ada/ChangeLog: * libgnat/a-strunb__shared.adb: Restructure code to inline only the most common cases. Remove whenever possible runtime checks. * libgnat/a-strunb__shared.ads: Add Inline => True to Append variants and Element.
2024-11-04ada: Initial implementation of Extended_Access aspect (FE portion only)Steve Baird10-5/+204
The Extended_Access aspect can be specified to be True for certain access-to-unconstrained-array-subtype types. Such extended access types can designate objects that a normal general access type (with the same designated subtype) cannot, such as a slice of an aliased array object or an object that is represented without contiguous bounds information. gcc/ada/ChangeLog: * aspects.ads: Add Aspect_Extended_Access to Aspect_Id enumeration. * par-prag.adb: Add Pragma_Extended_Access to list of pragmas that get no interesting processing in the parser. * sem_attr.adb: Relax legality checks on Access/Unchecked_Access attribute references if access type is Extended_Access. * sem_ch12.adb (Validate_Access_Type_Instance): For an instance of a generic with a formal access type, check that formal and actual agree with with respect to Extended_Access aspect. * sem_prag.adb (Analyze_Pragma): Add analysis code for pragma Extended_Access. Set Pragma_Extended_Access element in Sig_Flags aggregate. * sem_prag.ads: Set Pragma_Extended_Access element in Aspect_Specifying_Pragma aggregate. * sem_res.adb (Valid_Conversion): Disallow extended-to-not-extended access conversion. * sem_util.adb (Is_Extended_Access_Access_Type): Implement new function. (Is_Aliased_View): If (and only if) the new Boolean For_Extended parameter is True, then a slice of an aliased non-bitpacked array is aliased, a constrained nominal subtype does not force a result of False, and a dereference of an extended access value is aliased. The last point is somewhat subtle. This is how we prevent covert fat-to-nonfat type conversions via things like "Not_Extended_Type'(Extended_Ptr.all'Access)" or passing Extended_Ptr.all as an actual parameter corresponding to an explicitly aliased formal parameter. * sem_util.ads (Is_Extended_Access_Type): Declare new function. (Is_Aliased_View): Add new defaults-False parameter For_Extended. * snames.ads-tmpl: Declare Name_Extended_Access Name_Id constant and Pragma_Extended_Access Pragma_Id enumeration literal.