aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
7 daysada: Fix regression in Root_Type -- adjustmentBob Duff1-5/+1
Recent changes "Fix regression in Root_Type" and "Crash on b3a1004 with assertions enabled" are partially redundant; they are addressing the same bug. This patch adjusts the former in the case of Root_Type. But we leave Root_Type_If_Set alone; debugging printouts should survive bugs when possible. gcc/ada/ChangeLog: * einfo-utils.adb (Root_Type): Do not deal with missing Etype.
7 daysada: Fix regression in Root_TypeBob Duff1-7/+10
Previous change, "Make pp and friends more robust (base type only)" introduced a bug in Root_Type. Etype (T) can, in fact, be Empty (but only in case of errors.) This patch fixes it. gcc/ada/ChangeLog: * einfo-utils.adb (Root_Type): Deal with missing Etype. (Root_Type_If_Set): Likewise.
7 daysada: Crash on b3a1004 with assertions enabledJavier Miranda3-4/+18
The compilation of files b3a10041.ads and b3a10042.adb crash when the compiler is built with assertions enabled. gcc/ada/ChangeLog: * freeze.adb (Freeze_Entity): Protect call to Associated_Storage_Pool since it cannot be used when the Etype is not set. * sem_ch3.adb (Access_Type_Declaration): Ditto. * sem_aux.adb (Is_Derived_Type): Protect call to Root_Type since it cannot be used when the Etype is not set.
7 daysada: Fix argument type of read() and write() on windowsTonu Naks2-4/+7
gcc/ada/ChangeLog: * libgnat/s-crtl.ads: define unsigned * libgnat/s-crtl__mingw.adb (read, write): change arg type
7 daysada: Allow implicit packing of arrays when larger than neededBob Duff2-25/+24
For Implicit_Packing, do not require the Size clause to exactly match the packed size. For example, an array of 7 Booleans will fit in 7 bits if packed, or 7*8=56 bits if not packed. This patch allows "for T'Size use 8;" to force packing in Implicit_Packing mode; previously, the compiler ignored Implicit_Packing unless it was exactly "use 7". Apparently, customers have that sort of code, and the whole point of Implicit_Packing is to allow such legacy code to work. We already do the right thing for records, at least in cases tested. We deliberately avoid changing the error messages given here. They could possibly use some work, but there are subtle interactions with the messages given in Sem_Ch13 for the same thing. gcc/ada/ChangeLog: * freeze.adb (Freeze_Entity): Change "=" to ">=" in size comparison for Implicit_Packing mode. Keep it as "=" for giving error messages. * opt.ads (Implicit_Packing): Minor: correct obsolete comment.
7 daysada: Crash on null aggregate of multidimensional typeJavier Miranda1-3/+18
A compiler built with assertions enabled crashes processing a null aggregate of multidimensional type. gcc/ada/ChangeLog: * sem_aggr.adb (Report_Null_Array_Constraint_Error): Adjust code for reporting the error on enumeration types. (Resolve_Null_Array_Aggregate): On multidimiensional arrays, avoid reporting the same error several times. Flag the node as raising constraint error when the bounds are known and some of them is known to raise constraint error.
7 daysada: Make pp and friends more robust (base type only)Bob Duff4-51/+135
Prior to this fix, if pp(N) tried to print a "base type only" field, and Base_Type(N) was not yet set, it would raise an exception, which was confusing. This patch makes it simply ignore such fields. Similarly for Impl_Base_Type_Only and Root_Type_Only fields. We do this by having alternative versions of Base_Type, Implementation_Base_Type, and Root_Type that return Empty in error cases, and call these alteratives from Treepr. We don't want to Base_Type and friends to return Empty; we want them to blow up when called from anywhere but Treepr. gcc/ada/ChangeLog: * atree.ads (Node_To_Fetch_From_If_Set): Alternative to Node_To_Fetch_From that returns Empty in error cases. For use only in Treepr. * treepr.adb (Print_Entity_Field): Avoid printing field if Node_To_Fetch_From_If_Set returns Empty. * einfo-utils.ads (Base_Type_If_Set): Alternative to Base_Type that returns Empty in error cases. (Implementation_Base_Type_If_Set): Likewise. (Root_Type_If_Set): Likewise. (Underlying_Type): Use more accurate result subtype. * einfo-utils.adb (Base_Type): Add Asserts. (Implementation_Base_Type): Add Assert; minor cleanup. (Root_Type): Add Assert; minor cleanup. Remove Assert that is redundant with predicate. (Base_Type_If_Set): Body of new function. (Implementation_Base_Type_If_Set): Body of new function. (Root_Type_If_Set): Body of new function.
7 daysada: Disable signals when calling pthread_create on QNXJohannes Kliemann2-4/+83
The QNX Certified Products Defect Notification from February 2025 mentions a potential memory leak when pthread_create is interrupted by a signal. It recommends to disable signals for this function call. gcc/ada/ChangeLog: * adaint.c: Add functions to disable and enable signals on QNX. * libgnarl/s-taprop__qnx.adb (Create_Task): Disable signals when calling pthread_create.
7 daysada: Refine condition for reporting warnings on components with abstract ↵Gary Dismukes1-20/+40
equality The initial implementation of the warning resulted in unwanted false positives for types that have a user-defined equality function (in which case abstract equality on components will typically not ever be invoked). The conditions for reporting the warning are refined by this change to exclude checking for presence of abstract component equality functions in the case where the containing type has a user-defined equality. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Op_Eq): Test for absence of user-defined equality on type being compared (for both array and record types) as a condition for checking for abstract equality on component types. Add a "???" comment about current limitations on issuing the new warning. (Warn_On_Abstract_Equality_For_Component): Remove temporary disabling of the warning. Improve comment on declaration.
7 daysada: Fix commentsRonan Desplanques1-3/+2
This patch fixes a reference to an Ada RM clause, fixes an occurrence of "unconstrained" that should have been "indefinite", and removes an incorrect claim that completing a partial view without discriminants with a full view with defaulted discriminants is an error situation. gcc/ada/ChangeLog: * sem_ch3.adb (Process_Discriminants, Process_Full_View): Fix comments.
7 daysada: Fix compile time evaluation needed for static unfoldingsDenis Mazzucato1-7/+0
Unfolding of static expressions is needed when evaluating static bounds, even in the presence of strict analysis. Otherwise, we may wrongly identify static predicates as dynamic ones, and thus require unnecessary "others" default case. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): Remove strict analysis condition.
7 daysada: Better warning when single letter package conflicts with predefined ↵Denis Mazzucato1-2/+35
unit naming This patch improves the warning message when the actual file name of a child package with a single letter parent isn't the expected one because it may collide with a predefined unit name. The warning explain why in this specific case the expected name is not the standard one using the minus to separate parents with children. gcc/ada/ChangeLog: * par-load.adb (Load): Better warning message.
7 daysada: Set Related_Expression on compiler-generated Valid_Scalars functionsTucker Taft1-2/+4
When creating the local functions to implement the Valid_Scalars attribute for array and record types, set a Related_Expression that points to the original attribute reference (blah'Valid_Scalars). This allows the Inspector to give a more user-friendly name when these functions are called and they are known, for example, to always return True. gcc/ada/ChangeLog: * exp_attr.adb (Build_Array_VS_Func and Build_Record_VS_Func): Pass in the Attr as the Related_Node parametr when calling Make_Temporary for the Func_Id for the array and record Valid_Scalars local functions.
7 daysada: Improve documentation comment of Find_Type_NameRonan Desplanques1-6/+19
The meaning of the return value of Find_Type_Name depends greatly on whether the declaration it's passed is a completion. This patch adds a description of this to the documentation comment of Find_Type_Name. gcc/ada/ChangeLog: * sem_ch3.ads (Find_Type_Name): Improve documentation comment.
7 daysada: Disable new warning for composite equality ops that can raise Program_ErrorGary Dismukes1-0/+7
The new warning is spuriously flagged on membership tests in vss-xml-implementation-html_writer_data.adb, leading to the GNAT CB failing, so we disable it until that issue can be resolved. gcc/ada/ChangeLog: * exp_ch4.adb (Warn_On_Abstract_Equality_For_Component): Temporarily disable warning.
8 daysDaily bump.GCC Administrator1-0/+16
8 daysFix -Wlto-type-mismatch warning during GNAT LTO buildEric Botcazou7-15/+17
The recent addition of Pragma_Unsigned_Base_Range to the enumeration type Pragma_Id has made it exceed 256 enumeration values and thus overflow the unsigned 8-bit type used for it on the C side. This should have stopped the build, except that a glitch in the Snames machinery causes one value to be dropped on the C side, leaving it at just 256 enumeration values. This fixes both issues, i.e. ensures that the number of enumeration values is the same on both sides and bumps the size of the C type to 16 bits. gcc/ada/ PR ada/121885 * snames.ads-tmpl (Pragma_Id): Rename Unknown_Pragma to Pragma_Unknown for the sake of XSnamesT. * snames.adb-tmpl (Get_Pragma_Id): Adjust to above renaming. * snames.h-tmpl (Attribute_Id): Change underlying type to Byte. (Get_Attribute_Id): Use Byte as return value. (Pragma_Id): Change underlying type to Word. (Get_Pragma_Id): Use Word as return value. * types.h (Word): New typedef. * exp_prag.adb (Expand_N_Pragma): Remove useless comment. * par-prag.adb (Prag): Adjust to above renaming. * sem_prag.adb (Analyze_Pragma): Likewise. (Sig_Flags): Likewise.
9 daysDaily bump.GCC Administrator1-0/+558
9 daysada: Warning for composite equality that calls an abstract equality functionGary Dismukes1-0/+39
When equality is tested for a composite type that has any record components whose type has an abstract equality function that will be called as part of the enclosing type's equality, Program_Error will be raised. We now issue a warning on the equality test, mentioning the component type whose abstract equality function will trigger the exception. Note that this is currently only done for top-level components of the composite type. Another limitation is that the warning is not issued when the outer composite type is tagged. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Op_Eq): Check for warning about call to the abstract equality function of a component type, for both array and record enclosing types. (Warn_On_Abstract_Equality_For_Component): New procedure to issue a warning when an abstract equality function of a component type will be called and result in Program_Error.
9 daysada: Fix spurious warning for procedure named "Continue"Ronan Desplanques1-3/+8
The recent addition of a language extension for the "continue" nonreserved keyword caused spurious warnings about unreferenced subprograms for procedures named "Continue", because the call statements that are generated when identifiers are determined not to refer to the keyword were considered to come from expansion. This patch fixes this by marking those generated calls as coming from source instead. gcc/ada/ChangeLog: * sem_ch5.adb (Make_Call): Mark generated nodes as coming from source.
9 daysada: Remove incorrect commentRonan Desplanques1-5/+1
gcc/ada/ChangeLog: * sem_ch3.adb (Analyze_Incomplete_Type_Decl): Remove incorrect comment.
9 daysada: Ignore Ghost policy checks for some pragmasViljar Indus2-6/+58
Some pragmas where the ghostness is based on the argument of the pragma triggered ghost policy errors because we had not marked the pragmas as ghost. However we could only do so once the argument of the pragma was analyzed. We can safely ignore the policy checks for those pragmas since if the argument was ghost then the pragma also had to be ghost. Marking the pragma afterwards as ghost is only for the cleanup of ignored ghost purposes. gcc/ada/ChangeLog: * ghost.adb (Is_OK_Pragma): Use the Suppressed_Ghost_Policy_Check_Pragma list for ignoring certain pragmas. * sem_prag.ads (Suppressed_Ghost_Policy_Check_Pragma): New variable to store the pragmas that could be ignored when checking for consitant ghost policy.
9 daysada: Platform-specific import for read() and write()Tonu Naks5-4/+130
read() and write() return int on windows, whereas on Posix systems the return type is ssize_t (effectively long_int). The object file was added to GNAT_ADA_OBJS only, although the unit is also in the compilation closure of GNATbind, but this was harmless because the object file was essentially empty; that is no longer the case. gcc/ada/ChangeLog: * libgnat/s-crtl.ads (read, write): remove import * libgnat/s-crtl__mingw.adb: body for windows * libgnat/s-crtl.adb: body for all the other targets * Makefile.rtl: configure s-crtl.adb/libgnat/s-crtl__mingw.adb * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Alphabetize. (GNATBIND_OBJS): Add ada/libgnat/s-crtl.o. Co-authored-by: Eric Botcazou <ebotcazou@adacore.com>
9 daysada: Update the uses of Is_Ignored*_In_CodegenViljar Indus20-45/+96
Replace calls to Is_Ignored_Ghost_Entity and Predicates_Ignored with their In_Codegen versions in places where we would analyze those nodes differently from checked nodes. Describe the motive and use cases for those In_Codegen functions. gcc/ada/ChangeLog: * contracts.adb: Use the In_Codegen function instead. * exp_ch3.adb: Likewise. * exp_ch5.adb: Likewise. * exp_ch6.adb: Likewise. * exp_ch7.adb: Likewise. * exp_ch9.adb: Likewise. * exp_disp.adb: Likewise. * exp_util.adb: Likewise. * freeze.adb: Likewise. * ghost.adb: Likewise. * inline.adb: Likewise. * repinfo.adb: Likewise. * sem_ch10.adb: Likewise. * sem_ch13.adb: Likewise. * sem_ch3.adb: Likewise. * sem_ch6.adb: Likewise. * sem_elab.adb: Likewise. * sem_res.adb: Likewise. * sem_util.adb (Predicates_Ignored_In_Codegen): Add new function for the Predicates_Ignored property. (Predicates_Enabled): Use Predicates_Ignored_In_Codegen instead. * sem_util.ads (Predicates_Ignored_In_Codegen): New function. (Is_Ignored_In_Codegen): Add documentation on how _In_Codegen functions should be used.
9 daysada: Improve comments in Copy_And_SwapRonan Desplanques1-10/+13
This patch replaces usages of "attribute" with the more appropriate "field" when referring to Gen_IL fields, to avoid confusion with Ada's concept of attributes. This patch also makes comments more explicit about Gen_IL IDs and slots around a call to the low-level Atree.Exchange_Entities, and makes a few other minor comment changes. gcc/ada/ChangeLog: * sem_ch3.adb (Copy_And_Swap): Improve comments.
9 daysada: Spurious error on generalized prefix notationJavier Miranda1-2/+5
The compiler reports a spurious error when a primitive function of an untagged type that returns an array type is invoked using the prefix notation, and the sources are compiled with language extensions enabled. gcc/ada/ChangeLog: * sem_util.adb (Needs_One_Actual): Add support for untagged record types when the sources are compiled with Core Extensions allowed.
9 daysada: Fix comment in Find_Type_NameRonan Desplanques1-3/+5
The comment this patch changes was made incorrect by the possibility of completing an incomplete view with a private type declaration in Ada 2012. To avoid any possible confusion, this patch brings the comment up to date. gcc/ada/ChangeLog: * sem_ch3.adb (Find_Type_Name): Fix comment.
9 daysada: Remove unnecessary if statementRonan Desplanques1-14/+4
Calling Check_Nonoverridable_Aspects only makes sense when the full type declaration being analyzed is the completion of a partial view, and the one call site of this procedure ensures this. Therefore the handling of all the possible cases of completion in the procedure that this patch removes was useless. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Nonoverridable_Aspects): Remove if statement.
9 daysada: Improve documentation commentRonan Desplanques1-2/+4
The new version of the comment makes it clearer that Check_Nonoverridable_Aspects is only concerned with cases where a partial view is present. This patch also fixes a reference to an ARM clause in the comment. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Nonoverridable_Aspects): Improve documentation comment.
9 daysada: Add location info to policy difference errorsViljar Indus1-8/+10
gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Completion): Add location info to the policy messages. (Check_Ghost_Policy): Likwise.
9 daysada: Adding support to defer the addition of extra formals (part 2)Javier Miranda7-30/+56
Adjust previous patch to improve the support for AI05-0151-1/08. gcc/ada/ChangeLog: * exp_attr.adb (Rewrite_Attribute_Proc_Call): Add new parameter to calls to Create_Extra_Formals. (Expand_N_Attribute_Reference): Ditto. * exp_ch3.adb (Expand_Freeze_Record_Type): Ditto. * exp_ch6.adb (Expand_Call_Helper): Ditto. * exp_disp.adb (Expand_Dispatching_Call): Ditto. * freeze.adb (Check_Itype): Ditto. (Freeze_Expression): Ditto. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Ditto. (Create_Extra_Formals): Add new formal, and use it to determine if the creation of the extra formals can be deferred. Add the new parameter to calls to Create_Extra_Formals. (Is_Unsupported_Extra_Actuals_Call): Adjust the code to improve its performance when the result is known. (Is_Unsupported_Extra_Formals_Entity): Ditto. Add new formal * sem_ch6.ads (Create_Extra_Formals): Add new formal. (Is_Unsupported_Extra_Formals_Entity): Ditto.
9 daysada: Improve error message in the case of missing indicesViljar Indus1-2/+22
When both a missing index and an out of bounds error are present then we should also mention the error on out of bounds index as it suggests removing the index that is out of bounds rather than suggesting adding indices that are also out of bounds. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Array_Aggregate): Indicate an out of bounds index error also in the case of a missing index.
9 daysada: Create a pragma to emit a misplaced Storage_Size aspect errorViljar Indus1-2/+16
We do not emit an error on misplaced Strorage_Size error when the aspect is not applied to a task (or an access type). We instead create an attribute definition which is ignored most of the time. Create a temporary pragma for the aspect specification to emit the same misplaced aspect error as we do for pragmas. gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Aspect_Definitions): Create a temporary pragma for the non-task and access type cases.
9 daysada: Remove useless statementsRonan Desplanques1-3/+0
The initial value of fields of type Elist_Id is No_Elist, therefore the statements this patch removes were useless. gcc/ada/ChangeLog: * sem_ch7.adb (New_Private_Type): Remove useless statements.
9 daysada: Replace Preelaborable_Initialization pragmas with equivalent aspect specsDenis Mazzucato86-231/+231
All Preelaborable_Initialization pragmas in the language-defined units are replaced by the equivalent Preelaborable_Initialization aspect. gcc/ada/ChangeLog: * targparm.adb (Get_Target_Parameters): Address type declaration doesn't ends anymore with a semicolon. * libgnat/a-cdlili.ads: Replace Preelaborable_Initialization. * libgnat/a-cidlli.ads: Likewise. * libgnat/a-cihama.ads: Likewise. * libgnat/a-cihase.ads: Likewise. * libgnat/a-cimutr.ads: Likewise. * libgnat/a-ciorma.ads: Likewise. * libgnat/a-ciormu.ads: Likewise. * libgnat/a-ciorse.ads: Likewise. * libgnat/a-cohama.ads: Likewise. * libgnat/a-cohase.ads: Likewise. * libgnat/a-coinho.ads: Likewise. * libgnat/a-coinho__shared.ads: Likewise. * libgnat/a-coinve.ads: Likewise. * libgnat/a-comutr.ads: Likewise. * libgnat/a-convec.ads: Likewise. * libgnat/a-coorma.ads: Likewise. * libgnat/a-coormu.ads: Likewise. * libgnat/a-coorse.ads: Likewise. * libgnat/a-crdlli.ads: Likewise. * libgnat/a-except.ads: Likewise. * libgnat/a-finali.ads: Likewise. * libgnat/a-ngcoty.ads: Likewise. * libgnat/a-strbou.ads: Likewise. * libgnat/a-stream.ads: Likewise. * libgnat/a-strmap.ads: Likewise. * libgnat/a-strunb.ads: Likewise. * libgnat/a-strunb__shared.ads: Likewise. * libgnat/a-ststio.ads: Likewise. * libgnat/a-stwibo.ads: Likewise. * libgnat/a-stwima.ads: Likewise. * libgnat/a-stwiun.ads: Likewise. * libgnat/a-stwiun__shared.ads: Likewise. * libgnat/a-stzbou.ads: Likewise. * libgnat/a-stzmap.ads: Likewise. * libgnat/a-stzunb.ads: Likewise. * libgnat/a-stzunb__shared.ads: Likewise. * libgnat/a-tags.ads: Likewise. * libgnat/i-cstrin.ads: Likewise. * libgnat/s-stopoo.ads: Likewise. * libgnat/s-stposu.ads: Likewise. * libgnat/system-aix.ads: Likewise. * libgnat/system-darwin-arm.ads: Likewise. * libgnat/system-darwin-ppc.ads: Likewise. * libgnat/system-darwin-x86.ads: Likewise. * libgnat/system-djgpp.ads: Likewise. * libgnat/system-dragonfly-x86_64.ads: Likewise. * libgnat/system-freebsd.ads: Likewise. * libgnat/system-gnu.ads: Likewise. * libgnat/system-hpux-ia64.ads: Likewise. * libgnat/system-hpux.ads: Likewise. * libgnat/system-linux-alpha.ads: Likewise. * libgnat/system-linux-arm.ads: Likewise. * libgnat/system-linux-hppa.ads: Likewise. * libgnat/system-linux-ia64.ads: Likewise. * libgnat/system-linux-loongarch.ads: Likewise. * libgnat/system-linux-m68k.ads: Likewise. * libgnat/system-linux-mips.ads: Likewise. * libgnat/system-linux-ppc.ads: Likewise. * libgnat/system-linux-riscv.ads: Likewise. * libgnat/system-linux-s390.ads: Likewise. * libgnat/system-linux-sh4.ads: Likewise. * libgnat/system-linux-sparc.ads: Likewise. * libgnat/system-linux-x86.ads: Likewise. * libgnat/system-lynxos178-ppc.ads: Likewise. * libgnat/system-lynxos178-x86.ads: Likewise. * libgnat/system-mingw.ads: Likewise. * libgnat/system-qnx-arm.ads: Likewise. * libgnat/system-rtems.ads: Likewise. * libgnat/system-solaris-sparc.ads: Likewise. * libgnat/system-solaris-x86.ads: Likewise. * libgnat/system-vxworks-ppc-kernel.ads: Likewise. * libgnat/system-vxworks-ppc-rtp-smp.ads: Likewise. * libgnat/system-vxworks-ppc-rtp.ads: Likewise. * libgnat/system-vxworks7-aarch64-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-aarch64.ads: Likewise. * libgnat/system-vxworks7-arm-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-arm.ads: Likewise. * libgnat/system-vxworks7-ppc-kernel.ads: Likewise. * libgnat/system-vxworks7-ppc-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-ppc64-kernel.ads: Likewise. * libgnat/system-vxworks7-ppc64-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-x86-kernel.ads: Likewise. * libgnat/system-vxworks7-x86-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-x86_64-kernel.ads: Likewise. * libgnat/system-vxworks7-x86_64-rtp-smp.ads: Likewise.
9 daysada: Typo fix in commentMarc Poulhiès1-1/+1
gcc/ada/ChangeLog: * s-pack.adb.tmpl: Typo fix in comment.
9 daysada: Avoid marking a ghost pragma twiceViljar Indus1-6/+6
Previously all assertion level pragmas were marked based on the current scope. Additionally some pragmas were marked afterwards based on the relevant entity e.g. Pre. This would lead to cases where a pragma was marked as both ignored and checked ghost pragma. Each pragma should get marked only once based on their individual semantics. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pragma): Set Mark_Ghost_Code individually based on the semantics of each pragma.
9 daysada: Avoid renamed declaration becoming both ignored and checkedViljar Indus1-4/+33
gcc/ada/ChangeLog: * ghost.adb (Mark_Ghost_Declaration_Or_Body): Mark ghost entity explicitly as ignored or checked.
9 daysada: The policy of a generic can be different within a instantiationViljar Indus1-2/+4
gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Policy): ignore ghost policy changes within instantiation statements.
9 daysada: Fix ghost policy change detection for procedure callsViljar Indus1-3/+10
gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Policy): Use the policy in affect for the identifier at the current moment instead of the region around it when checking a policy change for a procedure call.
9 daysada: Fix ghost policy detection for declarationsViljar Indus1-33/+20
Declarations should take the ghost policy from the region if they do not have an explicit ghost aspect/pragam themselves. gcc/ada/ChangeLog: * ghost.adb (Mark_And_Set_Ghost_Declaration): apply the ghost policy and level from the declaration only if the declaration has an explicit ghost aspect/pragma.
9 daysada: Fix inheritance of Is_Primitive and legality check for nonoverridable ↵Denis Mazzucato2-14/+230
aspects This patch fixes the identification of inherited subprograms as primitive operations via the Is_Primitive flag. This is essential in the context of the new legality check which makes sure that, if any subprogram denoted by a nonoverridable aspect of a type T with formal or return of either type T or access T, then all denoted subprograms should be primitive operations. Note that all valid interpretations of a subprogram are denoted by the aspect under evaluation, all of these needs to be primitive then. This is a respin of eng/toolchain/gnat!2039 gcc/ada/ChangeLog: * sem_ch13.adb (Check_Nonoverridable_Aspect_Subprograms): Add the new legality check in Check_Nonoverridable_Aspect_Subprograms for nonoverridable aspects to check whether the denoted subprograms satisfy MR 13.1.1(18.4/6), otherwise we emit an error. Fix spacing. * sem_ch6.adb (New_Overloaded_Entity): Set Is_Primitive flag for inherited primitives, and filter out homonym candidates without a function specification as parents.
9 daysada: Reject pragma Attach_Handler on procedures in protected bodiesPiotr Trojanek1-2/+4
Pragma Attach_Handler and Interrupt_Handler are only legal for procedures declared in protected definition. When given for procedures declared in protected body, they were wrongly accepted and triggered an odd error message from expansion. gcc/ada/ChangeLog: * sem_prag.adb (Check_Interrupt_Or_Attach_Handler): Refine test for protected procedures; fix typo in comment.
9 daysada: Avoid performing policy checks on ignored ghost pragmasViljar Indus1-0/+7
These pragamas are already disabled if the relative ghost entity is disabled. gcc/ada/ChangeLog: * ghost.adb (Is_OK_Pragma): mark the context of ignored ghost pragmas as OK.
9 daysada: Fix resolution of assertion levelsViljar Indus2-26/+9
Unsuccessful preanalyze_and_resolve still marks identifiers as Any_Id. Override that result if an identifier matched an assertion level. gcc/ada/ChangeLog: * ghost.adb (Assertion_Level_From_Arg): Ensure that assertion level is stored as the entity for its reference. (Enables_Ghostness): Derive the result from whether or not the an argument indicated an assertion level. * tbuild.adb (Make_Assertion_Level): ensure that assertion levels have a standard scope.
9 daysada: Check restriction No_Secondary_Stack for overflow eliminationPiotr Trojanek1-0/+2
When overflow checks are eliminated using System.Bignums package, we must check if secondary stack that is necessary for this package is available. gcc/ada/ChangeLog: * checks.adb (Make_Bignum_Block): Check restriction No_Secondary_Stack.
9 daysada: Add special handling for Runtime and Static in Policy_In_EffectViljar Indus1-4/+15
When one of those levels is present then we should not look for the policy in the policy stack but rather determine the policy immidiately like we do in Check_Applicable_Policy. gcc/ada/ChangeLog: * sem_util.adb (Policy_In_Effect): Add special handling for Runtime and Static values.
9 daysada: Fix crash with global No_Tasking and async delaysDenis Mazzucato2-6/+4
When optimizations are enabled, the runtime for delays is inlined and expanded. If No_Tasking is set globally, for instance via a configuration file, then the initialization of _Master, _Chain, and _Task_Name formals is skipped for task entities. Later during expansion, these identifiers are expected but won't be found, crashing the compiler. This patch fixes Init_Formals by removing the check on Global_No_Tasking. If a No_Tasking restriction applies, then a violation error will be raised when analyzing the task type. gcc/ada/ChangeLog: * exp_ch3.adb (Init_Formals): Remove the check on Global_No_Tasking. * sem.adb: Fix typo.
9 daysada: Compiler crash on container aggregate with constant element choiceGary Dismukes1-4/+2
The compiler fails when compiling a container aggregate with an element association with a key choice that denotes a constant object. The code for getting the value of the choice was only accounting for the possibility of integer and enumeration literals, and is corrected to handle static expressions generally. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Replace existing conditional expression with call to Expr_Value.
9 daysada: Add default assertion level for assertionsViljar Indus2-0/+4
To standardize the comparisson between the levels of ghost entities and levels of assertion pragmasTo standardize the comparisson between the levels of ghost entities and levels of assertion pragmas. gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Aspect_Specifications): add default assertion level to assertion aspects. * sem_prag.adb (Analyze_Pragma): Likewise.