aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-05-25i386: Fix incorrect intrinsic signature for AVX512 s{lli|rai|rli}Hu, Lin16-167/+302
This patch aims to fix incorrect intrinsic signature for _mm{512|256|}_s{lli|rai|rli}_epi*. gcc/ChangeLog: PR target/109173 PR target/109174 * config/i386/avx512bwintrin.h (_mm512_srli_epi16): Change type from int to const int or const int to const unsigned int. (_mm512_mask_srli_epi16): Ditto. (_mm512_slli_epi16): Ditto. (_mm512_mask_slli_epi16): Ditto. (_mm512_maskz_slli_epi16): Ditto. (_mm512_srai_epi16): Ditto. (_mm512_mask_srai_epi16): Ditto. (_mm512_maskz_srai_epi16): Ditto. * config/i386/avx512fintrin.h (_mm512_slli_epi64): Ditto. (_mm512_mask_slli_epi64): Ditto. (_mm512_maskz_slli_epi64): Ditto. (_mm512_srli_epi64): Ditto. (_mm512_mask_srli_epi64): Ditto. (_mm512_maskz_srli_epi64): Ditto. (_mm512_srai_epi64): Ditto. (_mm512_mask_srai_epi64): Ditto. (_mm512_maskz_srai_epi64): Ditto. (_mm512_slli_epi32): Ditto. (_mm512_mask_slli_epi32): Ditto. (_mm512_maskz_slli_epi32): Ditto. (_mm512_srli_epi32): Ditto. (_mm512_mask_srli_epi32): Ditto. (_mm512_maskz_srli_epi32): Ditto. (_mm512_srai_epi32): Ditto. (_mm512_mask_srai_epi32): Ditto. (_mm512_maskz_srai_epi32): Ditto. * config/i386/avx512vlbwintrin.h (_mm256_mask_srai_epi16): Ditto. (_mm256_maskz_srai_epi16): Ditto. (_mm_mask_srai_epi16): Ditto. (_mm_maskz_srai_epi16): Ditto. (_mm256_mask_slli_epi16): Ditto. (_mm256_maskz_slli_epi16): Ditto. (_mm_mask_slli_epi16): Ditto. (_mm_maskz_slli_epi16): Ditto. (_mm_maskz_srli_epi16): Ditto. * config/i386/avx512vlintrin.h (_mm256_mask_srli_epi32): Ditto. (_mm256_maskz_srli_epi32): Ditto. (_mm_mask_srli_epi32): Ditto. (_mm_maskz_srli_epi32): Ditto. (_mm256_mask_srli_epi64): Ditto. (_mm256_maskz_srli_epi64): Ditto. (_mm_mask_srli_epi64): Ditto. (_mm_maskz_srli_epi64): Ditto. (_mm256_mask_srai_epi32): Ditto. (_mm256_maskz_srai_epi32): Ditto. (_mm_mask_srai_epi32): Ditto. (_mm_maskz_srai_epi32): Ditto. (_mm256_srai_epi64): Ditto. (_mm256_mask_srai_epi64): Ditto. (_mm256_maskz_srai_epi64): Ditto. (_mm_srai_epi64): Ditto. (_mm_mask_srai_epi64): Ditto. (_mm_maskz_srai_epi64): Ditto. (_mm_mask_slli_epi32): Ditto. (_mm_maskz_slli_epi32): Ditto. (_mm_mask_slli_epi64): Ditto. (_mm_maskz_slli_epi64): Ditto. (_mm256_mask_slli_epi32): Ditto. (_mm256_maskz_slli_epi32): Ditto. (_mm256_mask_slli_epi64): Ditto. (_mm256_maskz_slli_epi64): Ditto. gcc/testsuite/ChangeLog: PR target/109173 PR target/109174 * gcc.target/i386/pr109173-1.c: New test. * gcc.target/i386/pr109174-1.c: Ditto.
2023-05-25ada: Missing warning on null-excluding array aggregate componentJavier Miranda2-3/+165
The compiler does not report warnings on the initialization of arrays of null-excluding access type components by means of iterated component association, when the expression initializing each component is either a conditional expression or a case expression that may initialize some component with a null value. gcc/ada/ * sem_aggr.adb (Warn_On_Null_Component_Association): New subprogram. (Empty_Range): Adding missing support for iterated component association node. (Resolve_Array_Aggregate): Report warning on iterated component association that may initialize some component of an array of null-excluding access type components with a null value. * exp_ch4.adb (Expand_N_Expression_With_Actions): Add missing type check since the subtype of the EWA node and the subtype of the expression may differ.
2023-05-25ada: Expect Exceptional_Cases as a context for attribute OldPiotr Trojanek1-6/+10
When determining whether attribute Old is evaluated conditionally, we must also expect it to appear in the recently added contract Exceptional_Cases. gcc/ada/ * sem_util.adb (Determining_Expressions): Fix style; fix layout and ordering of pragma names; expect pragma Exceptional_Cases.
2023-05-25ada: Use procedural variant of Next_Index where possiblePiotr Trojanek2-4/+4
Code cleanup; semantics is unaffected. gcc/ada/ * einfo-utils.adb (Write_Entity_Info): Use procedural Next_Index. * sem_aggr.adb (Collect_Aggr_Bounds): Reuse local constant. (Resolve_Null_Array_Aggregate): Use procedural Next_Index.
2023-05-25ada: Crash on empty aggregate using the Ada 2022 notationJavier Miranda1-1/+3
The compiler crashes processing an empty aggregate initializing a component of a discriminated record type using the Ada 2022 notation (that is, []). gcc/ada/ * exp_aggr.adb (Build_Record_Aggr_Code): Protect access to aggregate components when the aggregate is empty.
2023-05-25ada: Enable Support_Atomic_Primitives on VxWorks 7 PPCJohannes Kliemann2-2/+2
gcc/ada/ * libgnat/system-vxworks7-ppc-kernel.ads: Enable Support_Atomic_Primitives. * libgnat/system-vxworks7-ppc-rtp-smp.ads: Likewise.
2023-05-25ada: Fix internal error on declare-expression in post-conditionEric Botcazou1-5/+7
It comes from an incorrect node sharing in the expanded tree. gcc/ada/ * sem_ch3.adb (Find_Type_Of_Object): Copy the object definition when building the subtype declaration in the case of a spec expression.
2023-05-25ada: Require successful build of xsnamestTom Tromey1-1/+1
While experimenting, I introduced a compilation error into xsnamest. This took a little while to track down because, while the error was in the log, the build did not stop. This patch changes Make-generated.in to require a successful build of this program. gcc/ada/ * Make-generated.in (ada/stamp-snames): Check result of gnatmake.
2023-05-25ada: Minor adjustments to Standard_AddressEric Botcazou2-4/+16
Standard_Address is an internal entity that is meant to be a clone of System.Address built at compilation startup. It needs to be seen as a bona-fide address by the code generator. For the sake of completeness, it is also given its modulus, although this does not matter in practice. gcc/ada/ * cstand.adb (Create_Standard): Set the Is_Descendant_Of_Address flag on Standard_Address. * freeze.adb (Freeze_Entity): Copy the modulus of System.Address onto Standard_Address.
2023-05-25ada: Add size clause to System.AddressEric Botcazou43-0/+86
Standard'Address_Size is the value provided by the code generator for the size of pointers, and it is set as the default size of every thin pointer by the front-end. Now it is documented in the GNAT RM as having the value of System.Address'Size, which is indeed the case on (correctly configured) platforms where pointers contain exactly the number of bits that are needed to address the memory space. However, on platforms where pointers contain additional bits of metadata, it has a larger value and the documented relation does not hold, which also means that unchecked conversions between System.Address and pointers are seen as potentially problematic. In order to fix the discrepancy on these platforms, this change adds the obvious size clause to System.Address, which is confirming on all the other (correctly configured) platforms. gcc/ada/ * libgnat/system-aix.ads (Address): Likewise. * libgnat/system-darwin-arm.ads (Address): Likewise. * libgnat/system-darwin-ppc.ads (Address): Likewise. * libgnat/system-darwin-x86.ads (Address): Likewise. * libgnat/system-djgpp.ads (Address): Likewise. * libgnat/system-dragonfly-x86_64.ads (Address): Likewise. * libgnat/system-freebsd.ads (Address): Likewise. * libgnat/system-hpux-ia64.ads (Address): Likewise. * libgnat/system-hpux.ads (Address): Likewise. * libgnat/system-linux-alpha.ads (Address): Likewise. * libgnat/system-linux-arm.ads (Address): Likewise. * libgnat/system-linux-hppa.ads (Address): Likewise. * libgnat/system-linux-ia64.ads (Address): Likewise. * libgnat/system-linux-m68k.ads (Address): Likewise. * libgnat/system-linux-mips.ads (Address): Likewise. * libgnat/system-linux-ppc.ads (Address): Likewise. * libgnat/system-linux-riscv.ads (Address): Likewise. * libgnat/system-linux-s390.ads (Address): Likewise. * libgnat/system-linux-sh4.ads (Address): Likewise. * libgnat/system-linux-sparc.ads (Address): Likewise. * libgnat/system-linux-x86.ads (Address): Likewise. * libgnat/system-lynxos178-ppc.ads (Address): Likewise. * libgnat/system-lynxos178-x86.ads (Address): Likewise. * libgnat/system-mingw.ads (Address): Likewise. * libgnat/system-qnx-arm.ads (Address): Likewise. * libgnat/system-rtems.ads (Address): Likewise. * libgnat/system-solaris-sparc.ads (Address): Likewise. * libgnat/system-solaris-x86.ads (Address): Likewise. * libgnat/system-vxworks-ppc-kernel.ads (Address): Likewise. * libgnat/system-vxworks-ppc-rtp-smp.ads (Address): Likewise. * libgnat/system-vxworks-ppc-rtp.ads (Address): Likewise. * libgnat/system-vxworks7-aarch64-rtp-smp.ads (Address): Likewise. * libgnat/system-vxworks7-aarch64.ads (Address): Likewise. * libgnat/system-vxworks7-arm-rtp-smp.ads (Address): Likewise. * libgnat/system-vxworks7-arm.ads (Address): Likewise. * libgnat/system-vxworks7-ppc-kernel.ads (Address): Likewise. * libgnat/system-vxworks7-ppc-rtp-smp.ads (Address): Likewise. * libgnat/system-vxworks7-ppc64-kernel.ads (Address): Likewise. * libgnat/system-vxworks7-ppc64-rtp-smp.ads (Address): Likewise. * libgnat/system-vxworks7-x86-kernel.ads (Address): Likewise. * libgnat/system-vxworks7-x86-rtp-smp.ads (Address): Likewise. * libgnat/system-vxworks7-x86_64-kernel.ads (Address): Likewise. * libgnat/system-vxworks7-x86_64-rtp-smp.ads (Address): Likewise.
2023-05-25ada: Fix error message for Aggregate aspectMarc Poulhiès1-2/+2
The error message was wrongly using % instead of & in the format string, causing the displayed message to refer to incorrect names in some cases. gcc/ada/ * sem_ch13.adb (Check_Aspect_At_Freeze_Point): fix format string, use existing local Ident.
2023-05-25ada: Switch from E_Void to Is_Not_Self_HiddenBob Duff6-80/+71
We had previously used Ekind = E_Void to indicate that a declaration is self-hidden. We now use the Is_Not_Self_Hidden flag instead. This allows us to avoid many "vanishing fields", which are (possibly-latent) bugs, and we now enable the assertions in Atree that detect such bugs. gcc/ada/ * atree.adb (Check_Vanishing_Fields): Fix bug in the "blah type only" cases. Remove the special cases for E_Void. Misc cleanup. (Mutate_Nkind): Disallow mutating to the same kind. (Mutate_Ekind): Disallow mutating to E_Void. (From E_Void is still OK -- entities start out as E_Void by default.) Fix bug in statistics gathering -- was setting the wrong count. Enable Check_Vanishing_Fields for entities. * sem_ch8.adb (Is_Self_Hidden): New function. (Find_Direct_Name): Call Is_Self_Hidden to use the new Is_Not_Self_Hidden flag to determine whether a declaration is hidden from all visibility by itself. This replaces the old method of checking E_Void. (Find_Expanded_Name): Likewise. (Find_Selected_Component): Likewise. * sem_util.adb (Enter_Name): Remove setting of Ekind to E_Void. * sem_ch3.adb: Set the Is_Not_Self_Hidden flag in appropriate places. Comment fixes. (Inherit_Component): Remove setting of Ekind to E_Void. * sem_ch9.adb (Analyze_Protected_Type_Declaration): Update comment. Skip Itypes, which should not be turned into components. * atree.ads (Mutate_Nkind): Document error case. (Mutate_Ekind): Remove comments apologizing for E_Void mutations. Document error cases.
2023-05-25ada: Decouple size of addresses and pointers from size of memory spaceEric Botcazou11-31/+18
This decouples the size of the types representing addresses and pointers, which is Standard'Address_Size, from the size of the memory space, which is System.Memory_Size (more precisely log2 of it). They are tied through the definition of System.Address: type Address is mod Memory_Size; so Standard'Address_Size >= log2 (System.Memory_Size) necessarily, but the equality does not hold on platforms where addresses and pointers contain additional bits of metadata. gcc/ada/ * libgnat/a-ststio.adb (Set_Mode): Test System.Memory_Size. * libgnat/g-debuti.ads (Address_64): Likewise. * libgnat/i-c.ads: Add with clause for System. (ptrdiff_t): Define based on the size of memory space. (size_t): Likewise. * libgnat/s-crtl.ads (size_t): Likewise. (ssize_t): Likewise. * libgnat/s-memory.ads (size_t): Likewise. * libgnat/s-parame.ads (Size_Type): Likewise. * libgnat/s-parame__hpux.ads (Size_Type): Likewise. * libgnat/s-parame__posix2008.ads (Size_Type): Likewise. * libgnat/s-parame__vxworks.ads (Size_Type): Likewise. * libgnat/s-putima.adb (Signed_Address): Likewise. (Unsigned_Address): Likewise. * libgnat/s-stoele.ads (Storage_Offset): Likewise.
2023-05-25ada: Fix copying of quantified expressionsPiotr Trojanek1-1/+4
While visiting the AST as part of routine New_Copy_Tree we maintain an EWA_Level variable in a stack-like fashion. This worked fine for expression with actions nodes but not for quantified expressions. gcc/ada/ * sem_util.adb (Visit_Node): Decrement EWA_Level with the same condition as when it was incremented.
2023-05-25ada: Deconstruct a no longer used parameter of New_Copy_TreePiotr Trojanek2-19/+10
Parameter Scopes_In_EWA_OK of New_Copy_Tree was introduced in 2018 to deal with expressions-with-actions (EWA) in the build-in-place machinery. However, after changes made in 2022 it is no longer used by any caller. Cleanup related to handling of expression functions in GNATprove; semantics is unaffected. gcc/ada/ * sem_util.ads (New_Copy_Tree): Remove Scopes_In_EWA_OK from spec; adapt comment. * sem_util.adb (New_Copy_Tree): Remove Scopes_In_EWA_OK from body; adapt code.
2023-05-25ada: Clean up copying of node treesPiotr Trojanek1-3/+1
Before calling routine In_Entity_Map we checked if the entity map is present; inside this routine we checked this again. Code cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Update_New_Entities): Remove redundant check for entity map being present.
2023-05-25ada: Simplify copying of node listsPiotr Trojanek1-6/+1
When creating a copy of a node list we called Copy_Entity for entities and Copy_Separate_Tree for other nodes. This was unnecessary, because the Copy_Separate_Tree when called on entities will just do Copy_Entity. Code cleanup; semantics is unaffected. gcc/ada/ * atree.adb (Copy_List): Call Copy_Separate_Tree for both entities and other nodes.
2023-05-25ada: Avoid duplicated streaming subprogramsSteve Baird5-150/+286
In some common cases, a reference to Some_Type'Some_Streaming_Attribute causes the needed subprogram to be generated "on demand". If there are multiple such references (e.g., two calls to Some_Type'Write) then we want to avoid generating multiple essentially-identical subprograms. This change implies that a generated streaming subprogram may now have multiple call sites, so we can no longer use the source position information from the (one and only) call site. If an exception is raised during a streaming operation, this can make a difference in the reported raise location. gcc/ada/ * exp_attr.adb (Cached_Streaming_Ops): A new package, providing maps to save previously-generated Read/Write/Input/Output procedures. (Expand_N_Attribute_Reference): When a new subprogram is generated for a Read/Write/Input/Output attribute reference, record that type/subp pair in the appropriate Cached_Streaming_Ops map. (Find_Stream_Subprogram): Check the appropriate Cached_Streaming_Ops map to see if an appropriate subprogram has already been generated. If so, then return it. The appropriateness test includes a call to a new nested subprogram, In_Available_Context. * exp_strm.ads, exp_strm.adb: Do not pass in a Loc parameter (or a source-location-bearing Nod parameter) to the 16 procedures provided for building streaming-related subprograms. Use the source location of the type instead. * exp_dist.adb, exp_ch3.adb: Adapt to Exp_Strm spec changes. For these calls the source location of the type was already being used.
2023-05-25ada: Fix crash during function return analysisMarc Poulhiès1-0/+1
The compiler would crash when checking type relation between the function's return type and the type of the expression used in the return statement. It would not work if the function's return type is an access type and the expression is not. gcc/ada/ * sem_ch6.adb (Analyze_Function_Return): Add missing Is_Access_Type check before accessing the Designated_Type field.
2023-05-25ada: Remove unused initial value of a local variablePiotr Trojanek1-1/+1
Cleanup related to improved handling of expression functions in GNATprove; semantics is unaffected. gcc/ada/ * sem_ch6.adb (Analyze_Return_Type): Remove unused initial value.
2023-05-25ada: Fix (again) incorrect handling of Aggregate aspectMarc Poulhiès2-7/+14
Previous fix stopped the processing of the Aggregate aspect early, skipping the call to Record_Rep_Item, making later call to Resolve_Container_Aggregate fail. Also, the previous fix would not handle correctly the case where the type is private and the check for non-array type can only be done at the freeze point with the full type. Adapt the resolving of the aspect when the input is not correct and the parameters can't be resolved. gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Call Record_Rep_Item. (Check_Aspect_At_Freeze_Point): Check the aspect is specified on non-array type only... (Analyze_One_Aspect): ... instead of doing it too early here. * sem_aggr.adb (Resolve_Container_Aggregate): Do nothing in case the parameters failed to resolve.
2023-05-25ada: Prevent search of calls in preconditions from going too farPiotr Trojanek1-0/+5
When determining whether a call to protected function appears within a pragma expression we can safely stop at the subprogram body. Cleanup related to recently added support for a new SPARK aspects, whose implementation was based on Contract_Cases. gcc/ada/ * sem_util.adb (Check_Internal_Protected_Use): Add standard protection against search going too far.
2023-05-25ada: Fix comments for recently added SPARK aspectsPiotr Trojanek5-9/+19
Implementation of contract Subprogram_Variant and Exceptional_Cases was based on the existing code for Contract_Cases, i.e. on the existing occurrences of Aspect_Contract_Cases, Name_Contract_Cases and Pragma_Contract_Cases. However, occurrences of "Contract_Cases" itself in the comments were not updated. gcc/ada/ * contracts.adb (Add_Pre_Post_Condition): Mention new aspects in the comment. * contracts.ads (Add_Contract_Item): Likewise. (Analyze_Subprogram_Body_Stub_Contract): Likewise. * sem_prag.adb (Contract_Freeze_Error): Likewise. (Ensure_Aggregate_Form): Likewise. * sem_prag.ads (Find_Related_Declaration_Or_Body): Likewise. * sinfo.ads (Is_Generic_Contract_Pragma): Likewise.
2023-05-25ada: Add missing supportive code for recently added SPARK aspectsPiotr Trojanek2-21/+27
Fix minor inconsistencies with the recently added SPARK aspects Exceptional_Cases and Subprogram_Variant, whose implementation is based on Contract_Cases. gcc/ada/ * aspects.ads (Implementation_Defined_Aspect): Recently added aspects are implementation-defined, just like Contract_Cases. * sem_prag.ads (Aspect_Specifying_Pragma): Recently added aspects have corresponding pragmas, just like Contract_Cases. (Pragma_Significant_To_Subprograms): Recently added aspects are significant to subprograms, just like Contract_Cases.
2023-05-25ada: Tune handling of attributes Old in contract Exceptional_CasesPiotr Trojanek1-2/+30
Contract Exceptional_Cases allows formal parameters to appear *in* prefixes of attributes Old, but the code only allowed them to appear *as* prefixes of those attributes. For example, we now accetp expressions like "X.all'Old" that were previously rejected. gcc/ada/ * sem_res.adb (Resolve_Entity_Name): Tune handling of formal parameters in contract Exceptional_Cases.
2023-05-25ada: Remove redundant guards from calls to Move_AspectsPiotr Trojanek3-12/+4
Routine Move_Aspects does nothing if its From parameter has no aspects. There is no need to check this at the call sites. Code cleanup related to changes in handling of expressions functions in GNATprove; semantics is unaffected. gcc/ada/ * par-ch7.adb (P_Package): Remove redundant guard from call to Move_Aspects. * par-ch9.adb (P_Task): Likewise. * sem_ch6.adb (Analyze_Expression_Function, Is_Inline_Pragma): Likewise.
2023-05-25ada: Small tweak to implementation of by-copy semantics for storage modelsEric Botcazou1-25/+4
Get_Actual_Subtype can be used to access the Actual_Designated_Subtype of explicit dereferences with a storage model. As a side effect, this also handles the case where the prefix of the dereference is a formal parameter. gcc/ada/ * exp_ch6.adb (Add_Simple_Call_By_Copy_Code): Use Get_Actual_Subtype to retrieve the actual subtype for all actuals and do it in only one place for all unconstrained composite formal types.
2023-05-25ada: Fix copy-paste mistake in analysis of Exceptional_CasesPiotr Trojanek1-3/+3
Trivial mistakes in copied code. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Fix references to Exceptional_Cases in code copied from handling of Subprogram_Variant.
2023-05-25ada: Enrich documentation of subprogramRonan Desplanques1-1/+5
This patch adds documentation to the subprogram Replace_Type in Sem_Ch3. In particular, references to relevant parts of the Ada reference manual are added. gcc/ada/ * sem_ch3.adb (Replace_Type): Add more documentation.
2023-05-25ada: Maximize use of existing constantRonan Desplanques1-2/+2
This patch does not change the behavior of the compiler and is intended as a readability improvement. gcc/ada/ * sem_ch3.adb (Replace_Type): Use existing constant wherever possible.
2023-05-25ada: Reduce span of variableRonan Desplanques1-1/+1
This patch does not change the behavior of the compiler, but is intended to improve readability. It seizes an opportunity to move a variable declaration to a smaller scope, so that it's clearer that the variable is not used outside of that scope. gcc/ada/ * sem_ch3.adb (Replace_Type): Reduce span of variable.
2023-05-25ada: Set Is_Not_Self_Hidden flag in more casesBob Duff3-3/+11
More work-in-progress for changing E_Void checks to the flag. gcc/ada/ * sem_ch9.adb (Analyze_Protected_Type_Declaration): Set the flag for protected types. (Analyze_Single_Protected_Declaration): Likewise, for singleton protected objects. (Analyze_Task_Type_Declaration): Set the flag for task types. (Analyze_Single_Task_Declaration): Likewise, for singleton task objects. * sem_ch10.adb (Decorate_Type): Set the flag for types treated as incomplete. (Build_Shadow_Entity): Set the flag for shadow entities. (Decorate_State): Set the flag for an abstract state. (Build_Limited_Views): Set the flag for limited view of package. * sem_attr.adb (Check_Not_Incomplete_Type): Disable the check when this is a current instance.
2023-05-25ada: Handle controlling access parameters in DTWsRonan Desplanques2-7/+7
This patch improves the way controlling access parameters are handled in dispatch table wrappers. The constructions of both the specifications and the bodies of wrappers are modified. gcc/ada/ * freeze.adb (Build_DTW_Body): Add appropriate type conversions for controlling access parameters. * sem_util.adb (Build_Overriding_Spec): Fix designated types in controlling access parameters.
2023-05-25ada: Add Entry_Cancel_Parameter to E_LabelBob Duff4-3/+9
...and other (minor) changes. gcc/ada/ * gen_il-gen-gen_entities.adb (E_Label): Add Entry_Cancel_Parameter. This is necessary because Analyze_Implicit_Label_Declaration set the Ekind to E_Label. Without this change, this field would fail the vanishing-fields check in Atree (which is currently commented out). * einfo.ads (Entry_Cancel_Parameter): Document for E_Label. * sem_eval.adb (Why_Not_Static): Protect against previous errors (no need to explain why something is not static if it's already illegal for other reasons). * sem_util.ads (Enter_Name): Fix misleading comment.
2023-05-25ada: Minor fixes in description of scope depthEric Botcazou1-3/+3
In particular, the scope depth of library units is 1 instead of 0. gcc/ada/ * einfo.ads (Scope_Depth): Fix circular definition. (Scope_Depth_Value): Fix value for library units.
2023-05-25ada: Tune warning about assignment just before a raise statementPiotr Trojanek3-6/+5
Tune warning about a possibly ineffective assignment to a formal parameter that happens just before a raise statement. The warning is now emitted for parameters of all by-copy types and not just of scalar types (this gives more warnings), but is suppressed for aliased parameters (this removes some spurious warnings). gcc/ada/ * sem_ch11.adb (Analyze_Raise_Expression): Tune warning condition. * libgnat/g-dirope.ads (Open): Remove a potentially inaccurate comment. * libgnat/g-dirope.adb (Open): Remove a potentially useless assignment; the Dir output parameter should be assigned a null value anyway by the preceding call to Free.
2023-05-25ada: Accept aliased parameters in Exceptional_CasesPiotr Trojanek1-1/+2
Aliased parameters, just like parameters by-reference types, can safely appear in consequences of Exceptional_Cases aspect. gcc/ada/ * sem_res.adb (Resolve_Entity_Name): Allow aliased parameters; tune error message.
2023-05-25ada: Fix incorrect handling of Aggregate aspectMarc Poulhiès1-2/+8
This change fixes 2 incorrect handlings of the aspect. The arguments are now correctly resolved and the aspect is rejected on non array types. gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Mark Aggregate aspect as needing delayed resolution and reject the aspect on non-array type.
2023-05-25ada: Fix obsolete comment in Sinfo.UtilsBob Duff1-1/+1
...caused by moving code here from Atree. gcc/ada/ * sinfo-utils.adb: Update comment to refer to New_Node_Debugging_Output.
2023-05-25ada: Fix SPARK context not restored when Load_Unit is failingMarc Poulhiès2-12/+31
When Load_Unit fails to find the unit or encounters an error, the Load_Fail procedure is called and an exception is raised, skipping the restoration of the SPARK/Ghost context stored on procedure entry. gcc/ada/ * rtsfind.adb (Load_RTU.Restore_SPARK_Context): New. (Load_RTU): Use Restore_SPARK_Context on all exit paths. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Initialize local variable to Empty.
2023-05-25ada: Restrict use of formal parameters within exceptional casesPiotr Trojanek2-0/+69
Restrict references to formal parameters within the new SPARK aspect Exceptional_Cases and allow occurrences of 'Old in this aspect. gcc/ada/ * sem_attr.adb (Analyze_Attribute_Old_Result): Allow uses of 'Old and 'Result within the new aspect. * sem_res.adb (Within_Exceptional_Cases_Consequence): New utility routine. (Resolve_Entity_Name): Restrict use of formal parameters within the new aspect.
2023-05-25RISC-V: Remove FRM_REGNUM dependency for rtx conversionsJuzhe-Zhong1-9/+3
According to RVV ISA: The conversions use the dynamic rounding mode in frm, except for the rtz variants, which round towards zero. So rtz conversion patterns should not have FRM dependency. We can't support mode switching for FRM yet since rvv intrinsic doc is not updated but I think this patch is correct. gcc/ChangeLog: * config/riscv/vector.md: Remove FRM_REGNUM dependency in rtz instructions. Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
2023-05-25testsuite, analyzer: Fix testcases with fcloseChristophe Lyon2-0/+4
The gcc.dg/analyzer/data-model-4.c and gcc.dg/analyzer/torture/conftest-1.c fail with recent glibc headers and succeed with older headers. The new error message is: warning: use of possibly-NULL 'f' where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] Like similar previous fixes in this area, this patch updates the testcase so that this warning isn't reported. 2023-05-23 Christophe Lyon <christophe.lyon@linaro.org> gcc/testsuite/ * gcc.dg/analyzer/data-model-4.c: Exit if fopen returns NULL. * gcc.dg/analyzer/torture/conftest-1.c: Likewise.
2023-05-25Stream out NANs correctly.Aldy Hernandez3-9/+25
NANs don't have bounds, so there's no need to stream them out. gcc/ChangeLog: * data-streamer-in.cc (streamer_read_value_range): Handle NANs. * data-streamer-out.cc (streamer_write_vrange): Same. * value-range.h (class vrange): Make streamer_write_vrange a friend.
2023-05-25Disallow setting of NANs in frange setter unless setting trees.Aldy Hernandez2-11/+11
frange::set() is confusing in that we can set a NAN by specifying a bound of +-NAN, even though we tecnically disallow NANs in the setter because the kind can never be VR_NAN. This is a wart for get_tree_range(), which builds a range out of a tree from the source, to work correctly. It's ugly, and it showed its limitation while implementing LTO streaming of ranges. This patch disallows passing NAN bounds in frange::set() and fixes get_tree_range. gcc/ChangeLog: * value-query.cc (range_query::get_tree_range): Set NAN directly if necessary. * value-range.cc (frange::set): Assert that bounds are not NAN.
2023-05-25Hash known NANs correctly for franges.Aldy Hernandez1-7/+7
We're ICEing when trying to hash a known NAN. This is unnoticeable because the only user would be IPA, and even so, it currently doesn't handle floats. However, handling floats is a flip of a switch, so it's best to handle them already. gcc/ChangeLog: * value-range.cc (add_vrange): Handle known NANs.
2023-05-25Add an frange::set_nan() variant that takes a nan_state.Aldy Hernandez1-15/+17
Generalize frange::set_nan() to take a nan_state and make current set_nan() methods syntactic sugar. This is in preparation for better streaming of NANs for LTO/IPA. gcc/ChangeLog: * value-range.h (frange::set_nan): New.
2023-05-24[PR100106] Reject unaligned subregs when strict alignment is requiredAlexandre Oliva2-0/+19
The testcase for pr100106, compiled with optimization for 32-bit powerpc -mcpu=604 with -mstrict-align expands the initialization of a union from a float _Complex value into a load from an SCmode constant pool entry, aligned to 4 bytes, into a DImode pseudo, requiring 8-byte alignment. The patch that introduced the testcase modified simplify_subreg to avoid changing the MEM to outermode, but simplify_gen_subreg still creates a SUBREG or a MEM that would require stricter alignment than MEM's, and lra_constraints appears to get confused by that, repeatedly creating unsatisfiable reloads for the SUBREG until it exceeds the insn count. Avoiding the unaligned SUBREG, expand splits the DImode dest into SUBREGs and loads each SImode word of the constant pool with the proper alignment. for gcc/ChangeLog PR target/100106 * emit-rtl.cc (validate_subreg): Reject a SUBREG of a MEM that requires stricter alignment than MEM's. for gcc/testsuite/ChangeLog PR target/100106 * gcc.target/powerpc/pr100106-sa.c: New.
2023-05-24[testsuite] require profiling for -pgAlexandre Oliva2-0/+2
Fix two tests that use -pg but don't declare their requirement for profiling support. for gcc/testsuite/ChangeLog * gcc.target/i386/mcount_pic.c: Add dg-require-profiling. * gcc.target/i386/pr104447.c: Likewise.
2023-05-24[testsuite] require pthread for openmpAlexandre Oliva1-0/+2
Fix test that uses -fopenmp without declaring requirement for pthread support. for gcc/testsuite/ChangeLog * g++.dg/pr80481.C: Add explicit pthread requirement.