Re: [PATCH 1/2 v3] Ada: Synchronized private extensions are always limited

2023-09-18 Thread Marc Poulhiès via Gcc-patches
Hello Richard, > I have added the required “Signed-off-by” tag to the patch and to the change > log > entry below. I believe for all other aspects I have followed the instructions. Thanks for doing these modifications. I believe you have read the Developer's Certificate of Origin

[PATCH] Trivial typo fix in variadic

2023-09-17 Thread Marc Poulhiès via Gcc-patches
Fix all occurences of varadic, except for Rust (will be part of another change). gcc/ChangeLog: * config/nvptx/nvptx.h (struct machine_function): Fix typo in variadic. * config/nvptx/nvptx.cc (nvptx_function_arg_advance): Adjust to use fixed name.

[COMMITTED] ada: Explicitly analyze and expand null array aggregates

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Null array aggregates have present but empty lists of expressions and component associations. This confuses the previous code for ordinary array aggregates, which assumes that if a list of either expressions or component associations is present, then it is non-empty. This

[COMMITTED] ada: Fix minor glitch in finish_record_type

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The size needs to be rounded up to the storage unit in all cases. gcc/ada/ * gcc-interface/utils.cc (finish_record_type): Round the size in the padding case as well. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils.cc |

[COMMITTED] ada: Fix internal error on misaligned component with variable nominal size

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The back-end cannot handle this kind of components even when they are small. gcc/ada/ * exp_util.adb (Component_May_Be_Bit_Aligned): Do not return false for a small component of a record type with a variant part. Tested on x86_64-pc-linux-gnu, committed on

[COMMITTED] ada: Fix wrong optimization of extended return for discriminated record type

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This happens when the discriminants of the record type have default values. gcc/ada/ChangeLog: * inline.adb (Expand_Inlined_Call): In the case of a function call that returns an unconstrained type and initializes an object, set the No_Initialization

[COMMITTED] ada: Remove GNAT Pro details regarding mold

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Kévin Le Gouguec gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Remove extended discussion regarding mold run-time dependencies; packaging changes in GNAT Pro have made them obsolete. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Generate runtime restrictions list when the standard library is suppressed

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Patrick Bernardi With the introduction of Jorvik support into the light-tasking runtime comes the requirement to detect voliations of runtime restrictions (for example Max_Entry_Queue_Length) where previously they could be hard coded in the runtime. This means we now need the binder to

[COMMITTED] ada: Do not perform local-exception-to-goto optimization on barrier functions

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Patrick Bernardi The local-exception-to-goto optimization is no longer applied to entry barrier functions as entry barriers cannot contain exception handlers and this optimization interferes with another optimization that occurs for simple barrier functions. In particular, the simple

[COMMITTED] ada: Fix internal error on expression function with Refined_Post aspect

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This occurs when the expression function calls a protected function and the -gnata switch is specified, because the compiler wrongly freezes the called function when analyzing the expression function, a fallout of the wrapping scheme used for the Post and Refined_Post

[COMMITTED] ada: Fix internal error on aggregate nested in container aggregate

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This handles the case where a component association is present. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): In the case of a component association, call Is_Container_Aggregate on the parent's parent. (Expand_Array_Aggregate): Likewise.

[COMMITTED] ada: Clean up scope depth and related code (tech debt)

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff The main point of this patch is to remove the special case for Atree.F_Scope_Depth_Value in the Assert that Field_Present in Get_Field_Value. Pulling on that thread leads to lots of related cleanup. gcc/ada/ChangeLog: * atree.adb (Node_Kind_Table): Specify parameter

[COMMITTED] ada: Crash on creation of extra formals on type extension

2023-09-15 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda Revert previous patch and fix the pending issue. gcc/ada/ * accessibility.ads (Needs_Result_Accessibility_Extra_Formal): Removed. * accessibility.adb (Needs_Result_Accessibility_Level_Param): Removed.

[COMMITTED] ada: Assertion failure on expansion of record with invariant

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * exp_util.adb (Process_Record_Component): Adjust assertion on the availablity of the invariant procedure; required because the invariant procedure is built by the expander, and hence it is not available compiling generic units or

[COMMITTED] ada: Assertion failure on calculation of Large_Max_Size_Mutable

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * sem_util.adb (Large_Max_Size_Mutable): Protect access to attribute Is_Array_Type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

