[COMMITTED 18/30] ada: Fix pragma Compile_Time_Error for sizes of nonstatic array types

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou The pragma is consistenly rejected for the sizes of nonstatic array types because Eval_Attribute does not evaluate it even if it is known. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): Treat the various size attributes like Component_Size for nonstatic

[COMMITTED 12/30] ada: Crash on assignment of task allocator with expanded name

2024-12-12 Thread Marc Poulhiès
From: Bob Duff The compiler crashes on an assignment statement of the form "X.Y := new T;", where X.Y is an expanded name (i.e. not a record component or similar) and T is a type containing tasks. gcc/ada/ChangeLog: * exp_util.adb (Build_Task_Image_Decls): Deal properly with the

[COMMITTED 04/30] ada: Avoid expanding LHS assignments for controlled types

2024-12-12 Thread Marc Poulhiès
From: Viljar Indus Expanding a function call that returns a controlled type on the left-hand side of an assignment should be avoided. Otherwise we will miss the diagnostic for trying to assign something to a non-variable element. gcc/ada/ChangeLog: * exp_ch6.adb (Expand_Ctrl_Function_Ca

[COMMITTED 05/30] ada: Clean up and restrict usage of Initialization_Statements

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou This mechanism is the only producer of N_Compound_Statement in the expanded code and parks the statements generated for the in-place initialization of objects by an aggregate, so that they can be moved to the freeze point if there is an address aspect/clause, or even cancelled

[COMMITTED 09/30] ada: Fix wrong finalization with private unconstrained array type

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou The address passed to the routine attaching a controlled object to the finalization master must be that of its dope vector for an object whose nominal subtype is an unconstrained array type, but this is not the case when this subtype has a private declaration. gcc/ada/ChangeL

[COMMITTED 11/30] ada: Lift technical limitation in expansion of record aggregates

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou The mechanim deferring the expansion of record aggregates nested in other aggregates with intermediate conditional expressions is disabled in the case where they contain self-references, because of a technical limitation in the replacements done by Build_Record_Aggr_Code. Thi

[COMMITTED 06/30] ada: Restrict External_Initialization file lookup

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, External_Initialization looked for files in all directories of the source search path, which led to inconsistencies in some cases. This patch restricts the file lookup so the argument is interpreted as relative to the current source file's directory only

[COMMITTED 13/30] ada: Fix documentation comment for Scan_Sign

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques This patches fixes a couple of details that were wrong in the documentation comment for System.Val_Util.Scan_Sign. gcc/ada/ChangeLog: * libgnat/s-valuti.ads (Scan_Sign): Fix documentation comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada

[COMMITTED 02/30] ada: Export CHERI exception IDs

2024-12-12 Thread Marc Poulhiès
From: Daniel King This allows CHERI exceptions to be raised from C code in the runtime. gcc/ada/ChangeLog: * libgnat/i-cheri-exceptions.ads: Export CHERI exception IDs. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/i-cheri-exceptions.ads | 30 +++

[COMMITTED 14/30] ada: Add minimal support for other delayed aspects on controlled objects

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou This extends the processing done for the Address aspect to other delayed aspects. The External_Name aspect is also reclassified as a representation aspect and the three representation aspects External_Name, Link_Name and Linker_Section are moved from the Always_Delay to the R

[COMMITTED 15/30] ada: Fix validity check for private types

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the machinery to generate validity checks got confused in some situations involving private views of types, and ended up generating incorrect conversions from floating point types to integer types. This patch fixes this. gcc/ada/ChangeLog: * ex

[COMMITTED 20/30] ada: Accept static strings with External_Initialization

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the argument to the External_Initialization aspect had to be a string literal. This patch extends the possibilities so that any static string is accepted. A new helper function, Is_OK_Static_Expression_Of_Type, is introduced, and in addition to the main

[COMMITTED 07/30] ada: Tweak Is_Predefined_File_Name

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques This patch slightly widens the set of filenames that the compiler considers predefined. That makes it possible to build the GNAT runtime using only the file mapping facilities of the compiler, without having to rename files. gcc/ada/ChangeLog: * fname.adb (Is_Pre

[COMMITTED 22/30] ada: Elide the copy for bit-packed aggregates in allocators

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou The in-place expansion has been historically disabled for them, but there does not seem to be any good reason left for this. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Array_Aggregate): Do not exclude aggregates of bit-packed array types in allocators from in-

[COMMITTED 10/30] ada: Small improvements to expansion of conditional expressions

2024-12-12 Thread Marc Poulhiès
From: Eric Botcazou They comprise using a nonnull accesss type for the indirect expansion to avoid useless checks, smplifying the expansion of if expressions whose condition is known at compile time to avoid an N_Expression_With_Actions, using the indirect expansion for them in the indefinite cas

[COMMITTED 26/30] ada: Fix minor display issue on invalid floats

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques GNAT implements a format with trailing '*' signs for the Image attribute of NaN, +inf and -inf. It was probably always intended to be the same length as the image of 1.0, but one '*' was actually missing. This patch fixes this. gcc/ada/ChangeLog: * libgnat/s-imag

[COMMITTED 28/30] ada: Defend against risk of infinite loop

2024-12-12 Thread Marc Poulhiès
From: Ronan Desplanques A recently fixed bug caused an infinite loop when assertions were not checked. With assertions checked, the symptom was just an internal error caused by an assertion failure. This patch makes it so that if another bug ever causes the same condition to fail, there will neve

[COMMITTED 21/30] ada: Fix the level of the LLVM chapter in the User's Guide

2024-12-12 Thread Marc Poulhiès
From: Sebastian Poeplau gcc/ada/ChangeLog: * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Move the LLVM chapter one level up. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../building_executable_programs_with_gnat.rst

[COMMITTED 27/30] ada: Avoid going through symlinks in the json report

2024-12-12 Thread Marc Poulhiès
From: Viljar Indus gcc/ada/ChangeLog: * errout.adb (Write_JSON_Location): Avoid going through symbolic links when printing the full name. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/errout.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --

[COMMITTED 15/20] ada: Fix code indentation

2024-12-13 Thread Marc Poulhiès
From: Piotr Trojanek Fix uncontroversial coding style violations detected by an experiment with a tree-sitter indentation support in Emacs. gcc/ada/ChangeLog: * atree.adb, diagnostics-pretty_emitter.adb, diagnostics-utils.adb, einfo-utils.adb, errout.adb, exp_aggr.adb, e

[COMMITTED 02/20] ada: Remove implicit assumption in the double case

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou The assumption is fulfilled in all the instantiations of the package, but it should not be made in the generic code. gcc/ada/ChangeLog: * libgnat/s-imager.adb (Set_Image_Real): In the case where a double integer is needed, do not implicit assume that it can c

[COMMITTED 14/20] ada: Fix fixed point text-io when subtype has dynamic range

2024-12-13 Thread Marc Poulhiès
When the fixed point subtype has dynamic range, for example in the context of a generic procedure Test where Fixed_Type is a type formal: procedure Test (Low, High : Fixed_Type) is type New_Subtype is new Fixed_Type range Low .. High; package New_Io is new Text_IO.Fixed_IO (New_Subtype);

[COMMITTED 10/20] ada: Elide copy for calls in allocators for nonlimited by-reference types

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou This prevents a temporary from being created on the primary stack to hold the result of the function calls before it is copied to the newly allocated memory in the nonlimited by-reference case. That's already not done in the nonlimited non-by-reference case and there is no re

[COMMITTED 16/20] ada: Fix indentation in record component declarations

2024-12-13 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup. gcc/ada/ChangeLog: * exp_aggr.adb (Case_Bounds): Fix indentation. * sem_case.adb (Choice_Bounds): Likewise. * libgnat/s-dourea.ads (Duuble_T): Likewise. * libgnat/s-excmac__arm.ads (Cleanup_Cache_Type): Likewise. Tested on x86_

[COMMITTED 07/20] ada: Fix typo in reference manual

2024-12-13 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Fix typo. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/gnat_language_extensions.rst | 2 +- gc

[COMMITTED 17/20] ada: Improve expansion of nested conditional expressions in return statements

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou This arranges for nested conditional expressions in simple return statements to have their expansion delayed until the returns are distributed into their dependent expressions. This comprises the case of the elsif part of an if expression present in the source code. This als

[COMMITTED 20/20] ada: Fix internal error on packed record with 0-size component

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou The problem is that the order of components listed in a constant CONSTRUCTOR does not match that of the associated record type. gcc/ada/ChangeLog: * gcc-interface/utils2.cc (compare_elmt_bitpos): Deal specially with 0-sized components when the bit position is

[COMMITTED 01/20] ada: Adjust cut-off for scaling of floating-point numbers

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou The value needs to take into account denormals and encompass Maxdigs. gcc/ada/ChangeLog: * libgnat/s-imager.adb (Maxscaling): Change to Natural constant and add Maxdigs to value. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-ima

[COMMITTED 03/20] ada: Further work in semantic analysis of iterated component associations

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou This finishes up the transition to preanalysis of a copy of the expression for iterated component associations in all contexts, thus voiding the need to clean things up afterward. However, this requires a larger cleanup in semantics analysis of aggregates, in particular for o

[COMMITTED 05/20] ada: Fix documentation of Ada.Real_Time.Timing_Events

2024-12-13 Thread Marc Poulhiès
From: Ronan Desplanques The GNAT reference manual stated that GNAT did not implement this language-defined package, but GNAT in fact does offer an implementation of it. gcc/ada/ChangeLog: * doc/gnat_rm/standard_library_routines.rst: Fix documentation. * gnat_rm.texi: Regenerate.

[COMMITTED 06/20] ada: Fix dangling reference with user-defined indexing of function call

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou This happens with a noncontrolled type because the user-defined indexing is expanded into a function call that binds the lifetime of the original call to its return value. The temporary must be created explicitly in this case, so that the front-end can control its lifetime.

[COMMITTED 04/20] ada: Exclude library units from gnatcov instrumentation

2024-12-13 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, we instrumented code that's only used during the build process to generate more code. This patch marks the code-generating code so it's not instrumented for coverage. gcc/ada/ChangeLog: * gnat2.gpr: Add library units to coverage exclusion list.

[COMMITTED 11/20] ada: Remove unused parameter from volatile type queries

2024-12-13 Thread Marc Poulhiès
From: Piotr Trojanek Routines Is_Effectively_Volatile and Is_Effectively_Volatile_For_Reading were always called with Ignore_Protected parameter set to True (or has been passed unmodified on recursive calls), so this parameter wasn't actually needed. Code cleanup; semantics is unaffected. gcc/a

[COMMITTED 08/20] ada: Fix breakage of GNATprove introduced by latest change

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Aggr_Expr): Always perform a full analysis of the expression in SPARK mode. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aggr.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) d