[COMMITTED] ada: Fix late finalization for function call in delta aggregate

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem occurs at library level because the temporary created for the function call lives in the elaboration routine but is finalized only when the package itself is. It turns out that there is no need for this temporary, since the expansion of delta aggregates already

[COMMITTED] ada: Improve detection of deactivated code for warnings with -gnatwt

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Switch -gnatwt is used in GNAT to track deleted code. It can be emitted by GNAT on code that is intentionally deactivated for a given configuration. The current test to suppress spurious warnings is not complex enough to detect all such cases. Now improved, by using the same

[COMMITTED] ada: Assertion failure on for-of loop iterating on selected component

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * sem_util.adb (Is_Dependent_Component_Of_Mutable_Object): Protect access to Entity attribute and add missing code to check function selector in a prefix form call. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Fix premature finalization in loop over limited iterable container

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This happens when the iterable container is obtained as the result of a call to a function that is a subprogram parameter of a generic construct. gcc/ada/ * exp_util.adb (Initialized_By_Aliased_BIP_Func_Call): Make the name matching more robust. Tested on

[COMMITTED] ada: Assertion failure adding extra formals to late overriding subp.

2023-09-14 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * sem_ch6.adb (Parent_Subprogram): Complete assertion. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch6.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index

Re: [PING][PATCH] LoongArch: initial ada support on linux

2023-09-05 Thread Marc Poulhiès via Gcc-patches
Yujie Yang writes: > Hi Marc, > > Thank you for the review! > > We added -gnatea and -gnatez to CC1_SPECS for correct multilib handling, > and I believe this is currently specific to LoongArch. > > LoongArch relies on the GCC driver (via self_specs rules) to generate a > canonicalized tuple of

[COMMITTED] ada: Elide the copy in extended returns for nonlimited by-reference types

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu): Really test Storage_Pool on the simple return statement. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[COMMITTED] ada: Fix spurious warning emissions

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques Before this patch, warnings handled by `Sem_Warn.Check_References` were erroneously emitted in some cases. Here is an example of a program that, when compiled with the `-gnatwu` switch, triggered the bug: procedure Main is package T is A : Integer;

[COMMITTED] ada: Support setting task affinity on QNX

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Johannes Kliemann QNX does not support setting the thread affinity via a POSIX API. This implementation uses QNX's native Thread_Ctl API to set the thread affinity for Ada tasks. gcc/ada/ * libgnarl/s-taprop__qnx.adb: Implement Set_Task_Affinity. Tested on x86_64-pc-linux-gnu,

[COMMITTED] ada: building_executable_programs_with_gnat.rst: fix -gnatw.x index

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Ghjuvan Lacambre The index for this paragraph was wrong. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix index. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Remove redundant protection against empty list

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Calls to First on No_List intentionally return Empty, so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * sem_type.adb (Interface_Present_In_Ancestor): Remove guard against no list of interfaces; fix style

[COMMITTED] ada: Fix problematic secondary stack management in protected entry

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The secondary stack mark goes formally out of scope before the finalizer reads it to reclaim the storage. gcc/ada/ * exp_ch9.adb (Build_Protected_Entry): Move the At_End procedure from the entry body to the inner block statement. Tested on

[COMMITTED] ada: Preserve capability validity in address arithmetic

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Daniel King On CHERI targets where System.Address is a capability, arithmetic on addresses should avoid converting to integers and instead use the operations defined in System.Storage_Elements to perform the arithmetic directly on the System.Address object. This preserves the capability's

[COMMITTED] ada: Add guard before querying the type for its interfaces

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Fix crash on illegal code, when routine Iface_Present_In_Ancestor is called on the predefined String type and attempts to examine the list of interfaces. gcc/ada/ * sem_type.adb (Iface_Present_In_Ancestor): Only look at the list of interfaces for types that

[COMMITTED] ada: Fix DWARF for certain arrays

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Tom Tromey An array whose index type is a nonstandard enum will be marked as "packed", but should not emit DW_AT_bit_stride unless it is also bit-packed. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Set bit-packed for constrained and unconstrained array types.

[COMMITTED] ada: Remove TBC comment, no more needed

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Liaiss Merzougue gcc/ada/ * libgnat/s-imguti.adb: Remove comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-imguti.adb | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/ada/libgnat/s-imguti.adb b/gcc/ada/libgnat/s-imguti.adb index