[COMMITTED 09/20] ada: Remove last call to Preanalyze_And_Resolve from Exp_Aggr

2024-12-13 Thread Marc Poulhiès
From: Eric Botcazou All the expressions are now at least preanalyzed in a non-iterated context, so we do not need to redo it in Aggr_Assignment_OK_For_Backend, given that Is_OK_Aggregate explicitly rejects iterated component associations. gcc/ada/ChangeLog: * exp_aggr.adb (Aggr_Assignme

[COMMITTED 13/20] ada: Refactor code of Check_Ambiguous_Call and Valid_Conversion

2024-12-13 Thread Marc Poulhiès
From: Javier Miranda gcc/ada/ChangeLog: * sem_res.adb (Report_Ambiguous_Argument): Code cleanup. (Resolve): Code cleanup. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_res.adb | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-)

[COMMITTED 12/20] ada: Implement new rules about effectively volatile types in SPARK

2024-12-13 Thread Marc Poulhiès
From: Piotr Trojanek New rules make record types effectively volatile based on the effective volatility of their components; same for effectively volatile for reading. Now volatility composition for records works like volatility composition for arrays. gcc/ada/ChangeLog: * sem_util.adb

[COMMITTED 18/20] ada: Cleanup preanalysis of static expressions

2024-12-13 Thread Marc Poulhiès
From: Javier Miranda During preanalysis, the frontend does not generate freeze nodes. The exception to this rule occurs during the preanalysis of default and per-object expressions, where static expressions are frozen. A patch merged six years ago to address an issue in this area introduced addi

[COMMITTED 19/20] ada: Pass artificial_p to create_type_decl

2024-12-13 Thread Marc Poulhiès
From: Tom Tromey The recent "nameless types" change to gcc-interface caused the gdb pretty-printer for VSS to fail. This happens because one call to create_type_decl unconditionally passes "true" as the "artificial_p" parameter. This patch changes this call to instead pass the entity's local ar

[COMMITTED 1/3] ada: Cleanup in expansion of aggregates in object declarations with aspects

2024-11-21 Thread Marc Poulhiès
From: Eric Botcazou The strategy to expand aggregates present as initialization expressions in object declarations, originally with a subsequent address clause given for the object and later with aspects whose resolution needs to be delayed up to the freeze point, has been to block their resoluti

[COMMITTED 1/2] ada: Cleanup preanalysis of static expressions (part 3)

2025-01-09 Thread Marc Poulhiès
From: Javier Miranda Avoid reporting spurious errors. gcc/ada/ChangeLog: * freeze.adb (Freeze_Expr_Types): Reverse patch; that is, restore calls to Preanalyze_Spec_Expression instead of Preanalyze_And_Resolve for the sake of consistency with Analyze_Expression_Function.

[COMMITTED 2/2] ada: Error on Disable_Controlled aspect in Multiway_Trees