[COMMITTED] ada: Fix internal error on instantiation with private component type

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou First, this fixes an internal error on the instantiation of a nested generic package taking an array type whose component type is a private type declared in the parent package as formal type parameter. In the body of the instance, the full view of the private type is visible

[COMMITTED] ada: Remove redundant guard against an empty list of interfaces

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * sem_type.adb (Iface_Present_In_Ancestor): Remove guard for empty list of interfaces; the following loop will work just fine without it. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Crash on creation of extra formals on type extension

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler blows up processing an overriding dispatching function of a derived tagged type that returns a private tagged type that has an access type discriminant. gcc/ada/ * accessibility.ads (Needs_Result_Accessibility_Extra_Formal): New subprogram.

[COMMITTED] ada: Handle GNATcheck violations

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Sheri Bernstein For the GNATcheck rule "Improper_Returns", either use pragma Annotate to exempt the violation with the rationale "early returns for performance", or refactor the code by replacing multiple returns by a single return statement with a conditional expression; this is more

[COMMITTED] ada: Pass -msmp when linking for ppc-vx6 --RTS=rtp-smp

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Alexandre Oliva gprbuild and gnatmake won't pass --RTS=rtp-smp to the compiler driver for linking. The flag was not used during linking: the .spec files named as linker options were all we passed for the linker to get the -L flags for lib_smp and lib. There was a problem, though:

[COMMITTED] ada: Fix crash on selected component lookup in generic instance

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff This patch fixes a compiler crash on selected component lookup in an instance of a generic unit when the relevant type is an itype. gcc/ada/ * sem_ch4.adb (Find_Component_In_Instance): Check that Declaration_Node (Par) is not Empty, as it is for itypes. Tested

[COMMITTED] ada: Spurious warning about negative modular literal

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird If -gnatw.m is enabled, the compiler generates a warning if a unary minus operator of a modular type is applied to an integer literal. This warning was being incorrectly generated in some cases where no integer literal is present in the source code. gcc/ada/ *

[COMMITTED] ada: Crash on function returning empty Ada 2022 aggregate

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler crashes processing a function that returns an empty aggregate when its returned type is a record type which defined its container aggregate aspects. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Report warning on infinite recursion if

[COMMITTED] ada: Compiler hangs on invalid postcondition

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird In some cases involving an illegal reference to F'Result in the postcondition for a function not named F, the compiler would hang instead of correctly diagnosing the error. gcc/ada/ * sem_attr.adb (Denote_Same_Function): Handle the case where Has_Homonym

[COMMITTED] ada: Tweak comment about tasking corner case

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch adjusts a comment that could have misleadingly suggested that a corner case related to tasks could not exist in Ada 2012 or Ada 2022. gcc/ada/ * libgnarl/s-tassta.adb: Tweak comment. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Fix assertion failure on very peculiar enumeration type

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The compiler currently does not support the combination of a representation clause on an enumeration type with a size clause whose value is greater than the size of the largest machine scalar supported by the target. Given that such a type would have little practical value,

[COMMITTED] ada: Add missing units to Makefile.rtl

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques A previous change accidently removed a-cohama and a-cohase from `Makefile.rtl`. This patch adds these units back gcc/ada/ * Makefile.rtl: Add missing units. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/Makefile.rtl | 2 ++ 1 file changed, 2

[COMMITTED] ada: Remove GNATcheck violations

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Sheri Bernstein Use pragma Annotate to exempt GNATcheck violations that are related to proof code. Specifically, exempt rules "Metrics_LSLOC" and "Metrics_Cyclomatic_Complexity" whose limits are exceeded due to proof code, and exempt rule "Discriminated_Records" for a variant record that

[COMMITTED] ada: Enforce subtype conformance of interface primitives

2023-09-05 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * sem_ch3.adb (Add_Internal_Interface_Entities): Add missing subtype-conformance check on primitives implementing interface primitives. (Error_Posted_In_Formals): New subprogram. Tested on x86_64-pc-linux-gnu, committed on master.

[COMMITTED] Revert "Adjust one Ada test"

2023-09-05 Thread Marc Poulhiès via Gcc-patches
This reverts commit d8dc61bb5ab99c3239ea93a37097f9419bee0211. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/testsuite/gnat.dg/unroll3.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gnat.dg/unroll3.adb b/gcc/testsuite/gnat.dg/unroll3.adb