2025-01-09 Thread Marc Poulhiès
From: squirek This patch fixes an issue in the compiler whereby instantiating Multiway_Trees with a formal type leads to a compile-time error due to the expression supplied for aspect Disable_Controlled specified on types decalred within Multiway_Trees' body not being static. gcc/ada/ChangeLog:

[COMMITTED 1/5] ada: Reorder syntactic node fields to match the Ada RM grammar

2025-01-10 Thread Marc Poulhiès
From: Piotr Trojanek Several AST nodes had their syntactic fields in a different order than specified by the Ada RM grammar. With the variable-size nodes this no longer had an impact on the AST memory layout and was making the automatically generated Nmake routines a bit unintuitive to use. gcc/

[COMMITTED 2/5] ada: Turn Is_Effective_Use_Clause from syntactic to semantic flag

2025-01-10 Thread Marc Poulhiès
From: Piotr Trojanek For a USE clause being effective is a semantic property, not a syntactic. AST cleanup; behavior is unaffected. gcc/ada/ChangeLog: * gen_il-gen-gen_nodes.adb (Gen_Nodes): Change Is_Effective_Use_Clause from syntactic to semantic property. Tested on x86_64-pc

[COMMITTED 4/5] ada: Remove empty line.

2025-01-10 Thread Marc Poulhiès
gcc/ada/ChangeLog: * env.h: Remove last empty line. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/env.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/ada/env.h b/gcc/ada/env.h index b80b7e9a0fc..58a92b9d7f2 100644 --- a/gcc/ada/env.h +++ b/g

[COMMITTED 3/5] ada: Set syntactic node properties immediately when crating the nodes

2025-01-10 Thread Marc Poulhiès
From: Piotr Trojanek When creating a node, we can directly set its syntactic properties. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * contracts.adb (Build_Call_Helper_Decl): Tune whitespace. * exp_attr.adb (Analyze_Attribute): Set Of_Present while creating

[COMMITTED 5/5] ada: Incorrect accessibilty level for library level subprograms

2025-01-10 Thread Marc Poulhiès
From: squirek The patch fixes an issue in the compiler whereby accessibility level calculations for objects declared witihin library-level subprograms were done incorrectly - potentially allowing runtime accessibility checks to spuriously pass. gcc/ada/ChangeLog: * accessibility.adb:

[COMMITTED 03/14] ada: Warn about redundant parentheses in upper range bounds

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek Fix a glitch in condition that effectively caused detection of redundant parentheses in upper range bounds to be dead code. gcc/ada/ChangeLog: * par-ch3.adb (P_Discrete_Range): Replace N_Subexpr, which was catching all subexpressions, with kinds that catch n

[COMMITTED 01/14] ada: Fix parsing of raise expressions with no parens

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek According to Ada grammar, raise expression is an expression, but requires parens to be a simple_expression. We wrongly classified raise expressions as expressions, because we mishandled a global state variable in the parser. This patch causes some illegal code to be rejected

[COMMITTED 02/14] ada: Add more commentary to System.Val_Real.Large_Powfive

2025-01-13 Thread Marc Poulhiès
From: Eric Botcazou gcc/ada/ChangeLog: * libgnat/s-valrea.adb (Large_Powfive) [2 parameters]: Add a couple of additional comments. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-valrea.adb | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/