[COMMITED v4] mklog: handle Signed-off-by, minor cleanup

2023-09-04 Thread Marc Poulhiès via Gcc-patches
Consider Signed-off-by lines as part of the ending of the initial commit to avoid having these in the middle of the log when the changelog part is injected after. This is particularly usefull with: $ git gcc-commit-mklog --amend -s that can be used to create the changelog and add the

[PATCH v3] mklog: handle Signed-off-by, minor cleanup

2023-09-03 Thread Marc Poulhiès via Gcc-patches
Richard Sandiford via Gcc-patches writes: >> +# this regex matches the first line of the "end" in the initial commit >> message >> +FIRST_LINE_OF_END_RE = re.compile('(?i)^(signed-off-by|co-authored-by|#): ') > > The current code only requires an initial "#", rather than an initial "#: ". > Is

Re: [PING][PATCH] LoongArch: initial ada support on linux

2023-08-31 Thread Marc Poulhiès via Gcc-patches
Yang Yujie writes: Hello Yujie, > gcc/ChangeLog: > > * ada/Makefile.rtl: Add LoongArch support. > * ada/libgnarl/s-linux__loongarch.ads: New. > * ada/libgnat/system-linux-loongarch.ads: New. > * config/loongarch/loongarch.h: mark normalized options > passed from

[COMMITTED] ada: Refactor multiple returns

2023-08-07 Thread Marc Poulhiès via Gcc-patches
From: Sheri Bernstein Replace multiple returns by a single return statement with a conditional expression. This is more readable and maintainable, and also conformant with a Highly Recommended design principle of ISO 26262-6. gcc/ada/ * libgnat/s-parame__qnx.adb: Refactor multiple

[COMMITTED] ada: Extend precondition of Interfaces.C.String.Value with Length

2023-08-07 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The existing precondition guarded against exception Dereference_Error, but not against Constraint_Error. The RM rule B.3.1(36/3) only mentions Constraint_Error for the Value function which returns char_array, but the one which returns String has the same restriction,

[COMMITTED] ada: Crash in GNATprove due to wrong detection of inlining

2023-08-07 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy When a function is called in a predicate, it was not properly detected as not always inlined in GNATprove mode, which led to crashes later during analysis. Fixed now. gcc/ada/ * sem_res.adb (Resolve_Call): Always call Cannot_Inline so that subprogram called is

[COMMITTED] ada: Spurious error on class-wide preconditions

2023-08-07 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler reports an spurious error when a class-wide precondition expression has a class-wide type conversion. gcc/ada/ * sem_res.adb (Resolve_Type_Conversion): Do not warn on conversion to class-wide type on internally build helpers of class-wide

[COMMITTED] ada: Rewrite Set_Image_*_Unsigned routines to remove recursion.

2023-08-03 Thread Marc Poulhiès via Gcc-patches
From: Vasiliy Fofanov This rewriting removes algorithm inefficiencies due to unnecessary recursion and copying. The new version has much smaller and statically known stack requirements and is additionally up to 2x faster. gcc/ada/ * libgnat/s-imageb.adb (Set_Image_Based_Unsigned):

[COMMITTED] ada: Add pragma Annotate for GNATcheck exemptions

2023-08-03 Thread Marc Poulhiès via Gcc-patches
From: Sheri Bernstein Exempt the GNATcheck rule "Improper_Returns" with the rationale "early returns for performance". gcc/ada/ * libgnat/s-aridou.adb: Add pragma to exempt Improper_Returns. * libgnat/s-atopri.adb (Lock_Free_Try_Write): Likewise. * libgnat/s-bitops.adb

[COMMITTED] ada: Adjust again address arithmetics in System.Dwarf_Lines

2023-08-03 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Using the operator of System.Storage_Elements has introduced a range check that may be tripped on, so this removes the intermediate conversion to the Storage_Count subtype that is responsible for it. gcc/ada/ * libgnat/s-dwalin.adb ("-"): New subtraction operator.

[COMMITTED] ada: Fix spurious error on 'Input of private type with Type_Invariant aspect

2023-08-03 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem is that it is necessary to break the privacy during the expansion of the Input attribute, which may introduce a view mismatch with the parameter of the routine checking the invariant of the type. gcc/ada/ * exp_util.adb (Make_Invariant_Call): Convert the

[PATCH v3] mklog: handle Signed-off-by, minor cleanup

2023-08-02 Thread Marc Poulhiès via Gcc-patches
Consider Signed-off-by lines as part of the ending of the initial commit to avoid having these in the middle of the log when the changelog part is injected after. This is particularly usefull with: $ git gcc-commit-mklog --amend -s that can be used to create the changelog and add the

[COMMITTED] ada: Disable inlining of subprograms with Skip(_Flow_And)_Proof in GNATprove

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Subprograms with these Skip(_Flow_And)_Proof annotations should not be inlined in GNATprove, as we want to skip part of the analysis for their body. gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Check for Skip_Proof and Skip_Flow_And_Proof

[COMMITTED] ada: Bugbox compiling Constrained_Protected_Object'Image

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird In some cases, a bugbox is generated when compiling an example that references X'Image, where X is a constrained object of a discriminated protected type. gcc/ada/ * sem_ch3.adb (Constrain_Corresponding_Record): When copying information from the unconstrained

[COMMITTED] ada: Fix printing of numbers in JSON output for data representation

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy When calling GNAT with -gnatRj to generate JSON output for the data representation of types and objects, it could happen that numbers are printed in the Ada syntax for hexadecimal numbers, which leads to an invalid JSON file being generated. Now fixed both for the JSON output

[COMMITTED] ada: Incorrect optimization for unconstrained limited record component type

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird If the discriminants of an immutably limited record type have defaults, then it is safe to assume that a discriminant of an object of this type will never change once it is initialized. In some cases, this means that the default discriminant values can be treated like a

[COMMITTED] ada: Emit SCOs for nested decisions in quantified expressions

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Léo Creuse The tree traversal for decision SCO emission did not recurse in the iterator specification or loop parameter specification of quantified expressions, resulting in missing coverage obligations for nested decisions. This change fixes this by traversing all the attributes of

[COMMITTED] ada: Fix generation of JSON output for data representation

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Using -gnatRj to generate data representation in JSON format could lead to an ill-formed output or an assertion failure. Now fixed. gcc/ada/ * repinfo.adb (List_Common_Type_Info): Fix output when alignment is not statically known, and fix assertion when

[COMMITTED] ada: Default Put_Image for composite derived types is missing information

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Pascal Obry The output generated by a call to Some_Derived_Composite_Type'Put_Image (in Ada2022 code) is incomplete in some cases, notably for a type derived from a container type (i.e., from the Set/Map/List/Vector type declared in an instance of one of Ada's predefined container

[COMMITTED] ada: check Atree.Get/Set_Field_Value

2023-08-01 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff Get_Field_Value and Set_Field_Value now check that the Nkind or Ekind is correct. However, the checks are partially disabled, because they sometimes fail. gcc/ada/ * atree.adb (Field_Present): New function to detect whether or not a given field is present in a

[COMMITTED] ada: Add support for binding to a specific network interface controller.

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Pascal Obry gcc/ada/ * s-oscons-tmplt.c: Add support for SO_BINDTODEVICE constant. * libgnat/g-socket.ads (Set_Socket_Option): Handle SO_BINDTODEVICE option. (Get_Socket_Option): Handle SO_BINDTODEVICE option. * libgnat/g-socket.adb: Likewise.

[COMMITTED] ada: Fix memory explosion on aggregate of nested packed array type

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou It occurs at compile time on an aggregate of a 2-dimensional packed array type whose component type is itself a packed array, because the compiler is trying to pack the intermediate aggregate and ends up rewriting a bunch of subcomponents. This optimization was originally

[COMMITTED] ada: Fix unsupported dispatching constructor call

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda Add dummy build-in-place parameters when a BIP function does not require the BIP parameters but it is a dispatching operation that inherited them. gcc/ada/ * einfo-utils.adb (Underlying_Type): Protect recursion call against non-available attribute Etype.

[COMMITTED] ada: Leave detection of missing return in functions to GNATprove

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek GNAT has a heuristic to warn about missing return statements in functions. This warning was escalated to errors when operating in GNATprove mode and SPARK_Mode was On. However, this heuristic was imprecise and caused spurious errors. Also, it was applied after the

[COMMITTED] ada: Add an assert in Posix Interrupt_Wait

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Clément Chigot All functions but Interrupt_Wait in s-inmaop__posix are checking the result of their syscalls with an assert. However, any return code of sigwait different than 0 means that something went wrong for it. >From sigwait man: > RETURN VALUE > On success, sigwait() returns