[COMMITTED 06/14] ada: Fix spurious warning about redundant parentheses in range bound

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek Use the same logic for warning about redundant parentheses in lower and upper bounds of a discrete range. This fixes a spurious warning that, if followed, would render the code illegal. gcc/ada/ChangeLog: * par-ch3.adb (P_Discrete_Range): Detect redundant parenthese

[COMMITTED 07/14] ada: Remove redundant parentheses inside unary operators

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid future build errors. gcc/ada/ChangeLog:

[COMMITTED 05/14] ada: Unbounded recursion on character aggregates with predicated component subtype

2025-01-13 Thread Marc Poulhiès
From: Gary Dismukes The compiler was recursing endlessly when analyzing an aggregate of an array type whose component subtype has a static predicate and the component expressions are static, repeatedly transforming the aggregate first into a string literal and then back into an aggregate. This is

[COMMITTED 13/14] ada: Cleanup preanalysis of static expressions (part 5)

2025-01-13 Thread Marc Poulhiès
From: Javier Miranda Partially revert the fix for sem_ch13.adb as it does not comply with RM 13.14(7.2/5). gcc/ada/ChangeLog: * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Restore calls to Preanalyze_Spec_Expression that were replaced by calls to Preanalyze_And_R

[COMMITTED 04/14] ada: Simplify expansion of negative membership operator

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch4.adb: (Expand_N_Not_In): Preserve Alternatives in expanded membership operator just like preserving Right_Opnd (though only one of these fields is present at a time). * par-ch

[COMMITTED 11/14] ada: Remove redundant parentheses inside unary operators (cont.)

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid build errors. gcc/ada/ChangeLog:

[COMMITTED 10/14] ada: Cleanup preanalysis of static expressions (part 4)

2025-01-13 Thread Marc Poulhiès
From: Javier Miranda Fix regression in the SPARK 2014 testsuite. gcc/ada/ChangeLog: * sem_util.adb (Build_Actual_Subtype_Of_Component): No action under preanalysis. * sem_ch5.adb (Set_Assignment_Type): If the right-hand side contains target names, expansion has b

[COMMITTED 08/14] ada: Remove redundant parentheses inside unary operators in comments

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid future build errors. gcc/ada/ChangeLog:

[COMMITTED 12/14] ada: Fix relocatable DLL creation with gnatdll

2025-01-13 Thread Marc Poulhiès
From: Pascal Obry gcc/ada/ChangeLog: * mdll.adb: For the created DLL to be relocatable we do not want to use the base file name when calling gnatdll. * gnatdll.adb: Removes option -d which is not working anymore. And when using a truly relocatable DLL the base-add

[COMMITTED 09/14] ada: Warn about redundant parentheses inside unary operators

2025-01-13 Thread Marc Poulhiès
From: Piotr Trojanek GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning is now emitted for unary operators as well. gcc/ada/ChangeLog: * par-ch4.adb (P_Factor): Warn when the operand of a unary operator

[COMMITTED 14/14] ada: Update gnatdll documentation (-b option removed)

2025-01-13 Thread Marc Poulhiès
From: Pascal Obry gcc/ada/ChangeLog: * doc/gnat_ugn/platform_specific_information.rst: Update. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../platform_specific_information.rst | 19 ++- gcc/ada/gnat_ugn.texi

[COMMITTED 04/30] ada: Improve expansion of conditional expressions in object declarations

2025-01-03 Thread Marc Poulhiès
From: Eric Botcazou This arranges for conditional expressions in objects declarations to have their expansion delayed when they have a type that cannot be easily copied or copied at all, including limited and controlled types. The ultimate goal is to replace the declaration with a renaming decla

[COMMITTED 10/30] ada: Leave empty parent in an array component of an anonymous access type

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek An itype created for a record component with an anonymous access type has empty parent. However, a similar itype created for an array component has its parent copied from the parent of the array type. The above discrepancy appears to be not needed for the frontend. Also, it