[COMMITTED] ada: Emit enums rather than defines for various constants

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Tom Tromey This patch changes xsnamest and gen_il-gen to emit various constants as enums rather than a sequence of preprocessor defines. This enables better debugging and somewhat better type safety. gcc/ada/ * fe.h (Convention): Now inline function. * gen_il-gen.adb

[COMMITTED] ada: Fix race condition in protected entry call

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch only affects the single-entry implementation of protected objects. Before this patch, there was a race condition where a task that called an entry could put itself to sleep right after another task had executed the entry as a proxy and signalled the

[COMMITTED] ada: Add missing SCO generation for quantified expressions in object decl

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Léo Creuse This change corrects the Has_Decision predicate in par_sco.adb to properly consider predicates of quantified expressions as decisions. gcc/ada/ * par_sco.adb (Has_Decision): Consider that quantified expressions contain decisions. Tested on x86_64-pc-linux-gnu,

[COMMITTED] ada: Fix typo in comment of Ada.Exceptions.Save_Occurrence

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Minor typo in comment. gcc/ada/ * libgnat/a-except.ads (Save_Occurrence): Fix typo. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-except.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[COMMITTED] ada: Elide the copy in extended returns for nonlimited by-reference types

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu): Restrict previous change to the case where the simple return statement has got no storage pool. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 7 --- 1 file

[COMMITTED] ada: Add guard for detection of class-wide precondition subprograms

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When skipping check on subprograms built for class-wide preconditions we must deal with the current scope not being a subprogram, e.g. it could be a declare-block. gcc/ada/ * sem_res.adb (Resolve_Actuals): Add guard for the call to

[COMMITTED] ada: Small refactor

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus gcc/ada/ * exp_util.adb (Find_Optional_Prim_Op): use "No" instead of "= Empty" Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_util.adb

[COMMITTED] ada: Allow calls to Number_Formals when no formals are present

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek It is much simpler and safer for the routine Number_Formals to accept subprogram entities that have no formals. gcc/ada/ * einfo-utils.adb (Number_Formals): Change types in body. * einfo-utils.ads (Number_Formals): Change type in spec. * einfo.ads

[COMMITTED] ada: Improve defense against illegal code in check for infinite loops

2023-07-28 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Fix crash occurring when attribute System'To_Address is used without a WITH clause for package System. gcc/ada/ * sem_warn.adb (Check_Infinite_Loop_Warning): Don't look at the type of actual parameter when it has no type at all, e.g. because the entire

[COMMITTED] Adjust one Ada test

2023-07-25 Thread Marc Poulhiès via Gcc-patches
Recent change modified how the loops are created, with the first iteration being extracted out of the loops in the 2 test cases. Adjust the text to match from the unroll dump. gcc/testsuite/ChangeLog: * gnat.dg/unroll3.adb: Adjust. --- Tested on x86_64-pc-linux-gnu, committed on master.

[PATCH v2] mklog: handle Signed-Off-By, minor cleanup

2023-07-21 Thread Marc Poulhiès via Gcc-patches
Consider Signed-Off-By lines as part of the ending of the initial commit to avoid having these in the middle of the log when the changelog part is injected after. This is particularly usefull with: $ git gcc-commit-mklog --amend -s that can be used to create the changelog and add the

[COMMITTED] ada: Use new typedefs in gcc-interface

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Tom Tromey This changes gcc-interface to use the typedefs that were recently introduced in gnat. This is another step toward switching the code generator to emit enums rather than preprocessor defines. In a couple of spots, a 'default' case is also added. These avoid warnings from

[COMMITTED] ada: Constraint_Error caused by 'Image applied to interface type

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda When the prefix of 'Image is used with a class-wide interface type object, the frontend does not generate code to displace the pointer to the underlying object to reference its base, and this is required to invoke Ada.Tags.Wide_Wide_Expanded_Name. gcc/ada/ *

[COMMITTED] ada: Improve error message for ambiguous subprogram call

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This restores the full listing of the types for the interpretations. gcc/ada/ * sem_util.ads (Wrong_Type): Add Multiple parameter defaulting to False and document it. * sem_util.adb (Wrong_Type): Do not return early if an error has already

[COMMITTED] ada: Fix expanding container aggregates with Iterator specification

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus The compiler should use unnamed addition methods such as Append when expanding a container aggregate with Iterator Specification. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Use the positional addition method only when dealing with a container

[COMMITTED] ada: Avoid iterator conflicts in container aggregates

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus Create temporary scope for the iterators defined in a container aggregate so that it would not be put to the same scope where the expression was used. This would otherwise lead to multiple aggregates with iterators that have the same name leading to a name conflict. gcc/ada/

[COMMITTED] ada: Tweak CPU affinity handling on Linux

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques Before this patch, the run-time assumed that not specifying a CPU affinity mask when creating a thread was equivalent to specifying a CPU affinity mask that included all CPUs. As documented in the man pages for pthread_create and pthread_setaffinity_np, this assumption

[COMMITTED] ada: Constraint_Error caused by interface conversion

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda When the sources have a type conversion from an interface type T2 to some ancestor interface type T1 (that is, T2 extends T1) the tag check added by the compiler may fail at runtime. gcc/ada/ * exp_disp.adb (Has_Dispatching_Constructor_Call): Removed.

[COMMITTED] ada: Apply correct element type for container aggregates

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus When dealing with a container aggregate with an iterator specification the iterator should take the value of the element of the container instead of the key. gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Association): Use the element type for the iterator in a

[COMMITTED] ada: Expose expected_throw attribute

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Alexandre Oliva Mark exception-raising subprograms with expected_throw attribute. Document the use of the attribute in Control Flow Redundancy. Enable marking subprograms as expected_throw with Machine_Attribute pragmas. gcc/ada/ * libgnat/a-except.ads (Raise_Exception): Mark

[COMMITTED] ada: Fix internal error on aggregates of self-referencing types

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The front-end contains a specific mechanism to deal with aggregates of self-referencing types by means of the Has_Self_Reference flag, which is supposed to be set during semantic analysis and used during expansion. The problem is that the first part overlooks aggregates of

[COMMITTED] ada: Fix assertion failure introduced by latest change

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The new processing is not properly guarded. gcc/ada/ * sem_ch13.adb (Replace_Type_References_Generic.Visible_Component): In the case of private discriminated types, explicitly check that we have a private declaration before examining its discriminant

[COMMITTED] ada: Fix Valid_Scalars attribute applied to types from limited with

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The attribute is wrongly computed as always True because, unlike for e.g. private types, Validated_View does not look through the limited view. gcc/ada/ * sem_util.ads (Validated_View): Document enhanced behavior. * sem_util.adb (Validated_View): Return the

[COMMITTED] ada: Allow warnings with explain code

2023-07-18 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Change the way explain codes are handled to generate the command for the user to get the explanations, as this was not working for warnings. gcc/ada/ * errout.adb (Error_Msg_Internal): Remove call to Prescan_Message on the special continuation for the explain

[COMMITTED] ada: Fix wrong resolution for hidden discriminant in predicate

2023-07-11 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem occurs for hidden discriminants of private discriminated types. gcc/ada/ * sem_ch13.adb (Replace_Type_References_Generic.Visible_Component): In the case of private discriminated types, return a discriminant only if it is listed in the

[COMMITTED] ada: Avoid renaming_decl in case of constrained array

2023-07-11 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff This patch avoids rewriting "X: S := F(...);" as "X: S renames F(...);". That rewrite is incorrect if S is a constrained array subtype, because it changes the semantics. In the original, the bounds of X are that of S. But constraints are ignored in renamings, so the bounds of X

[COMMITTED] ada: Documentation for mixed declarations and statements

2023-07-10 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff This patch documents the new feature that allows declarations mixed with statements, primarily by referring to the RFC. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst (Local Declarations Without Block): Document the feature very briefly, and refer

[COMMITTED] ada: hardcfr: optionally disable in leaf functions

2023-07-10 Thread Marc Poulhiès via Gcc-patches
From: Alexandre Oliva Document -fhardcfr-skip-leaf. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Hardening): Document -fhardcfr-skip-leaf. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: hardcfr: mark throw-expected functions

2023-07-10 Thread Marc Poulhiès via Gcc-patches
From: Alexandre Oliva Adjust documentation to reflect the introduction of -fhardcfr-check-noreturn-calls=no-xthrow. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Redundancy): Add -fhardcfr-check-noreturn-calls=no-xthrow. * gnat_rm.texi:

  1   2   3   4   5   6   7   8   9   >