[COMMITTED 17/30] ada: Simplify uses of the global name buffer

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_dist.adb (Assign_Subprogram_Identifier, Reserve_NamingContext_Methods): Simplify. * osint.adb (Append_Suffix_To_File_Name, Find_File, Get_Directory, Object_File_Name, Strip_Direc

[COMMITTED 24/30] ada: Remove guards against empty lists

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek There is no need to guard against calling First on a No_List, in which case the call intentionally returns Empty. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * contracts.adb (Create_Generic_Contract): Remove calls to Present. * sem_util.adb (No

[COMMITTED 27/30] ada: Simplify code for obtaining function entity from a function call

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_ch5.adb (Check_Call): Reuse Get_Called_Entity. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch5.adb | 24 ++-- 1 file changed, 2 insertions(+), 22 deletions(

[COMMITTED 06/30] ada: Warn on unmodified parameters of expression functions

2025-01-03 Thread Marc Poulhiès
From: Bob Duff If an 'out' or 'in out' parameter is not modified in a function body, we warn. However, the warning was missing when we have an expression function instead of a proper body. This patch enables the warning on expression functions. gcc/ada/ChangeLog: * sem_ch6.adb (Analyze_

[COMMITTED 09/30] ada: Incompatible conversion on vxworks in socket.c

2025-01-03 Thread Marc Poulhiès
From: Douglas B Rupp In the vxworks section, a conversion between char* and int is attempted, which results in a warning with gcc. However with clang with is an error. Note also on 64bit targets, there's a size mismatch. gcc/ada/ChangeLog: * socket.c [__vxworks]: Change vxw_h_addr type

[COMMITTED 08/30] ada: Do not search executables in current dir by default

2025-01-03 Thread Marc Poulhiès
From: Tonu Naks gcc/ada/ChangeLog: * adaint.c: change default behaviour of __gnat_locate_exec_on_path * adaint.h: change prototype of __gnat_locate_exec_on_path * libgnat/s-os_lib.adb: pass optional argument in Locate_Exec_On_Path * libgnat/s-os_lib.ads: change sp

[COMMITTED 14/30] ada: Assorted style cleanups

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Whitespace and comment cleanups. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): Fix comment for attribute Image. * tbuild.adb (Make_SC): Remove extra whitespace. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.adb | 2 +- gcc

[COMMITTED 03/30] ada: Preliminary work in analysis and expansion of initialized allocators

2025-01-03 Thread Marc Poulhiès
From: Eric Botcazou This makes the expansion of the various cases of initialized allocators more uniform by factoring out common processing as much as possible. This also avoids giving the warning or error for a default-initialized allocator when it is marked with No_Initialization. No function

[COMMITTED 02/30] ada: Remove useless space in ALI P lines

2025-01-03 Thread Marc Poulhiès
From: Ronan Desplanques The generated ALI files are syntactically unchanged. gcc/ada/ChangeLog: * lib-writ.adb (Write_ALI): Remove useless space. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/lib-writ.adb | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/ada/li

[COMMITTED 13/30] ada: Handle C++ exception hierarchies

2025-01-03 Thread Marc Poulhiès
From: Alexandre Oliva This patch introduces support for defining exceptions in Ada with C++'s notion of exception type compatibility, such as handling occurrences of derived types, and obtaining class-wide access to the thrown/raised objects. As a bonus, it adds support for C++ dependent (wrappe

[COMMITTED 05/30] ada: Avoid failing reanalysis of aggregate bounds

2025-01-03 Thread Marc Poulhiès
From: Steve Baird An expression like Some_Package."+" (Arg1, Arg2) is sometimes transformed during expansion into an unqualified call of the form "+" (Arg1, Arg2). This is normally ok, but it means that reanalysis of the expression is likely to fail and must therefore be avoided. Remove code that

[COMMITTED 12/30] ada: Improve and correct support for inheritance of nonoverriding aspects

2025-01-03 Thread Marc Poulhiès
From: Gary Dismukes This set of changes fixes various issues with the handling of inheritance of nonoverridable aspects (such as for Aggregate, and the indexing and iterator aspects, among others), plus improves some of the error reporting related to those. The prior implementation incorrectly ha

[COMMITTED 18/30] ada: Reuse existing utility routine to detect attribute Loop_Entry

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * checks.adb (Generate_Index_Checks): Reuse existing utility routine. * sem_ch4.adb (Analyze_Indexed_Component_Form): Likewise. * sem_prag.adb (Analyze_Pragma): Likewise. Tested on x86_64-pc-

[COMMITTED 07/30] ada: Fix double free at run time for class-wide allocation

2025-01-03 Thread Marc Poulhiès
From: Eric Botcazou The previous change was too aggressive and overlooked a specific case. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_Allocator_Expression): Put back the call to Remove_Side_Effects in the case of a function call, a class-wide designated type and a regular

[COMMITTED 25/30] ada: Reuse and simplify counting the length of various lists

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Use utility routines to compute number of elements in lists of nodes and chains of formal parameters. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_aggr.adb (Others_Check): Reuse List_Length; tune whitespace. * exp_ch3.adb (Constrain_Array)

Re: [PATCH v11] ada: fix timeval timespec on 32 bits archs with 64 bits time_t [PR114065]

2025-01-03 Thread Marc Poulhiès
Hello Nicolas, >> At first view, it seems possible and desirable to merge _posix and >> _rtems, but working on this right now would be counter-productive. >> >> I suggest to apply patches 1-2 and fix PR114065 first. >> >> Then the cosmetic changes in patches 3-6 (and possibly a trivial >> backport

[COMMITTED 01/30] ada: Fix omissions of ALI P line parameters

2025-01-03 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the compiler would not report various tasking settings specified in library units when these library units did not use tasking, or when they were predefined. While this behavior was implemented deliberately, that was a long time ago and it proved to be a

[COMMITTED 15/30] ada: Simplify traversal procedures into traversal functions

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Instead of using the generic routine Traverse_Proc to set a global flag when a particular node is found, we can use its underlying routine Traverse_Func and check if traversal has been abandoned. We already used this pattern in a number of places; this patch merely applies it

[COMMITTED 21/30] ada: Add parentheses in expressions involving combinations of and & or

2025-01-03 Thread Marc Poulhiès
From: Tucker Taft In the Expression_Image function, we were not inserting parentheses properly when there was a sequence of and and or operators, even though Ada requires such parentheses to show the correct order of association. gcc/ada/ChangeLog: * pprint.adb (Expression_Image): In lo

[COMMITTED 29/30] ada: Rely on default parameter when making non-constant nodes

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek When calling Make_Access_To_Object_Definition and Make_Object_Declaration we can rely on the default value of parameter Constant_Present being False. This makes code cleaner and consistent with relying on the default value of other parameters of this routine, like Null_Exclus

[COMMITTED 22/30] ada: Fix comments and change subtype name in response to review

2025-01-03 Thread Marc Poulhiès
From: Tucker Taft gcc/ada/ChangeLog: * pprint.adb (Expression_Image): Adjust and improve comments to match style recommendations, and change name of subtype from Not_Associative to Non_Associative, in response to code review. Tested on x86_64-pc-linux-gnu, commit

[COMMITTED 11/30] ada: Fix small thinko in previous change

2025-01-03 Thread Marc Poulhiès
From: Eric Botcazou Even if the declaration of the conditional object is turned into a renaming during expansion, the conditional object must be finalized when the original object would have been. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Create the

[COMMITTED 16/30] ada: Simplify check for No_Coextensions restriction

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Alocator): Move unrelated code out of a declare block. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_res.adb | 4 ++-- 1 file changed, 2 insertions(+),

[COMMITTED 19/30] ada: Refine subtype of a universal arithmetic utility routine

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * uintp.adb (N_Digits): Refine return subtype, since this routine always returns a positive number of digits. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/uintp.adb | 4 ++-- 1 f

[COMMITTED 20/30] ada: Fix latent issue exposed by latest change

2025-01-03 Thread Marc Poulhiès
From: Eric Botcazou The finalization machinery needs to precisely locate the point where the initialization of objects is complete in order to generate the attachment to the finalization master. For objects initialized with a built-in-place function call, this is achieved by means of the BIP_Ini

[COMMITTED 23/30] ada: Enclosing_Entity of specless subprogram bodies

2025-01-03 Thread Marc Poulhiès
From: Bob Duff Correct Enclosing_Entity of specless subprogram bodies; these are marked as Comes_From_Source = False, so the simple name was missing. gcc/ada/ChangeLog: * sem_util.adb (Append_Entity_Name): Do not skip the simple name for a compilation unit (which includes

[COMMITTED 26/30] ada: Remove extra checks for raising a constraint error

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek Routine Is_OK_Static_Expression itself calls Raises_Constraint_Error, so there is no need to call both of these routines in a row. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_attr.adb (Check_Array_Type): Remove extra call. * sem_util.adb

[COMMITTED 28/30] ada: Rely on default parameter when making component definition nodes

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek When calling Make_Component_Definition we can rely on the default value of parameter Aliased_Present being False. This makes code cleaner and consistent with relying on the default value of other parameters of this routine, e.g. Null_Exclusion_Present. Code cleanup; semantic

[COMMITTED 30/30] ada: Rely on default parameter when making non-null nodes

2025-01-03 Thread Marc Poulhiès
From: Piotr Trojanek When calling Make_Access_To_Object_Definition and Make_Parameter_Specification we can rely on the default value of parameter Null_Exclusion_Present being False. This makes code cleaner and consistent with relying on the default value of other parameters of this routine. Code

Re: [PATCH v11] ada: fix timeval timespec on 32 bits archs with 64 bits time_t [PR114065]

2025-01-03 Thread Marc Poulhiès
>> Would it make sense to drop the "Glibc" here? Having "Glibc" means that >> we end up with glibc specifics in files that are not glibc specific (e.g. >> a-exetim__posix.adb or s-osinte__linux.ads). Are these particular macros >> glibc specific? We need these to build with other libc (e.g. musl)

[COMMITTED 2/2] ada: Fix missing detection of late equality operator returning subtype of Boolean

2025-01-09 Thread Marc Poulhiès
From: Eric Botcazou In Ada 2012, the compiler fails to check that a primitive equality operator for an untagged record type must appear before the type is frozen, when the operator returns a subtype of Boolean. This plugs the legality loophole but adds the debug switch -gnatd_q to go back to the

[COMMITTED 1/2] ada: Accept predefined multiply operator for fixed point in expression function

2025-01-09 Thread Marc Poulhiès
From: Eric Botcazou The RM 4.5.5(19.1/2) subclause says that the predefined multiply operator for universal_fixed is still available, despite the declaration of a user- defined primitive multiply operator for the fixed-point type at stake, if it is identified using an expanded name with prefix de

[COMMITTED] gcc-15/changes: Document Ada changes

2025-04-08 Thread Marc Poulhiès
From: Fernando Oleo Blanco Co-authored-by: Marc Poulhiès --- Thanks Fernando, I've pushed the attached changes. Marc htdocs/gcc-15/changes.html | 112 - 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/htdocs/gcc-15/changes.html b/htdoc

Re: [PATCH v15] ada: fix timeval timespec on 32 bits archs with 64 bits time_t [PR114065]

2025-04-18 Thread Marc Poulhiès
age4). As GCC 16 cycle has just started, we'll iterate with our testing and hopefully will manage to have this merged as part of the forthcoming stage1. Best regards, Marc Poulhiès

Re: [PATCH][15.2] nr2.0: late: Correctly initialize funny_error member

2025-04-29 Thread Marc Poulhiès
April 29, 2025 at 10:39 AM, "Andrew Pinski" mailto:pins...@gmail.com?to=%22Andrew%20Pinski%22%20%3Cpinskia%40gmail.com%3E > wrote: > > On Tue, Apr 29, 2025 at 1:26 AM wrote: > > > > > From: Arthur Cohen > > > > Hi everyone, > > > > We noticed inconsistent errors when running name-resolu

[PATCH] Fix for older version of GCC

2025-04-29 Thread Marc Poulhiès
::ensure_closed): Likewise. (range::add_bound): Likewise. Signed-off-by: Marc Poulhiès --- bootstrapped trunk with gcc 5.4.0 gcc/analyzer/constraint-manager.cc | 10 +- gcc/analyzer/exploded-graph.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc

Re: [PATCH v15] ada: fix timeval timespec on 32 bits archs with 64 bits time_t [PR114065]

2025-05-27 Thread Marc Poulhiès
Hello Nicolas, Continuing discussion from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065 but on the mailing list. After more testing, we've observed a regression on one simple test: 8<8<8<8<8<8< with Ada.Text_IO; use Ada.Text_IO; with Interfaces.C.Extensions; with GN

<    6   7   8   9   10   11   12   13   14   15   >