From patchwork Tue May 21 07:30:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90536 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BB863858D38 for ; Tue, 21 May 2024 07:35:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id 6AA813858CDA for ; Tue, 21 May 2024 07:30:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AA813858CDA Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AA813858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::233 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276658; cv=none; b=wT4qJsfy9pyIgUU1v/ZH9+yx9XOznaEy4DpiE+LmFLDqwUTRx2A0CrXcM5nLOY7CQLXJM86E/ehbqwD8DLCpbR3U3oEr/YLgbs21hd6A+oMFakWMSM79kkXS4UDZqF34nDHmPnrTxMqpsDNLUEgUWJSSSpRNlPF7n9QIg0HXXpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276658; c=relaxed/simple; bh=M/eORO9U+jRnkABu+45ukgebkOK5bVziEx/86wd4p1c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=V3JhSiUS3KvObQcBSKYOkeyYJyOJ+5tZxzf/EE++lekZ0n0Xwz954g4sIeLnqHwacmDaJsvVZmZXgPunOhiMeBkv8eaPCpJsQOYAOmi7u/nYBGEIBPHKztr+jh7+COGQVCFNX6d66ZAnK3Kd2xnM6OAiGzWzWPP1qy2AGK8Mk9A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2e34e85ebf4so41252841fa.2 for ; Tue, 21 May 2024 00:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276650; x=1716881450; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aSRMReHlOuQwwHqQuVvbcxEc7vJ11vexfcpetTQfBiU=; b=HPotp+lpTWueGwYC8s0vpnrEBLfd4NfieYIU7jJu11AGWA+y9k+JGT590PaNGbm+D6 0CWDFVf+HeUBxHdi9iWpjQpfyaeenAG5e/rSQ6giRdJFkjI7koyARxz2+7iFE+mvyF8p eRjmdU3Y4/65pNssG/jCYr/RxgK5O6E55CDnVSb4IMDjMV/rq3vnJNso7abDywGF7Jwp xUnZoKB3hHTMYWDBSJGe5iBV+QUacUIqHhKBbx7jU2XXhQ8vtXtFol1R/lrby5DhJ5Ds ftAo0yKe6GoYIq+Ph6/sWQWpSn7KhczENW+/f9EGo0vVp28/+DZP5uNx1/EjtIPP1Lks q7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276650; x=1716881450; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aSRMReHlOuQwwHqQuVvbcxEc7vJ11vexfcpetTQfBiU=; b=ta3C/dMB4VeqgSANXI42wciWMICAsMGG9/7NTAdHfZ87qeGo0+fKt8OXPoSoqtwZy4 sjRwPaik+VbHRO3mjPpozG2UUs4A5Hkfd0r2ASv3xKEhyBGs6y9yKqNyB0L3DtF5TO2Y e/SfHouXemc7Pot7pN85h/yx7kDstnmmK8D+E7NrHi2FsUbnphhkVWGA4/dxNzmk65wX VUbIkGgzFV2vfB8rw/vYhXSyuB4pERzkAW/qD8i1bdMVcCdeIMnIwdhKGNKVecSyahIF LLFSs46UqCSZqGh4YL9iZ/GgCZ8I6KukgNIGofQAHbkTJnuJT3+NKmbx9V/EcN9Rh5BA vdOA== X-Gm-Message-State: AOJu0YxP/gKjh6OOLXojFu542lBAJkyzYz5HSufub6DzBuk7aX8s2cXE K1FTu7da3LAcZ23SjExMbIT1vvj6fDocJ9w/X4OH2uWwxkUmxWO4YO8bv7bC4VceTRIHeifXUrI = X-Google-Smtp-Source: AGHT+IEkbm7oJPq6gx12YxX3NIncR0VNopRjKfqPQZp09PDa59zI62AEQpyq+3x8pMBzrwVTftf9nQ== X-Received: by 2002:a05:651c:14f:b0:2df:eee9:c71f with SMTP id 38308e7fff4ca-2e51fc36881mr189789281fa.7.1716276648795; Tue, 21 May 2024 00:30:48 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:48 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Justin Squirek Subject: [COMMITTED 01/31] ada: Add new Mingw task priority mapping Date: Tue, 21 May 2024 09:30:04 +0200 Message-ID: <20240521073035.314024-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Justin Squirek This patch adds a new mapping (Non_FIFO_Underlying_Priorities) for dynamically setting task priorities in Windows when pragma Task_Dispatching_Policy (FIFO_Within_Priorities) is not present. Additionally, it documents the requirement to specify the pragma in order to use Set_Priority in the general case. gcc/ada/ * doc/gnat_ugn/platform_specific_information.rst: Add note about different priority level granularities under different policies in Windows and move POSIX related info into new section. * libgnarl/s-taprop.ads: Add note about Task_Dispatching_Policy. * libgnarl/s-taprop__mingw.adb: (Set_Priority): Add use of Non_FIFO_Underlying_Priorities. * libgnat/system-mingw.ads: Add documentation for modifying priority mappings and add alternative mapping Non_FIFO_Underlying_Priorities. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../platform_specific_information.rst | 117 +++--- gcc/ada/gnat_ugn.texi | 359 +++++++++--------- gcc/ada/libgnarl/s-taprop.ads | 9 + gcc/ada/libgnarl/s-taprop__mingw.adb | 5 +- gcc/ada/libgnat/system-mingw.ads | 27 +- 5 files changed, 289 insertions(+), 228 deletions(-) diff --git a/gcc/ada/doc/gnat_ugn/platform_specific_information.rst b/gcc/ada/doc/gnat_ugn/platform_specific_information.rst index 3744b742f8e..7eeb6c2c396 100644 --- a/gcc/ada/doc/gnat_ugn/platform_specific_information.rst +++ b/gcc/ada/doc/gnat_ugn/platform_specific_information.rst @@ -171,57 +171,6 @@ Selecting another run-time library temporarily can be achieved by using the :switch:`--RTS` switch, e.g., :switch:`--RTS=sjlj` -.. _Choosing_the_Scheduling_Policy: - -.. index:: SCHED_FIFO scheduling policy -.. index:: SCHED_RR scheduling policy -.. index:: SCHED_OTHER scheduling policy - -Choosing the Scheduling Policy ------------------------------- - -When using a POSIX threads implementation, you have a choice of several -scheduling policies: ``SCHED_FIFO``, ``SCHED_RR`` and ``SCHED_OTHER``. - -Typically, the default is ``SCHED_OTHER``, while using ``SCHED_FIFO`` -or ``SCHED_RR`` requires special (e.g., root) privileges. - -.. index:: pragma Time_Slice -.. index:: -T0 option -.. index:: pragma Task_Dispatching_Policy - - -By default, GNAT uses the ``SCHED_OTHER`` policy. To specify -``SCHED_FIFO``, -you can use one of the following: - -* ``pragma Time_Slice (0.0)`` -* the corresponding binder option :switch:`-T0` -* ``pragma Task_Dispatching_Policy (FIFO_Within_Priorities)`` - - -To specify ``SCHED_RR``, -you should use ``pragma Time_Slice`` with a -value greater than 0.0, or else use the corresponding :switch:`-T` -binder option. - - -To make sure a program is running as root, you can put something like -this in a library package body in your application: - - .. code-block:: ada - - function geteuid return Integer; - pragma Import (C, geteuid, "geteuid"); - Ignore : constant Boolean := - (if geteuid = 0 then True else raise Program_Error with "must be root"); - -It gets the effective user id, and if it's not 0 (i.e. root), it raises -Program_Error. Note that if you re running the code in a container, this may -not be sufficient, as you may have sufficient priviledge on the container, -but not on the host machine running the container, so check that you also -have sufficient priviledge for running the container image. - .. index:: Linux .. index:: GNU/Linux @@ -296,6 +245,55 @@ drop the :samp:`-no-pie` workaround, you'll need to get the identified dependencies rebuilt with PIE enabled (compiled with :samp:`-fPIE` and linked with :samp:`-pie`). +.. _Choosing_the_Scheduling_Policy_With_GNU_Linux: + +.. index:: SCHED_FIFO scheduling policy +.. index:: SCHED_RR scheduling policy +.. index:: SCHED_OTHER scheduling policy + +Choosing the Scheduling Policy with GNU/Linux +--------------------------------------------- + +When using a POSIX threads implementation, you have a choice of several +scheduling policies: ``SCHED_FIFO``, ``SCHED_RR`` and ``SCHED_OTHER``. + +Typically, the default is ``SCHED_OTHER``, while using ``SCHED_FIFO`` +or ``SCHED_RR`` requires special (e.g., root) privileges. + +.. index:: pragma Time_Slice +.. index:: -T0 option +.. index:: pragma Task_Dispatching_Policy + + +By default, GNAT uses the ``SCHED_OTHER`` policy. To specify +``SCHED_FIFO``, +you can use one of the following: + +* ``pragma Time_Slice (0.0)`` +* the corresponding binder option :switch:`-T0` +* ``pragma Task_Dispatching_Policy (FIFO_Within_Priorities)`` + +To specify ``SCHED_RR``, +you should use ``pragma Time_Slice`` with a +value greater than 0.0, or else use the corresponding :switch:`-T` +binder option. + +To make sure a program is running as root, you can put something like +this in a library package body in your application: + + .. code-block:: ada + + function geteuid return Integer; + pragma Import (C, geteuid, "geteuid"); + Ignore : constant Boolean := + (if geteuid = 0 then True else raise Program_Error with "must be root"); + +It gets the effective user id, and if it's not 0 (i.e. root), it raises +Program_Error. Note that if you re running the code in a container, this may +not be sufficient, as you may have sufficient priviledge on the container, +but not on the host machine running the container, so check that you also +have sufficient priviledge for running the container image. + .. _A_GNU_Linux_debug_quirk: A GNU/Linux Debug Quirk @@ -534,6 +532,23 @@ and:: Ada.Command_Line.Argument (1) -> "'*.txt'" +.. _Choosing_the_Scheduling_Policy_With_Windows: + +Choosing the Scheduling Policy with Windows +------------------------------------------- + +Under Windows, the standard 31 priorities of the Ada model are mapped onto +Window's seven standard priority levels by default: Idle, Lowest, Below Normal, +Normal, Above Normal, + +When using the ``FIFO_Within_Priorities`` task dispatching policy, GNAT +will assign the ``REALTIME_PRIORITY_CLASS`` priority class to the application +and map the Ada priority range to the sixteen priorities made available under +``REALTIME_PRIORITY_CLASS``. + +For details on the values of the different priority mappings, see declarations +in :file:`system.ads`. For more information about Windows priorities, please +refer to Microsoft's documentation. Windows Socket Timeouts ----------------------- diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index ebc10288c20..43251ba3f1c 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -425,14 +425,11 @@ Run-Time Libraries * Summary of Run-Time Configurations:: -Specifying a Run-Time Library - -* Choosing the Scheduling Policy:: - GNU/Linux Topics * Required Packages on GNU/Linux:: * Position Independent Executable (PIE) Enabled by Default on Linux: Position Independent Executable PIE Enabled by Default on Linux. +* Choosing the Scheduling Policy with GNU/Linux:: * A GNU/Linux Debug Quirk:: Microsoft Windows Topics @@ -442,6 +439,7 @@ Microsoft Windows Topics * CONSOLE and WINDOWS subsystems:: * Temporary Files:: * Disabling Command Line Argument Expansion:: +* Choosing the Scheduling Policy with Windows:: * Windows Socket Timeouts:: * Mixed-Language Programming on Windows:: * Windows Specific Add-Ons:: @@ -22913,82 +22911,13 @@ Alternatively, you can specify @code{rts-sjlj/adainclude} in the file Selecting another run-time library temporarily can be achieved by using the @code{--RTS} switch, e.g., @code{--RTS=sjlj} -@anchor{gnat_ugn/platform_specific_information choosing-the-scheduling-policy}@anchor{1bb} -@geindex SCHED_FIFO scheduling policy - -@geindex SCHED_RR scheduling policy - -@geindex SCHED_OTHER scheduling policy - -@menu -* Choosing the Scheduling Policy:: - -@end menu - -@node Choosing the Scheduling Policy,,,Specifying a Run-Time Library -@anchor{gnat_ugn/platform_specific_information id5}@anchor{1bc} -@subsection Choosing the Scheduling Policy - - -When using a POSIX threads implementation, you have a choice of several -scheduling policies: @code{SCHED_FIFO}, @code{SCHED_RR} and @code{SCHED_OTHER}. - -Typically, the default is @code{SCHED_OTHER}, while using @code{SCHED_FIFO} -or @code{SCHED_RR} requires special (e.g., root) privileges. - -@geindex pragma Time_Slice - -@geindex -T0 option - -@geindex pragma Task_Dispatching_Policy - -By default, GNAT uses the @code{SCHED_OTHER} policy. To specify -@code{SCHED_FIFO}, -you can use one of the following: - - -@itemize * - -@item -@code{pragma Time_Slice (0.0)} - -@item -the corresponding binder option @code{-T0} - -@item -@code{pragma Task_Dispatching_Policy (FIFO_Within_Priorities)} -@end itemize - -To specify @code{SCHED_RR}, -you should use @code{pragma Time_Slice} with a -value greater than 0.0, or else use the corresponding @code{-T} -binder option. - -To make sure a program is running as root, you can put something like -this in a library package body in your application: - -@quotation - -@example -function geteuid return Integer; -pragma Import (C, geteuid, "geteuid"); -Ignore : constant Boolean := - (if geteuid = 0 then True else raise Program_Error with "must be root"); -@end example -@end quotation - -It gets the effective user id, and if it’s not 0 (i.e. root), it raises -Program_Error. Note that if you re running the code in a container, this may -not be sufficient, as you may have sufficient priviledge on the container, -but not on the host machine running the container, so check that you also -have sufficient priviledge for running the container image. @geindex Linux @geindex GNU/Linux @node GNU/Linux Topics,Microsoft Windows Topics,Specifying a Run-Time Library,Platform-Specific Information -@anchor{gnat_ugn/platform_specific_information gnu-linux-topics}@anchor{1bd}@anchor{gnat_ugn/platform_specific_information id6}@anchor{1be} +@anchor{gnat_ugn/platform_specific_information gnu-linux-topics}@anchor{1bb}@anchor{gnat_ugn/platform_specific_information id5}@anchor{1bc} @section GNU/Linux Topics @@ -22997,12 +22926,13 @@ This section describes topics that are specific to GNU/Linux platforms. @menu * Required Packages on GNU/Linux:: * Position Independent Executable (PIE) Enabled by Default on Linux: Position Independent Executable PIE Enabled by Default on Linux. +* Choosing the Scheduling Policy with GNU/Linux:: * A GNU/Linux Debug Quirk:: @end menu @node Required Packages on GNU/Linux,Position Independent Executable PIE Enabled by Default on Linux,,GNU/Linux Topics -@anchor{gnat_ugn/platform_specific_information id7}@anchor{1bf}@anchor{gnat_ugn/platform_specific_information required-packages-on-gnu-linux}@anchor{1c0} +@anchor{gnat_ugn/platform_specific_information id6}@anchor{1bd}@anchor{gnat_ugn/platform_specific_information required-packages-on-gnu-linux}@anchor{1be} @subsection Required Packages on GNU/Linux @@ -23038,8 +22968,8 @@ Debian, Ubuntu: @code{libc6:i386}, @code{libc6-dev:i386}, @code{lib32ncursesw5} Other GNU/Linux distributions might be choosing a different name for those packages. -@node Position Independent Executable PIE Enabled by Default on Linux,A GNU/Linux Debug Quirk,Required Packages on GNU/Linux,GNU/Linux Topics -@anchor{gnat_ugn/platform_specific_information pie-enabled-by-default-on-linux}@anchor{1c1}@anchor{gnat_ugn/platform_specific_information position-independent-executable-pie-enabled-by-default-on-linux}@anchor{1c2} +@node Position Independent Executable PIE Enabled by Default on Linux,Choosing the Scheduling Policy with GNU/Linux,Required Packages on GNU/Linux,GNU/Linux Topics +@anchor{gnat_ugn/platform_specific_information pie-enabled-by-default-on-linux}@anchor{1bf}@anchor{gnat_ugn/platform_specific_information position-independent-executable-pie-enabled-by-default-on-linux}@anchor{1c0} @subsection Position Independent Executable (PIE) Enabled by Default on Linux @@ -23081,8 +23011,72 @@ From there, to be able to link your binaries with PIE and therefore drop the @code{-no-pie} workaround, you’ll need to get the identified dependencies rebuilt with PIE enabled (compiled with @code{-fPIE} and linked with @code{-pie}). +@anchor{gnat_ugn/platform_specific_information choosing-the-scheduling-policy-with-gnu-linux}@anchor{1c1} +@geindex SCHED_FIFO scheduling policy + +@geindex SCHED_RR scheduling policy + +@geindex SCHED_OTHER scheduling policy + +@node Choosing the Scheduling Policy with GNU/Linux,A GNU/Linux Debug Quirk,Position Independent Executable PIE Enabled by Default on Linux,GNU/Linux Topics +@anchor{gnat_ugn/platform_specific_information id7}@anchor{1c2} +@subsection Choosing the Scheduling Policy with GNU/Linux + + +When using a POSIX threads implementation, you have a choice of several +scheduling policies: @code{SCHED_FIFO}, @code{SCHED_RR} and @code{SCHED_OTHER}. + +Typically, the default is @code{SCHED_OTHER}, while using @code{SCHED_FIFO} +or @code{SCHED_RR} requires special (e.g., root) privileges. + +@geindex pragma Time_Slice + +@geindex -T0 option -@node A GNU/Linux Debug Quirk,,Position Independent Executable PIE Enabled by Default on Linux,GNU/Linux Topics +@geindex pragma Task_Dispatching_Policy + +By default, GNAT uses the @code{SCHED_OTHER} policy. To specify +@code{SCHED_FIFO}, +you can use one of the following: + + +@itemize * + +@item +@code{pragma Time_Slice (0.0)} + +@item +the corresponding binder option @code{-T0} + +@item +@code{pragma Task_Dispatching_Policy (FIFO_Within_Priorities)} +@end itemize + +To specify @code{SCHED_RR}, +you should use @code{pragma Time_Slice} with a +value greater than 0.0, or else use the corresponding @code{-T} +binder option. + +To make sure a program is running as root, you can put something like +this in a library package body in your application: + +@quotation + +@example +function geteuid return Integer; +pragma Import (C, geteuid, "geteuid"); +Ignore : constant Boolean := + (if geteuid = 0 then True else raise Program_Error with "must be root"); +@end example +@end quotation + +It gets the effective user id, and if it’s not 0 (i.e. root), it raises +Program_Error. Note that if you re running the code in a container, this may +not be sufficient, as you may have sufficient priviledge on the container, +but not on the host machine running the container, so check that you also +have sufficient priviledge for running the container image. + +@node A GNU/Linux Debug Quirk,,Choosing the Scheduling Policy with GNU/Linux,GNU/Linux Topics @anchor{gnat_ugn/platform_specific_information a-gnu-linux-debug-quirk}@anchor{1c3}@anchor{gnat_ugn/platform_specific_information id8}@anchor{1c4} @subsection A GNU/Linux Debug Quirk @@ -23117,6 +23111,7 @@ platforms. * CONSOLE and WINDOWS subsystems:: * Temporary Files:: * Disabling Command Line Argument Expansion:: +* Choosing the Scheduling Policy with Windows:: * Windows Socket Timeouts:: * Mixed-Language Programming on Windows:: * Windows Specific Add-Ons:: @@ -23291,7 +23286,7 @@ file will be created. This is particularly useful in networked environments where you may not have write access to some directories. -@node Disabling Command Line Argument Expansion,Windows Socket Timeouts,Temporary Files,Microsoft Windows Topics +@node Disabling Command Line Argument Expansion,Choosing the Scheduling Policy with Windows,Temporary Files,Microsoft Windows Topics @anchor{gnat_ugn/platform_specific_information disabling-command-line-argument-expansion}@anchor{1cf} @subsection Disabling Command Line Argument Expansion @@ -23362,8 +23357,26 @@ and: Ada.Command_Line.Argument (1) -> "'*.txt'" @end example -@node Windows Socket Timeouts,Mixed-Language Programming on Windows,Disabling Command Line Argument Expansion,Microsoft Windows Topics -@anchor{gnat_ugn/platform_specific_information windows-socket-timeouts}@anchor{1d0} +@node Choosing the Scheduling Policy with Windows,Windows Socket Timeouts,Disabling Command Line Argument Expansion,Microsoft Windows Topics +@anchor{gnat_ugn/platform_specific_information choosing-the-scheduling-policy-with-windows}@anchor{1d0}@anchor{gnat_ugn/platform_specific_information id14}@anchor{1d1} +@subsection Choosing the Scheduling Policy with Windows + + +Under Windows, the standard 31 priorities of the Ada model are mapped onto +Window’s seven standard priority levels by default: Idle, Lowest, Below Normal, +Normal, Above Normal, + +When using the @code{FIFO_Within_Priorities} task dispatching policy, GNAT +will assign the @code{REALTIME_PRIORITY_CLASS} priority class to the application +and map the Ada priority range to the sixteen priorities made available under +@code{REALTIME_PRIORITY_CLASS}. + +For details on the values of the different priority mappings, see declarations +in @code{system.ads}. For more information about Windows priorities, please +refer to Microsoft’s documentation. + +@node Windows Socket Timeouts,Mixed-Language Programming on Windows,Choosing the Scheduling Policy with Windows,Microsoft Windows Topics +@anchor{gnat_ugn/platform_specific_information windows-socket-timeouts}@anchor{1d2} @subsection Windows Socket Timeouts @@ -23409,7 +23422,7 @@ shorter than 500 ms is needed on these Windows versions, a call to Check_Selector should be added before any socket read or write operations. @node Mixed-Language Programming on Windows,Windows Specific Add-Ons,Windows Socket Timeouts,Microsoft Windows Topics -@anchor{gnat_ugn/platform_specific_information id14}@anchor{1d1}@anchor{gnat_ugn/platform_specific_information mixed-language-programming-on-windows}@anchor{1d2} +@anchor{gnat_ugn/platform_specific_information id15}@anchor{1d3}@anchor{gnat_ugn/platform_specific_information mixed-language-programming-on-windows}@anchor{1d4} @subsection Mixed-Language Programming on Windows @@ -23431,12 +23444,12 @@ to use the Microsoft tools for your C++ code, you have two choices: Encapsulate your C++ code in a DLL to be linked with your Ada application. In this case, use the Microsoft or whatever environment to build the DLL and use GNAT to build your executable -(@ref{1d3,,Using DLLs with GNAT}). +(@ref{1d5,,Using DLLs with GNAT}). @item Or you can encapsulate your Ada code in a DLL to be linked with the other part of your application. In this case, use GNAT to build the DLL -(@ref{1d4,,Building DLLs with GNAT Project files}) and use the Microsoft +(@ref{1d6,,Building DLLs with GNAT Project files}) and use the Microsoft or whatever environment to build your executable. @end itemize @@ -23493,7 +23506,7 @@ native SEH support is used. @end menu @node Windows Calling Conventions,Introduction to Dynamic Link Libraries DLLs,,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information id15}@anchor{1d5}@anchor{gnat_ugn/platform_specific_information windows-calling-conventions}@anchor{1d6} +@anchor{gnat_ugn/platform_specific_information id16}@anchor{1d7}@anchor{gnat_ugn/platform_specific_information windows-calling-conventions}@anchor{1d8} @subsubsection Windows Calling Conventions @@ -23538,7 +23551,7 @@ are available for Windows: @end menu @node C Calling Convention,Stdcall Calling Convention,,Windows Calling Conventions -@anchor{gnat_ugn/platform_specific_information c-calling-convention}@anchor{1d7}@anchor{gnat_ugn/platform_specific_information id16}@anchor{1d8} +@anchor{gnat_ugn/platform_specific_information c-calling-convention}@anchor{1d9}@anchor{gnat_ugn/platform_specific_information id17}@anchor{1da} @subsubsection @code{C} Calling Convention @@ -23580,10 +23593,10 @@ is missing, as in the above example, this parameter is set to be the When importing a variable defined in C, you should always use the @code{C} calling convention unless the object containing the variable is part of a DLL (in which case you should use the @code{Stdcall} calling -convention, @ref{1d9,,Stdcall Calling Convention}). +convention, @ref{1db,,Stdcall Calling Convention}). @node Stdcall Calling Convention,Win32 Calling Convention,C Calling Convention,Windows Calling Conventions -@anchor{gnat_ugn/platform_specific_information id17}@anchor{1da}@anchor{gnat_ugn/platform_specific_information stdcall-calling-convention}@anchor{1d9} +@anchor{gnat_ugn/platform_specific_information id18}@anchor{1dc}@anchor{gnat_ugn/platform_specific_information stdcall-calling-convention}@anchor{1db} @subsubsection @code{Stdcall} Calling Convention @@ -23680,7 +23693,7 @@ Note that to ease building cross-platform bindings this convention will be handled as a @code{C} calling convention on non-Windows platforms. @node Win32 Calling Convention,DLL Calling Convention,Stdcall Calling Convention,Windows Calling Conventions -@anchor{gnat_ugn/platform_specific_information id18}@anchor{1db}@anchor{gnat_ugn/platform_specific_information win32-calling-convention}@anchor{1dc} +@anchor{gnat_ugn/platform_specific_information id19}@anchor{1dd}@anchor{gnat_ugn/platform_specific_information win32-calling-convention}@anchor{1de} @subsubsection @code{Win32} Calling Convention @@ -23688,7 +23701,7 @@ This convention, which is GNAT-specific is fully equivalent to the @code{Stdcall} calling convention described above. @node DLL Calling Convention,,Win32 Calling Convention,Windows Calling Conventions -@anchor{gnat_ugn/platform_specific_information dll-calling-convention}@anchor{1dd}@anchor{gnat_ugn/platform_specific_information id19}@anchor{1de} +@anchor{gnat_ugn/platform_specific_information dll-calling-convention}@anchor{1df}@anchor{gnat_ugn/platform_specific_information id20}@anchor{1e0} @subsubsection @code{DLL} Calling Convention @@ -23696,7 +23709,7 @@ This convention, which is GNAT-specific is fully equivalent to the @code{Stdcall} calling convention described above. @node Introduction to Dynamic Link Libraries DLLs,Using DLLs with GNAT,Windows Calling Conventions,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information id20}@anchor{1df}@anchor{gnat_ugn/platform_specific_information introduction-to-dynamic-link-libraries-dlls}@anchor{1e0} +@anchor{gnat_ugn/platform_specific_information id21}@anchor{1e1}@anchor{gnat_ugn/platform_specific_information introduction-to-dynamic-link-libraries-dlls}@anchor{1e2} @subsubsection Introduction to Dynamic Link Libraries (DLLs) @@ -23780,10 +23793,10 @@ As a side note, an interesting difference between Microsoft DLLs and Unix shared libraries, is the fact that on most Unix systems all public routines are exported by default in a Unix shared library, while under Windows it is possible (but not required) to list exported routines in -a definition file (see @ref{1e1,,The Definition File}). +a definition file (see @ref{1e3,,The Definition File}). @node Using DLLs with GNAT,Building DLLs with GNAT Project files,Introduction to Dynamic Link Libraries DLLs,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information id21}@anchor{1e2}@anchor{gnat_ugn/platform_specific_information using-dlls-with-gnat}@anchor{1d3} +@anchor{gnat_ugn/platform_specific_information id22}@anchor{1e4}@anchor{gnat_ugn/platform_specific_information using-dlls-with-gnat}@anchor{1d5} @subsubsection Using DLLs with GNAT @@ -23874,7 +23887,7 @@ example a fictitious DLL called @code{API.dll}. @end menu @node Creating an Ada Spec for the DLL Services,Creating an Import Library,,Using DLLs with GNAT -@anchor{gnat_ugn/platform_specific_information creating-an-ada-spec-for-the-dll-services}@anchor{1e3}@anchor{gnat_ugn/platform_specific_information id22}@anchor{1e4} +@anchor{gnat_ugn/platform_specific_information creating-an-ada-spec-for-the-dll-services}@anchor{1e5}@anchor{gnat_ugn/platform_specific_information id23}@anchor{1e6} @subsubsection Creating an Ada Spec for the DLL Services @@ -23914,7 +23927,7 @@ end API; @end quotation @node Creating an Import Library,,Creating an Ada Spec for the DLL Services,Using DLLs with GNAT -@anchor{gnat_ugn/platform_specific_information creating-an-import-library}@anchor{1e5}@anchor{gnat_ugn/platform_specific_information id23}@anchor{1e6} +@anchor{gnat_ugn/platform_specific_information creating-an-import-library}@anchor{1e7}@anchor{gnat_ugn/platform_specific_information id24}@anchor{1e8} @subsubsection Creating an Import Library @@ -23928,7 +23941,7 @@ as in this case it is possible to link directly against the DLL. Otherwise read on. @geindex Definition file -@anchor{gnat_ugn/platform_specific_information the-definition-file}@anchor{1e1} +@anchor{gnat_ugn/platform_specific_information the-definition-file}@anchor{1e3} @subsubheading The Definition File @@ -23976,17 +23989,17 @@ EXPORTS @end table Note that you must specify the correct suffix (@code{@@@var{nn}}) -(see @ref{1d6,,Windows Calling Conventions}) for a Stdcall +(see @ref{1d8,,Windows Calling Conventions}) for a Stdcall calling convention function in the exported symbols list. There can actually be other sections in a definition file, but these sections are not relevant to the discussion at hand. -@anchor{gnat_ugn/platform_specific_information create-def-file-automatically}@anchor{1e7} +@anchor{gnat_ugn/platform_specific_information create-def-file-automatically}@anchor{1e9} @subsubheading Creating a Definition File Automatically You can automatically create the definition file @code{API.def} -(see @ref{1e1,,The Definition File}) from a DLL. +(see @ref{1e3,,The Definition File}) from a DLL. For that use the @code{dlltool} program as follows: @quotation @@ -23996,7 +24009,7 @@ $ dlltool API.dll -z API.def --export-all-symbols @end example Note that if some routines in the DLL have the @code{Stdcall} convention -(@ref{1d6,,Windows Calling Conventions}) with stripped @code{@@@var{nn}} +(@ref{1d8,,Windows Calling Conventions}) with stripped @code{@@@var{nn}} suffix then you’ll have to edit @code{api.def} to add it, and specify @code{-k} to @code{gnatdll} when creating the import library. @@ -24020,13 +24033,13 @@ tells you what symbol is expected. You just have to go back to the definition file and add the right suffix. @end itemize @end quotation -@anchor{gnat_ugn/platform_specific_information gnat-style-import-library}@anchor{1e8} +@anchor{gnat_ugn/platform_specific_information gnat-style-import-library}@anchor{1ea} @subsubheading GNAT-Style Import Library To create a static import library from @code{API.dll} with the GNAT tools you should create the .def file, then use @code{gnatdll} tool -(see @ref{1e9,,Using gnatdll}) as follows: +(see @ref{1eb,,Using gnatdll}) as follows: @quotation @@ -24042,15 +24055,15 @@ definition file name is @code{xyz.def}, the import library name will be @code{libxyz.a}. Note that in the previous example option @code{-e} could have been removed because the name of the definition file (before the @code{.def} suffix) is the same as the name of the -DLL (@ref{1e9,,Using gnatdll} for more information about @code{gnatdll}). +DLL (@ref{1eb,,Using gnatdll} for more information about @code{gnatdll}). @end quotation -@anchor{gnat_ugn/platform_specific_information msvs-style-import-library}@anchor{1ea} +@anchor{gnat_ugn/platform_specific_information msvs-style-import-library}@anchor{1ec} @subsubheading Microsoft-Style Import Library A Microsoft import library is needed only if you plan to make an Ada DLL available to applications developed with Microsoft -tools (@ref{1d2,,Mixed-Language Programming on Windows}). +tools (@ref{1d4,,Mixed-Language Programming on Windows}). To create a Microsoft-style import library for @code{API.dll} you should create the .def file, then build the actual import library using @@ -24074,7 +24087,7 @@ See the Microsoft documentation for further details about the usage of @end quotation @node Building DLLs with GNAT Project files,Building DLLs with GNAT,Using DLLs with GNAT,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat-project-files}@anchor{1d4}@anchor{gnat_ugn/platform_specific_information id24}@anchor{1eb} +@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat-project-files}@anchor{1d6}@anchor{gnat_ugn/platform_specific_information id25}@anchor{1ed} @subsubsection Building DLLs with GNAT Project files @@ -24090,7 +24103,7 @@ when inside the @code{DllMain} routine which is used for auto-initialization of shared libraries, so it is not possible to have library level tasks in SALs. @node Building DLLs with GNAT,Building DLLs with gnatdll,Building DLLs with GNAT Project files,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat}@anchor{1ec}@anchor{gnat_ugn/platform_specific_information id25}@anchor{1ed} +@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat}@anchor{1ee}@anchor{gnat_ugn/platform_specific_information id26}@anchor{1ef} @subsubsection Building DLLs with GNAT @@ -24121,7 +24134,7 @@ $ gcc -shared -shared-libgcc -o api.dll obj1.o obj2.o ... It is important to note that in this case all symbols found in the object files are automatically exported. It is possible to restrict the set of symbols to export by passing to @code{gcc} a definition -file (see @ref{1e1,,The Definition File}). +file (see @ref{1e3,,The Definition File}). For example: @example @@ -24159,7 +24172,7 @@ $ gnatmake main -Iapilib -bargs -shared -largs -Lapilib -lAPI @end quotation @node Building DLLs with gnatdll,Ada DLLs and Finalization,Building DLLs with GNAT,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnatdll}@anchor{1ee}@anchor{gnat_ugn/platform_specific_information id26}@anchor{1ef} +@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnatdll}@anchor{1f0}@anchor{gnat_ugn/platform_specific_information id27}@anchor{1f1} @subsubsection Building DLLs with gnatdll @@ -24167,8 +24180,8 @@ $ gnatmake main -Iapilib -bargs -shared -largs -Lapilib -lAPI @geindex building Note that it is preferred to use GNAT Project files -(@ref{1d4,,Building DLLs with GNAT Project files}) or the built-in GNAT -DLL support (@ref{1ec,,Building DLLs with GNAT}) or to build DLLs. +(@ref{1d6,,Building DLLs with GNAT Project files}) or the built-in GNAT +DLL support (@ref{1ee,,Building DLLs with GNAT}) or to build DLLs. This section explains how to build DLLs containing Ada code using @code{gnatdll}. These DLLs will be referred to as Ada DLLs in the @@ -24184,20 +24197,20 @@ non-Ada applications are as follows: You need to mark each Ada entity exported by the DLL with a @code{C} or @code{Stdcall} calling convention to avoid any Ada name mangling for the entities exported by the DLL -(see @ref{1f0,,Exporting Ada Entities}). You can +(see @ref{1f2,,Exporting Ada Entities}). You can skip this step if you plan to use the Ada DLL only from Ada applications. @item Your Ada code must export an initialization routine which calls the routine @code{adainit} generated by @code{gnatbind} to perform the elaboration of -the Ada code in the DLL (@ref{1f1,,Ada DLLs and Elaboration}). The initialization +the Ada code in the DLL (@ref{1f3,,Ada DLLs and Elaboration}). The initialization routine exported by the Ada DLL must be invoked by the clients of the DLL to initialize the DLL. @item When useful, the DLL should also export a finalization routine which calls routine @code{adafinal} generated by @code{gnatbind} to perform the -finalization of the Ada code in the DLL (@ref{1f2,,Ada DLLs and Finalization}). +finalization of the Ada code in the DLL (@ref{1f4,,Ada DLLs and Finalization}). The finalization routine exported by the Ada DLL must be invoked by the clients of the DLL when the DLL services are no further needed. @@ -24207,11 +24220,11 @@ of the programming languages to which you plan to make the DLL available. @item You must provide a definition file listing the exported entities -(@ref{1e1,,The Definition File}). +(@ref{1e3,,The Definition File}). @item Finally you must use @code{gnatdll} to produce the DLL and the import -library (@ref{1e9,,Using gnatdll}). +library (@ref{1eb,,Using gnatdll}). @end itemize Note that a relocatable DLL stripped using the @code{strip} @@ -24231,7 +24244,7 @@ chapter of the `GPRbuild User’s Guide'. @end menu @node Limitations When Using Ada DLLs from Ada,Exporting Ada Entities,,Building DLLs with gnatdll -@anchor{gnat_ugn/platform_specific_information limitations-when-using-ada-dlls-from-ada}@anchor{1f3} +@anchor{gnat_ugn/platform_specific_information limitations-when-using-ada-dlls-from-ada}@anchor{1f5} @subsubsection Limitations When Using Ada DLLs from Ada @@ -24252,7 +24265,7 @@ It is completely safe to exchange plain elementary, array or record types, Windows object handles, etc. @node Exporting Ada Entities,Ada DLLs and Elaboration,Limitations When Using Ada DLLs from Ada,Building DLLs with gnatdll -@anchor{gnat_ugn/platform_specific_information exporting-ada-entities}@anchor{1f0}@anchor{gnat_ugn/platform_specific_information id27}@anchor{1f4} +@anchor{gnat_ugn/platform_specific_information exporting-ada-entities}@anchor{1f2}@anchor{gnat_ugn/platform_specific_information id28}@anchor{1f6} @subsubsection Exporting Ada Entities @@ -24352,10 +24365,10 @@ end API; Note that if you do not export the Ada entities with a @code{C} or @code{Stdcall} convention you will have to provide the mangled Ada names in the definition file of the Ada DLL -(@ref{1f5,,Creating the Definition File}). +(@ref{1f7,,Creating the Definition File}). @node Ada DLLs and Elaboration,,Exporting Ada Entities,Building DLLs with gnatdll -@anchor{gnat_ugn/platform_specific_information ada-dlls-and-elaboration}@anchor{1f1}@anchor{gnat_ugn/platform_specific_information id28}@anchor{1f6} +@anchor{gnat_ugn/platform_specific_information ada-dlls-and-elaboration}@anchor{1f3}@anchor{gnat_ugn/platform_specific_information id29}@anchor{1f8} @subsubsection Ada DLLs and Elaboration @@ -24373,7 +24386,7 @@ the Ada elaboration routine @code{adainit} generated by the GNAT binder (@ref{7e,,Binding with Non-Ada Main Programs}). See the body of @code{Initialize_Api} for an example. Note that the GNAT binder is automatically invoked during the DLL build process by the @code{gnatdll} -tool (@ref{1e9,,Using gnatdll}). +tool (@ref{1eb,,Using gnatdll}). When a DLL is loaded, Windows systematically invokes a routine called @code{DllMain}. It would therefore be possible to call @code{adainit} @@ -24386,7 +24399,7 @@ time), which means that the GNAT run-time will deadlock waiting for the newly created task to complete its initialization. @node Ada DLLs and Finalization,Creating a Spec for Ada DLLs,Building DLLs with gnatdll,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information ada-dlls-and-finalization}@anchor{1f2}@anchor{gnat_ugn/platform_specific_information id29}@anchor{1f7} +@anchor{gnat_ugn/platform_specific_information ada-dlls-and-finalization}@anchor{1f4}@anchor{gnat_ugn/platform_specific_information id30}@anchor{1f9} @subsubsection Ada DLLs and Finalization @@ -24401,10 +24414,10 @@ routine @code{adafinal} generated by the GNAT binder See the body of @code{Finalize_Api} for an example. As already pointed out the GNAT binder is automatically invoked during the DLL build process by the @code{gnatdll} tool -(@ref{1e9,,Using gnatdll}). +(@ref{1eb,,Using gnatdll}). @node Creating a Spec for Ada DLLs,GNAT and Windows Resources,Ada DLLs and Finalization,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information creating-a-spec-for-ada-dlls}@anchor{1f8}@anchor{gnat_ugn/platform_specific_information id30}@anchor{1f9} +@anchor{gnat_ugn/platform_specific_information creating-a-spec-for-ada-dlls}@anchor{1fa}@anchor{gnat_ugn/platform_specific_information id31}@anchor{1fb} @subsubsection Creating a Spec for Ada DLLs @@ -24462,7 +24475,7 @@ end API; @end menu @node Creating the Definition File,Using gnatdll,,Creating a Spec for Ada DLLs -@anchor{gnat_ugn/platform_specific_information creating-the-definition-file}@anchor{1f5}@anchor{gnat_ugn/platform_specific_information id31}@anchor{1fa} +@anchor{gnat_ugn/platform_specific_information creating-the-definition-file}@anchor{1f7}@anchor{gnat_ugn/platform_specific_information id32}@anchor{1fc} @subsubsection Creating the Definition File @@ -24498,7 +24511,7 @@ EXPORTS @end quotation @node Using gnatdll,,Creating the Definition File,Creating a Spec for Ada DLLs -@anchor{gnat_ugn/platform_specific_information id32}@anchor{1fb}@anchor{gnat_ugn/platform_specific_information using-gnatdll}@anchor{1e9} +@anchor{gnat_ugn/platform_specific_information id33}@anchor{1fd}@anchor{gnat_ugn/platform_specific_information using-gnatdll}@anchor{1eb} @subsubsection Using @code{gnatdll} @@ -24709,7 +24722,7 @@ asks @code{gnatlink} to generate the routines @code{DllMain} and is loaded into memory. @item -@code{gnatdll} uses @code{dlltool} (see @ref{1fc,,Using dlltool}) to build the +@code{gnatdll} uses @code{dlltool} (see @ref{1fe,,Using dlltool}) to build the export table (@code{api.exp}). The export table contains the relocation information in a form which can be used during the final link to ensure that the Windows loader is able to place the DLL anywhere in memory. @@ -24748,7 +24761,7 @@ $ gnatbind -n api $ gnatlink api api.exp -o api.dll -mdll @end example @end itemize -@anchor{gnat_ugn/platform_specific_information using-dlltool}@anchor{1fc} +@anchor{gnat_ugn/platform_specific_information using-dlltool}@anchor{1fe} @subsubheading Using @code{dlltool} @@ -24807,7 +24820,7 @@ DLL in the static import library generated by @code{dlltool} with switch @item @code{-k} Kill @code{@@@var{nn}} from exported names -(@ref{1d6,,Windows Calling Conventions} +(@ref{1d8,,Windows Calling Conventions} for a discussion about @code{Stdcall}-style symbols). @end table @@ -24863,7 +24876,7 @@ Use @code{assembler-name} as the assembler. The default is @code{as}. @end table @node GNAT and Windows Resources,Using GNAT DLLs from Microsoft Visual Studio Applications,Creating a Spec for Ada DLLs,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information gnat-and-windows-resources}@anchor{1fd}@anchor{gnat_ugn/platform_specific_information id33}@anchor{1fe} +@anchor{gnat_ugn/platform_specific_information gnat-and-windows-resources}@anchor{1ff}@anchor{gnat_ugn/platform_specific_information id34}@anchor{200} @subsubsection GNAT and Windows Resources @@ -24958,7 +24971,7 @@ the corresponding Microsoft documentation. @end menu @node Building Resources,Compiling Resources,,GNAT and Windows Resources -@anchor{gnat_ugn/platform_specific_information building-resources}@anchor{1ff}@anchor{gnat_ugn/platform_specific_information id34}@anchor{200} +@anchor{gnat_ugn/platform_specific_information building-resources}@anchor{201}@anchor{gnat_ugn/platform_specific_information id35}@anchor{202} @subsubsection Building Resources @@ -24978,7 +24991,7 @@ complete description of the resource script language can be found in the Microsoft documentation. @node Compiling Resources,Using Resources,Building Resources,GNAT and Windows Resources -@anchor{gnat_ugn/platform_specific_information compiling-resources}@anchor{201}@anchor{gnat_ugn/platform_specific_information id35}@anchor{202} +@anchor{gnat_ugn/platform_specific_information compiling-resources}@anchor{203}@anchor{gnat_ugn/platform_specific_information id36}@anchor{204} @subsubsection Compiling Resources @@ -25020,7 +25033,7 @@ $ windres -i myres.res -o myres.o @end quotation @node Using Resources,,Compiling Resources,GNAT and Windows Resources -@anchor{gnat_ugn/platform_specific_information id36}@anchor{203}@anchor{gnat_ugn/platform_specific_information using-resources}@anchor{204} +@anchor{gnat_ugn/platform_specific_information id37}@anchor{205}@anchor{gnat_ugn/platform_specific_information using-resources}@anchor{206} @subsubsection Using Resources @@ -25040,7 +25053,7 @@ $ gnatmake myprog -largs myres.o @end quotation @node Using GNAT DLLs from Microsoft Visual Studio Applications,Debugging a DLL,GNAT and Windows Resources,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information using-gnat-dll-from-msvs}@anchor{205}@anchor{gnat_ugn/platform_specific_information using-gnat-dlls-from-microsoft-visual-studio-applications}@anchor{206} +@anchor{gnat_ugn/platform_specific_information using-gnat-dll-from-msvs}@anchor{207}@anchor{gnat_ugn/platform_specific_information using-gnat-dlls-from-microsoft-visual-studio-applications}@anchor{208} @subsubsection Using GNAT DLLs from Microsoft Visual Studio Applications @@ -25074,7 +25087,7 @@ $ gprbuild -p mylib.gpr @item Produce a .def file for the symbols you need to interface with, either by hand or automatically with possibly some manual adjustments -(see @ref{1e7,,Creating Definition File Automatically}): +(see @ref{1e9,,Creating Definition File Automatically}): @end enumerate @quotation @@ -25091,7 +25104,7 @@ $ dlltool libmylib.dll -z libmylib.def --export-all-symbols Make sure that MSVS command-line tools are accessible on the path. @item -Create the Microsoft-style import library (see @ref{1ea,,MSVS-Style Import Library}): +Create the Microsoft-style import library (see @ref{1ec,,MSVS-Style Import Library}): @end enumerate @quotation @@ -25133,7 +25146,7 @@ or copy the DLL into into the directory containing the .exe. @end enumerate @node Debugging a DLL,Setting Stack Size from gnatlink,Using GNAT DLLs from Microsoft Visual Studio Applications,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information debugging-a-dll}@anchor{207}@anchor{gnat_ugn/platform_specific_information id37}@anchor{208} +@anchor{gnat_ugn/platform_specific_information debugging-a-dll}@anchor{209}@anchor{gnat_ugn/platform_specific_information id38}@anchor{20a} @subsubsection Debugging a DLL @@ -25171,7 +25184,7 @@ tools suite used to build the DLL. @end menu @node Program and DLL Both Built with GCC/GNAT,Program Built with Foreign Tools and DLL Built with GCC/GNAT,,Debugging a DLL -@anchor{gnat_ugn/platform_specific_information id38}@anchor{209}@anchor{gnat_ugn/platform_specific_information program-and-dll-both-built-with-gcc-gnat}@anchor{20a} +@anchor{gnat_ugn/platform_specific_information id39}@anchor{20b}@anchor{gnat_ugn/platform_specific_information program-and-dll-both-built-with-gcc-gnat}@anchor{20c} @subsubsection Program and DLL Both Built with GCC/GNAT @@ -25181,7 +25194,7 @@ the process. Let’s suppose here that the main procedure is named @code{ada_main} and that in the DLL there is an entry point named @code{ada_dll}. -The DLL (@ref{1e0,,Introduction to Dynamic Link Libraries (DLLs)}) and +The DLL (@ref{1e2,,Introduction to Dynamic Link Libraries (DLLs)}) and program must have been built with the debugging information (see GNAT -g switch). Here are the step-by-step instructions for debugging it: @@ -25221,7 +25234,7 @@ you can use the standard approach to debug the whole program (@ref{14f,,Running and Debugging Ada Programs}). @node Program Built with Foreign Tools and DLL Built with GCC/GNAT,,Program and DLL Both Built with GCC/GNAT,Debugging a DLL -@anchor{gnat_ugn/platform_specific_information id39}@anchor{20b}@anchor{gnat_ugn/platform_specific_information program-built-with-foreign-tools-and-dll-built-with-gcc-gnat}@anchor{20c} +@anchor{gnat_ugn/platform_specific_information id40}@anchor{20d}@anchor{gnat_ugn/platform_specific_information program-built-with-foreign-tools-and-dll-built-with-gcc-gnat}@anchor{20e} @subsubsection Program Built with Foreign Tools and DLL Built with GCC/GNAT @@ -25238,7 +25251,7 @@ example some C code built with Microsoft Visual C) and that there is a DLL named @code{test.dll} containing an Ada entry point named @code{ada_dll}. -The DLL (see @ref{1e0,,Introduction to Dynamic Link Libraries (DLLs)}) must have +The DLL (see @ref{1e2,,Introduction to Dynamic Link Libraries (DLLs)}) must have been built with debugging information (see the GNAT @code{-g} option). @subsubheading Debugging the DLL Directly @@ -25377,7 +25390,7 @@ approach to debug a program as described in @ref{14f,,Running and Debugging Ada Programs}. @node Setting Stack Size from gnatlink,Setting Heap Size from gnatlink,Debugging a DLL,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information id40}@anchor{20d}@anchor{gnat_ugn/platform_specific_information setting-stack-size-from-gnatlink}@anchor{129} +@anchor{gnat_ugn/platform_specific_information id41}@anchor{20f}@anchor{gnat_ugn/platform_specific_information setting-stack-size-from-gnatlink}@anchor{129} @subsubsection Setting Stack Size from @code{gnatlink} @@ -25420,7 +25433,7 @@ because the comma is a separator for this option. @end itemize @node Setting Heap Size from gnatlink,,Setting Stack Size from gnatlink,Mixed-Language Programming on Windows -@anchor{gnat_ugn/platform_specific_information id41}@anchor{20e}@anchor{gnat_ugn/platform_specific_information setting-heap-size-from-gnatlink}@anchor{12a} +@anchor{gnat_ugn/platform_specific_information id42}@anchor{210}@anchor{gnat_ugn/platform_specific_information setting-heap-size-from-gnatlink}@anchor{12a} @subsubsection Setting Heap Size from @code{gnatlink} @@ -25453,7 +25466,7 @@ because the comma is a separator for this option. @end itemize @node Windows Specific Add-Ons,,Mixed-Language Programming on Windows,Microsoft Windows Topics -@anchor{gnat_ugn/platform_specific_information win32-specific-addons}@anchor{20f}@anchor{gnat_ugn/platform_specific_information windows-specific-add-ons}@anchor{210} +@anchor{gnat_ugn/platform_specific_information win32-specific-addons}@anchor{211}@anchor{gnat_ugn/platform_specific_information windows-specific-add-ons}@anchor{212} @subsection Windows Specific Add-Ons @@ -25466,7 +25479,7 @@ This section describes the Windows specific add-ons. @end menu @node Win32Ada,wPOSIX,,Windows Specific Add-Ons -@anchor{gnat_ugn/platform_specific_information id42}@anchor{211}@anchor{gnat_ugn/platform_specific_information win32ada}@anchor{212} +@anchor{gnat_ugn/platform_specific_information id43}@anchor{213}@anchor{gnat_ugn/platform_specific_information win32ada}@anchor{214} @subsubsection Win32Ada @@ -25497,7 +25510,7 @@ gprbuild p.gpr @end quotation @node wPOSIX,,Win32Ada,Windows Specific Add-Ons -@anchor{gnat_ugn/platform_specific_information id43}@anchor{213}@anchor{gnat_ugn/platform_specific_information wposix}@anchor{214} +@anchor{gnat_ugn/platform_specific_information id44}@anchor{215}@anchor{gnat_ugn/platform_specific_information wposix}@anchor{216} @subsubsection wPOSIX @@ -25530,7 +25543,7 @@ gprbuild p.gpr @end quotation @node Mac OS Topics,,Microsoft Windows Topics,Platform-Specific Information -@anchor{gnat_ugn/platform_specific_information id44}@anchor{215}@anchor{gnat_ugn/platform_specific_information mac-os-topics}@anchor{216} +@anchor{gnat_ugn/platform_specific_information id45}@anchor{217}@anchor{gnat_ugn/platform_specific_information mac-os-topics}@anchor{218} @section Mac OS Topics @@ -25545,7 +25558,7 @@ platform. @end menu @node Codesigning the Debugger,,,Mac OS Topics -@anchor{gnat_ugn/platform_specific_information codesigning-the-debugger}@anchor{217} +@anchor{gnat_ugn/platform_specific_information codesigning-the-debugger}@anchor{219} @subsection Codesigning the Debugger @@ -25626,7 +25639,7 @@ the location where you installed GNAT. Also, be sure that users are in the Unix group @code{_developer}. @node Example of Binder Output File,Elaboration Order Handling in GNAT,Platform-Specific Information,Top -@anchor{gnat_ugn/example_of_binder_output doc}@anchor{218}@anchor{gnat_ugn/example_of_binder_output example-of-binder-output-file}@anchor{e}@anchor{gnat_ugn/example_of_binder_output id1}@anchor{219} +@anchor{gnat_ugn/example_of_binder_output doc}@anchor{21a}@anchor{gnat_ugn/example_of_binder_output example-of-binder-output-file}@anchor{e}@anchor{gnat_ugn/example_of_binder_output id1}@anchor{21b} @chapter Example of Binder Output File @@ -26378,7 +26391,7 @@ elaboration code in your own application). @c -- Example: A |withing| unit has a |with| clause, it |withs| a |withed| unit @node Elaboration Order Handling in GNAT,Inline Assembler,Example of Binder Output File,Top -@anchor{gnat_ugn/elaboration_order_handling_in_gnat doc}@anchor{21a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order-handling-in-gnat}@anchor{f}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id1}@anchor{21b} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat doc}@anchor{21c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order-handling-in-gnat}@anchor{f}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id1}@anchor{21d} @chapter Elaboration Order Handling in GNAT @@ -26408,7 +26421,7 @@ GNAT, either automatically or with explicit programming features. @end menu @node Elaboration Code,Elaboration Order,,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-code}@anchor{21c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id2}@anchor{21d} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-code}@anchor{21e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id2}@anchor{21f} @section Elaboration Code @@ -26556,7 +26569,7 @@ elaborated. @end itemize @node Elaboration Order,Checking the Elaboration Order,Elaboration Code,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order}@anchor{21e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id3}@anchor{21f} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order}@anchor{220}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id3}@anchor{221} @section Elaboration Order @@ -26725,7 +26738,7 @@ however a compiler may not always find such an order due to complications with respect to control and data flow. @node Checking the Elaboration Order,Controlling the Elaboration Order in Ada,Elaboration Order,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat checking-the-elaboration-order}@anchor{220}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id4}@anchor{221} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat checking-the-elaboration-order}@anchor{222}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id4}@anchor{223} @section Checking the Elaboration Order @@ -26786,7 +26799,7 @@ order. @end itemize @node Controlling the Elaboration Order in Ada,Controlling the Elaboration Order in GNAT,Checking the Elaboration Order,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-ada}@anchor{222}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id5}@anchor{223} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-ada}@anchor{224}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id5}@anchor{225} @section Controlling the Elaboration Order in Ada @@ -27114,7 +27127,7 @@ is that the program continues to stay in the last state (one or more correct orders exist) even if maintenance changes the bodies of targets. @node Controlling the Elaboration Order in GNAT,Mixing Elaboration Models,Controlling the Elaboration Order in Ada,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-gnat}@anchor{224}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id6}@anchor{225} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-gnat}@anchor{226}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id6}@anchor{227} @section Controlling the Elaboration Order in GNAT @@ -27244,7 +27257,7 @@ The dynamic, legacy, and static models can be relaxed using compiler switch may not diagnose certain elaboration issues or install run-time checks. @node Mixing Elaboration Models,ABE Diagnostics,Controlling the Elaboration Order in GNAT,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat id7}@anchor{226}@anchor{gnat_ugn/elaboration_order_handling_in_gnat mixing-elaboration-models}@anchor{227} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat id7}@anchor{228}@anchor{gnat_ugn/elaboration_order_handling_in_gnat mixing-elaboration-models}@anchor{229} @section Mixing Elaboration Models @@ -27291,7 +27304,7 @@ warning: "y.ads" which has static elaboration checks The warnings can be suppressed by binder switch @code{-ws}. @node ABE Diagnostics,SPARK Diagnostics,Mixing Elaboration Models,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat abe-diagnostics}@anchor{228}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id8}@anchor{229} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat abe-diagnostics}@anchor{22a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id8}@anchor{22b} @section ABE Diagnostics @@ -27398,7 +27411,7 @@ declaration @code{Safe} because the body of function @code{ABE} has already been elaborated at that point. @node SPARK Diagnostics,Elaboration Circularities,ABE Diagnostics,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat id9}@anchor{22a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat spark-diagnostics}@anchor{22b} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat id9}@anchor{22c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat spark-diagnostics}@anchor{22d} @section SPARK Diagnostics @@ -27424,7 +27437,7 @@ rules. @end quotation @node Elaboration Circularities,Resolving Elaboration Circularities,SPARK Diagnostics,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-circularities}@anchor{22c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id10}@anchor{22d} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-circularities}@anchor{22e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id10}@anchor{22f} @section Elaboration Circularities @@ -27524,7 +27537,7 @@ This section enumerates various tactics for eliminating the circularity. @end itemize @node Resolving Elaboration Circularities,Elaboration-related Compiler Switches,Elaboration Circularities,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat id11}@anchor{22e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat resolving-elaboration-circularities}@anchor{22f} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat id11}@anchor{230}@anchor{gnat_ugn/elaboration_order_handling_in_gnat resolving-elaboration-circularities}@anchor{231} @section Resolving Elaboration Circularities @@ -27796,7 +27809,7 @@ Use the relaxed dynamic-elaboration model, with compiler switches @end itemize @node Elaboration-related Compiler Switches,Summary of Procedures for Elaboration Control,Resolving Elaboration Circularities,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-related-compiler-switches}@anchor{230}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id12}@anchor{231} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-related-compiler-switches}@anchor{232}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id12}@anchor{233} @section Elaboration-related Compiler Switches @@ -27977,7 +27990,7 @@ checks. The example above will still fail at run time with an ABE. @end table @node Summary of Procedures for Elaboration Control,Inspecting the Chosen Elaboration Order,Elaboration-related Compiler Switches,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat id13}@anchor{232}@anchor{gnat_ugn/elaboration_order_handling_in_gnat summary-of-procedures-for-elaboration-control}@anchor{233} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat id13}@anchor{234}@anchor{gnat_ugn/elaboration_order_handling_in_gnat summary-of-procedures-for-elaboration-control}@anchor{235} @section Summary of Procedures for Elaboration Control @@ -28035,7 +28048,7 @@ Use the relaxed dynamic elaboration model, with compiler switches @end itemize @node Inspecting the Chosen Elaboration Order,,Summary of Procedures for Elaboration Control,Elaboration Order Handling in GNAT -@anchor{gnat_ugn/elaboration_order_handling_in_gnat id14}@anchor{234}@anchor{gnat_ugn/elaboration_order_handling_in_gnat inspecting-the-chosen-elaboration-order}@anchor{235} +@anchor{gnat_ugn/elaboration_order_handling_in_gnat id14}@anchor{236}@anchor{gnat_ugn/elaboration_order_handling_in_gnat inspecting-the-chosen-elaboration-order}@anchor{237} @section Inspecting the Chosen Elaboration Order @@ -28178,7 +28191,7 @@ gdbstr (body) @end quotation @node Inline Assembler,GNU Free Documentation License,Elaboration Order Handling in GNAT,Top -@anchor{gnat_ugn/inline_assembler doc}@anchor{236}@anchor{gnat_ugn/inline_assembler id1}@anchor{237}@anchor{gnat_ugn/inline_assembler inline-assembler}@anchor{10} +@anchor{gnat_ugn/inline_assembler doc}@anchor{238}@anchor{gnat_ugn/inline_assembler id1}@anchor{239}@anchor{gnat_ugn/inline_assembler inline-assembler}@anchor{10} @chapter Inline Assembler @@ -28237,7 +28250,7 @@ and with assembly language programming. @end menu @node Basic Assembler Syntax,A Simple Example of Inline Assembler,,Inline Assembler -@anchor{gnat_ugn/inline_assembler basic-assembler-syntax}@anchor{238}@anchor{gnat_ugn/inline_assembler id2}@anchor{239} +@anchor{gnat_ugn/inline_assembler basic-assembler-syntax}@anchor{23a}@anchor{gnat_ugn/inline_assembler id2}@anchor{23b} @section Basic Assembler Syntax @@ -28353,7 +28366,7 @@ Intel: Destination first; for example @code{mov eax, 4}@w{ } @node A Simple Example of Inline Assembler,Output Variables in Inline Assembler,Basic Assembler Syntax,Inline Assembler -@anchor{gnat_ugn/inline_assembler a-simple-example-of-inline-assembler}@anchor{23a}@anchor{gnat_ugn/inline_assembler id3}@anchor{23b} +@anchor{gnat_ugn/inline_assembler a-simple-example-of-inline-assembler}@anchor{23c}@anchor{gnat_ugn/inline_assembler id3}@anchor{23d} @section A Simple Example of Inline Assembler @@ -28502,7 +28515,7 @@ If there are no errors, @code{as} will generate an object file @code{nothing.out}. @node Output Variables in Inline Assembler,Input Variables in Inline Assembler,A Simple Example of Inline Assembler,Inline Assembler -@anchor{gnat_ugn/inline_assembler id4}@anchor{23c}@anchor{gnat_ugn/inline_assembler output-variables-in-inline-assembler}@anchor{23d} +@anchor{gnat_ugn/inline_assembler id4}@anchor{23e}@anchor{gnat_ugn/inline_assembler output-variables-in-inline-assembler}@anchor{23f} @section Output Variables in Inline Assembler @@ -28869,7 +28882,7 @@ end Get_Flags_3; @end quotation @node Input Variables in Inline Assembler,Inlining Inline Assembler Code,Output Variables in Inline Assembler,Inline Assembler -@anchor{gnat_ugn/inline_assembler id5}@anchor{23e}@anchor{gnat_ugn/inline_assembler input-variables-in-inline-assembler}@anchor{23f} +@anchor{gnat_ugn/inline_assembler id5}@anchor{240}@anchor{gnat_ugn/inline_assembler input-variables-in-inline-assembler}@anchor{241} @section Input Variables in Inline Assembler @@ -28958,7 +28971,7 @@ _increment__incr.1: @end quotation @node Inlining Inline Assembler Code,Other Asm Functionality,Input Variables in Inline Assembler,Inline Assembler -@anchor{gnat_ugn/inline_assembler id6}@anchor{240}@anchor{gnat_ugn/inline_assembler inlining-inline-assembler-code}@anchor{241} +@anchor{gnat_ugn/inline_assembler id6}@anchor{242}@anchor{gnat_ugn/inline_assembler inlining-inline-assembler-code}@anchor{243} @section Inlining Inline Assembler Code @@ -29029,7 +29042,7 @@ movl %esi,%eax thus saving the overhead of stack frame setup and an out-of-line call. @node Other Asm Functionality,,Inlining Inline Assembler Code,Inline Assembler -@anchor{gnat_ugn/inline_assembler id7}@anchor{242}@anchor{gnat_ugn/inline_assembler other-asm-functionality}@anchor{243} +@anchor{gnat_ugn/inline_assembler id7}@anchor{244}@anchor{gnat_ugn/inline_assembler other-asm-functionality}@anchor{245} @section Other @code{Asm} Functionality @@ -29044,7 +29057,7 @@ and @code{Volatile}, which inhibits unwanted optimizations. @end menu @node The Clobber Parameter,The Volatile Parameter,,Other Asm Functionality -@anchor{gnat_ugn/inline_assembler id8}@anchor{244}@anchor{gnat_ugn/inline_assembler the-clobber-parameter}@anchor{245} +@anchor{gnat_ugn/inline_assembler id8}@anchor{246}@anchor{gnat_ugn/inline_assembler the-clobber-parameter}@anchor{247} @subsection The @code{Clobber} Parameter @@ -29108,7 +29121,7 @@ Use ‘register’ name @code{memory} if you changed a memory location @end itemize @node The Volatile Parameter,,The Clobber Parameter,Other Asm Functionality -@anchor{gnat_ugn/inline_assembler id9}@anchor{246}@anchor{gnat_ugn/inline_assembler the-volatile-parameter}@anchor{247} +@anchor{gnat_ugn/inline_assembler id9}@anchor{248}@anchor{gnat_ugn/inline_assembler the-volatile-parameter}@anchor{249} @subsection The @code{Volatile} Parameter @@ -29144,7 +29157,7 @@ to @code{True} only if the compiler’s optimizations have created problems. @node GNU Free Documentation License,Index,Inline Assembler,Top -@anchor{share/gnu_free_documentation_license doc}@anchor{248}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{249} +@anchor{share/gnu_free_documentation_license doc}@anchor{24a}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{24b} @chapter GNU Free Documentation License diff --git a/gcc/ada/libgnarl/s-taprop.ads b/gcc/ada/libgnarl/s-taprop.ads index 35f0ea417f8..b3d224047c5 100644 --- a/gcc/ada/libgnarl/s-taprop.ads +++ b/gcc/ada/libgnarl/s-taprop.ads @@ -322,6 +322,15 @@ package System.Task_Primitives.Operations is -- priority (RM D.2.2 par 9). Loss_Of_Inheritance helps the underlying -- implementation to do it right when the OS doesn't. + -- Note: The behavior of Set_Priority is OS specific when a dispatching + -- policy is not specified, and, as a result, calls to Set_Priority may + -- have no affect without setting such a policy via pragma + -- Task_Dispatching_Policy. + + -- For example: + + -- pragma Task_Dispatching_Policy (FIFO_Within_Priorities); + function Get_Priority (T : ST.Task_Id) return System.Any_Priority; pragma Inline (Get_Priority); -- Returns the priority last set by Set_Priority for this task diff --git a/gcc/ada/libgnarl/s-taprop__mingw.adb b/gcc/ada/libgnarl/s-taprop__mingw.adb index df1cb67b707..3a124ba78d0 100644 --- a/gcc/ada/libgnarl/s-taprop__mingw.adb +++ b/gcc/ada/libgnarl/s-taprop__mingw.adb @@ -675,7 +675,10 @@ package body System.Task_Primitives.Operations is Res := SetThreadPriority (T.Common.LL.Thread, - Interfaces.C.int (Underlying_Priorities (Prio))); + Interfaces.C.int ((if Dispatching_Policy = 'F' then + FIFO_Underlying_Priorities (Prio) + else + Underlying_Priorities (Prio)))); pragma Assert (Res = Win32.TRUE); -- Note: Annex D (RM D.2.3(5/2)) requires the task to be placed at the diff --git a/gcc/ada/libgnat/system-mingw.ads b/gcc/ada/libgnat/system-mingw.ads index e30e9b04223..0a130e7f810 100644 --- a/gcc/ada/libgnat/system-mingw.ads +++ b/gcc/ada/libgnat/system-mingw.ads @@ -153,15 +153,20 @@ private -- that the value of these parameters is available for analysis -- of the declarations here (using Rtsfind at compile time). - -- The underlying priorities table provides a generalized mechanism + -- The underlying priorities tables provide a generalized mechanism -- for mapping from Ada priorities to system priorities. In some -- cases a 1-1 mapping is not the convenient or optimal choice. + -- We include two different tables here - one for when + -- FIFO_Within_Priorites is specified and one for default behavior - + -- since Windows will allow a greater granularity of levels when it + -- is in affect. + type Priorities_Mapping is array (Any_Priority) of Integer; pragma Suppress_Initialization (Priorities_Mapping); -- Suppress initialization in case gnat.adc specifies Normalize_Scalars - Underlying_Priorities : constant Priorities_Mapping := + FIFO_Underlying_Priorities : constant Priorities_Mapping := (Priority'First .. Default_Priority - 8 => -15, Default_Priority - 7 => -7, @@ -181,8 +186,24 @@ private Priority'Last => 6, Interrupt_Priority => 15); -- The default mapping preserves the standard 31 priorities of the Ada + -- model, but maps them using compression onto the 16 priority levels + -- available in NT when REALTIME_PRIORITY_CLASS base class is set via + -- pragma Task_Dispatching_Policy (FIFO_Within_Priorities). + + Underlying_Priorities : constant Priorities_Mapping := + (Priority'First => -15, -- Thread_Priority_Idle + 1 .. 6 => -2, -- Thread_Priority_Lowest + 7 .. 12 => -1, -- Thread_Priority_Below_Normal + 13 .. 14 => 0, -- Thread_Priority_Normal + Default_Priority => 0, -- Thread_Priority_Normal + 16 .. 18 => 0, -- Thread_Priority_Normal + 19 .. 24 => 1, -- Thread_Priority_Above_Normal + 25 .. 29 => 2, -- Thread_Priority_Highest + Priority'Last => 2, -- Thread_Priority_Highest + Interrupt_Priority => 15); -- Thread_Priority_Time_Critical + -- The non FIFO mapping preserves the standard 31 priorities of the Ada -- model, but maps them using compression onto the 7 priority levels - -- available in NT and on the 16 priority levels available in 2000/XP. + -- available in NT when pragma Task_Dispatching_Policy is unspecified. pragma Linker_Options ("-Wl,--stack=0x2000000"); -- This is used to change the default stack (32 MB) size for non tasking From patchwork Tue May 21 07:30:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90525 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62092385840D for ; Tue, 21 May 2024 07:31:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id 6A7B33858D33 for ; Tue, 21 May 2024 07:30:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A7B33858D33 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6A7B33858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276653; cv=none; b=YWM8y2apy96aiH9GYrP3FyCw8KkVkRmGFVfBVTBYYXbU9arcaZzIY44PCoe6K6TLibsMlJ5SdO2Mg/bnV59su9o1x66GrHTnVNK2Vp4FBm2KjcvjMlsCyOSpN3n4N+2OTXtCppDxU46S1oHlIsjMUzUCc0zILnNwUcguWV94a/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276653; c=relaxed/simple; bh=C9rECyO/xUJ1i0KNoDFp3Z0/Fg+qHQWfJ0p75RRYsmg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nQPwXUB5L+FNxDRTj0nAQmSSBONrC4WQwbuOKOEfnGriGtRMCneisoVx+wQCM8LtxmCn7jG/B09wJ4UAMW5wD6siqMV08hr/jqJlS0SuI4tmDLZntslFmDmPw0S3twU0hLvbeZtHc8VwVDtklYLXr4ry2fE/Ej6/sBRSCBu6ga0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e271acb015so65233141fa.1 for ; Tue, 21 May 2024 00:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276650; x=1716881450; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0XamGX/FV1J0NOZiIgOyEaMrVMqzxaSKBSR14k62yI8=; b=CR7ox2R7qKO1HSWH3gOGKyZeRXEWU8NtZAPO9f7Ikxr8R/3MXzLcgnBMC6cAeodw15 612hAa31AAyGyIm+6cL4DbNOhzaY/Jt6PbkNr4Cy3b2Hejh4T4ZCPA/9LbrYjCSKkBiI zSDc9IckvO6H0y46AzOAyCMARRZMKSNf0PYXMQcQKniN2gDgVfSR7HclHlMRFtKU+KPa GX7MC3ljQvCmETIf9OqM6SwhLdL9uYXdig7uazkfOvGgN4GtaXqKdneiJBbFDHpiXLcc 1j61sPHD3F9GFTFJMLUKqbUtyLs5s1njDofFGwSp0ZTOMDp8Nkl3l0QgHHzevwxcp+bm JOEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276650; x=1716881450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0XamGX/FV1J0NOZiIgOyEaMrVMqzxaSKBSR14k62yI8=; b=rgNN8cko8QTxqZLeTe5cEEOrQanpJdYsoaBRN7hBWPqM9I0VivVwf0NB7TeEJtbFUT 1esrxaZ4cS/2tbQ2B3EIF18zn4eoD2ASKGMg4fX1SZvkzpksB9U0eBPuStXrE5dZ2RpJ 1HVnIZ+4f5gkt/JrFuNryHPU0mcm2Tp5RarkZayuxF5a3LCkMTZX2drJ3vn/q3VY9/sl zMXDxuuACdS33zCgVSO9pqlk461DSUkh0SnuDcEfFEKusiOkOsNmlXuvgUak5cMyrnMy UFuoFJ96j8eo0j2MiEVNlvDyoKnMSNtcZvdLfTEcw2yPkty8pWOwk7rSSYhLgGEwnTto g5Yw== X-Gm-Message-State: AOJu0YwEM7o0FROV0Q+G19f/I0apuY6WEyVwSffLt5G+0sb6KJcVSsL1 h7uoSylcglRlYw9jSPKMh/Q+rxvBpFXvZCTJ5/5PJGjHgtopWWyydeEYB+mNbVfqARpRC/7nvSM = X-Google-Smtp-Source: AGHT+IE0HdhT9iwaBF4QEXsEnRcI6ckClLxWWgToZ5MjpzrpI6qRcb/ZHgZX3N4iQeTt/dXi1rGw0A== X-Received: by 2002:a2e:b0d6:0:b0:2e2:55:4edd with SMTP id 38308e7fff4ca-2e51fd42b59mr213434231fa.3.1716276649687; Tue, 21 May 2024 00:30:49 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:49 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 02/31] ada: Follow-up fix to previous change for Text_Ptr Date: Tue, 21 May 2024 09:30:05 +0200 Message-ID: <20240521073035.314024-2-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou The variable would be saved and restored while still uninitialized. gcc/ada/ * err_vars.ads (Error_Msg_Sloc): Initialize to No_Location. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/err_vars.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/err_vars.ads b/gcc/ada/err_vars.ads index 113dd936db6..838217b95f4 100644 --- a/gcc/ada/err_vars.ads +++ b/gcc/ada/err_vars.ads @@ -107,7 +107,7 @@ package Err_Vars is -- WARNING: There is a matching C declaration of these variables in fe.h - Error_Msg_Sloc : Source_Ptr; + Error_Msg_Sloc : Source_Ptr := No_Location; -- Source location for # insertion character in message Error_Msg_Name_1 : Name_Id; From patchwork Tue May 21 07:30:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90528 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 01EEF385828B for ; Tue, 21 May 2024 07:32:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id B40623858CDB for ; Tue, 21 May 2024 07:30:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B40623858CDB Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B40623858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276653; cv=none; b=ZrY7xKDpXV13D6GviaxCuI1uAoAhwfHA2QwrEMPqjQCwomUOzWPJEd6hjKqT6wcgrMrxp4HrnJhvNdMO6F+ZzZRMnA7HMUwcH71DGkCWmdmVdX5hMdAmet5AKInuxQ01MAlNTWeut6KIudvdeH3foiiRTaw5A4j34EdxmcNSRmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276653; c=relaxed/simple; bh=7mR+vVnrG9e6iwCbWsbGucoag99BSEWMRM5KDVdJDns=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kT8UhBRyctVobWyluJDKqM5JV6Mqakr5m+5iShGJ2hcDOYQJOYPP0UFR/dt4J/hNyU9vSBkWOThAihty8XA9Z3CdxviW1Zmu5POe6BpGaYPhrphZJveR3T1TuYTqDNMe8OTg56PNHpWy/o4eO7JzQkJxdC4dODRzdFq9ehxyBok= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-420180b5897so27403955e9.3 for ; Tue, 21 May 2024 00:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276650; x=1716881450; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=abGRKroYrv0+ZrnFYagQEVeo/AZ4vHxLhr4IAEUKbeA=; b=Ni8+Mb/X4jFnjHd6qL9j39Z1ohmbl7v7VHYlX4rEF/BIFACq5K3P+mmcexw3y55M0Z ozFU2b3j/acVxC56yK7gKNRt654K6VbedaTyNOLjONVwRnbpZdymBRCzOvZ8m7L0+FCt Eqea6giW34FM4yVOeAPfR2GbBZJRi8dJNT32elXIko3Vs2XDf9Un0MbQBhsK7fhkvEwD DWwtwV08VR9q+UO/WIl7IHjR7GU9wm/jjWwoEaAT1nL0Oma2iY7YNovb5S+Kzt3nYxBD 5Zd5C43lkFsFf7Z7MeoBuhKxly96Ubnc5GJQtJd1SraOPj1tLOcQf/6TXGirtz09+ih0 lRjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276650; x=1716881450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=abGRKroYrv0+ZrnFYagQEVeo/AZ4vHxLhr4IAEUKbeA=; b=uzkFA1Wk9riAoNu4SEUGD4WJCQzwUBV0mnUlqqEx1S04+Acp3zcL2Kt9OCmK9+cOjW LDT/Jhf1acdMswdG4KbPNwdfCYhDsoP2kUlUTtxLfySVAEYMywYbnTXlxGDA19QlwVvU p4EvgW7PJJkOH9Amr6AwU3s2iaPMEA2MjjhuTTsNBXpbFVgZqnP50E/2PInKn6F7ZC5M IKn2FejtldXJR32c1cVDrhd63tR3hkW36cruZuGyA1kMOhlnK4K8IFYIlAZ6WZjiupF0 /JqWeZh1q3YnVMQsi8LnCLOYintj1s3Wh/ZYb9sqV8N38nmwSyYpihSySgR1B6unbPNu t5Rg== X-Gm-Message-State: AOJu0Yz8DtoS4kkz4xBe/kL6vDCa+s1A3M3p83oN1aAIxTbGW2lcPdDa crlGSyMgarQNGw9PcpDMPSWde8vXiUarB4zoq3ISNIhYOUCOb7qBVQpJaDdAYPZwz2tpwrqrWwA = X-Google-Smtp-Source: AGHT+IHv2km42kt7Muhy1FTWX1fxnYluSGA6UUCAkR5PbB2tB6YP1JxejtqEeiVicQFguuUhjkrkLQ== X-Received: by 2002:a05:600c:4f0e:b0:420:151e:b205 with SMTP id 5b1f17b1804b1-420151eb4f3mr184467215e9.39.1716276650345; Tue, 21 May 2024 00:30:50 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:50 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 03/31] ada: Remove trailing NUL in minimal expansion of Put_Image attribute Date: Tue, 21 May 2024 09:30:06 +0200 Message-ID: <20240521073035.314024-3-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek When procedure that implements Put_Image attribute emits the type name, this name was wrongly followed by a NUL character. gcc/ada/ * exp_put_image.adb (Build_Record_Put_Image_Procedure): Remove trailing NUL from the fully qualified type name. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_put_image.adb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index c23b4e24354..f5141a56626 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -832,7 +832,9 @@ package body Exp_Put_Image is Parameter_Associations => New_List (Make_Identifier (Loc, Name_S), Make_String_Literal (Loc, - To_String (Fully_Qualified_Name_String (Btyp)))))); + To_String + (Fully_Qualified_Name_String + (Btyp, Append_NUL => False)))))); end if; elsif Is_Null_Record_Type (Btyp, Ignore_Privacy => True) then From patchwork Tue May 21 07:30:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90526 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AEAE63858C33 for ; Tue, 21 May 2024 07:31:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 5394A3858C60 for ; Tue, 21 May 2024 07:30:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5394A3858C60 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5394A3858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276654; cv=none; b=OHGtDbJWvEfyYvBMYFnWZBEZVwgmHC61+Tltp2vGoqU4F2GlkyqU7u391eMtEA6QnNwXD5VxN5sqzxgoeovs36UMDtFO5sexgF/QpywA7WrEJjWt0jNlt9b1K0mAnwbmRGtXfnVPZiv7C4K17KvFxoi+oiFl1oElAwTpU+sIpCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276654; c=relaxed/simple; bh=qK7lKI8//E7E14PTFkgTrV+CDCmKaIdXCE5IzvI8f9E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ahHpXNaQO2Fc7iDGNb9i2f1i24bx3vaRBe0mIY0mY3KA4mZ882bqOvMy26058jOEin2NkfPJZWi8qbRUVQGx3RAHREbJaRupRirbGqFEW1g33kFrKucuSRckMPtmlTJ5apD8srNXAy1eNCtultV8fXkCD67d+ZrqdgIXss39F9o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-420180b5897so27404055e9.3 for ; Tue, 21 May 2024 00:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276651; x=1716881451; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FOlx7UapbT6eBNKNnHzmaZkZzOtnQsn7cEah/zx92uk=; b=Omrs1ak23FPdfZWy64mMcVmeerfRIsYFYog/EvvUpXjOKtdJlfZql7+aeKyIu7pVel lXOSg0ZUceMxxSOCZ4HbEIUO7l/bKOTfcCFiRSE1O468uspWjeoGK8hULk9hZ88gQIM1 twafdQ430wyseS4c1n/xnRb5JcDwboq9ay6b4xnUpLIE9ffJCnwEmW+ryrtkWcSYjQJm zkx+d8J37bpfE53ktqcm9QBY4AE7pK6xjy5TROf212bZY3hreTSqz+qr8ds7QcDR22WW JQkjv8ARpoPKZrGjlvQMHZde0vM9q3FkRCn6hEr415E9R11CB/wMkS7+nz29PAe9tbzE f2OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276651; x=1716881451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FOlx7UapbT6eBNKNnHzmaZkZzOtnQsn7cEah/zx92uk=; b=shuHJ/UaHNkrPoPZIp/qeMHl+n1TX/iwjixfx73L2rR8fuW7OkSP5xpYl6iXbm74nW +EyJaqvHDFBQ6j2ovqwwBqdkubByb/aUTp0BRDttxvbW77UaiyzBfos3ZI/I78wUv30F vql4mrieLRRB0DFrcx1zov/IRGbJTJHLNea+RwMOVOUYk+H3l3ePS7lx53Kvb4Usw5d0 vtXiLixO4prB3j40sBNd4IVmxTfwTbg3GxWezQBACkROgGJkFiSeLFQnxaOLIZVspu0Z uxuYICjtV9Vv3nZjW4nTgK8BcStl5Z3ENCf6y0cgMSbWFhW1njFRRme13/1DSxwyaCX/ a7BQ== X-Gm-Message-State: AOJu0Yx7+CDhOuYoA/I0KL9TfDlq+lUd+D1kLsXPBkdXk9yc8d1f2E3Q PP8GsE8Wj62kY7ZFsdQIpYuvr7guNf+4z0Yfs0PyENuwSBUWB7/1lfYVeNPNeVO264PapleUXYI = X-Google-Smtp-Source: AGHT+IEwfD9Qpw5M65loOggv91jv45+4QDEPkUOLJlY2Y3tjc3VWI+yqPQzPXzGZWoZQ7X+MyuOMZA== X-Received: by 2002:a05:600c:3595:b0:41a:e995:b924 with SMTP id 5b1f17b1804b1-41fead6504emr231549215e9.33.1716276650980; Tue, 21 May 2024 00:30:50 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:50 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 04/31] ada: Remove conversion from String_Id to String and back to String_Id Date: Tue, 21 May 2024 09:30:07 +0200 Message-ID: <20240521073035.314024-4-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * exp_put_image.adb (Build_Record_Put_Image_Procedure): Remove useless conversions. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_put_image.adb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index f5141a56626..09fbfa75eeb 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -44,7 +44,6 @@ with Sinfo.Nodes; use Sinfo.Nodes; with Sinfo.Utils; use Sinfo.Utils; with Snames; use Snames; with Stand; -with Stringt; use Stringt; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uintp; use Uintp; @@ -832,9 +831,8 @@ package body Exp_Put_Image is Parameter_Associations => New_List (Make_Identifier (Loc, Name_S), Make_String_Literal (Loc, - To_String - (Fully_Qualified_Name_String - (Btyp, Append_NUL => False)))))); + Fully_Qualified_Name_String + (Btyp, Append_NUL => False))))); end if; elsif Is_Null_Record_Type (Btyp, Ignore_Privacy => True) then From patchwork Tue May 21 07:30:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90532 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 133C9384B06A for ; Tue, 21 May 2024 07:33:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id ED5DF3858C31 for ; Tue, 21 May 2024 07:30:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED5DF3858C31 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ED5DF3858C31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276657; cv=none; b=uzAj+dYso5LqGTRPTjhyrjxlTxKUfD1gvNRDcGA5+/7kKPFjCGnpDU97oYSJ1w9gUTmZnFw3jxX6czA1nSWHsm+QlraJ03nOf3zkKv6VEHTVVNdXCPfTzoq8h/9nanN/hlgzuaPROUGkIYTCyVl57yYzh07JhiSh7saawSp66hY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276657; c=relaxed/simple; bh=b1uXOilsI1R/AkjksZ0fKH0HgWWTvowq8tinK2kwkQs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WXJ1gXCR9qU49VU9JflC1EXDMyn0Ij2hSgDMfSLv/hynJg8AVo9rgXERtTflLnP+9GywGBzZPFcFabBWgsvptiDAIo/dYFSVvGnG/zk9P76TiTIH5IiWBh2nu8Y2aFozn0NIG7xwGYFpU4p1uUwp4kO7WtFOZyD82PdkCD/BzRU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41fe54cb0e3so25560945e9.2 for ; Tue, 21 May 2024 00:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276651; x=1716881451; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SWuhrllePJ+czO6Lu3JOe75P44p828egcVLH0Z+RdNs=; b=Xx6ooF3Go57SzksQXGjg1XO7/WGqa0bpyBfHLovl9qWkl39XYLCx00DbYsjpXPhlAc RuyKhvGEM4MiIx0k/DKT0HFWXTe0jBqCrEnGyijzejUcNhgM06WYe3uZFCiqmA/HB37m 2h8v2T6Av6nPPhyNA5lKZNQvWJqD4VRFDUUlfjMM09bRKgEWkY1TZfESxMkhgN1EZJ02 ElDcFI/FR9uugkeNyjnPxHN+e8xERC7kGllrssPcxcLHQHS78zMWJVnyxR11kdfXyxdj 5xFlk/Ojrfj61HmJcnYtENP14aiFvB+uMO01ePkXN5n8+NcJrf8R7ruHZnz2WZl33aPQ 71Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276651; x=1716881451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SWuhrllePJ+czO6Lu3JOe75P44p828egcVLH0Z+RdNs=; b=wJiatqBxqaVCuTKJmEiXWpbv8IAa3AX6LmWO6pVClF9c4JgHhN0zNL6dmvJ9ZwPjv8 M+95JQ1zGfhfM4yl3VM9r5EMEyWg50GtJnzpa+G3IJ4e2gR0T7D+hHeiu6MFtf+j5G/8 lZzk2mDO8ThjwhpPW1IFbryN+d/mMp1SXMijjqJXWmHv4MoIlZ3heHd6cnfSaB06Gnpp vsDOsZkfKCZPVxGCnMC2a7FwIOesaCQMi2YwMt7MinCSpiPjJp7m8BXsSO3pnpMwI3W3 sRHhN0Tn0z2fqsMFmtJLj6B/+ifvt2xTY6A4jR/0F5HMcK2VXPYWkDWBJyOxeoxY0vJE tbFA== X-Gm-Message-State: AOJu0YzspIoJostbg7U9TsxwyqLVu5OBP2np9WiXk3wLUfIg6JE0CFkz P+10DDYMRgzoFlgmtyYSCRKuZ4Dg57eAFYTwkfjCTC5y2seshTIODlyjBVHWt5i0tw63XgHWzdI = X-Google-Smtp-Source: AGHT+IE7aVbNrIuCgt96qAJkc9iLnHKMxw2buRD4GcEL3PiF3LV/iUEXE6QH1zCEyXWJrc46sWk6Ww== X-Received: by 2002:a05:600c:154b:b0:420:1fab:177f with SMTP id 5b1f17b1804b1-4201fab19e5mr164087535e9.30.1716276651706; Tue, 21 May 2024 00:30:51 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:51 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 05/31] ada: Do not leak tagged type names when Discard_Names is enabled Date: Tue, 21 May 2024 09:30:08 +0200 Message-ID: <20240521073035.314024-5-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek When both pragmas Discard_Names and No_Tagged_Streams apply to a tagged type, the intended behavior is to prevent type names from leaking into object code, as documented in GNAT RM. However, while Discard_Names can be used as a configuration pragma, No_Tagged_Streams must be applied to each type separately. This patch enables the use of restriction No_Streams, which can be activated globally, instead of No_Tagged_Streams on individual types. When no tagged stream object can be created and allocated, then routines that make use of the External_Tag won't be used. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (No_Tagged_Streams): Document how to avoid exposing entity names for the entire partition. * exp_disp.adb (Make_DT): Make use of restriction No_Streams. * exp_put_image.adb (Build_Record_Put_Image_Procedure): Respect Discard_Names in the generated Put_Image procedure. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../implementation_defined_pragmas.rst | 6 ++++ gcc/ada/exp_disp.adb | 5 +-- gcc/ada/exp_put_image.adb | 34 ++++++++++++++----- gcc/ada/gnat_rm.texi | 6 ++++ 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index 0661670e047..7e4dd935342 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -4000,6 +4000,12 @@ applied to a tagged type its Expanded_Name and External_Tag are initialized with empty strings. This is useful to avoid exposing entity names at binary level but has a negative impact on the debuggability of tagged types. +Alternatively, when pragmas ``Discard_Names`` and ``Restrictions (No_Streams)`` +simultanously apply to a tagged type, its Expanded_Name and External_Tag are +also initialized with empty strings. In particular, both these pragmas can be +applied as configuration pragmas to avoid exposing entity names at binary +level for the entire parition. + Pragma Normalize_Scalars ======================== diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 601d463a8b0..66be77c9ffc 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -4600,8 +4600,9 @@ package body Exp_Disp is -- streams. Discard_Names : constant Boolean := - Present (No_Tagged_Streams_Pragma (Typ)) - and then + (Present (No_Tagged_Streams_Pragma (Typ)) + or else Restriction_Active (No_Streams)) + and then (Global_Discard_Names or else Einfo.Entities.Discard_Names (Typ)); -- The following name entries are used by Make_DT to generate a number diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index 09fbfa75eeb..94299e39661 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -44,6 +44,7 @@ with Sinfo.Nodes; use Sinfo.Nodes; with Sinfo.Utils; use Sinfo.Utils; with Snames; use Snames; with Stand; +with Stringt; use Stringt; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uintp; use Uintp; @@ -825,14 +826,31 @@ package body Exp_Put_Image is Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise)); else - Append_To (Stms, - Make_Procedure_Call_Statement (Loc, - Name => New_Occurrence_Of (RTE (RE_Put_Image_Unknown), Loc), - Parameter_Associations => New_List - (Make_Identifier (Loc, Name_S), - Make_String_Literal (Loc, - Fully_Qualified_Name_String - (Btyp, Append_NUL => False))))); + declare + Type_Name : String_Id; + begin + -- If aspect Discard_Names is enabled the intention is to + -- prevent type names from leaking into object file. Instead, + -- we emit string that is different from the ones from the + -- default implementations of the Put_Image attribute. + + if Global_Discard_Names or else Discard_Names (Typ) then + Start_String; + Store_String_Chars ("(DISCARDED TYPE NAME)"); + Type_Name := End_String; + else + Type_Name := + Fully_Qualified_Name_String (Btyp, Append_NUL => False); + end if; + + Append_To (Stms, + Make_Procedure_Call_Statement (Loc, + Name => New_Occurrence_Of (RTE (RE_Put_Image_Unknown), Loc), + Parameter_Associations => New_List + (Make_Identifier (Loc, Name_S), + Make_String_Literal (Loc, + Type_Name)))); + end; end if; elsif Is_Null_Record_Type (Btyp, Ignore_Privacy => True) then diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 4dbbb036a25..4ff1de42db2 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -5535,6 +5535,12 @@ applied to a tagged type its Expanded_Name and External_Tag are initialized with empty strings. This is useful to avoid exposing entity names at binary level but has a negative impact on the debuggability of tagged types. +Alternatively, when pragmas @code{Discard_Names} and @code{Restrictions (No_Streams)} +simultanously apply to a tagged type, its Expanded_Name and External_Tag are +also initialized with empty strings. In particular, both these pragmas can be +applied as configuration pragmas to avoid exposing entity names at binary +level for the entire parition. + @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{b0} @section Pragma Normalize_Scalars From patchwork Tue May 21 07:30:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90531 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 11E19385B50B for ; Tue, 21 May 2024 07:33:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id A4D923858C5F for ; Tue, 21 May 2024 07:30:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4D923858C5F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A4D923858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276658; cv=none; b=woEGUytnwJxD43Zv5Y6BkDzv1z1HvwrQXBvCCgbt+nhGadgucMdD87Rp9CiEDoQWsvQVWM2hit25TWTp7YnM5aepot73nmTQGisu8n1fLenCKrDAKo35sd0EU48rLw18cuhtAzoY9vhF7TkvNYtMfYrmLjWZjstqqbRQyLT2k+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276658; c=relaxed/simple; bh=sIVoCjUUmX/y4OXNT9uEewBBLOWlGAAOtIteZJYZe6g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SXdPWIvWD4iC/s62R0RBg5K6ASEaXOOtkVH+hqqMmZWsIoa9mMTUWa7p2ir2pvU/OHBAQby2GFt2oIcCF3ZmRH2S+Tyr8v//E90ShgqnhnQW605V975d0KtaANdjcAnGKunwPwgW97nV8OjZep9MQCdFW+u0DjsEOf5XQ5GzZis= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-420180b5898so27947685e9.2 for ; Tue, 21 May 2024 00:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276652; x=1716881452; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1ozR8J3ugdLEfqOIp3IldqIVVT9VGg3r9R3zkW/eiWU=; b=imHjvceZBxdXiUebz1Y6DYu7aB/C+rJCclBZv+ifLfcDrmidORYROThuF2+ohg5bVc H7tRgfPA9qbuiAk7NIqydvzz1GKZeo8avW9iJQLUOlDwsa5nr2Xv9hLNPI2RFfNPO0Wk QK/7vWLPNetCg6DC87hoPzKURY7F13KV1hEV6LIVhEMM4UZdpDyheQWYwYHbkTUd1jvn kSBqKfXuYabKPDmz2HvugCY0LQG49U1ExSrx/cp+Eiq+F23Z1zmX5Rs4qhwZR6bCBGTB hSPEWvpx+auHhmYDYOoFIn3QsxrN/MuBtC2F5BAjKkmT2E5fs1ZQzqt1cB7iTqmKcrIQ IltA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276652; x=1716881452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ozR8J3ugdLEfqOIp3IldqIVVT9VGg3r9R3zkW/eiWU=; b=ZXHOcjIcJohmvWfNF5Hih14AAjdQh4NMSb6SPHCQFJzYXmKe/RwFl0wHGm+XUjyrvj dZRuHW/a+z0xew98nfu0aLenuckvT4OL7mk+w6CSW7hWTQPKOHxYjnOW4rydHgNQ3PC4 rmr5YzPhn4qb4NSsnAGVGia8r9O08RP9OsVLjEZba9HsOw0qJJ12dmNJZn+9ALxW+S+F uOsUCI5nEFDpx0tjvyOu79ue+9gh/W/JcUJfXyTRbLDS2dHU4gtgFUXqnghYTS3rKS3x V6ouD7KxxJWzu5EE6jAm6lJ/cIx0WTLsWrLdQlFbrCZWYkXcRcPBkI4wHzjmPXXz0sml 7xfg== X-Gm-Message-State: AOJu0Yzm0lr0q9i1k3zwKpgqyePBSfwSNPhz4Jjd6Ii5wcXlgPs4hRd4 EkOXeA71iwdXUJz88q9IyCub0dfg4kdilprGG/SPNmseenZ3ocCQnkT9g79j/qpqRw2Z02aQ21c = X-Google-Smtp-Source: AGHT+IHDQwqxLH3R5yhtfGVliwcntiIzz4LA7mCuyCHvLU9dx+owyt73Yw25DB2Z69NlrXyu17BmTQ== X-Received: by 2002:a05:600c:2d53:b0:41b:dabe:8633 with SMTP id 5b1f17b1804b1-41feab40bc9mr222461685e9.21.1716276652376; Tue, 21 May 2024 00:30:52 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:52 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 06/31] ada: Update documentation of warning messages Date: Tue, 21 May 2024 09:30:09 +0200 Message-ID: <20240521073035.314024-6-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Viljar Indus Update the documentation of warning messages that only emit info messages to clearly reflect that they only emit info messages and not warning messages. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update the documentation of -gnatw.n and -gnatw.l * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../building_executable_programs_with_gnat.rst | 14 +++++++------- gcc/ada/gnat_ugn.texi | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst index 21e277d5916..2f63d02daf7 100644 --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst @@ -3415,7 +3415,7 @@ of the pragma in the :title:`GNAT_Reference_manual`). .. index:: -gnatw.l (gcc) :switch:`-gnatw.l` - *List inherited aspects.* + *List inherited aspects as info messages.* This switch causes the compiler to list inherited invariants, preconditions, and postconditions from Type_Invariant'Class, Invariant'Class, @@ -3425,7 +3425,7 @@ of the pragma in the :title:`GNAT_Reference_manual`). .. index:: -gnatw.L (gcc) :switch:`-gnatw.L` - *Suppress listing of inherited aspects.* + *Suppress listing of inherited aspects as info messages.* This switch suppresses listing of inherited aspects. @@ -3495,20 +3495,20 @@ of the pragma in the :title:`GNAT_Reference_manual`). .. index:: Atomic Synchronization, warnings :switch:`-gnatw.n` - *Activate warnings on atomic synchronization.* + *Activate info messages on atomic synchronization.* - This switch actives warnings when an access to an atomic variable + This switch activates info messages when an access to an atomic variable requires the generation of atomic synchronization code. These - warnings are off by default. + info messages are off by default. .. index:: -gnatw.N (gcc) :switch:`-gnatw.N` - *Suppress warnings on atomic synchronization.* + *Suppress info messages on atomic synchronization.* .. index:: Atomic Synchronization, warnings - This switch suppresses warnings when an access to an atomic variable + This switch suppresses info messages when an access to an atomic variable requires the generation of atomic synchronization code. diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 43251ba3f1c..2df2a780ec7 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -11646,7 +11646,7 @@ This switch suppresses warnings for possible elaboration problems. @item @code{-gnatw.l} -`List inherited aspects.' +`List inherited aspects as info messages.' This switch causes the compiler to list inherited invariants, preconditions, and postconditions from Type_Invariant’Class, Invariant’Class, @@ -11660,7 +11660,7 @@ Pre’Class, and Post’Class aspects. Also list inherited subtype predicates. @item @code{-gnatw.L} -`Suppress listing of inherited aspects.' +`Suppress listing of inherited aspects as info messages.' This switch suppresses listing of inherited aspects. @end table @@ -11755,11 +11755,11 @@ use of @code{-gnatg}. @item @code{-gnatw.n} -`Activate warnings on atomic synchronization.' +`Activate info messages on atomic synchronization.' -This switch actives warnings when an access to an atomic variable +This switch activates info messages when an access to an atomic variable requires the generation of atomic synchronization code. These -warnings are off by default. +info messages are off by default. @end table @geindex -gnatw.N (gcc) @@ -11769,12 +11769,12 @@ warnings are off by default. @item @code{-gnatw.N} -`Suppress warnings on atomic synchronization.' +`Suppress info messages on atomic synchronization.' @geindex Atomic Synchronization @geindex warnings -This switch suppresses warnings when an access to an atomic variable +This switch suppresses info messages when an access to an atomic variable requires the generation of atomic synchronization code. @end table @@ -29645,8 +29645,8 @@ to permit their use in free software. @printindex ge -@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } @anchor{d1}@w{ } +@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } @c %**end of body @bye From patchwork Tue May 21 07:30:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90527 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7DF8385E83A for ; Tue, 21 May 2024 07:31:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 3FF383858D39 for ; Tue, 21 May 2024 07:30:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FF383858D39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FF383858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276658; cv=none; b=UFYlUCB9LmkDXRawvNYfL24ZKgj6xWFGJXnVIVy134uo1aqjalJ005kxwyC589hQTQzhiAe6B2BwvrorKLERB/EXgvCwDjQ3F1OH1pZhR28hVZRIoWywRM9kwH2i8bVpzXKftMBCaNeKy5UFooeS57jASmXxHq9e1LO88l4GQsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276658; c=relaxed/simple; bh=bINDhsjuoyFMaSugsYPQoPBm8lClIJGV9dUPnceZer8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=n+y5M+C9h5O8J7E0xf3TlTn+1TUix0ZXMcKBJl75cz7Pr7ar4prMn2uHuWGkV2hmkww1vgmd1NvKUZ58vpad+35b6JVIkRRFASPVtOwSic1Xsdo5SY2t/gy8/CneRlgirFp/oIWx0h1Tjy7J6TG8O2AMhxYvod31gsX1y9GruQA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4202959b060so27423345e9.2 for ; Tue, 21 May 2024 00:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276653; x=1716881453; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1YX5i28A+MN8pGN6LUWjcSTCziCmWZ+GVha0OEuOjXw=; b=lqA+cgBlRgpPxUQnuKN5+IbdVgDHfTDq93+kZkV9eQpEiJpYBt4ebzAQCMZBprFHc1 jdwEgVPjMYaKSHiTYmCQBHNA1LywkX14FisBfs8bpaYRRw2EYApts5JIxOWgMZFt7t9P QbzhJQS1z/pE2mRLJou2FBLq3sc9iO/Ey/RLf+uD3fwlLNJhUIcBsXA/EK4YA7pdDK93 hIx9M+Im1kyYLvFpI9L180gxer4CW9rDoYa3eL8tUn/X3PCFt0eWMe1lAdTLbknB8zH9 JsO7nFVC0zg9C2+2go2SJHPkliSRo16H2JUWespzXTA//Kdsm3JQVmvrwfMPU3Jt+mFY PyMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276653; x=1716881453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1YX5i28A+MN8pGN6LUWjcSTCziCmWZ+GVha0OEuOjXw=; b=t4HRobZJZLgdVo7918wNxuxD5FWltFRRqRkms9z/ibU71RsXVa1dpxQbq/GIXEqwcq bOa7gOWriCuHGHN/Pou1+mMhgTy5mZuxmsVbL0Sz9Bl50ZBG3K5QAsAKk9HchJFtbdQ/ FeXCVUBShWhCYSFC7w8XB0bD4dYdfsc9mPQov5bLWS7lw6r9hVxJgaOcUDvKEMa9tCIC BeHHB4quq4nC41enK0MExF3WwsXrolfEUR3em4ypGikn2qSxyE5+HEDfoLP9wwJGZppu ovPmD7oYlJMhQjZy2m1Ve0aDm78B00Dis1pqGGNLonzYXxbYwR5Uz+EfvS7UzeHItRp5 R4fg== X-Gm-Message-State: AOJu0Yxp8osZHumYQowD0ajah69Il+TgcuXuciWxuKe/fvGFYbfe9owb xUJ36Wdkfore+szcYYbtWTfxxkQRVt4NCcsaldnTGhD4ij0vid+1WkqXUzsf0dlN+rKDWeoNmAI = X-Google-Smtp-Source: AGHT+IG+UmVg8w59reDQnOmFK3YIV1A3G8Z2ZIgpGOuoxitxWqaPP9OqG88sZ2ihkkfozigMNW9zpQ== X-Received: by 2002:a05:600c:45cc:b0:41f:f592:2fa3 with SMTP id 5b1f17b1804b1-41ff5922fb3mr207225535e9.11.1716276653119; Tue, 21 May 2024 00:30:53 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:52 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 07/31] ada: Fix index entry for an implemented AI feature Date: Tue, 21 May 2024 09:30:10 +0200 Message-ID: <20240521073035.314024-7-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Fix inconsistent reference with "05" in the name of AI. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst (AI-0216): Fix index reference. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst | 2 +- gcc/ada/gnat_rm.texi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst index 2825362c616..d7f1fea01f3 100644 --- a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst +++ b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst @@ -1243,7 +1243,7 @@ Supported Aspect Source RM References: B.01 (17) B.03 (62) B.03 (71.1/2) -.. index:: AI05-0216 (Ada 2012 feature) +.. index:: AI-0216 (Ada 2012 feature) * *AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)* diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 4ff1de42db2..0d38b1a4bc6 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -28603,7 +28603,7 @@ non-portable. RM References: B.01 (17) B.03 (62) B.03 (71.1/2) @end itemize -@geindex AI05-0216 (Ada 2012 feature) +@geindex AI-0216 (Ada 2012 feature) @itemize * From patchwork Tue May 21 07:30:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90534 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 361AC3858420 for ; Tue, 21 May 2024 07:35:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 8F35E3858408 for ; Tue, 21 May 2024 07:30:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F35E3858408 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F35E3858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276666; cv=none; b=eELY1DTnRyFWro6Jy1dJ+870TzR2AyhmErpS1Oz3urbrqj8nZSFi3HVT5CFkJVPOVmTL2dfk1CAWCFvBuIjp1sdzpvIvn9hqYBpIqfe9cymkZ1Vbd2gPJi3RXorX+BAPRA2/T2XE4fZX4LdEL3WqYZiPbh1pErDoZkEP+hMKdQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276666; c=relaxed/simple; bh=6CD9f3Blr/HkS5olootmhClPZm+2qddIEkSJySyyUf0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ohhfsgQUBbhBNFjt4MSheacPkXdcosxF7nvrM7kYW23rk4sKyUuHEOguhH/qGEA1kanzhgMsuNPYVpsCz9puwwASRkYKR/oijNNFrMrC9PJqGc0xo5GIXMshY1Q474iSW/s7QH6AG9hfShHu/pVK0rZxft+ItidgCagUmgQ+X7Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42017f8de7aso28192655e9.1 for ; Tue, 21 May 2024 00:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276657; x=1716881457; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oudlWap1ycevCvW5gn5enm7bK86FboPa2BimKCRSqeU=; b=EGqNwzNmFiXPiAQeDuDG4bZXb9Py6bNmuZtUp3HLjnM5zepI3jTeM9bteQlV+/pq5u 0VIhaV84CxaaYyeMTYgPxxD4fdjecunFc6hQxm8VdzJHCpJt4CEA3vV+Bqqp+iwlpGU7 alWfpa1rSyqGYUrtNOAfHkqeQMG7qB9pGvJMU5j7HrYHcsdQR2Alj9CYPogd/8LDKA+/ F6H5/Y7nlu6ML3gY9RhjC0A6pdSlo+JiswDTasCdNScZX5H90BLrSRTX4xujqipI1YqD gi7FSRqhPFTGvog7IM3QoYTrZrNF62TNmbGFuieaJ8d4+69ZNuPp785skhSIKWeG5q5k yLCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276657; x=1716881457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oudlWap1ycevCvW5gn5enm7bK86FboPa2BimKCRSqeU=; b=ddJnKJgSbp5ZJ2nlpdYuQwtX/lIJ/uXEBthjxuPmBdr3PLWM4kiLuJ+RaXH7cEq62h i+kBizT9BNsFvgb9pNG3tkcV+GGYREYgTM5KfAdPtt9TL4K3eY2YUn3lcTvllc4RmJxe IWYabIyOHRhdjgWMBVSN42CMo0Mwr9aHTpKyJuefVp/lW/kyGA/nnauQhXjf+BnVu0Aw 6RzN912FoYQhuSaxBjxojjkTp9PNaQMrxIp4Zhw9mUik0wQ6yFCEf8RzRnNfhg9X96wt DVawbPdD05OZuV713wh7L81c1VG4W00Fu5LcQqXfg8xGW7IySDES2dvU9s6FhiK/axuG PwXA== X-Gm-Message-State: AOJu0YztqnNqJwsQtm9dvKudQEKUXLWUF0XNugwZu26NFdpw5y7sEAlB bMgvsMkgMO8teCcNJGgi7cyBIF5IZk+VburXHT7aYMu4yKUCd3GZhAoV8Ojj0CuEugxS6foXDXk = X-Google-Smtp-Source: AGHT+IFcsvkMdZ22jhj3lUD5VtCh+aMdtO0ubLR8ARarxnT2sf8gA/uMgvdQlhitz4az4HA1pQxZCA== X-Received: by 2002:a05:600c:3b97:b0:418:5ed2:5aa6 with SMTP id 5b1f17b1804b1-41feac63341mr277844855e9.31.1716276654208; Tue, 21 May 2024 00:30:54 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:53 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 08/31] ada: Sort list of implemented Ada 2012 features Date: Tue, 21 May 2024 09:30:11 +0200 Message-ID: <20240521073035.314024-8-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek The list of implemented Ada 2012 features is now ordered by the AI numbers. It has been sorted mechanically using the csplit command with a bit of shell scripting. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst: Order list by AI number. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../implementation_of_ada_2012_features.rst | 1658 ++++++------- gcc/ada/gnat_rm.texi | 2054 ++++++++--------- 2 files changed, 1856 insertions(+), 1856 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst index d7f1fea01f3..706de492301 100644 --- a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst +++ b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst @@ -43,330 +43,343 @@ in the RM, the earliest is used. A complete description of the AIs may be found in http://www.ada-auth.org/ai05-summary.html. -.. index:: AI-0176 (Ada 2012 feature) +.. index:: AI-0002 (Ada 2012 feature) -* *AI-0176 Quantified expressions (2010-09-29)* +* *AI-0002 Export C with unconstrained arrays (0000-00-00)* - Both universally and existentially quantified expressions are implemented. - They use the new syntax for iterators proposed in AI05-139-2, as well as - the standard Ada loop syntax. + The compiler is not required to support exporting an Ada subprogram with + convention C if there are parameters or a return type of an unconstrained + array type (such as ``String``). GNAT allows such declarations but + generates warnings. It is possible, but complicated, to write the + corresponding C code and certainly such code would be specific to GNAT and + non-portable. - RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0) + RM References: B.01 (17) B.03 (62) B.03 (71.1/2) -.. index:: AI-0079 (Ada 2012 feature) +.. index:: AI-0003 (Ada 2012 feature) -* *AI-0079 Allow other_format characters in source (2010-07-10)* +* *AI-0003 Qualified expressions as names (2010-07-11)* - Wide characters in the unicode category *other_format* are now allowed in - source programs between tokens, but not within a token such as an identifier. + In Ada 2012, a qualified expression is considered to be syntactically a name, + meaning that constructs such as ``A'(F(X)).B`` are now legal. This is + useful in disambiguating some cases of overloading. - RM References: 2.01 (4/2) 2.02 (7) + RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3) + 5.04 (7) -.. index:: AI-0091 (Ada 2012 feature) +.. index:: AI-0007 (Ada 2012 feature) -* *AI-0091 Do not allow other_format in identifiers (0000-00-00)* +* *AI-0007 Stream read and private scalar types (0000-00-00)* - Wide characters in the unicode category *other_format* are not permitted - within an identifier, since this can be a security problem. The error - message for this case has been improved to be more specific, but GNAT has - never allowed such characters to appear in identifiers. + The RM as written appeared to limit the possibilities of declaring read + attribute procedures for private scalar types. This limitation was not + intended, and has never been enforced by GNAT. - RM References: 2.03 (3.1/2) 2.03 (4/2) 2.03 (5/2) 2.03 (5.1/2) 2.03 (5.2/2) 2.03 (5.3/2) 2.09 (2/2) + RM References: 13.13.02 (50/2) 13.13.02 (51/2) -.. index:: AI-0100 (Ada 2012 feature) +.. index:: AI-0008 (Ada 2012 feature) -* *AI-0100 Placement of pragmas (2010-07-01)* +* *AI-0008 General access to constrained objects (0000-00-00)* - This AI is an earlier version of AI-163. It simplifies the rules - for legal placement of pragmas. In the case of lists that allow pragmas, if - the list may have no elements, then the list may consist solely of pragmas. + The wording in the RM implied that if you have a general access to a + constrained object, it could be used to modify the discriminants. This was + obviously not intended. ``Constraint_Error`` should be raised, and GNAT + has always done so in this situation. - RM References: 2.08 (7) + RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2) -.. index:: AI-0163 (Ada 2012 feature) +.. index:: AI-0009 (Ada 2012 feature) -* *AI-0163 Pragmas in place of null (2010-07-01)* +* *AI-0009 Pragma Independent[_Components] (2010-07-23)* - A statement sequence may be composed entirely of pragmas. It is no longer - necessary to add a dummy ``null`` statement to make the sequence legal. + This AI introduces the new pragmas ``Independent`` and + ``Independent_Components``, + which control guaranteeing independence of access to objects and components. + The AI also requires independence not unaffected by confirming rep clauses. - RM References: 2.08 (7) 2.08 (16) + RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2) + C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14) -.. index:: AI-0080 (Ada 2012 feature) +.. index:: AI-0012 (Ada 2012 feature) -* *AI-0080 'View of' not needed if clear from context (0000-00-00)* +* *AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)* - This is an editorial change only, described as non-testable in the AI. + It is now illegal to give an inappropriate component size or a pragma + ``Pack`` that attempts to change the component size in the case of atomic + or aliased components. Previously GNAT ignored such an attempt with a + warning. - RM References: 3.01 (7) + RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21) -.. index:: AI-0183 (Ada 2012 feature) +.. index:: AI-0015 (Ada 2012 feature) -* *AI-0183 Aspect specifications (2010-08-16)* +* *AI-0015 Constant return objects (0000-00-00)* - Aspect specifications have been fully implemented except for pre and post- - conditions, and type invariants, which have their own separate AI's. All - forms of declarations listed in the AI are supported. The following is a - list of the aspects supported (with GNAT implementation aspects marked) + The return object declared in an *extended_return_statement* may be + declared constant. This was always intended, and GNAT has always allowed it. -==================================== =========== -Supported Aspect Source -==================================== =========== - ``Ada_2005`` -- GNAT - ``Ada_2012`` -- GNAT - ``Address`` - ``Alignment`` - ``Atomic`` - ``Atomic_Components`` - ``Bit_Order`` - ``Component_Size`` - ``Contract_Cases`` -- GNAT - ``Discard_Names`` - ``External_Tag`` - ``Favor_Top_Level`` -- GNAT - ``Inline`` - ``Inline_Always`` -- GNAT - ``Invariant`` -- GNAT - ``Machine_Radix`` - ``No_Return`` - ``Object_Size`` -- GNAT - ``Pack`` - ``Persistent_BSS`` -- GNAT - ``Post`` - ``Pre`` - ``Predicate`` - ``Preelaborable_Initialization`` - ``Pure_Function`` -- GNAT - ``Remote_Access_Type`` -- GNAT - ``Shared`` -- GNAT - ``Size`` - ``Storage_Pool`` - ``Storage_Size`` - ``Stream_Size`` - ``Suppress`` - ``Suppress_Debug_Info`` -- GNAT - ``Test_Case`` -- GNAT - ``Thread_Local_Storage`` -- GNAT - ``Type_Invariant`` - ``Unchecked_Union`` - ``Universal_Aliasing`` -- GNAT - ``Unmodified`` -- GNAT - ``Unreferenced`` -- GNAT - ``Unreferenced_Objects`` -- GNAT - ``Unsuppress`` - ``Value_Size`` -- GNAT - ``Volatile`` - ``Volatile_Components`` - ``Warnings`` -- GNAT -==================================== =========== + RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2) + 6.05 (5.7/2) - Note that for aspects with an expression, e.g. ``Size``, the expression is - treated like a default expression (visibility is analyzed at the point of - occurrence of the aspect, but evaluation of the expression occurs at the - freeze point of the entity involved). +.. index:: AI-0017 (Ada 2012 feature) - RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6) - 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03 - (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2) - 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2) - 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1) - 13.03.01 (0) +* *AI-0017 Freezing and incomplete types (0000-00-00)* -.. index:: AI-0128 (Ada 2012 feature) + So-called 'Taft-amendment types' (i.e., types that are completed in package + bodies) are not frozen by the occurrence of bodies in the + enclosing declarative part. GNAT always implemented this properly. -* *AI-0128 Inequality is a primitive operation (0000-00-00)* + RM References: 13.14 (3/1) - If an equality operator ("=") is declared for a type, then the implicitly - declared inequality operator ("/=") is a primitive operation of the type. - This is the only reasonable interpretation, and is the one always implemented - by GNAT, but the RM was not entirely clear in making this point. +.. index:: AI-0019 (Ada 2012 feature) - RM References: 3.02.03 (6) 6.06 (6) +* *AI-0019 Freezing of primitives for tagged types (0000-00-00)* -.. index:: AI-0003 (Ada 2012 feature) + The RM suggests that primitive subprograms of a specific tagged type are + frozen when the tagged type is frozen. This would be an incompatible change + and is not intended. GNAT has never attempted this kind of freezing and its + behavior is consistent with the recommendation of this AI. -* *AI-0003 Qualified expressions as names (2010-07-11)* + RM References: 13.14 (2) 13.14 (3/1) 13.14 (8.1/1) 13.14 (10) 13.14 (14) 13.14 (15.1/2) - In Ada 2012, a qualified expression is considered to be syntactically a name, - meaning that constructs such as ``A'(F(X)).B`` are now legal. This is - useful in disambiguating some cases of overloading. +.. index:: AI-0026 (Ada 2012 feature) - RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3) - 5.04 (7) +* *AI-0026 Missing rules for Unchecked_Union (2010-07-07)* -.. index:: AI-0120 (Ada 2012 feature) + Record representation clauses concerning Unchecked_Union types cannot mention + the discriminant of the type. The type of a component declared in the variant + part of an Unchecked_Union cannot be controlled, have controlled components, + nor have protected or task parts. If an Unchecked_Union type is declared + within the body of a generic unit or its descendants, then the type of a + component declared in the variant part cannot be a formal private type or a + formal private extension declared within the same generic unit. -* *AI-0120 Constant instance of protected object (0000-00-00)* + RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2) - This is an RM editorial change only. The section that lists objects that are - constant failed to include the current instance of a protected object - within a protected function. This has always been treated as a constant - in GNAT. +.. index:: AI-0030 (Ada 2012 feature) - RM References: 3.03 (21) +* *AI-0030 Requeue on synchronized interfaces (2010-07-19)* -.. index:: AI-0008 (Ada 2012 feature) + Requeue is permitted to a protected, synchronized or task interface primitive + providing it is known that the overriding operation is an entry. Otherwise + the requeue statement has the same effect as a procedure call. Use of pragma + ``Implemented`` provides a way to impose a static requirement on the + overriding operation by adhering to one of the implementation kinds: entry, + protected procedure or any of the above. -* *AI-0008 General access to constrained objects (0000-00-00)* + RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5) + 9.05.04 (6) 9.05.04 (7) 9.05.04 (12) - The wording in the RM implied that if you have a general access to a - constrained object, it could be used to modify the discriminants. This was - obviously not intended. ``Constraint_Error`` should be raised, and GNAT - has always done so in this situation. +.. index:: AI-0031 (Ada 2012 feature) - RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2) +* *AI-0031 Add From parameter to Find_Token (2010-07-25)* -.. index:: AI-0093 (Ada 2012 feature) + A new version of ``Find_Token`` is added to all relevant string packages, + with an extra parameter ``From``. Instead of starting at the first + character of the string, the search for a matching Token starts at the + character indexed by the value of ``From``. + These procedures are available in all versions of Ada + but if used in versions earlier than Ada 2012 they will generate a warning + that an Ada 2012 subprogram is being used. -* *AI-0093 Additional rules use immutably limited (0000-00-00)* + RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51) + A.04.05 (46) - This is an editorial change only, to make more widespread use of the Ada 2012 - 'immutably limited'. +.. index:: AI-0032 (Ada 2012 feature) - RM References: 3.03 (23.4/3) +* *AI-0032 Extended return for class-wide functions (0000-00-00)* -.. index:: AI-0096 (Ada 2012 feature) + If a function returns a class-wide type, the object of an extended return + statement can be declared with a specific type that is covered by the class- + wide type. This has been implemented in GNAT since the introduction of + extended returns. Note AI-0103 complements this AI by imposing matching + rules for constrained return types. -* *AI-0096 Deriving from formal private types (2010-07-20)* + RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2) + 6.05 (8/2) - In general it is illegal for a type derived from a formal limited type to be - nonlimited. This AI makes an exception to this rule: derivation is legal - if it appears in the private part of the generic, and the formal type is not - tagged. If the type is tagged, the legality check must be applied to the - private part of the package. +.. index:: AI-0033 (Ada 2012 feature) - RM References: 3.04 (5.1/2) 6.02 (7) +* *AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)* -.. index:: AI-0181 (Ada 2012 feature) + Neither of these two pragmas may appear within a generic template, because + the generic might be instantiated at other than the library level. -* *AI-0181 Soft hyphen is a non-graphic character (2010-07-23)* + RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2) - From Ada 2005 on, soft hyphen is considered a non-graphic character, which - means that it has a special name (``SOFT_HYPHEN``) in conjunction with the - ``Image`` and ``Value`` attributes for the character types. Strictly - speaking this is an inconsistency with Ada 95, but in practice the use of - these attributes is so obscure that it will not cause problems. +.. index:: AI-0034 (Ada 2012 feature) - RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21) +* *AI-0034 Categorization of limited views (0000-00-00)* -.. index:: AI-0182 (Ada 2012 feature) + The RM makes certain limited with clauses illegal because of categorization + considerations, when the corresponding normal with would be legal. This is + not intended, and GNAT has always implemented the recommended behavior. -* *AI-0182 Additional forms for* ``Character'Value`` *(0000-00-00)* + RM References: 10.02.01 (11/1) 10.02.01 (17/2) - This AI allows ``Character'Value`` to accept the string ``'?'`` where - ``?`` is any character including non-graphic control characters. GNAT has - always accepted such strings. It also allows strings such as - ``HEX_00000041`` to be accepted, but GNAT does not take advantage of this - permission and raises ``Constraint_Error``, as is certainly still - permitted. +.. index:: AI-0035 (Ada 2012 feature) - RM References: 3.05 (56/2) +* *AI-0035 Inconsistencies with Pure units (0000-00-00)* -.. index:: AI-0214 (Ada 2012 feature) + This AI remedies some inconsistencies in the legality rules for Pure units. + Derived access types are legal in a pure unit (on the assumption that the + rule for a zero storage pool size has been enforced on the ancestor type). + The rules are enforced in generic instances and in subunits. GNAT has always + implemented the recommended behavior. -* *AI-0214 Defaulted discriminants for limited tagged (2010-10-01)* + RM References: 10.02.01 (15.1/2) 10.02.01 (15.4/2) 10.02.01 (15.5/2) 10.02.01 (17/2) - Ada 2012 relaxes the restriction that forbids discriminants of tagged types - to have default expressions by allowing them when the type is limited. It - is often useful to define a default value for a discriminant even though - it can't be changed by assignment. +.. index:: AI-0037 (Ada 2012 feature) - RM References: 3.07 (9.1/2) 3.07.02 (3) +* *AI-0037 Out-of-range box associations in aggregate (0000-00-00)* -.. index:: AI-0102 (Ada 2012 feature) + This AI confirms that an association of the form ``Indx => <>`` in an + array aggregate must raise ``Constraint_Error`` if ``Indx`` + is out of range. The RM specified a range check on other associations, but + not when the value of the association was defaulted. GNAT has always inserted + a constraint check on the index value. -* *AI-0102 Some implicit conversions are illegal (0000-00-00)* + RM References: 4.03.03 (29) - It is illegal to assign an anonymous access constant to an anonymous access - variable. The RM did not have a clear rule to prevent this, but GNAT has - always generated an error for this usage. +.. index:: AI-0038 (Ada 2012 feature) - RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2) +* *AI-0038 Minor errors in Text_IO (0000-00-00)* -.. index:: AI-0158 (Ada 2012 feature) + These are minor errors in the description on three points. The intent on + all these points has always been clear, and GNAT has always implemented the + correct intended semantics. -* *AI-0158 Generalizing membership tests (2010-09-16)* + RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.10.08 (10) A.10.08 (24) - This AI extends the syntax of membership tests to simplify complex conditions - that can be expressed as membership in a subset of values of any type. It - introduces syntax for a list of expressions that may be used in loop contexts - as well. +.. index:: AI-0039 (Ada 2012 feature) - RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27) +* *AI-0039 Stream attributes cannot be dynamic (0000-00-00)* -.. index:: AI-0173 (Ada 2012 feature) + The RM permitted the use of dynamic expressions (such as ``ptr.all``)` + for stream attributes, but these were never useful and are now illegal. GNAT + has always regarded such expressions as illegal. -* *AI-0173 Testing if tags represent abstract types (2010-07-03)* + RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2) - The function ``Ada.Tags.Type_Is_Abstract`` returns ``True`` if invoked - with the tag of an abstract type, and ``False`` otherwise. +.. index:: AI-0040 (Ada 2012 feature) + +* *AI-0040 Limited with clauses on descendant (0000-00-00)* + + This AI confirms that a limited with clause in a child unit cannot name + an ancestor of the unit. This has always been checked in GNAT. + + RM References: 10.01.02 (20/2) + +.. index:: AI-0042 (Ada 2012 feature) + +* *AI-0042 Overriding versus implemented-by (0000-00-00)* + + This AI fixes a wording gap in the RM. An operation of a synchronized + interface can be implemented by a protected or task entry, but the abstract + operation is not being overridden in the usual sense, and it must be stated + separately that this implementation is legal. This has always been the case + in GNAT. + + RM References: 9.01 (9.2/2) 9.04 (11.1/2) + +.. index:: AI-0043 (Ada 2012 feature) + +* *AI-0043 Rules about raising exceptions (0000-00-00)* + + This AI covers various omissions in the RM regarding the raising of + exceptions. GNAT has always implemented the intended semantics. + + RM References: 11.04.01 (10.1/2) 11 (2) + +.. index:: AI-0044 (Ada 2012 feature) + +* *AI-0044 Restrictions on container instantiations (0000-00-00)* + + This AI places restrictions on allowed instantiations of generic containers. + These restrictions are not checked by the compiler, so there is nothing to + change in the implementation. This affects only the RM documentation. + + RM References: A.18 (4/2) A.18.02 (231/2) A.18.03 (145/2) A.18.06 (56/2) A.18.08 (66/2) A.18.09 (79/2) A.18.26 (5/2) A.18.26 (9/2) + +.. index:: AI-0046 (Ada 2012 feature) + +* *AI-0046 Null exclusion match for full conformance (2010-07-17)* + + For full conformance, in the case of access parameters, the null exclusion + must match (either both or neither must have ``not null``). + + RM References: 6.03.02 (18) + +.. index:: AI-0050 (Ada 2012 feature) + +* *AI-0050 Raising Constraint_Error early for function call (0000-00-00)* + + The implementation permissions for raising ``Constraint_Error`` early on a function call + when it was clear an exception would be raised were over-permissive and allowed + mishandling of discriminants in some cases. GNAT did + not take advantage of these incorrect permissions in any case. - RM References: 3.09 (7.4/2) 3.09 (12.4/2) + RM References: 6.05 (24/2) -.. index:: AI-0076 (Ada 2012 feature) +.. index:: AI-0056 (Ada 2012 feature) -* *AI-0076 function with controlling result (0000-00-00)* +* *AI-0056 Index on null string returns zero (0000-00-00)* - This is an editorial change only. The RM defines calls with controlling - results, but uses the term 'function with controlling result' without an - explicit definition. + The wording in the Ada 2005 RM implied an incompatible handling of the + ``Index`` functions, resulting in raising an exception instead of + returning zero in some situations. + This was not intended and has been corrected. + GNAT always returned zero, and is thus consistent with this AI. - RM References: 3.09.02 (2/2) + RM References: A.04.03 (56.2/2) A.04.03 (58.5/2) -.. index:: AI-0126 (Ada 2012 feature) +.. index:: AI-0058 (Ada 2012 feature) -* *AI-0126 Dispatching with no declared operation (0000-00-00)* +* *AI-0058 Abnormal completion of an extended return (0000-00-00)* - This AI clarifies dispatching rules, and simply confirms that dispatching - executes the operation of the parent type when there is no explicitly or - implicitly declared operation for the descendant type. This has always been - the case in all versions of GNAT. + The RM had some incorrect wording implying wrong treatment of abnormal + completion in an extended return. GNAT has always implemented the intended + correct semantics as described by this AI. - RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2) + RM References: 6.05 (22/2) -.. index:: AI-0097 (Ada 2012 feature) +.. index:: AI-0060 (Ada 2012 feature) -* *AI-0097 Treatment of abstract null extension (2010-07-19)* +* *AI-0060 Extended definition of remote access types (0000-00-00)* - The RM as written implied that in some cases it was possible to create an - object of an abstract type, by having an abstract extension inherit a non- - abstract constructor from its parent type. This mistake has been corrected - in GNAT and in the RM, and this construct is now illegal. + This AI extends the definition of remote access types to include access + to limited, synchronized, protected or task class-wide interface types. + GNAT already implemented this extension. - RM References: 3.09.03 (4/2) + RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18) -.. index:: AI-0203 (Ada 2012 feature) +.. index:: AI-0062 (Ada 2012 feature) -* *AI-0203 Extended return cannot be abstract (0000-00-00)* +* *AI-0062 Null exclusions and deferred constants (0000-00-00)* - A return_subtype_indication cannot denote an abstract subtype. GNAT has never - permitted such usage. + A full constant may have a null exclusion even if its associated deferred + constant does not. GNAT has always allowed this. - RM References: 3.09.03 (8/3) + RM References: 7.04 (6/2) 7.04 (7.1/2) -.. index:: AI-0198 (Ada 2012 feature) +.. index:: AI-0064 (Ada 2012 feature) -* *AI-0198 Inheriting abstract operators (0000-00-00)* +* *AI-0064 Redundant finalization rule (0000-00-00)* - This AI resolves a conflict between two rules involving inherited abstract - operations and predefined operators. If a derived numeric type inherits - an abstract operator, it overrides the predefined one. This interpretation - was always the one implemented in GNAT. + This is an editorial change only. The intended behavior is already checked + by an existing ACATS test, which GNAT has always executed correctly. - RM References: 3.09.03 (4/3) + RM References: 7.06.01 (17.1/1) -.. index:: AI-0073 (Ada 2012 feature) +.. index:: AI-0065 (Ada 2012 feature) -* *AI-0073 Functions returning abstract types (2010-07-10)* +* *AI-0065 Remote access types and external streaming (0000-00-00)* - This AI covers a number of issues regarding returning abstract types. In - particular generic functions cannot have abstract result types or access - result types designated an abstract type. There are some other cases which - are detailed in the AI. Note that this binding interpretation has not been - retrofitted to operate before Ada 2012 mode, since it caused a significant - number of regressions. + This AI clarifies the fact that all remote access types support external + streaming. This fixes an obvious oversight in the definition of the + language, and GNAT always implemented the intended correct rules. - RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2) + RM References: 13.13.02 (52/2) .. index:: AI-0070 (Ada 2012 feature) @@ -377,107 +390,87 @@ Supported Aspect Source RM References: 3.09.04 (18/2) -.. index:: AI-0208 (Ada 2012 feature) - -* *AI-0208 Characteristics of incomplete views (0000-00-00)* - - The wording in the Ada 2005 RM concerning characteristics of incomplete views - was incorrect and implied that some programs intended to be legal were now - illegal. GNAT had never considered such programs illegal, so it has always - implemented the intent of this AI. - - RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2) - -.. index:: AI-0162 (Ada 2012 feature) +.. index:: AI-0072 (Ada 2012 feature) -* *AI-0162 Incomplete type completed by partial view (2010-09-15)* +* *AI-0072 Task signalling using 'Terminated (0000-00-00)* - Incomplete types are made more useful by allowing them to be completed by - private types and private extensions. + This AI clarifies that task signalling for reading ``'Terminated`` only + occurs if the result is True. GNAT semantics has always been consistent with + this notion of task signalling. - RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2) + RM References: 9.10 (6.1/1) -.. index:: AI-0098 (Ada 2012 feature) +.. index:: AI-0073 (Ada 2012 feature) -* *AI-0098 Anonymous subprogram access restrictions (0000-00-00)* +* *AI-0073 Functions returning abstract types (2010-07-10)* - An unintentional omission in the RM implied some inconsistent restrictions on - the use of anonymous access to subprogram values. These restrictions were not - intentional, and have never been enforced by GNAT. + This AI covers a number of issues regarding returning abstract types. In + particular generic functions cannot have abstract result types or access + result types designated an abstract type. There are some other cases which + are detailed in the AI. Note that this binding interpretation has not been + retrofitted to operate before Ada 2012 mode, since it caused a significant + number of regressions. - RM References: 3.10.01 (6) 3.10.01 (9.2/2) + RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2) -.. index:: AI-0199 (Ada 2012 feature) +.. index:: AI-0076 (Ada 2012 feature) -* *AI-0199 Aggregate with anonymous access components (2010-07-14)* +* *AI-0076 function with controlling result (0000-00-00)* - A choice list in a record aggregate can include several components of - (distinct) anonymous access types as long as they have matching designated - subtypes. + This is an editorial change only. The RM defines calls with controlling + results, but uses the term 'function with controlling result' without an + explicit definition. - RM References: 4.03.01 (16) + RM References: 3.09.02 (2/2) -.. index:: AI-0220 (Ada 2012 feature) +.. index:: AI-0077 (Ada 2012 feature) -* *AI-0220 Needed components for aggregates (0000-00-00)* +* *AI-0077 Limited withs and scope of declarations (0000-00-00)* - This AI addresses a wording problem in the RM that appears to permit some - complex cases of aggregates with nonstatic discriminants. GNAT has always - implemented the intended semantics. + This AI clarifies that a declaration does not include a context clause, + and confirms that it is illegal to have a context in which both a limited + and a nonlimited view of a package are accessible. Such double visibility + was always rejected by GNAT. - RM References: 4.03.01 (17) + RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2) -.. index:: AI-0147 (Ada 2012 feature) +.. index:: AI-0078 (Ada 2012 feature) -* *AI-0147 Conditional expressions (2009-03-29)* +* *AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)* - Conditional expressions are permitted. The form of such an expression is: + In Ada 2012, compilers are required to support unchecked conversion where the + target alignment is a multiple of the source alignment. GNAT always supported + this case (and indeed all cases of differing alignments, doing copies where + required if the alignment was reduced). - :: + RM References: 13.09 (7) - (if expr then expr {elsif expr then expr} [else expr]) +.. index:: AI-0079 (Ada 2012 feature) - The parentheses can be omitted in contexts where parentheses are present - anyway, such as subprogram arguments and pragma arguments. If the **else** - clause is omitted, **else** *True* is assumed; - thus ``(if A then B)`` is a way to conveniently represent - *(A implies B)* in standard logic. +* *AI-0079 Allow other_format characters in source (2010-07-10)* - RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2) - 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2) + Wide characters in the unicode category *other_format* are now allowed in + source programs between tokens, but not within a token such as an identifier. -.. index:: AI-0037 (Ada 2012 feature) + RM References: 2.01 (4/2) 2.02 (7) -* *AI-0037 Out-of-range box associations in aggregate (0000-00-00)* +.. index:: AI-0080 (Ada 2012 feature) - This AI confirms that an association of the form ``Indx => <>`` in an - array aggregate must raise ``Constraint_Error`` if ``Indx`` - is out of range. The RM specified a range check on other associations, but - not when the value of the association was defaulted. GNAT has always inserted - a constraint check on the index value. +* *AI-0080 'View of' not needed if clear from context (0000-00-00)* - RM References: 4.03.03 (29) + This is an editorial change only, described as non-testable in the AI. -.. index:: AI-0123 (Ada 2012 feature) + RM References: 3.01 (7) -* *AI-0123 Composability of equality (2010-04-13)* +.. index:: AI-0087 (Ada 2012 feature) - Equality of untagged record composes, so that the predefined equality for a - composite type that includes a component of some untagged record type - ``R`` uses the equality operation of ``R`` (which may be user-defined - or predefined). This makes the behavior of untagged records identical to that - of tagged types in this respect. +* *AI-0087 Actual for formal nonlimited derived type (2010-07-15)* - This change is an incompatibility with previous versions of Ada, but it - corrects a non-uniformity that was often a source of confusion. Analysis of - a large number of industrial programs indicates that in those rare cases - where a composite type had an untagged record component with a user-defined - equality, either there was no use of the composite equality, or else the code - expected the same composability as for tagged types, and thus had a bug that - would be fixed by this change. + The actual for a formal nonlimited derived type cannot be limited. In + particular, a formal derived type that extends a limited interface but which + is not explicitly limited cannot be instantiated with a limited type. - RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24) - 8.05.04 (8) + RM References: 7.05 (5/2) 12.05.01 (5.1/2) .. index:: AI-0088 (Ada 2012 feature) @@ -491,128 +484,100 @@ Supported Aspect Source RM References: 4.05.06 (11) -.. index:: AI-0188 (Ada 2012 feature) - -* *AI-0188 Case expressions (2010-01-09)* - - Case expressions are permitted. This allows use of constructs such as: - - .. code-block:: ada - - X := (case Y is when 1 => 2, when 2 => 3, when others => 31) - - RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33) - -.. index:: AI-0104 (Ada 2012 feature) - -* *AI-0104 Null exclusion and uninitialized allocator (2010-07-15)* - - The assignment ``Ptr := new not null Some_Ptr;`` will raise - ``Constraint_Error`` because the default value of the allocated object is - **null**. This useless construct is illegal in Ada 2012. - - RM References: 4.08 (2) - -.. index:: AI-0157 (Ada 2012 feature) - -* *AI-0157 Allocation/Deallocation from empty pool (2010-07-11)* - - Allocation and Deallocation from an empty storage pool (i.e. allocation or - deallocation of a pointer for which a static storage size clause of zero - has been given) is now illegal and is detected as such. GNAT - previously gave a warning but not an error. - - RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17) - -.. index:: AI-0179 (Ada 2012 feature) - -* *AI-0179 Statement not required after label (2010-04-10)* +.. index:: AI-0091 (Ada 2012 feature) - It is not necessary to have a statement following a label, so a label - can appear at the end of a statement sequence without the need for putting a - null statement afterwards, but it is not allowable to have only labels and - no real statements in a statement sequence. +* *AI-0091 Do not allow other_format in identifiers (0000-00-00)* - RM References: 5.01 (2) + Wide characters in the unicode category *other_format* are not permitted + within an identifier, since this can be a security problem. The error + message for this case has been improved to be more specific, but GNAT has + never allowed such characters to appear in identifiers. -.. index:: AI-0139-2 (Ada 2012 feature) + RM References: 2.03 (3.1/2) 2.03 (4/2) 2.03 (5/2) 2.03 (5.1/2) 2.03 (5.2/2) 2.03 (5.3/2) 2.09 (2/2) -* *AI-0139-2 Syntactic sugar for iterators (2010-09-29)* +.. index:: AI-0093 (Ada 2012 feature) - The new syntax for iterating over arrays and containers is now implemented. - Iteration over containers is for now limited to read-only iterators. Only - default iterators are supported, with the syntax: ``for Elem of C``. +* *AI-0093 Additional rules use immutably limited (0000-00-00)* - RM References: 5.05 + This is an editorial change only, to make more widespread use of the Ada 2012 + 'immutably limited'. -.. index:: AI-0134 (Ada 2012 feature) + RM References: 3.03 (23.4/3) -* *AI-0134 Profiles must match for full conformance (0000-00-00)* +.. index:: AI-0095 (Ada 2012 feature) - For full conformance, the profiles of anonymous-access-to-subprogram - parameters must match. GNAT has always enforced this rule. +* *AI-0095 Address of intrinsic subprograms (0000-00-00)* - RM References: 6.03.01 (18) + The prefix of ``'Address`` cannot statically denote a subprogram with + convention ``Intrinsic``. The use of the ``Address`` attribute raises + ``Program_Error`` if the prefix denotes a subprogram with convention + ``Intrinsic``. -.. index:: AI-0207 (Ada 2012 feature) + RM References: 13.03 (11/1) -* *AI-0207 Mode conformance and access constant (0000-00-00)* +.. index:: AI-0096 (Ada 2012 feature) - This AI confirms that access_to_constant indication must match for mode - conformance. This was implemented in GNAT when the qualifier was originally - introduced in Ada 2005. +* *AI-0096 Deriving from formal private types (2010-07-20)* - RM References: 6.03.01 (16/2) + In general it is illegal for a type derived from a formal limited type to be + nonlimited. This AI makes an exception to this rule: derivation is legal + if it appears in the private part of the generic, and the formal type is not + tagged. If the type is tagged, the legality check must be applied to the + private part of the package. -.. index:: AI-0046 (Ada 2012 feature) + RM References: 3.04 (5.1/2) 6.02 (7) -* *AI-0046 Null exclusion match for full conformance (2010-07-17)* +.. index:: AI-0097 (Ada 2012 feature) - For full conformance, in the case of access parameters, the null exclusion - must match (either both or neither must have ``not null``). +* *AI-0097 Treatment of abstract null extension (2010-07-19)* - RM References: 6.03.02 (18) + The RM as written implied that in some cases it was possible to create an + object of an abstract type, by having an abstract extension inherit a non- + abstract constructor from its parent type. This mistake has been corrected + in GNAT and in the RM, and this construct is now illegal. -.. index:: AI-0118 (Ada 2012 feature) + RM References: 3.09.03 (4/2) -* *AI-0118 The association of parameter associations (0000-00-00)* +.. index:: AI-0098 (Ada 2012 feature) - This AI clarifies the rules for named associations in subprogram calls and - generic instantiations. The rules have been in place since Ada 83. +* *AI-0098 Anonymous subprogram access restrictions (0000-00-00)* - RM References: 6.04.01 (2) 12.03 (9) + An unintentional omission in the RM implied some inconsistent restrictions on + the use of anonymous access to subprogram values. These restrictions were not + intentional, and have never been enforced by GNAT. -.. index:: AI-0196 (Ada 2012 feature) + RM References: 3.10.01 (6) 3.10.01 (9.2/2) -* *AI-0196 Null exclusion tests for out parameters (0000-00-00)* +.. index:: AI-0099 (Ada 2012 feature) - Null exclusion checks are not made for ``out`` parameters when - evaluating the actual parameters. GNAT has never generated these checks. +* *AI-0099 Tag determines whether finalization needed (0000-00-00)* - RM References: 6.04.01 (13) + This AI clarifies that 'needs finalization' is part of dynamic semantics, + and therefore depends on the run-time characteristics of an object (i.e. its + tag) and not on its nominal type. As the AI indicates: "we do not expect + this to affect any implementation''. -.. index:: AI-0015 (Ada 2012 feature) + RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) -* *AI-0015 Constant return objects (0000-00-00)* +.. index:: AI-0100 (Ada 2012 feature) - The return object declared in an *extended_return_statement* may be - declared constant. This was always intended, and GNAT has always allowed it. +* *AI-0100 Placement of pragmas (2010-07-01)* - RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2) - 6.05 (5.7/2) + This AI is an earlier version of AI-163. It simplifies the rules + for legal placement of pragmas. In the case of lists that allow pragmas, if + the list may have no elements, then the list may consist solely of pragmas. -.. index:: AI-0032 (Ada 2012 feature) + RM References: 2.08 (7) -* *AI-0032 Extended return for class-wide functions (0000-00-00)* +.. index:: AI-0102 (Ada 2012 feature) - If a function returns a class-wide type, the object of an extended return - statement can be declared with a specific type that is covered by the class- - wide type. This has been implemented in GNAT since the introduction of - extended returns. Note AI-0103 complements this AI by imposing matching - rules for constrained return types. +* *AI-0102 Some implicit conversions are illegal (0000-00-00)* - RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2) - 6.05 (8/2) + It is illegal to assign an anonymous access constant to an anonymous access + variable. The RM did not have a clear rule to prevent this, but GNAT has + always generated an error for this usage. + + RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2) .. index:: AI-0103 (Ada 2012 feature) @@ -624,178 +589,170 @@ Supported Aspect Source RM References: 6.05 (5.2/2) -.. index:: AI-0058 (Ada 2012 feature) - -* *AI-0058 Abnormal completion of an extended return (0000-00-00)* - - The RM had some incorrect wording implying wrong treatment of abnormal - completion in an extended return. GNAT has always implemented the intended - correct semantics as described by this AI. - - RM References: 6.05 (22/2) +.. index:: AI-0104 (Ada 2012 feature) -.. index:: AI-0050 (Ada 2012 feature) +* *AI-0104 Null exclusion and uninitialized allocator (2010-07-15)* -* *AI-0050 Raising Constraint_Error early for function call (0000-00-00)* + The assignment ``Ptr := new not null Some_Ptr;`` will raise + ``Constraint_Error`` because the default value of the allocated object is + **null**. This useless construct is illegal in Ada 2012. - The implementation permissions for raising ``Constraint_Error`` early on a function call - when it was clear an exception would be raised were over-permissive and allowed - mishandling of discriminants in some cases. GNAT did - not take advantage of these incorrect permissions in any case. + RM References: 4.08 (2) - RM References: 6.05 (24/2) +.. index:: AI-0106 (Ada 2012 feature) -.. index:: AI-0125 (Ada 2012 feature) +* *AI-0106 No representation pragmas on generic formals (0000-00-00)* -* *AI-0125 Nonoverridable operations of an ancestor (2010-09-28)* + The RM appeared to allow representation pragmas on generic formal parameters, + but this was not intended, and GNAT has never permitted this usage. - In Ada 2012, the declaration of a primitive operation of a type extension - or private extension can also override an inherited primitive that is not - visible at the point of this declaration. + RM References: 13.01 (9.1/1) - RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2) +.. index:: AI-0108 (Ada 2012 feature) -.. index:: AI-0062 (Ada 2012 feature) +* *AI-0108 Limited incomplete view and discriminants (0000-00-00)* -* *AI-0062 Null exclusions and deferred constants (0000-00-00)* + This AI confirms that an incomplete type from a limited view does not have + discriminants. This has always been the case in GNAT. - A full constant may have a null exclusion even if its associated deferred - constant does not. GNAT has always allowed this. + RM References: 10.01.01 (12.3/2) - RM References: 7.04 (6/2) 7.04 (7.1/2) +.. index:: AI-0109 (Ada 2012 feature) -.. index:: AI-0178 (Ada 2012 feature) +* *AI-0109 Redundant check in S'Class'Input (0000-00-00)* -* *AI-0178 Incomplete views are limited (0000-00-00)* + This AI is an editorial change only. It removes the need for a tag check + that can never fail. - This AI clarifies the role of incomplete views and plugs an omission in the - RM. GNAT always correctly restricted the use of incomplete views and types. + RM References: 13.13.02 (34/2) - RM References: 7.05 (3/2) 7.05 (6/2) +.. index:: AI-0112 (Ada 2012 feature) -.. index:: AI-0087 (Ada 2012 feature) +* *AI-0112 Detection of duplicate pragmas (2010-07-24)* -* *AI-0087 Actual for formal nonlimited derived type (2010-07-15)* + This AI concerns giving names to various representation aspects, but the + practical effect is simply to make the use of duplicate + ``Atomic[_Components]``, + ``Volatile[_Components]``, and + ``Independent[_Components]`` pragmas illegal, and GNAT + now performs this required check. - The actual for a formal nonlimited derived type cannot be limited. In - particular, a formal derived type that extends a limited interface but which - is not explicitly limited cannot be instantiated with a limited type. + RM References: 13.01 (8) - RM References: 7.05 (5/2) 12.05.01 (5.1/2) +.. index:: AI-0114 (Ada 2012 feature) -.. index:: AI-0099 (Ada 2012 feature) +* *AI-0114 Classification of letters (0000-00-00)* -* *AI-0099 Tag determines whether finalization needed (0000-00-00)* + The code points 170 (``FEMININE ORDINAL INDICATOR``), + 181 (``MICRO SIGN``), and + 186 (``MASCULINE ORDINAL INDICATOR``) are technically considered + lower case letters by Unicode. + However, they are not allowed in identifiers, and they + return ``False`` to ``Ada.Characters.Handling.Is_Letter/Is_Lower``. + This behavior is consistent with that defined in Ada 95. - This AI clarifies that 'needs finalization' is part of dynamic semantics, - and therefore depends on the run-time characteristics of an object (i.e. its - tag) and not on its nominal type. As the AI indicates: "we do not expect - this to affect any implementation''. + RM References: A.03.02 (59) A.04.06 (7) - RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) +.. index:: AI-0116 (Ada 2012 feature) -.. index:: AI-0064 (Ada 2012 feature) +* *AI-0116 Alignment of class-wide objects (0000-00-00)* -* *AI-0064 Redundant finalization rule (0000-00-00)* + This AI requires that the alignment of a class-wide object be no greater + than the alignment of any type in the class. GNAT has always followed this + recommendation. - This is an editorial change only. The intended behavior is already checked - by an existing ACATS test, which GNAT has always executed correctly. + RM References: 13.03 (29) 13.11 (16) - RM References: 7.06.01 (17.1/1) +.. index:: AI-0118 (Ada 2012 feature) -.. index:: AI-0026 (Ada 2012 feature) +* *AI-0118 The association of parameter associations (0000-00-00)* -* *AI-0026 Missing rules for Unchecked_Union (2010-07-07)* + This AI clarifies the rules for named associations in subprogram calls and + generic instantiations. The rules have been in place since Ada 83. - Record representation clauses concerning Unchecked_Union types cannot mention - the discriminant of the type. The type of a component declared in the variant - part of an Unchecked_Union cannot be controlled, have controlled components, - nor have protected or task parts. If an Unchecked_Union type is declared - within the body of a generic unit or its descendants, then the type of a - component declared in the variant part cannot be a formal private type or a - formal private extension declared within the same generic unit. + RM References: 6.04.01 (2) 12.03 (9) - RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2) +.. index:: AI-0120 (Ada 2012 feature) -.. index:: AI-0205 (Ada 2012 feature) +* *AI-0120 Constant instance of protected object (0000-00-00)* -* *AI-0205 Extended return declares visible name (0000-00-00)* + This is an RM editorial change only. The section that lists objects that are + constant failed to include the current instance of a protected object + within a protected function. This has always been treated as a constant + in GNAT. - This AI corrects a simple omission in the RM. Return objects have always - been visible within an extended return statement. + RM References: 3.03 (21) - RM References: 8.03 (17) +.. index:: AI-0122 (Ada 2012 feature) -.. index:: AI-0042 (Ada 2012 feature) +* *AI-0122 Private with and children of generics (0000-00-00)* -* *AI-0042 Overriding versus implemented-by (0000-00-00)* + This AI clarifies the visibility of private children of generic units within + instantiations of a parent. GNAT has always handled this correctly. - This AI fixes a wording gap in the RM. An operation of a synchronized - interface can be implemented by a protected or task entry, but the abstract - operation is not being overridden in the usual sense, and it must be stated - separately that this implementation is legal. This has always been the case - in GNAT. + RM References: 10.01.02 (12/2) - RM References: 9.01 (9.2/2) 9.04 (11.1/2) +.. index:: AI-0123 (Ada 2012 feature) -.. index:: AI-0030 (Ada 2012 feature) +* *AI-0123 Composability of equality (2010-04-13)* -* *AI-0030 Requeue on synchronized interfaces (2010-07-19)* + Equality of untagged record composes, so that the predefined equality for a + composite type that includes a component of some untagged record type + ``R`` uses the equality operation of ``R`` (which may be user-defined + or predefined). This makes the behavior of untagged records identical to that + of tagged types in this respect. - Requeue is permitted to a protected, synchronized or task interface primitive - providing it is known that the overriding operation is an entry. Otherwise - the requeue statement has the same effect as a procedure call. Use of pragma - ``Implemented`` provides a way to impose a static requirement on the - overriding operation by adhering to one of the implementation kinds: entry, - protected procedure or any of the above. + This change is an incompatibility with previous versions of Ada, but it + corrects a non-uniformity that was often a source of confusion. Analysis of + a large number of industrial programs indicates that in those rare cases + where a composite type had an untagged record component with a user-defined + equality, either there was no use of the composite equality, or else the code + expected the same composability as for tagged types, and thus had a bug that + would be fixed by this change. - RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5) - 9.05.04 (6) 9.05.04 (7) 9.05.04 (12) + RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24) + 8.05.04 (8) -.. index:: AI-0201 (Ada 2012 feature) +.. index:: AI-0125 (Ada 2012 feature) -* *AI-0201 Independence of atomic object components (2010-07-22)* +* *AI-0125 Nonoverridable operations of an ancestor (2010-09-28)* - If an Atomic object has a pragma ``Pack`` or a ``Component_Size`` - attribute, then individual components may not be addressable by independent - tasks. However, if the representation clause has no effect (is confirming), - then independence is not compromised. Furthermore, in GNAT, specification of - other appropriately addressable component sizes (e.g. 16 for 8-bit - characters) also preserves independence. GNAT now gives very clear warnings - both for the declaration of such a type, and for any assignment to its components. + In Ada 2012, the declaration of a primitive operation of a type extension + or private extension can also override an inherited primitive that is not + visible at the point of this declaration. - RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2) + RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2) -.. index:: AI-0009 (Ada 2012 feature) +.. index:: AI-0126 (Ada 2012 feature) -* *AI-0009 Pragma Independent[_Components] (2010-07-23)* +* *AI-0126 Dispatching with no declared operation (0000-00-00)* - This AI introduces the new pragmas ``Independent`` and - ``Independent_Components``, - which control guaranteeing independence of access to objects and components. - The AI also requires independence not unaffected by confirming rep clauses. + This AI clarifies dispatching rules, and simply confirms that dispatching + executes the operation of the parent type when there is no explicitly or + implicitly declared operation for the descendant type. This has always been + the case in all versions of GNAT. - RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2) - C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14) + RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2) -.. index:: AI-0072 (Ada 2012 feature) +.. index:: AI-0127 (Ada 2012 feature) -* *AI-0072 Task signalling using 'Terminated (0000-00-00)* +* *AI-0127 Adding Locale Capabilities (2010-09-29)* - This AI clarifies that task signalling for reading ``'Terminated`` only - occurs if the result is True. GNAT semantics has always been consistent with - this notion of task signalling. + This package provides an interface for identifying the current locale. - RM References: 9.10 (6.1/1) + RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06 + A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13 -.. index:: AI-0108 (Ada 2012 feature) +.. index:: AI-0128 (Ada 2012 feature) -* *AI-0108 Limited incomplete view and discriminants (0000-00-00)* +* *AI-0128 Inequality is a primitive operation (0000-00-00)* - This AI confirms that an incomplete type from a limited view does not have - discriminants. This has always been the case in GNAT. + If an equality operator ("=") is declared for a type, then the implicitly + declared inequality operator ("/=") is a primitive operation of the type. + This is the only reasonable interpretation, and is the one always implemented + by GNAT, but the RM was not entirely clear in making this point. - RM References: 10.01.01 (12.3/2) + RM References: 3.02.03 (6) 6.06 (6) .. index:: AI-0129 (Ada 2012 feature) @@ -809,35 +766,6 @@ Supported Aspect Source RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2) -.. index:: AI-0077 (Ada 2012 feature) - -* *AI-0077 Limited withs and scope of declarations (0000-00-00)* - - This AI clarifies that a declaration does not include a context clause, - and confirms that it is illegal to have a context in which both a limited - and a nonlimited view of a package are accessible. Such double visibility - was always rejected by GNAT. - - RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2) - -.. index:: AI-0122 (Ada 2012 feature) - -* *AI-0122 Private with and children of generics (0000-00-00)* - - This AI clarifies the visibility of private children of generic units within - instantiations of a parent. GNAT has always handled this correctly. - - RM References: 10.01.02 (12/2) - -.. index:: AI-0040 (Ada 2012 feature) - -* *AI-0040 Limited with clauses on descendant (0000-00-00)* - - This AI confirms that a limited with clause in a child unit cannot name - an ancestor of the unit. This has always been checked in GNAT. - - RM References: 10.01.02 (20/2) - .. index:: AI-0132 (Ada 2012 feature) * *AI-0132 Placement of library unit pragmas (0000-00-00)* @@ -848,175 +776,173 @@ Supported Aspect Source RM References: 10.01.05 (7) -.. index:: AI-0034 (Ada 2012 feature) - -* *AI-0034 Categorization of limited views (0000-00-00)* - - The RM makes certain limited with clauses illegal because of categorization - considerations, when the corresponding normal with would be legal. This is - not intended, and GNAT has always implemented the recommended behavior. - - RM References: 10.02.01 (11/1) 10.02.01 (17/2) - -.. index:: AI-0035 (Ada 2012 feature) +.. index:: AI-0134 (Ada 2012 feature) -* *AI-0035 Inconsistencies with Pure units (0000-00-00)* +* *AI-0134 Profiles must match for full conformance (0000-00-00)* - This AI remedies some inconsistencies in the legality rules for Pure units. - Derived access types are legal in a pure unit (on the assumption that the - rule for a zero storage pool size has been enforced on the ancestor type). - The rules are enforced in generic instances and in subunits. GNAT has always - implemented the recommended behavior. + For full conformance, the profiles of anonymous-access-to-subprogram + parameters must match. GNAT has always enforced this rule. - RM References: 10.02.01 (15.1/2) 10.02.01 (15.4/2) 10.02.01 (15.5/2) 10.02.01 (17/2) + RM References: 6.03.01 (18) -.. index:: AI-0219 (Ada 2012 feature) +.. index:: AI-0137 (Ada 2012 feature) -* *AI-0219 Pure permissions and limited parameters (2010-05-25)* +* *AI-0137 String encoding package (2010-03-25)* - This AI refines the rules for the cases with limited parameters which do not - allow the implementations to omit 'redundant'. GNAT now properly conforms - to the requirements of this binding interpretation. + The packages ``Ada.Strings.UTF_Encoding``, together with its child + packages, ``Conversions``, ``Strings``, ``Wide_Strings``, + and ``Wide_Wide_Strings`` have been + implemented. These packages (whose documentation can be found in the spec + files :file:`a-stuten.ads`, :file:`a-suenco.ads`, :file:`a-suenst.ads`, + :file:`a-suewst.ads`, :file:`a-suezst.ads`) allow encoding and decoding of + ``String``, ``Wide_String``, and ``Wide_Wide_String`` + values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and + UTF-16), as well as conversions between the different UTF encodings. With + the exception of ``Wide_Wide_Strings``, these packages are available in + Ada 95 and Ada 2005 mode as well as Ada 2012 mode. + The ``Wide_Wide_Strings`` package + is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95 + mode since it uses ``Wide_Wide_Character``). - RM References: 10.02.01 (18/2) + RM References: A.04.11 -.. index:: AI-0043 (Ada 2012 feature) +.. index:: AI-0139-2 (Ada 2012 feature) -* *AI-0043 Rules about raising exceptions (0000-00-00)* +* *AI-0139-2 Syntactic sugar for iterators (2010-09-29)* - This AI covers various omissions in the RM regarding the raising of - exceptions. GNAT has always implemented the intended semantics. + The new syntax for iterating over arrays and containers is now implemented. + Iteration over containers is for now limited to read-only iterators. Only + default iterators are supported, with the syntax: ``for Elem of C``. - RM References: 11.04.01 (10.1/2) 11 (2) + RM References: 5.05 -.. index:: AI-0200 (Ada 2012 feature) +.. index:: AI-0146 (Ada 2012 feature) -* *AI-0200 Mismatches in formal package declarations (0000-00-00)* +* *AI-0146 Type invariants (2009-09-21)* - This AI plugs a gap in the RM which appeared to allow some obviously intended - illegal instantiations. GNAT has never allowed these instantiations. + Type invariants may be specified for private types using the aspect notation. + Aspect ``Type_Invariant`` may be specified for any private type, + ``Type_Invariant'Class`` can + only be specified for tagged types, and is inherited by any descendent of the + tagged types. The invariant is a boolean expression that is tested for being + true in the following situations: conversions to the private type, object + declarations for the private type that are default initialized, and + [**in**] **out** + parameters and returned result on return from any primitive operation for + the type that is visible to a client. + GNAT defines the synonyms ``Invariant`` for ``Type_Invariant`` and + ``Invariant'Class`` for ``Type_Invariant'Class``. - RM References: 12.07 (16) + RM References: 13.03.03 (00) -.. index:: AI-0112 (Ada 2012 feature) +.. index:: AI-0147 (Ada 2012 feature) -* *AI-0112 Detection of duplicate pragmas (2010-07-24)* +* *AI-0147 Conditional expressions (2009-03-29)* - This AI concerns giving names to various representation aspects, but the - practical effect is simply to make the use of duplicate - ``Atomic[_Components]``, - ``Volatile[_Components]``, and - ``Independent[_Components]`` pragmas illegal, and GNAT - now performs this required check. + Conditional expressions are permitted. The form of such an expression is: - RM References: 13.01 (8) + :: -.. index:: AI-0106 (Ada 2012 feature) + (if expr then expr {elsif expr then expr} [else expr]) -* *AI-0106 No representation pragmas on generic formals (0000-00-00)* + The parentheses can be omitted in contexts where parentheses are present + anyway, such as subprogram arguments and pragma arguments. If the **else** + clause is omitted, **else** *True* is assumed; + thus ``(if A then B)`` is a way to conveniently represent + *(A implies B)* in standard logic. - The RM appeared to allow representation pragmas on generic formal parameters, - but this was not intended, and GNAT has never permitted this usage. + RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2) + 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2) - RM References: 13.01 (9.1/1) +.. index:: AI-0152 (Ada 2012 feature) -.. index:: AI-0012 (Ada 2012 feature) +* *AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)* -* *AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)* + Restriction ``No_Anonymous_Allocators`` prevents the use of allocators + where the type of the returned value is an anonymous access type. - It is now illegal to give an inappropriate component size or a pragma - ``Pack`` that attempts to change the component size in the case of atomic - or aliased components. Previously GNAT ignored such an attempt with a - warning. + RM References: H.04 (8/1) - RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21) +.. index:: AI-0157 (Ada 2012 feature) -.. index:: AI-0039 (Ada 2012 feature) +* *AI-0157 Allocation/Deallocation from empty pool (2010-07-11)* -* *AI-0039 Stream attributes cannot be dynamic (0000-00-00)* + Allocation and Deallocation from an empty storage pool (i.e. allocation or + deallocation of a pointer for which a static storage size clause of zero + has been given) is now illegal and is detected as such. GNAT + previously gave a warning but not an error. - The RM permitted the use of dynamic expressions (such as ``ptr.all``)` - for stream attributes, but these were never useful and are now illegal. GNAT - has always regarded such expressions as illegal. + RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17) - RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2) +.. index:: AI-0158 (Ada 2012 feature) -.. index:: AI-0095 (Ada 2012 feature) +* *AI-0158 Generalizing membership tests (2010-09-16)* -* *AI-0095 Address of intrinsic subprograms (0000-00-00)* + This AI extends the syntax of membership tests to simplify complex conditions + that can be expressed as membership in a subset of values of any type. It + introduces syntax for a list of expressions that may be used in loop contexts + as well. - The prefix of ``'Address`` cannot statically denote a subprogram with - convention ``Intrinsic``. The use of the ``Address`` attribute raises - ``Program_Error`` if the prefix denotes a subprogram with convention - ``Intrinsic``. + RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27) - RM References: 13.03 (11/1) +.. index:: AI-0161 (Ada 2012 feature) -.. index:: AI-0116 (Ada 2012 feature) +* *AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)* -* *AI-0116 Alignment of class-wide objects (0000-00-00)* + A new restriction ``No_Default_Stream_Attributes`` prevents the use of any + of the default stream attributes for elementary types. If this restriction is + in force, then it is necessary to provide explicit subprograms for any + stream attributes used. - This AI requires that the alignment of a class-wide object be no greater - than the alignment of any type in the class. GNAT has always followed this - recommendation. + RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2) - RM References: 13.03 (29) 13.11 (16) +.. index:: AI-0162 (Ada 2012 feature) -.. index:: AI-0146 (Ada 2012 feature) +* *AI-0162 Incomplete type completed by partial view (2010-09-15)* -* *AI-0146 Type invariants (2009-09-21)* + Incomplete types are made more useful by allowing them to be completed by + private types and private extensions. - Type invariants may be specified for private types using the aspect notation. - Aspect ``Type_Invariant`` may be specified for any private type, - ``Type_Invariant'Class`` can - only be specified for tagged types, and is inherited by any descendent of the - tagged types. The invariant is a boolean expression that is tested for being - true in the following situations: conversions to the private type, object - declarations for the private type that are default initialized, and - [**in**] **out** - parameters and returned result on return from any primitive operation for - the type that is visible to a client. - GNAT defines the synonyms ``Invariant`` for ``Type_Invariant`` and - ``Invariant'Class`` for ``Type_Invariant'Class``. + RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2) - RM References: 13.03.03 (00) +.. index:: AI-0163 (Ada 2012 feature) -.. index:: AI-0078 (Ada 2012 feature) +* *AI-0163 Pragmas in place of null (2010-07-01)* -* *AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)* + A statement sequence may be composed entirely of pragmas. It is no longer + necessary to add a dummy ``null`` statement to make the sequence legal. - In Ada 2012, compilers are required to support unchecked conversion where the - target alignment is a multiple of the source alignment. GNAT always supported - this case (and indeed all cases of differing alignments, doing copies where - required if the alignment was reduced). + RM References: 2.08 (7) 2.08 (16) - RM References: 13.09 (7) +.. index:: AI-0171 (Ada 2012 feature) -.. index:: AI-0195 (Ada 2012 feature) +* *AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)* -* *AI-0195 Invalid value handling is implementation defined (2010-07-03)* + A new package ``System.Multiprocessors`` is added, together with the + definition of pragma ``CPU`` for controlling task affinity. A new no + dependence restriction, on ``System.Multiprocessors.Dispatching_Domains``, + is added to the Ravenscar profile. - The handling of invalid values is now designated to be implementation - defined. This is a documentation change only, requiring Annex M in the GNAT - Reference Manual to document this handling. - In GNAT, checks for invalid values are made - only when necessary to avoid erroneous behavior. Operations like assignments - which cannot cause erroneous behavior ignore the possibility of invalid - values and do not do a check. The date given above applies only to the - documentation change, this behavior has always been implemented by GNAT. + RM References: D.13.01 (4/2) D.16 - RM References: 13.09.01 (10) +.. index:: AI-0173 (Ada 2012 feature) -.. index:: AI-0193 (Ada 2012 feature) +* *AI-0173 Testing if tags represent abstract types (2010-07-03)* -* *AI-0193 Alignment of allocators (2010-09-16)* + The function ``Ada.Tags.Type_Is_Abstract`` returns ``True`` if invoked + with the tag of an abstract type, and ``False`` otherwise. - This AI introduces a new attribute ``Max_Alignment_For_Allocation``, - analogous to ``Max_Size_In_Storage_Elements``, but for alignment instead - of size. + RM References: 3.09 (7.4/2) 3.09 (12.4/2) - RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1) - 13.11.01 (2) 13.11.01 (3) +.. index:: AI-0176 (Ada 2012 feature) + +* *AI-0176 Quantified expressions (2010-09-29)* + + Both universally and existentially quantified expressions are implemented. + They use the new syntax for iterators proposed in AI05-139-2, as well as + the standard Ada loop syntax. + + RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0) .. index:: AI-0177 (Ada 2012 feature) @@ -1035,225 +961,321 @@ Supported Aspect Source RM References: 13.11.01 (3/2) -.. index:: AI-0033 (Ada 2012 feature) +.. index:: AI-0178 (Ada 2012 feature) -* *AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)* +* *AI-0178 Incomplete views are limited (0000-00-00)* - Neither of these two pragmas may appear within a generic template, because - the generic might be instantiated at other than the library level. + This AI clarifies the role of incomplete views and plugs an omission in the + RM. GNAT always correctly restricted the use of incomplete views and types. - RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2) + RM References: 7.05 (3/2) 7.05 (6/2) -.. index:: AI-0161 (Ada 2012 feature) +.. index:: AI-0179 (Ada 2012 feature) -* *AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)* +* *AI-0179 Statement not required after label (2010-04-10)* - A new restriction ``No_Default_Stream_Attributes`` prevents the use of any - of the default stream attributes for elementary types. If this restriction is - in force, then it is necessary to provide explicit subprograms for any - stream attributes used. + It is not necessary to have a statement following a label, so a label + can appear at the end of a statement sequence without the need for putting a + null statement afterwards, but it is not allowable to have only labels and + no real statements in a statement sequence. - RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2) + RM References: 5.01 (2) -.. index:: AI-0194 (Ada 2012 feature) +.. index:: AI-0181 (Ada 2012 feature) -* *AI-0194 Value of Stream_Size attribute (0000-00-00)* +* *AI-0181 Soft hyphen is a non-graphic character (2010-07-23)* - The ``Stream_Size`` attribute returns the default number of bits in the - stream representation of the given type. - This value is not affected by the presence - of stream subprogram attributes for the type. GNAT has always implemented - this interpretation. + From Ada 2005 on, soft hyphen is considered a non-graphic character, which + means that it has a special name (``SOFT_HYPHEN``) in conjunction with the + ``Image`` and ``Value`` attributes for the character types. Strictly + speaking this is an inconsistency with Ada 95, but in practice the use of + these attributes is so obscure that it will not cause problems. - RM References: 13.13.02 (1.2/2) + RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21) -.. index:: AI-0109 (Ada 2012 feature) +.. index:: AI-0182 (Ada 2012 feature) -* *AI-0109 Redundant check in S'Class'Input (0000-00-00)* +* *AI-0182 Additional forms for* ``Character'Value`` *(0000-00-00)* - This AI is an editorial change only. It removes the need for a tag check - that can never fail. + This AI allows ``Character'Value`` to accept the string ``'?'`` where + ``?`` is any character including non-graphic control characters. GNAT has + always accepted such strings. It also allows strings such as + ``HEX_00000041`` to be accepted, but GNAT does not take advantage of this + permission and raises ``Constraint_Error``, as is certainly still + permitted. - RM References: 13.13.02 (34/2) + RM References: 3.05 (56/2) -.. index:: AI-0007 (Ada 2012 feature) +.. index:: AI-0183 (Ada 2012 feature) -* *AI-0007 Stream read and private scalar types (0000-00-00)* +* *AI-0183 Aspect specifications (2010-08-16)* - The RM as written appeared to limit the possibilities of declaring read - attribute procedures for private scalar types. This limitation was not - intended, and has never been enforced by GNAT. + Aspect specifications have been fully implemented except for pre and post- + conditions, and type invariants, which have their own separate AI's. All + forms of declarations listed in the AI are supported. The following is a + list of the aspects supported (with GNAT implementation aspects marked) - RM References: 13.13.02 (50/2) 13.13.02 (51/2) +==================================== =========== +Supported Aspect Source +==================================== =========== + ``Ada_2005`` -- GNAT + ``Ada_2012`` -- GNAT + ``Address`` + ``Alignment`` + ``Atomic`` + ``Atomic_Components`` + ``Bit_Order`` + ``Component_Size`` + ``Contract_Cases`` -- GNAT + ``Discard_Names`` + ``External_Tag`` + ``Favor_Top_Level`` -- GNAT + ``Inline`` + ``Inline_Always`` -- GNAT + ``Invariant`` -- GNAT + ``Machine_Radix`` + ``No_Return`` + ``Object_Size`` -- GNAT + ``Pack`` + ``Persistent_BSS`` -- GNAT + ``Post`` + ``Pre`` + ``Predicate`` + ``Preelaborable_Initialization`` + ``Pure_Function`` -- GNAT + ``Remote_Access_Type`` -- GNAT + ``Shared`` -- GNAT + ``Size`` + ``Storage_Pool`` + ``Storage_Size`` + ``Stream_Size`` + ``Suppress`` + ``Suppress_Debug_Info`` -- GNAT + ``Test_Case`` -- GNAT + ``Thread_Local_Storage`` -- GNAT + ``Type_Invariant`` + ``Unchecked_Union`` + ``Universal_Aliasing`` -- GNAT + ``Unmodified`` -- GNAT + ``Unreferenced`` -- GNAT + ``Unreferenced_Objects`` -- GNAT + ``Unsuppress`` + ``Value_Size`` -- GNAT + ``Volatile`` + ``Volatile_Components`` + ``Warnings`` -- GNAT +==================================== =========== -.. index:: AI-0065 (Ada 2012 feature) + Note that for aspects with an expression, e.g. ``Size``, the expression is + treated like a default expression (visibility is analyzed at the point of + occurrence of the aspect, but evaluation of the expression occurs at the + freeze point of the entity involved). -* *AI-0065 Remote access types and external streaming (0000-00-00)* + RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6) + 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03 + (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2) + 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2) + 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1) + 13.03.01 (0) - This AI clarifies the fact that all remote access types support external - streaming. This fixes an obvious oversight in the definition of the - language, and GNAT always implemented the intended correct rules. +.. index:: AI-0185 (Ada 2012 feature) - RM References: 13.13.02 (52/2) +* *AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)* -.. index:: AI-0019 (Ada 2012 feature) + Two new packages ``Ada.Wide_[Wide_]Characters.Handling`` provide + classification functions for ``Wide_Character`` and + ``Wide_Wide_Character``, as well as providing + case folding routines for ``Wide_[Wide_]Character`` and + ``Wide_[Wide_]String``. -* *AI-0019 Freezing of primitives for tagged types (0000-00-00)* + RM References: A.03.05 (0) A.03.06 (0) - The RM suggests that primitive subprograms of a specific tagged type are - frozen when the tagged type is frozen. This would be an incompatible change - and is not intended. GNAT has never attempted this kind of freezing and its - behavior is consistent with the recommendation of this AI. +.. index:: AI-0188 (Ada 2012 feature) + +* *AI-0188 Case expressions (2010-01-09)* + + Case expressions are permitted. This allows use of constructs such as: + + .. code-block:: ada + + X := (case Y is when 1 => 2, when 2 => 3, when others => 31) + + RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33) + +.. index:: AI-0189 (Ada 2012 feature) + +* *AI-0189 No_Allocators_After_Elaboration (2010-01-23)* + + This AI introduces a new restriction ``No_Allocators_After_Elaboration``, + which says that no dynamic allocation will occur once elaboration is + completed. + In general this requires a run-time check, which is not required, and which + GNAT does not attempt. But the static cases of allocators in a task body or + in the body of the main program are detected and flagged at compile or bind + time. + + RM References: D.07 (19.1/2) H.04 (23.3/2) + +.. index:: AI-0190 (Ada 2012 feature) + +* *AI-0190 pragma Default_Storage_Pool (2010-09-15)* + + This AI introduces a new pragma ``Default_Storage_Pool``, which can be + used to control storage pools globally. + In particular, you can force every access + type that is used for allocation (**new**) to have an explicit storage pool, + or you can declare a pool globally to be used for all access types that lack + an explicit one. + + RM References: D.07 (8) + +.. index:: AI-0193 (Ada 2012 feature) + +* *AI-0193 Alignment of allocators (2010-09-16)* + + This AI introduces a new attribute ``Max_Alignment_For_Allocation``, + analogous to ``Max_Size_In_Storage_Elements``, but for alignment instead + of size. + + RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1) + 13.11.01 (2) 13.11.01 (3) + +.. index:: AI-0194 (Ada 2012 feature) + +* *AI-0194 Value of Stream_Size attribute (0000-00-00)* + + The ``Stream_Size`` attribute returns the default number of bits in the + stream representation of the given type. + This value is not affected by the presence + of stream subprogram attributes for the type. GNAT has always implemented + this interpretation. - RM References: 13.14 (2) 13.14 (3/1) 13.14 (8.1/1) 13.14 (10) 13.14 (14) 13.14 (15.1/2) + RM References: 13.13.02 (1.2/2) -.. index:: AI-0017 (Ada 2012 feature) +.. index:: AI-0195 (Ada 2012 feature) -* *AI-0017 Freezing and incomplete types (0000-00-00)* +* *AI-0195 Invalid value handling is implementation defined (2010-07-03)* - So-called 'Taft-amendment types' (i.e., types that are completed in package - bodies) are not frozen by the occurrence of bodies in the - enclosing declarative part. GNAT always implemented this properly. + The handling of invalid values is now designated to be implementation + defined. This is a documentation change only, requiring Annex M in the GNAT + Reference Manual to document this handling. + In GNAT, checks for invalid values are made + only when necessary to avoid erroneous behavior. Operations like assignments + which cannot cause erroneous behavior ignore the possibility of invalid + values and do not do a check. The date given above applies only to the + documentation change, this behavior has always been implemented by GNAT. - RM References: 13.14 (3/1) + RM References: 13.09.01 (10) -.. index:: AI-0060 (Ada 2012 feature) +.. index:: AI-0196 (Ada 2012 feature) -* *AI-0060 Extended definition of remote access types (0000-00-00)* +* *AI-0196 Null exclusion tests for out parameters (0000-00-00)* - This AI extends the definition of remote access types to include access - to limited, synchronized, protected or task class-wide interface types. - GNAT already implemented this extension. + Null exclusion checks are not made for ``out`` parameters when + evaluating the actual parameters. GNAT has never generated these checks. - RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18) + RM References: 6.04.01 (13) -.. index:: AI-0114 (Ada 2012 feature) +.. index:: AI-0198 (Ada 2012 feature) -* *AI-0114 Classification of letters (0000-00-00)* +* *AI-0198 Inheriting abstract operators (0000-00-00)* - The code points 170 (``FEMININE ORDINAL INDICATOR``), - 181 (``MICRO SIGN``), and - 186 (``MASCULINE ORDINAL INDICATOR``) are technically considered - lower case letters by Unicode. - However, they are not allowed in identifiers, and they - return ``False`` to ``Ada.Characters.Handling.Is_Letter/Is_Lower``. - This behavior is consistent with that defined in Ada 95. + This AI resolves a conflict between two rules involving inherited abstract + operations and predefined operators. If a derived numeric type inherits + an abstract operator, it overrides the predefined one. This interpretation + was always the one implemented in GNAT. - RM References: A.03.02 (59) A.04.06 (7) + RM References: 3.09.03 (4/3) -.. index:: AI-0185 (Ada 2012 feature) +.. index:: AI-0199 (Ada 2012 feature) -* *AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)* +* *AI-0199 Aggregate with anonymous access components (2010-07-14)* - Two new packages ``Ada.Wide_[Wide_]Characters.Handling`` provide - classification functions for ``Wide_Character`` and - ``Wide_Wide_Character``, as well as providing - case folding routines for ``Wide_[Wide_]Character`` and - ``Wide_[Wide_]String``. + A choice list in a record aggregate can include several components of + (distinct) anonymous access types as long as they have matching designated + subtypes. - RM References: A.03.05 (0) A.03.06 (0) + RM References: 4.03.01 (16) -.. index:: AI-0031 (Ada 2012 feature) +.. index:: AI-0200 (Ada 2012 feature) -* *AI-0031 Add From parameter to Find_Token (2010-07-25)* +* *AI-0200 Mismatches in formal package declarations (0000-00-00)* - A new version of ``Find_Token`` is added to all relevant string packages, - with an extra parameter ``From``. Instead of starting at the first - character of the string, the search for a matching Token starts at the - character indexed by the value of ``From``. - These procedures are available in all versions of Ada - but if used in versions earlier than Ada 2012 they will generate a warning - that an Ada 2012 subprogram is being used. + This AI plugs a gap in the RM which appeared to allow some obviously intended + illegal instantiations. GNAT has never allowed these instantiations. - RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51) - A.04.05 (46) + RM References: 12.07 (16) -.. index:: AI-0056 (Ada 2012 feature) +.. index:: AI-0201 (Ada 2012 feature) -* *AI-0056 Index on null string returns zero (0000-00-00)* +* *AI-0201 Independence of atomic object components (2010-07-22)* - The wording in the Ada 2005 RM implied an incompatible handling of the - ``Index`` functions, resulting in raising an exception instead of - returning zero in some situations. - This was not intended and has been corrected. - GNAT always returned zero, and is thus consistent with this AI. + If an Atomic object has a pragma ``Pack`` or a ``Component_Size`` + attribute, then individual components may not be addressable by independent + tasks. However, if the representation clause has no effect (is confirming), + then independence is not compromised. Furthermore, in GNAT, specification of + other appropriately addressable component sizes (e.g. 16 for 8-bit + characters) also preserves independence. GNAT now gives very clear warnings + both for the declaration of such a type, and for any assignment to its components. - RM References: A.04.03 (56.2/2) A.04.03 (58.5/2) + RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2) -.. index:: AI-0137 (Ada 2012 feature) +.. index:: AI-0203 (Ada 2012 feature) -* *AI-0137 String encoding package (2010-03-25)* +* *AI-0203 Extended return cannot be abstract (0000-00-00)* - The packages ``Ada.Strings.UTF_Encoding``, together with its child - packages, ``Conversions``, ``Strings``, ``Wide_Strings``, - and ``Wide_Wide_Strings`` have been - implemented. These packages (whose documentation can be found in the spec - files :file:`a-stuten.ads`, :file:`a-suenco.ads`, :file:`a-suenst.ads`, - :file:`a-suewst.ads`, :file:`a-suezst.ads`) allow encoding and decoding of - ``String``, ``Wide_String``, and ``Wide_Wide_String`` - values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and - UTF-16), as well as conversions between the different UTF encodings. With - the exception of ``Wide_Wide_Strings``, these packages are available in - Ada 95 and Ada 2005 mode as well as Ada 2012 mode. - The ``Wide_Wide_Strings`` package - is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95 - mode since it uses ``Wide_Wide_Character``). + A return_subtype_indication cannot denote an abstract subtype. GNAT has never + permitted such usage. - RM References: A.04.11 + RM References: 3.09.03 (8/3) -.. index:: AI-0038 (Ada 2012 feature) +.. index:: AI-0205 (Ada 2012 feature) -* *AI-0038 Minor errors in Text_IO (0000-00-00)* +* *AI-0205 Extended return declares visible name (0000-00-00)* - These are minor errors in the description on three points. The intent on - all these points has always been clear, and GNAT has always implemented the - correct intended semantics. + This AI corrects a simple omission in the RM. Return objects have always + been visible within an extended return statement. - RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.10.08 (10) A.10.08 (24) + RM References: 8.03 (17) -.. index:: AI-0044 (Ada 2012 feature) +.. index:: AI-0206 (Ada 2012 feature) -* *AI-0044 Restrictions on container instantiations (0000-00-00)* +* *AI-0206 Remote types packages and preelaborate (2010-07-24)* - This AI places restrictions on allowed instantiations of generic containers. - These restrictions are not checked by the compiler, so there is nothing to - change in the implementation. This affects only the RM documentation. + Remote types packages are now allowed to depend on preelaborated packages. + This was formerly considered illegal. - RM References: A.18 (4/2) A.18.02 (231/2) A.18.03 (145/2) A.18.06 (56/2) A.18.08 (66/2) A.18.09 (79/2) A.18.26 (5/2) A.18.26 (9/2) + RM References: E.02.02 (6) -.. index:: AI-0127 (Ada 2012 feature) +.. index:: AI-0207 (Ada 2012 feature) -* *AI-0127 Adding Locale Capabilities (2010-09-29)* +* *AI-0207 Mode conformance and access constant (0000-00-00)* - This package provides an interface for identifying the current locale. + This AI confirms that access_to_constant indication must match for mode + conformance. This was implemented in GNAT when the qualifier was originally + introduced in Ada 2005. - RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06 - A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13 + RM References: 6.03.01 (16/2) -.. index:: AI-0002 (Ada 2012 feature) +.. index:: AI-0208 (Ada 2012 feature) -* *AI-0002 Export C with unconstrained arrays (0000-00-00)* +* *AI-0208 Characteristics of incomplete views (0000-00-00)* - The compiler is not required to support exporting an Ada subprogram with - convention C if there are parameters or a return type of an unconstrained - array type (such as ``String``). GNAT allows such declarations but - generates warnings. It is possible, but complicated, to write the - corresponding C code and certainly such code would be specific to GNAT and - non-portable. + The wording in the Ada 2005 RM concerning characteristics of incomplete views + was incorrect and implied that some programs intended to be legal were now + illegal. GNAT had never considered such programs illegal, so it has always + implemented the intent of this AI. - RM References: B.01 (17) B.03 (62) B.03 (71.1/2) + RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2) -.. index:: AI-0216 (Ada 2012 feature) +.. index:: AI-0210 (Ada 2012 feature) -* *AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)* +* *AI-0210 Correct Timing_Events metric (0000-00-00)* - It is clearly the intention that ``No_Task_Hierarchy`` is intended to - forbid tasks declared locally within subprograms, or functions returning task - objects, and that is the implementation that GNAT has always provided. - However the language in the RM was not sufficiently clear on this point. - Thus this is a documentation change in the RM only. + This is a documentation only issue regarding wording of metric requirements, + that does not affect the implementation of the compiler. - RM References: D.07 (3/3) + RM References: D.15 (24/2) .. index:: AI-0211 (Ada 2012 feature) @@ -1264,67 +1286,45 @@ Supported Aspect Source RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2) -.. index:: AI-0190 (Ada 2012 feature) - -* *AI-0190 pragma Default_Storage_Pool (2010-09-15)* - - This AI introduces a new pragma ``Default_Storage_Pool``, which can be - used to control storage pools globally. - In particular, you can force every access - type that is used for allocation (**new**) to have an explicit storage pool, - or you can declare a pool globally to be used for all access types that lack - an explicit one. - - RM References: D.07 (8) - -.. index:: AI-0189 (Ada 2012 feature) - -* *AI-0189 No_Allocators_After_Elaboration (2010-01-23)* - - This AI introduces a new restriction ``No_Allocators_After_Elaboration``, - which says that no dynamic allocation will occur once elaboration is - completed. - In general this requires a run-time check, which is not required, and which - GNAT does not attempt. But the static cases of allocators in a task body or - in the body of the main program are detected and flagged at compile or bind - time. - - RM References: D.07 (19.1/2) H.04 (23.3/2) - -.. index:: AI-0171 (Ada 2012 feature) +.. index:: AI-0214 (Ada 2012 feature) -* *AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)* +* *AI-0214 Defaulted discriminants for limited tagged (2010-10-01)* - A new package ``System.Multiprocessors`` is added, together with the - definition of pragma ``CPU`` for controlling task affinity. A new no - dependence restriction, on ``System.Multiprocessors.Dispatching_Domains``, - is added to the Ravenscar profile. + Ada 2012 relaxes the restriction that forbids discriminants of tagged types + to have default expressions by allowing them when the type is limited. It + is often useful to define a default value for a discriminant even though + it can't be changed by assignment. - RM References: D.13.01 (4/2) D.16 + RM References: 3.07 (9.1/2) 3.07.02 (3) -.. index:: AI-0210 (Ada 2012 feature) +.. index:: AI-0216 (Ada 2012 feature) -* *AI-0210 Correct Timing_Events metric (0000-00-00)* +* *AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)* - This is a documentation only issue regarding wording of metric requirements, - that does not affect the implementation of the compiler. + It is clearly the intention that ``No_Task_Hierarchy`` is intended to + forbid tasks declared locally within subprograms, or functions returning task + objects, and that is the implementation that GNAT has always provided. + However the language in the RM was not sufficiently clear on this point. + Thus this is a documentation change in the RM only. - RM References: D.15 (24/2) + RM References: D.07 (3/3) -.. index:: AI-0206 (Ada 2012 feature) +.. index:: AI-0219 (Ada 2012 feature) -* *AI-0206 Remote types packages and preelaborate (2010-07-24)* +* *AI-0219 Pure permissions and limited parameters (2010-05-25)* - Remote types packages are now allowed to depend on preelaborated packages. - This was formerly considered illegal. + This AI refines the rules for the cases with limited parameters which do not + allow the implementations to omit 'redundant'. GNAT now properly conforms + to the requirements of this binding interpretation. - RM References: E.02.02 (6) + RM References: 10.02.01 (18/2) -.. index:: AI-0152 (Ada 2012 feature) +.. index:: AI-0220 (Ada 2012 feature) -* *AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)* +* *AI-0220 Needed components for aggregates (0000-00-00)* - Restriction ``No_Anonymous_Allocators`` prevents the use of allocators - where the type of the returned value is an anonymous access type. + This AI addresses a wording problem in the RM that appears to permit some + complex cases of aggregates with nonstatic discriminants. GNAT has always + implemented the intended semantics. - RM References: H.04 (8/1) + RM References: 4.03.01 (17) diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 0d38b1a4bc6..df6969f98b7 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -26607,865 +26607,958 @@ in the RM, the earliest is used. A complete description of the AIs may be found in @indicateurl{http://www.ada-auth.org/ai05-summary.html}. -@geindex AI-0176 (Ada 2012 feature) +@geindex AI-0002 (Ada 2012 feature) @itemize * @item -`AI-0176 Quantified expressions (2010-09-29)' +`AI-0002 Export C with unconstrained arrays (0000-00-00)' -Both universally and existentially quantified expressions are implemented. -They use the new syntax for iterators proposed in AI05-139-2, as well as -the standard Ada loop syntax. +The compiler is not required to support exporting an Ada subprogram with +convention C if there are parameters or a return type of an unconstrained +array type (such as @code{String}). GNAT allows such declarations but +generates warnings. It is possible, but complicated, to write the +corresponding C code and certainly such code would be specific to GNAT and +non-portable. -RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0) +RM References: B.01 (17) B.03 (62) B.03 (71.1/2) @end itemize -@geindex AI-0079 (Ada 2012 feature) +@geindex AI-0003 (Ada 2012 feature) @itemize * @item -`AI-0079 Allow other_format characters in source (2010-07-10)' +`AI-0003 Qualified expressions as names (2010-07-11)' -Wide characters in the unicode category `other_format' are now allowed in -source programs between tokens, but not within a token such as an identifier. +In Ada 2012, a qualified expression is considered to be syntactically a name, +meaning that constructs such as @code{A'(F(X)).B} are now legal. This is +useful in disambiguating some cases of overloading. -RM References: 2.01 (4/2) 2.02 (7) +RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3) +5.04 (7) @end itemize -@geindex AI-0091 (Ada 2012 feature) +@geindex AI-0007 (Ada 2012 feature) @itemize * @item -`AI-0091 Do not allow other_format in identifiers (0000-00-00)' +`AI-0007 Stream read and private scalar types (0000-00-00)' -Wide characters in the unicode category `other_format' are not permitted -within an identifier, since this can be a security problem. The error -message for this case has been improved to be more specific, but GNAT has -never allowed such characters to appear in identifiers. +The RM as written appeared to limit the possibilities of declaring read +attribute procedures for private scalar types. This limitation was not +intended, and has never been enforced by GNAT. -RM References: 2.03 (3.1/2) 2.03 (4/2) 2.03 (5/2) 2.03 (5.1/2) 2.03 (5.2/2) 2.03 (5.3/2) 2.09 (2/2) +RM References: 13.13.02 (50/2) 13.13.02 (51/2) @end itemize -@geindex AI-0100 (Ada 2012 feature) +@geindex AI-0008 (Ada 2012 feature) @itemize * @item -`AI-0100 Placement of pragmas (2010-07-01)' +`AI-0008 General access to constrained objects (0000-00-00)' -This AI is an earlier version of AI-163. It simplifies the rules -for legal placement of pragmas. In the case of lists that allow pragmas, if -the list may have no elements, then the list may consist solely of pragmas. +The wording in the RM implied that if you have a general access to a +constrained object, it could be used to modify the discriminants. This was +obviously not intended. @code{Constraint_Error} should be raised, and GNAT +has always done so in this situation. -RM References: 2.08 (7) +RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2) @end itemize -@geindex AI-0163 (Ada 2012 feature) +@geindex AI-0009 (Ada 2012 feature) @itemize * @item -`AI-0163 Pragmas in place of null (2010-07-01)' +`AI-0009 Pragma Independent[_Components] (2010-07-23)' -A statement sequence may be composed entirely of pragmas. It is no longer -necessary to add a dummy @code{null} statement to make the sequence legal. +This AI introduces the new pragmas @code{Independent} and +@code{Independent_Components}, +which control guaranteeing independence of access to objects and components. +The AI also requires independence not unaffected by confirming rep clauses. -RM References: 2.08 (7) 2.08 (16) +RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2) +C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14) @end itemize -@geindex AI-0080 (Ada 2012 feature) +@geindex AI-0012 (Ada 2012 feature) @itemize * @item -`AI-0080 ‘View of’ not needed if clear from context (0000-00-00)' +`AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)' -This is an editorial change only, described as non-testable in the AI. +It is now illegal to give an inappropriate component size or a pragma +@code{Pack} that attempts to change the component size in the case of atomic +or aliased components. Previously GNAT ignored such an attempt with a +warning. -RM References: 3.01 (7) +RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21) @end itemize -@geindex AI-0183 (Ada 2012 feature) +@geindex AI-0015 (Ada 2012 feature) @itemize * @item -`AI-0183 Aspect specifications (2010-08-16)' - -Aspect specifications have been fully implemented except for pre and post- -conditions, and type invariants, which have their own separate AI’s. All -forms of declarations listed in the AI are supported. The following is a -list of the aspects supported (with GNAT implementation aspects marked) -@end itemize +`AI-0015 Constant return objects (0000-00-00)' +The return object declared in an `extended_return_statement' may be +declared constant. This was always intended, and GNAT has always allowed it. -@multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} -@headitem +RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2) +6.05 (5.7/2) +@end itemize -Supported Aspect +@geindex AI-0017 (Ada 2012 feature) -@tab -Source +@itemize * -@item +@item +`AI-0017 Freezing and incomplete types (0000-00-00)' -@code{Ada_2005} +So-called ‘Taft-amendment types’ (i.e., types that are completed in package +bodies) are not frozen by the occurrence of bodies in the +enclosing declarative part. GNAT always implemented this properly. -@tab +RM References: 13.14 (3/1) +@end itemize -– GNAT +@geindex AI-0019 (Ada 2012 feature) -@item -@code{Ada_2012} +@itemize * -@tab +@item +`AI-0019 Freezing of primitives for tagged types (0000-00-00)' -– GNAT +The RM suggests that primitive subprograms of a specific tagged type are +frozen when the tagged type is frozen. This would be an incompatible change +and is not intended. GNAT has never attempted this kind of freezing and its +behavior is consistent with the recommendation of this AI. -@item +RM References: 13.14 (2) 13.14 (3/1) 13.14 (8.1/1) 13.14 (10) 13.14 (14) 13.14 (15.1/2) +@end itemize -@code{Address} +@geindex AI-0026 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Alignment} +@item +`AI-0026 Missing rules for Unchecked_Union (2010-07-07)' -@tab +Record representation clauses concerning Unchecked_Union types cannot mention +the discriminant of the type. The type of a component declared in the variant +part of an Unchecked_Union cannot be controlled, have controlled components, +nor have protected or task parts. If an Unchecked_Union type is declared +within the body of a generic unit or its descendants, then the type of a +component declared in the variant part cannot be a formal private type or a +formal private extension declared within the same generic unit. -@item +RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2) +@end itemize -@code{Atomic} +@geindex AI-0030 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Atomic_Components} +@item +`AI-0030 Requeue on synchronized interfaces (2010-07-19)' -@tab +Requeue is permitted to a protected, synchronized or task interface primitive +providing it is known that the overriding operation is an entry. Otherwise +the requeue statement has the same effect as a procedure call. Use of pragma +@code{Implemented} provides a way to impose a static requirement on the +overriding operation by adhering to one of the implementation kinds: entry, +protected procedure or any of the above. -@item +RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5) +9.05.04 (6) 9.05.04 (7) 9.05.04 (12) +@end itemize -@code{Bit_Order} +@geindex AI-0031 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Component_Size} +@item +`AI-0031 Add From parameter to Find_Token (2010-07-25)' -@tab +A new version of @code{Find_Token} is added to all relevant string packages, +with an extra parameter @code{From}. Instead of starting at the first +character of the string, the search for a matching Token starts at the +character indexed by the value of @code{From}. +These procedures are available in all versions of Ada +but if used in versions earlier than Ada 2012 they will generate a warning +that an Ada 2012 subprogram is being used. -@item +RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51) +A.04.05 (46) +@end itemize -@code{Contract_Cases} +@geindex AI-0032 (Ada 2012 feature) -@tab -– GNAT +@itemize * -@item +@item +`AI-0032 Extended return for class-wide functions (0000-00-00)' -@code{Discard_Names} +If a function returns a class-wide type, the object of an extended return +statement can be declared with a specific type that is covered by the class- +wide type. This has been implemented in GNAT since the introduction of +extended returns. Note AI-0103 complements this AI by imposing matching +rules for constrained return types. -@tab +RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2) +6.05 (8/2) +@end itemize -@item +@geindex AI-0033 (Ada 2012 feature) -@code{External_Tag} -@tab +@itemize * -@item +@item +`AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)' -@code{Favor_Top_Level} +Neither of these two pragmas may appear within a generic template, because +the generic might be instantiated at other than the library level. -@tab +RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2) +@end itemize -– GNAT +@geindex AI-0034 (Ada 2012 feature) -@item -@code{Inline} +@itemize * -@tab +@item +`AI-0034 Categorization of limited views (0000-00-00)' -@item +The RM makes certain limited with clauses illegal because of categorization +considerations, when the corresponding normal with would be legal. This is +not intended, and GNAT has always implemented the recommended behavior. -@code{Inline_Always} +RM References: 10.02.01 (11/1) 10.02.01 (17/2) +@end itemize -@tab +@geindex AI-0035 (Ada 2012 feature) -– GNAT -@item +@itemize * -@code{Invariant} +@item +`AI-0035 Inconsistencies with Pure units (0000-00-00)' -@tab +This AI remedies some inconsistencies in the legality rules for Pure units. +Derived access types are legal in a pure unit (on the assumption that the +rule for a zero storage pool size has been enforced on the ancestor type). +The rules are enforced in generic instances and in subunits. GNAT has always +implemented the recommended behavior. -– GNAT +RM References: 10.02.01 (15.1/2) 10.02.01 (15.4/2) 10.02.01 (15.5/2) 10.02.01 (17/2) +@end itemize -@item +@geindex AI-0037 (Ada 2012 feature) -@code{Machine_Radix} -@tab +@itemize * -@item +@item +`AI-0037 Out-of-range box associations in aggregate (0000-00-00)' -@code{No_Return} +This AI confirms that an association of the form @code{Indx => <>} in an +array aggregate must raise @code{Constraint_Error} if @code{Indx} +is out of range. The RM specified a range check on other associations, but +not when the value of the association was defaulted. GNAT has always inserted +a constraint check on the index value. -@tab +RM References: 4.03.03 (29) +@end itemize -@item +@geindex AI-0038 (Ada 2012 feature) -@code{Object_Size} -@tab +@itemize * -– GNAT +@item +`AI-0038 Minor errors in Text_IO (0000-00-00)' -@item +These are minor errors in the description on three points. The intent on +all these points has always been clear, and GNAT has always implemented the +correct intended semantics. -@code{Pack} +RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.10.08 (10) A.10.08 (24) +@end itemize -@tab +@geindex AI-0039 (Ada 2012 feature) -@item -@code{Persistent_BSS} +@itemize * -@tab +@item +`AI-0039 Stream attributes cannot be dynamic (0000-00-00)' -– GNAT +The RM permitted the use of dynamic expressions (such as @code{ptr.all})` +for stream attributes, but these were never useful and are now illegal. GNAT +has always regarded such expressions as illegal. -@item +RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2) +@end itemize -@code{Post} +@geindex AI-0040 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Pre} +@item +`AI-0040 Limited with clauses on descendant (0000-00-00)' -@tab +This AI confirms that a limited with clause in a child unit cannot name +an ancestor of the unit. This has always been checked in GNAT. -@item +RM References: 10.01.02 (20/2) +@end itemize -@code{Predicate} +@geindex AI-0042 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Preelaborable_Initialization} +@item +`AI-0042 Overriding versus implemented-by (0000-00-00)' -@tab +This AI fixes a wording gap in the RM. An operation of a synchronized +interface can be implemented by a protected or task entry, but the abstract +operation is not being overridden in the usual sense, and it must be stated +separately that this implementation is legal. This has always been the case +in GNAT. -@item +RM References: 9.01 (9.2/2) 9.04 (11.1/2) +@end itemize -@code{Pure_Function} +@geindex AI-0043 (Ada 2012 feature) -@tab -– GNAT +@itemize * -@item +@item +`AI-0043 Rules about raising exceptions (0000-00-00)' -@code{Remote_Access_Type} +This AI covers various omissions in the RM regarding the raising of +exceptions. GNAT has always implemented the intended semantics. -@tab +RM References: 11.04.01 (10.1/2) 11 (2) +@end itemize -– GNAT +@geindex AI-0044 (Ada 2012 feature) -@item -@code{Shared} +@itemize * -@tab +@item +`AI-0044 Restrictions on container instantiations (0000-00-00)' -– GNAT +This AI places restrictions on allowed instantiations of generic containers. +These restrictions are not checked by the compiler, so there is nothing to +change in the implementation. This affects only the RM documentation. -@item +RM References: A.18 (4/2) A.18.02 (231/2) A.18.03 (145/2) A.18.06 (56/2) A.18.08 (66/2) A.18.09 (79/2) A.18.26 (5/2) A.18.26 (9/2) +@end itemize -@code{Size} +@geindex AI-0046 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Storage_Pool} +@item +`AI-0046 Null exclusion match for full conformance (2010-07-17)' -@tab +For full conformance, in the case of access parameters, the null exclusion +must match (either both or neither must have @code{not null}). -@item +RM References: 6.03.02 (18) +@end itemize -@code{Storage_Size} +@geindex AI-0050 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Stream_Size} +@item +`AI-0050 Raising Constraint_Error early for function call (0000-00-00)' -@tab +The implementation permissions for raising @code{Constraint_Error} early on a function call +when it was clear an exception would be raised were over-permissive and allowed +mishandling of discriminants in some cases. GNAT did +not take advantage of these incorrect permissions in any case. -@item +RM References: 6.05 (24/2) +@end itemize -@code{Suppress} +@geindex AI-0056 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Suppress_Debug_Info} +@item +`AI-0056 Index on null string returns zero (0000-00-00)' -@tab +The wording in the Ada 2005 RM implied an incompatible handling of the +@code{Index} functions, resulting in raising an exception instead of +returning zero in some situations. +This was not intended and has been corrected. +GNAT always returned zero, and is thus consistent with this AI. -– GNAT +RM References: A.04.03 (56.2/2) A.04.03 (58.5/2) +@end itemize -@item +@geindex AI-0058 (Ada 2012 feature) -@code{Test_Case} -@tab +@itemize * -– GNAT +@item +`AI-0058 Abnormal completion of an extended return (0000-00-00)' -@item +The RM had some incorrect wording implying wrong treatment of abnormal +completion in an extended return. GNAT has always implemented the intended +correct semantics as described by this AI. -@code{Thread_Local_Storage} +RM References: 6.05 (22/2) +@end itemize -@tab +@geindex AI-0060 (Ada 2012 feature) -– GNAT -@item +@itemize * -@code{Type_Invariant} +@item +`AI-0060 Extended definition of remote access types (0000-00-00)' -@tab +This AI extends the definition of remote access types to include access +to limited, synchronized, protected or task class-wide interface types. +GNAT already implemented this extension. -@item +RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18) +@end itemize -@code{Unchecked_Union} +@geindex AI-0062 (Ada 2012 feature) -@tab -@item +@itemize * -@code{Universal_Aliasing} +@item +`AI-0062 Null exclusions and deferred constants (0000-00-00)' -@tab +A full constant may have a null exclusion even if its associated deferred +constant does not. GNAT has always allowed this. -– GNAT +RM References: 7.04 (6/2) 7.04 (7.1/2) +@end itemize -@item +@geindex AI-0064 (Ada 2012 feature) -@code{Unmodified} -@tab +@itemize * -– GNAT +@item +`AI-0064 Redundant finalization rule (0000-00-00)' -@item +This is an editorial change only. The intended behavior is already checked +by an existing ACATS test, which GNAT has always executed correctly. -@code{Unreferenced} +RM References: 7.06.01 (17.1/1) +@end itemize -@tab +@geindex AI-0065 (Ada 2012 feature) -– GNAT -@item +@itemize * -@code{Unreferenced_Objects} +@item +`AI-0065 Remote access types and external streaming (0000-00-00)' -@tab +This AI clarifies the fact that all remote access types support external +streaming. This fixes an obvious oversight in the definition of the +language, and GNAT always implemented the intended correct rules. -– GNAT +RM References: 13.13.02 (52/2) +@end itemize -@item +@geindex AI-0070 (Ada 2012 feature) -@code{Unsuppress} -@tab +@itemize * -@item +@item +`AI-0070 Elaboration of interface types (0000-00-00)' -@code{Value_Size} +This is an editorial change only, there are no testable consequences short of +checking for the absence of generated code for an interface declaration. -@tab +RM References: 3.09.04 (18/2) +@end itemize -– GNAT +@geindex AI-0072 (Ada 2012 feature) -@item -@code{Volatile} +@itemize * -@tab +@item +`AI-0072 Task signalling using ‘Terminated (0000-00-00)' -@item +This AI clarifies that task signalling for reading @code{'Terminated} only +occurs if the result is True. GNAT semantics has always been consistent with +this notion of task signalling. -@code{Volatile_Components} +RM References: 9.10 (6.1/1) +@end itemize -@tab +@geindex AI-0073 (Ada 2012 feature) -@item -@code{Warnings} +@itemize * -@tab +@item +`AI-0073 Functions returning abstract types (2010-07-10)' -– GNAT - -@end multitable - - -@quotation - -Note that for aspects with an expression, e.g. @code{Size}, the expression is -treated like a default expression (visibility is analyzed at the point of -occurrence of the aspect, but evaluation of the expression occurs at the -freeze point of the entity involved). +This AI covers a number of issues regarding returning abstract types. In +particular generic functions cannot have abstract result types or access +result types designated an abstract type. There are some other cases which +are detailed in the AI. Note that this binding interpretation has not been +retrofitted to operate before Ada 2012 mode, since it caused a significant +number of regressions. -RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6) -3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03 -(2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2) -9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2) -12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1) -13.03.01 (0) -@end quotation +RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2) +@end itemize -@geindex AI-0128 (Ada 2012 feature) +@geindex AI-0076 (Ada 2012 feature) @itemize * @item -`AI-0128 Inequality is a primitive operation (0000-00-00)' +`AI-0076 function with controlling result (0000-00-00)' -If an equality operator (“=”) is declared for a type, then the implicitly -declared inequality operator (“/=”) is a primitive operation of the type. -This is the only reasonable interpretation, and is the one always implemented -by GNAT, but the RM was not entirely clear in making this point. +This is an editorial change only. The RM defines calls with controlling +results, but uses the term ‘function with controlling result’ without an +explicit definition. -RM References: 3.02.03 (6) 6.06 (6) +RM References: 3.09.02 (2/2) @end itemize -@geindex AI-0003 (Ada 2012 feature) +@geindex AI-0077 (Ada 2012 feature) @itemize * @item -`AI-0003 Qualified expressions as names (2010-07-11)' +`AI-0077 Limited withs and scope of declarations (0000-00-00)' -In Ada 2012, a qualified expression is considered to be syntactically a name, -meaning that constructs such as @code{A'(F(X)).B} are now legal. This is -useful in disambiguating some cases of overloading. +This AI clarifies that a declaration does not include a context clause, +and confirms that it is illegal to have a context in which both a limited +and a nonlimited view of a package are accessible. Such double visibility +was always rejected by GNAT. -RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3) -5.04 (7) +RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2) @end itemize -@geindex AI-0120 (Ada 2012 feature) +@geindex AI-0078 (Ada 2012 feature) @itemize * @item -`AI-0120 Constant instance of protected object (0000-00-00)' +`AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)' -This is an RM editorial change only. The section that lists objects that are -constant failed to include the current instance of a protected object -within a protected function. This has always been treated as a constant -in GNAT. +In Ada 2012, compilers are required to support unchecked conversion where the +target alignment is a multiple of the source alignment. GNAT always supported +this case (and indeed all cases of differing alignments, doing copies where +required if the alignment was reduced). -RM References: 3.03 (21) +RM References: 13.09 (7) @end itemize -@geindex AI-0008 (Ada 2012 feature) +@geindex AI-0079 (Ada 2012 feature) @itemize * @item -`AI-0008 General access to constrained objects (0000-00-00)' +`AI-0079 Allow other_format characters in source (2010-07-10)' -The wording in the RM implied that if you have a general access to a -constrained object, it could be used to modify the discriminants. This was -obviously not intended. @code{Constraint_Error} should be raised, and GNAT -has always done so in this situation. +Wide characters in the unicode category `other_format' are now allowed in +source programs between tokens, but not within a token such as an identifier. -RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2) +RM References: 2.01 (4/2) 2.02 (7) @end itemize -@geindex AI-0093 (Ada 2012 feature) +@geindex AI-0080 (Ada 2012 feature) @itemize * @item -`AI-0093 Additional rules use immutably limited (0000-00-00)' +`AI-0080 ‘View of’ not needed if clear from context (0000-00-00)' -This is an editorial change only, to make more widespread use of the Ada 2012 -‘immutably limited’. +This is an editorial change only, described as non-testable in the AI. -RM References: 3.03 (23.4/3) +RM References: 3.01 (7) @end itemize -@geindex AI-0096 (Ada 2012 feature) +@geindex AI-0087 (Ada 2012 feature) @itemize * @item -`AI-0096 Deriving from formal private types (2010-07-20)' +`AI-0087 Actual for formal nonlimited derived type (2010-07-15)' -In general it is illegal for a type derived from a formal limited type to be -nonlimited. This AI makes an exception to this rule: derivation is legal -if it appears in the private part of the generic, and the formal type is not -tagged. If the type is tagged, the legality check must be applied to the -private part of the package. +The actual for a formal nonlimited derived type cannot be limited. In +particular, a formal derived type that extends a limited interface but which +is not explicitly limited cannot be instantiated with a limited type. -RM References: 3.04 (5.1/2) 6.02 (7) +RM References: 7.05 (5/2) 12.05.01 (5.1/2) @end itemize -@geindex AI-0181 (Ada 2012 feature) +@geindex AI-0088 (Ada 2012 feature) @itemize * @item -`AI-0181 Soft hyphen is a non-graphic character (2010-07-23)' +`AI-0088 The value of exponentiation (0000-00-00)' -From Ada 2005 on, soft hyphen is considered a non-graphic character, which -means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the -@code{Image} and @code{Value} attributes for the character types. Strictly -speaking this is an inconsistency with Ada 95, but in practice the use of -these attributes is so obscure that it will not cause problems. +This AI clarifies the equivalence rule given for the dynamic semantics of +exponentiation: the value of the operation can be obtained by repeated +multiplication, but the operation can be implemented otherwise (for example +using the familiar divide-by-two-and-square algorithm, even if this is less +accurate), and does not imply repeated reads of a volatile base. -RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21) +RM References: 4.05.06 (11) @end itemize -@geindex AI-0182 (Ada 2012 feature) +@geindex AI-0091 (Ada 2012 feature) @itemize * @item -`AI-0182 Additional forms for' @code{Character'Value} `(0000-00-00)' +`AI-0091 Do not allow other_format in identifiers (0000-00-00)' -This AI allows @code{Character'Value} to accept the string @code{'?'} where -@code{?} is any character including non-graphic control characters. GNAT has -always accepted such strings. It also allows strings such as -@code{HEX_00000041} to be accepted, but GNAT does not take advantage of this -permission and raises @code{Constraint_Error}, as is certainly still -permitted. +Wide characters in the unicode category `other_format' are not permitted +within an identifier, since this can be a security problem. The error +message for this case has been improved to be more specific, but GNAT has +never allowed such characters to appear in identifiers. -RM References: 3.05 (56/2) +RM References: 2.03 (3.1/2) 2.03 (4/2) 2.03 (5/2) 2.03 (5.1/2) 2.03 (5.2/2) 2.03 (5.3/2) 2.09 (2/2) @end itemize -@geindex AI-0214 (Ada 2012 feature) +@geindex AI-0093 (Ada 2012 feature) @itemize * @item -`AI-0214 Defaulted discriminants for limited tagged (2010-10-01)' +`AI-0093 Additional rules use immutably limited (0000-00-00)' -Ada 2012 relaxes the restriction that forbids discriminants of tagged types -to have default expressions by allowing them when the type is limited. It -is often useful to define a default value for a discriminant even though -it can’t be changed by assignment. +This is an editorial change only, to make more widespread use of the Ada 2012 +‘immutably limited’. -RM References: 3.07 (9.1/2) 3.07.02 (3) +RM References: 3.03 (23.4/3) @end itemize -@geindex AI-0102 (Ada 2012 feature) +@geindex AI-0095 (Ada 2012 feature) @itemize * @item -`AI-0102 Some implicit conversions are illegal (0000-00-00)' +`AI-0095 Address of intrinsic subprograms (0000-00-00)' -It is illegal to assign an anonymous access constant to an anonymous access -variable. The RM did not have a clear rule to prevent this, but GNAT has -always generated an error for this usage. +The prefix of @code{'Address} cannot statically denote a subprogram with +convention @code{Intrinsic}. The use of the @code{Address} attribute raises +@code{Program_Error} if the prefix denotes a subprogram with convention +@code{Intrinsic}. -RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2) +RM References: 13.03 (11/1) @end itemize -@geindex AI-0158 (Ada 2012 feature) +@geindex AI-0096 (Ada 2012 feature) @itemize * @item -`AI-0158 Generalizing membership tests (2010-09-16)' +`AI-0096 Deriving from formal private types (2010-07-20)' -This AI extends the syntax of membership tests to simplify complex conditions -that can be expressed as membership in a subset of values of any type. It -introduces syntax for a list of expressions that may be used in loop contexts -as well. +In general it is illegal for a type derived from a formal limited type to be +nonlimited. This AI makes an exception to this rule: derivation is legal +if it appears in the private part of the generic, and the formal type is not +tagged. If the type is tagged, the legality check must be applied to the +private part of the package. -RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27) +RM References: 3.04 (5.1/2) 6.02 (7) @end itemize -@geindex AI-0173 (Ada 2012 feature) +@geindex AI-0097 (Ada 2012 feature) @itemize * @item -`AI-0173 Testing if tags represent abstract types (2010-07-03)' +`AI-0097 Treatment of abstract null extension (2010-07-19)' -The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked -with the tag of an abstract type, and @code{False} otherwise. +The RM as written implied that in some cases it was possible to create an +object of an abstract type, by having an abstract extension inherit a non- +abstract constructor from its parent type. This mistake has been corrected +in GNAT and in the RM, and this construct is now illegal. -RM References: 3.09 (7.4/2) 3.09 (12.4/2) +RM References: 3.09.03 (4/2) @end itemize -@geindex AI-0076 (Ada 2012 feature) +@geindex AI-0098 (Ada 2012 feature) @itemize * @item -`AI-0076 function with controlling result (0000-00-00)' +`AI-0098 Anonymous subprogram access restrictions (0000-00-00)' -This is an editorial change only. The RM defines calls with controlling -results, but uses the term ‘function with controlling result’ without an -explicit definition. +An unintentional omission in the RM implied some inconsistent restrictions on +the use of anonymous access to subprogram values. These restrictions were not +intentional, and have never been enforced by GNAT. -RM References: 3.09.02 (2/2) +RM References: 3.10.01 (6) 3.10.01 (9.2/2) @end itemize -@geindex AI-0126 (Ada 2012 feature) +@geindex AI-0099 (Ada 2012 feature) @itemize * @item -`AI-0126 Dispatching with no declared operation (0000-00-00)' +`AI-0099 Tag determines whether finalization needed (0000-00-00)' -This AI clarifies dispatching rules, and simply confirms that dispatching -executes the operation of the parent type when there is no explicitly or -implicitly declared operation for the descendant type. This has always been -the case in all versions of GNAT. +This AI clarifies that ‘needs finalization’ is part of dynamic semantics, +and therefore depends on the run-time characteristics of an object (i.e. its +tag) and not on its nominal type. As the AI indicates: “we do not expect +this to affect any implementation’’. -RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2) +RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) @end itemize -@geindex AI-0097 (Ada 2012 feature) +@geindex AI-0100 (Ada 2012 feature) @itemize * @item -`AI-0097 Treatment of abstract null extension (2010-07-19)' +`AI-0100 Placement of pragmas (2010-07-01)' -The RM as written implied that in some cases it was possible to create an -object of an abstract type, by having an abstract extension inherit a non- -abstract constructor from its parent type. This mistake has been corrected -in GNAT and in the RM, and this construct is now illegal. +This AI is an earlier version of AI-163. It simplifies the rules +for legal placement of pragmas. In the case of lists that allow pragmas, if +the list may have no elements, then the list may consist solely of pragmas. -RM References: 3.09.03 (4/2) +RM References: 2.08 (7) @end itemize -@geindex AI-0203 (Ada 2012 feature) +@geindex AI-0102 (Ada 2012 feature) @itemize * @item -`AI-0203 Extended return cannot be abstract (0000-00-00)' +`AI-0102 Some implicit conversions are illegal (0000-00-00)' -A return_subtype_indication cannot denote an abstract subtype. GNAT has never -permitted such usage. +It is illegal to assign an anonymous access constant to an anonymous access +variable. The RM did not have a clear rule to prevent this, but GNAT has +always generated an error for this usage. -RM References: 3.09.03 (8/3) +RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2) @end itemize -@geindex AI-0198 (Ada 2012 feature) +@geindex AI-0103 (Ada 2012 feature) @itemize * @item -`AI-0198 Inheriting abstract operators (0000-00-00)' +`AI-0103 Static matching for extended return (2010-07-23)' -This AI resolves a conflict between two rules involving inherited abstract -operations and predefined operators. If a derived numeric type inherits -an abstract operator, it overrides the predefined one. This interpretation -was always the one implemented in GNAT. +If the return subtype of a function is an elementary type or a constrained +type, the subtype indication in an extended return statement must match +statically this return subtype. -RM References: 3.09.03 (4/3) +RM References: 6.05 (5.2/2) @end itemize -@geindex AI-0073 (Ada 2012 feature) +@geindex AI-0104 (Ada 2012 feature) @itemize * @item -`AI-0073 Functions returning abstract types (2010-07-10)' +`AI-0104 Null exclusion and uninitialized allocator (2010-07-15)' -This AI covers a number of issues regarding returning abstract types. In -particular generic functions cannot have abstract result types or access -result types designated an abstract type. There are some other cases which -are detailed in the AI. Note that this binding interpretation has not been -retrofitted to operate before Ada 2012 mode, since it caused a significant -number of regressions. +The assignment @code{Ptr := new not null Some_Ptr;} will raise +@code{Constraint_Error} because the default value of the allocated object is +`null'. This useless construct is illegal in Ada 2012. -RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2) +RM References: 4.08 (2) @end itemize -@geindex AI-0070 (Ada 2012 feature) +@geindex AI-0106 (Ada 2012 feature) @itemize * @item -`AI-0070 Elaboration of interface types (0000-00-00)' +`AI-0106 No representation pragmas on generic formals (0000-00-00)' -This is an editorial change only, there are no testable consequences short of -checking for the absence of generated code for an interface declaration. +The RM appeared to allow representation pragmas on generic formal parameters, +but this was not intended, and GNAT has never permitted this usage. -RM References: 3.09.04 (18/2) +RM References: 13.01 (9.1/1) @end itemize -@geindex AI-0208 (Ada 2012 feature) +@geindex AI-0108 (Ada 2012 feature) @itemize * @item -`AI-0208 Characteristics of incomplete views (0000-00-00)' +`AI-0108 Limited incomplete view and discriminants (0000-00-00)' -The wording in the Ada 2005 RM concerning characteristics of incomplete views -was incorrect and implied that some programs intended to be legal were now -illegal. GNAT had never considered such programs illegal, so it has always -implemented the intent of this AI. +This AI confirms that an incomplete type from a limited view does not have +discriminants. This has always been the case in GNAT. -RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2) +RM References: 10.01.01 (12.3/2) @end itemize -@geindex AI-0162 (Ada 2012 feature) +@geindex AI-0109 (Ada 2012 feature) @itemize * @item -`AI-0162 Incomplete type completed by partial view (2010-09-15)' +`AI-0109 Redundant check in S’Class’Input (0000-00-00)' -Incomplete types are made more useful by allowing them to be completed by -private types and private extensions. +This AI is an editorial change only. It removes the need for a tag check +that can never fail. -RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2) +RM References: 13.13.02 (34/2) @end itemize -@geindex AI-0098 (Ada 2012 feature) +@geindex AI-0112 (Ada 2012 feature) @itemize * @item -`AI-0098 Anonymous subprogram access restrictions (0000-00-00)' +`AI-0112 Detection of duplicate pragmas (2010-07-24)' -An unintentional omission in the RM implied some inconsistent restrictions on -the use of anonymous access to subprogram values. These restrictions were not -intentional, and have never been enforced by GNAT. +This AI concerns giving names to various representation aspects, but the +practical effect is simply to make the use of duplicate +@code{Atomic[_Components]}, +@code{Volatile[_Components]}, and +@code{Independent[_Components]} pragmas illegal, and GNAT +now performs this required check. -RM References: 3.10.01 (6) 3.10.01 (9.2/2) +RM References: 13.01 (8) @end itemize -@geindex AI-0199 (Ada 2012 feature) +@geindex AI-0114 (Ada 2012 feature) @itemize * @item -`AI-0199 Aggregate with anonymous access components (2010-07-14)' +`AI-0114 Classification of letters (0000-00-00)' -A choice list in a record aggregate can include several components of -(distinct) anonymous access types as long as they have matching designated -subtypes. +The code points 170 (@code{FEMININE ORDINAL INDICATOR}), +181 (@code{MICRO SIGN}), and +186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered +lower case letters by Unicode. +However, they are not allowed in identifiers, and they +return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}. +This behavior is consistent with that defined in Ada 95. -RM References: 4.03.01 (16) +RM References: A.03.02 (59) A.04.06 (7) @end itemize -@geindex AI-0220 (Ada 2012 feature) +@geindex AI-0116 (Ada 2012 feature) @itemize * @item -`AI-0220 Needed components for aggregates (0000-00-00)' +`AI-0116 Alignment of class-wide objects (0000-00-00)' -This AI addresses a wording problem in the RM that appears to permit some -complex cases of aggregates with nonstatic discriminants. GNAT has always -implemented the intended semantics. +This AI requires that the alignment of a class-wide object be no greater +than the alignment of any type in the class. GNAT has always followed this +recommendation. -RM References: 4.03.01 (17) +RM References: 13.03 (29) 13.11 (16) @end itemize -@geindex AI-0147 (Ada 2012 feature) +@geindex AI-0118 (Ada 2012 feature) @itemize * @item -`AI-0147 Conditional expressions (2009-03-29)' +`AI-0118 The association of parameter associations (0000-00-00)' -Conditional expressions are permitted. The form of such an expression is: +This AI clarifies the rules for named associations in subprogram calls and +generic instantiations. The rules have been in place since Ada 83. -@example -(if expr then expr @{elsif expr then expr@} [else expr]) -@end example +RM References: 6.04.01 (2) 12.03 (9) +@end itemize -The parentheses can be omitted in contexts where parentheses are present -anyway, such as subprogram arguments and pragma arguments. If the `else' -clause is omitted, `else' `True' is assumed; -thus @code{(if A then B)} is a way to conveniently represent -`(A implies B)' in standard logic. +@geindex AI-0120 (Ada 2012 feature) -RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2) -4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2) + +@itemize * + +@item +`AI-0120 Constant instance of protected object (0000-00-00)' + +This is an RM editorial change only. The section that lists objects that are +constant failed to include the current instance of a protected object +within a protected function. This has always been treated as a constant +in GNAT. + +RM References: 3.03 (21) @end itemize -@geindex AI-0037 (Ada 2012 feature) +@geindex AI-0122 (Ada 2012 feature) @itemize * @item -`AI-0037 Out-of-range box associations in aggregate (0000-00-00)' +`AI-0122 Private with and children of generics (0000-00-00)' -This AI confirms that an association of the form @code{Indx => <>} in an -array aggregate must raise @code{Constraint_Error} if @code{Indx} -is out of range. The RM specified a range check on other associations, but -not when the value of the association was defaulted. GNAT has always inserted -a constraint check on the index value. +This AI clarifies the visibility of private children of generic units within +instantiations of a parent. GNAT has always handled this correctly. -RM References: 4.03.03 (29) +RM References: 10.01.02 (12/2) @end itemize @geindex AI-0123 (Ada 2012 feature) @@ -27494,100 +27587,97 @@ RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24) 8.05.04 (8) @end itemize -@geindex AI-0088 (Ada 2012 feature) +@geindex AI-0125 (Ada 2012 feature) @itemize * @item -`AI-0088 The value of exponentiation (0000-00-00)' +`AI-0125 Nonoverridable operations of an ancestor (2010-09-28)' -This AI clarifies the equivalence rule given for the dynamic semantics of -exponentiation: the value of the operation can be obtained by repeated -multiplication, but the operation can be implemented otherwise (for example -using the familiar divide-by-two-and-square algorithm, even if this is less -accurate), and does not imply repeated reads of a volatile base. +In Ada 2012, the declaration of a primitive operation of a type extension +or private extension can also override an inherited primitive that is not +visible at the point of this declaration. -RM References: 4.05.06 (11) +RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2) @end itemize -@geindex AI-0188 (Ada 2012 feature) +@geindex AI-0126 (Ada 2012 feature) @itemize * @item -`AI-0188 Case expressions (2010-01-09)' - -Case expressions are permitted. This allows use of constructs such as: +`AI-0126 Dispatching with no declared operation (0000-00-00)' -@example -X := (case Y is when 1 => 2, when 2 => 3, when others => 31) -@end example +This AI clarifies dispatching rules, and simply confirms that dispatching +executes the operation of the parent type when there is no explicitly or +implicitly declared operation for the descendant type. This has always been +the case in all versions of GNAT. -RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33) +RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2) @end itemize -@geindex AI-0104 (Ada 2012 feature) +@geindex AI-0127 (Ada 2012 feature) @itemize * @item -`AI-0104 Null exclusion and uninitialized allocator (2010-07-15)' +`AI-0127 Adding Locale Capabilities (2010-09-29)' -The assignment @code{Ptr := new not null Some_Ptr;} will raise -@code{Constraint_Error} because the default value of the allocated object is -`null'. This useless construct is illegal in Ada 2012. +This package provides an interface for identifying the current locale. -RM References: 4.08 (2) +RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06 +A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13 @end itemize -@geindex AI-0157 (Ada 2012 feature) +@geindex AI-0128 (Ada 2012 feature) @itemize * @item -`AI-0157 Allocation/Deallocation from empty pool (2010-07-11)' +`AI-0128 Inequality is a primitive operation (0000-00-00)' -Allocation and Deallocation from an empty storage pool (i.e. allocation or -deallocation of a pointer for which a static storage size clause of zero -has been given) is now illegal and is detected as such. GNAT -previously gave a warning but not an error. +If an equality operator (“=”) is declared for a type, then the implicitly +declared inequality operator (“/=”) is a primitive operation of the type. +This is the only reasonable interpretation, and is the one always implemented +by GNAT, but the RM was not entirely clear in making this point. -RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17) +RM References: 3.02.03 (6) 6.06 (6) @end itemize -@geindex AI-0179 (Ada 2012 feature) +@geindex AI-0129 (Ada 2012 feature) @itemize * @item -`AI-0179 Statement not required after label (2010-04-10)' +`AI-0129 Limited views and incomplete types (0000-00-00)' -It is not necessary to have a statement following a label, so a label -can appear at the end of a statement sequence without the need for putting a -null statement afterwards, but it is not allowable to have only labels and -no real statements in a statement sequence. +This AI clarifies the description of limited views: a limited view of a +package includes only one view of a type that has an incomplete declaration +and a full declaration (there is no possible ambiguity in a client package). +This AI also fixes an omission: a nested package in the private part has no +limited view. GNAT always implemented this correctly. -RM References: 5.01 (2) +RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2) @end itemize -@geindex AI-0139-2 (Ada 2012 feature) +@geindex AI-0132 (Ada 2012 feature) @itemize * @item -`AI-0139-2 Syntactic sugar for iterators (2010-09-29)' +`AI-0132 Placement of library unit pragmas (0000-00-00)' -The new syntax for iterating over arrays and containers is now implemented. -Iteration over containers is for now limited to read-only iterators. Only -default iterators are supported, with the syntax: @code{for Elem of C}. +This AI fills a gap in the description of library unit pragmas. The pragma +clearly must apply to a library unit, even if it does not carry the name +of the enclosing unit. GNAT has always enforced the required check. -RM References: 5.05 +RM References: 10.01.05 (7) @end itemize @geindex AI-0134 (Ada 2012 feature) @@ -27604,1129 +27694,1039 @@ parameters must match. GNAT has always enforced this rule. RM References: 6.03.01 (18) @end itemize -@geindex AI-0207 (Ada 2012 feature) +@geindex AI-0137 (Ada 2012 feature) @itemize * @item -`AI-0207 Mode conformance and access constant (0000-00-00)' +`AI-0137 String encoding package (2010-03-25)' -This AI confirms that access_to_constant indication must match for mode -conformance. This was implemented in GNAT when the qualifier was originally -introduced in Ada 2005. +The packages @code{Ada.Strings.UTF_Encoding}, together with its child +packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings}, +and @code{Wide_Wide_Strings} have been +implemented. These packages (whose documentation can be found in the spec +files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads}, +@code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of +@code{String}, @code{Wide_String}, and @code{Wide_Wide_String} +values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and +UTF-16), as well as conversions between the different UTF encodings. With +the exception of @code{Wide_Wide_Strings}, these packages are available in +Ada 95 and Ada 2005 mode as well as Ada 2012 mode. +The @code{Wide_Wide_Strings} package +is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95 +mode since it uses @code{Wide_Wide_Character}). -RM References: 6.03.01 (16/2) +RM References: A.04.11 @end itemize -@geindex AI-0046 (Ada 2012 feature) +@geindex AI-0139-2 (Ada 2012 feature) @itemize * @item -`AI-0046 Null exclusion match for full conformance (2010-07-17)' +`AI-0139-2 Syntactic sugar for iterators (2010-09-29)' -For full conformance, in the case of access parameters, the null exclusion -must match (either both or neither must have @code{not null}). +The new syntax for iterating over arrays and containers is now implemented. +Iteration over containers is for now limited to read-only iterators. Only +default iterators are supported, with the syntax: @code{for Elem of C}. -RM References: 6.03.02 (18) +RM References: 5.05 @end itemize -@geindex AI-0118 (Ada 2012 feature) +@geindex AI-0146 (Ada 2012 feature) @itemize * @item -`AI-0118 The association of parameter associations (0000-00-00)' - -This AI clarifies the rules for named associations in subprogram calls and -generic instantiations. The rules have been in place since Ada 83. - -RM References: 6.04.01 (2) 12.03 (9) -@end itemize - -@geindex AI-0196 (Ada 2012 feature) - +`AI-0146 Type invariants (2009-09-21)' -@itemize * - -@item -`AI-0196 Null exclusion tests for out parameters (0000-00-00)' - -Null exclusion checks are not made for @code{out} parameters when -evaluating the actual parameters. GNAT has never generated these checks. +Type invariants may be specified for private types using the aspect notation. +Aspect @code{Type_Invariant} may be specified for any private type, +@code{Type_Invariant'Class} can +only be specified for tagged types, and is inherited by any descendent of the +tagged types. The invariant is a boolean expression that is tested for being +true in the following situations: conversions to the private type, object +declarations for the private type that are default initialized, and +[`in'] `out' +parameters and returned result on return from any primitive operation for +the type that is visible to a client. +GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and +@code{Invariant'Class} for @code{Type_Invariant'Class}. -RM References: 6.04.01 (13) +RM References: 13.03.03 (00) @end itemize -@geindex AI-0015 (Ada 2012 feature) +@geindex AI-0147 (Ada 2012 feature) @itemize * @item -`AI-0015 Constant return objects (0000-00-00)' +`AI-0147 Conditional expressions (2009-03-29)' -The return object declared in an `extended_return_statement' may be -declared constant. This was always intended, and GNAT has always allowed it. +Conditional expressions are permitted. The form of such an expression is: -RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2) -6.05 (5.7/2) +@example +(if expr then expr @{elsif expr then expr@} [else expr]) +@end example + +The parentheses can be omitted in contexts where parentheses are present +anyway, such as subprogram arguments and pragma arguments. If the `else' +clause is omitted, `else' `True' is assumed; +thus @code{(if A then B)} is a way to conveniently represent +`(A implies B)' in standard logic. + +RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2) +4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2) @end itemize -@geindex AI-0032 (Ada 2012 feature) +@geindex AI-0152 (Ada 2012 feature) @itemize * @item -`AI-0032 Extended return for class-wide functions (0000-00-00)' +`AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)' -If a function returns a class-wide type, the object of an extended return -statement can be declared with a specific type that is covered by the class- -wide type. This has been implemented in GNAT since the introduction of -extended returns. Note AI-0103 complements this AI by imposing matching -rules for constrained return types. +Restriction @code{No_Anonymous_Allocators} prevents the use of allocators +where the type of the returned value is an anonymous access type. -RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2) -6.05 (8/2) +RM References: H.04 (8/1) @end itemize -@geindex AI-0103 (Ada 2012 feature) +@geindex AI-0157 (Ada 2012 feature) @itemize * @item -`AI-0103 Static matching for extended return (2010-07-23)' +`AI-0157 Allocation/Deallocation from empty pool (2010-07-11)' -If the return subtype of a function is an elementary type or a constrained -type, the subtype indication in an extended return statement must match -statically this return subtype. +Allocation and Deallocation from an empty storage pool (i.e. allocation or +deallocation of a pointer for which a static storage size clause of zero +has been given) is now illegal and is detected as such. GNAT +previously gave a warning but not an error. -RM References: 6.05 (5.2/2) +RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17) @end itemize -@geindex AI-0058 (Ada 2012 feature) +@geindex AI-0158 (Ada 2012 feature) @itemize * @item -`AI-0058 Abnormal completion of an extended return (0000-00-00)' +`AI-0158 Generalizing membership tests (2010-09-16)' -The RM had some incorrect wording implying wrong treatment of abnormal -completion in an extended return. GNAT has always implemented the intended -correct semantics as described by this AI. +This AI extends the syntax of membership tests to simplify complex conditions +that can be expressed as membership in a subset of values of any type. It +introduces syntax for a list of expressions that may be used in loop contexts +as well. -RM References: 6.05 (22/2) +RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27) @end itemize -@geindex AI-0050 (Ada 2012 feature) +@geindex AI-0161 (Ada 2012 feature) @itemize * @item -`AI-0050 Raising Constraint_Error early for function call (0000-00-00)' +`AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)' -The implementation permissions for raising @code{Constraint_Error} early on a function call -when it was clear an exception would be raised were over-permissive and allowed -mishandling of discriminants in some cases. GNAT did -not take advantage of these incorrect permissions in any case. +A new restriction @code{No_Default_Stream_Attributes} prevents the use of any +of the default stream attributes for elementary types. If this restriction is +in force, then it is necessary to provide explicit subprograms for any +stream attributes used. -RM References: 6.05 (24/2) +RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2) @end itemize -@geindex AI-0125 (Ada 2012 feature) +@geindex AI-0162 (Ada 2012 feature) @itemize * @item -`AI-0125 Nonoverridable operations of an ancestor (2010-09-28)' +`AI-0162 Incomplete type completed by partial view (2010-09-15)' -In Ada 2012, the declaration of a primitive operation of a type extension -or private extension can also override an inherited primitive that is not -visible at the point of this declaration. +Incomplete types are made more useful by allowing them to be completed by +private types and private extensions. -RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2) +RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2) @end itemize -@geindex AI-0062 (Ada 2012 feature) +@geindex AI-0163 (Ada 2012 feature) @itemize * @item -`AI-0062 Null exclusions and deferred constants (0000-00-00)' +`AI-0163 Pragmas in place of null (2010-07-01)' -A full constant may have a null exclusion even if its associated deferred -constant does not. GNAT has always allowed this. +A statement sequence may be composed entirely of pragmas. It is no longer +necessary to add a dummy @code{null} statement to make the sequence legal. -RM References: 7.04 (6/2) 7.04 (7.1/2) +RM References: 2.08 (7) 2.08 (16) @end itemize -@geindex AI-0178 (Ada 2012 feature) +@geindex AI-0171 (Ada 2012 feature) @itemize * @item -`AI-0178 Incomplete views are limited (0000-00-00)' +`AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)' -This AI clarifies the role of incomplete views and plugs an omission in the -RM. GNAT always correctly restricted the use of incomplete views and types. +A new package @code{System.Multiprocessors} is added, together with the +definition of pragma @code{CPU} for controlling task affinity. A new no +dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains}, +is added to the Ravenscar profile. -RM References: 7.05 (3/2) 7.05 (6/2) +RM References: D.13.01 (4/2) D.16 @end itemize -@geindex AI-0087 (Ada 2012 feature) +@geindex AI-0173 (Ada 2012 feature) @itemize * @item -`AI-0087 Actual for formal nonlimited derived type (2010-07-15)' +`AI-0173 Testing if tags represent abstract types (2010-07-03)' -The actual for a formal nonlimited derived type cannot be limited. In -particular, a formal derived type that extends a limited interface but which -is not explicitly limited cannot be instantiated with a limited type. +The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked +with the tag of an abstract type, and @code{False} otherwise. -RM References: 7.05 (5/2) 12.05.01 (5.1/2) +RM References: 3.09 (7.4/2) 3.09 (12.4/2) @end itemize -@geindex AI-0099 (Ada 2012 feature) +@geindex AI-0176 (Ada 2012 feature) @itemize * @item -`AI-0099 Tag determines whether finalization needed (0000-00-00)' +`AI-0176 Quantified expressions (2010-09-29)' -This AI clarifies that ‘needs finalization’ is part of dynamic semantics, -and therefore depends on the run-time characteristics of an object (i.e. its -tag) and not on its nominal type. As the AI indicates: “we do not expect -this to affect any implementation’’. +Both universally and existentially quantified expressions are implemented. +They use the new syntax for iterators proposed in AI05-139-2, as well as +the standard Ada loop syntax. -RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) +RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0) @end itemize -@geindex AI-0064 (Ada 2012 feature) +@geindex AI-0177 (Ada 2012 feature) @itemize * @item -`AI-0064 Redundant finalization rule (0000-00-00)' +`AI-0177 Parameterized expressions (2010-07-10)' -This is an editorial change only. The intended behavior is already checked -by an existing ACATS test, which GNAT has always executed correctly. +The new Ada 2012 notion of parameterized expressions is implemented. The form +is: -RM References: 7.06.01 (17.1/1) +@example +function-specification is (expression) +@end example + +This is exactly equivalent to the +corresponding function body that returns the expression, but it can appear +in a package spec. Note that the expression must be parenthesized. + +RM References: 13.11.01 (3/2) @end itemize -@geindex AI-0026 (Ada 2012 feature) +@geindex AI-0178 (Ada 2012 feature) @itemize * @item -`AI-0026 Missing rules for Unchecked_Union (2010-07-07)' +`AI-0178 Incomplete views are limited (0000-00-00)' -Record representation clauses concerning Unchecked_Union types cannot mention -the discriminant of the type. The type of a component declared in the variant -part of an Unchecked_Union cannot be controlled, have controlled components, -nor have protected or task parts. If an Unchecked_Union type is declared -within the body of a generic unit or its descendants, then the type of a -component declared in the variant part cannot be a formal private type or a -formal private extension declared within the same generic unit. +This AI clarifies the role of incomplete views and plugs an omission in the +RM. GNAT always correctly restricted the use of incomplete views and types. -RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2) +RM References: 7.05 (3/2) 7.05 (6/2) @end itemize -@geindex AI-0205 (Ada 2012 feature) +@geindex AI-0179 (Ada 2012 feature) @itemize * @item -`AI-0205 Extended return declares visible name (0000-00-00)' +`AI-0179 Statement not required after label (2010-04-10)' -This AI corrects a simple omission in the RM. Return objects have always -been visible within an extended return statement. +It is not necessary to have a statement following a label, so a label +can appear at the end of a statement sequence without the need for putting a +null statement afterwards, but it is not allowable to have only labels and +no real statements in a statement sequence. -RM References: 8.03 (17) +RM References: 5.01 (2) @end itemize -@geindex AI-0042 (Ada 2012 feature) +@geindex AI-0181 (Ada 2012 feature) @itemize * @item -`AI-0042 Overriding versus implemented-by (0000-00-00)' +`AI-0181 Soft hyphen is a non-graphic character (2010-07-23)' -This AI fixes a wording gap in the RM. An operation of a synchronized -interface can be implemented by a protected or task entry, but the abstract -operation is not being overridden in the usual sense, and it must be stated -separately that this implementation is legal. This has always been the case -in GNAT. +From Ada 2005 on, soft hyphen is considered a non-graphic character, which +means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the +@code{Image} and @code{Value} attributes for the character types. Strictly +speaking this is an inconsistency with Ada 95, but in practice the use of +these attributes is so obscure that it will not cause problems. -RM References: 9.01 (9.2/2) 9.04 (11.1/2) +RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21) @end itemize -@geindex AI-0030 (Ada 2012 feature) +@geindex AI-0182 (Ada 2012 feature) @itemize * @item -`AI-0030 Requeue on synchronized interfaces (2010-07-19)' +`AI-0182 Additional forms for' @code{Character'Value} `(0000-00-00)' -Requeue is permitted to a protected, synchronized or task interface primitive -providing it is known that the overriding operation is an entry. Otherwise -the requeue statement has the same effect as a procedure call. Use of pragma -@code{Implemented} provides a way to impose a static requirement on the -overriding operation by adhering to one of the implementation kinds: entry, -protected procedure or any of the above. +This AI allows @code{Character'Value} to accept the string @code{'?'} where +@code{?} is any character including non-graphic control characters. GNAT has +always accepted such strings. It also allows strings such as +@code{HEX_00000041} to be accepted, but GNAT does not take advantage of this +permission and raises @code{Constraint_Error}, as is certainly still +permitted. -RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5) -9.05.04 (6) 9.05.04 (7) 9.05.04 (12) +RM References: 3.05 (56/2) @end itemize -@geindex AI-0201 (Ada 2012 feature) +@geindex AI-0183 (Ada 2012 feature) @itemize * @item -`AI-0201 Independence of atomic object components (2010-07-22)' - -If an Atomic object has a pragma @code{Pack} or a @code{Component_Size} -attribute, then individual components may not be addressable by independent -tasks. However, if the representation clause has no effect (is confirming), -then independence is not compromised. Furthermore, in GNAT, specification of -other appropriately addressable component sizes (e.g. 16 for 8-bit -characters) also preserves independence. GNAT now gives very clear warnings -both for the declaration of such a type, and for any assignment to its components. +`AI-0183 Aspect specifications (2010-08-16)' -RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2) +Aspect specifications have been fully implemented except for pre and post- +conditions, and type invariants, which have their own separate AI’s. All +forms of declarations listed in the AI are supported. The following is a +list of the aspects supported (with GNAT implementation aspects marked) @end itemize -@geindex AI-0009 (Ada 2012 feature) +@multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} +@headitem -@itemize * +Supported Aspect -@item -`AI-0009 Pragma Independent[_Components] (2010-07-23)' +@tab -This AI introduces the new pragmas @code{Independent} and -@code{Independent_Components}, -which control guaranteeing independence of access to objects and components. -The AI also requires independence not unaffected by confirming rep clauses. +Source -RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2) -C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14) -@end itemize +@item -@geindex AI-0072 (Ada 2012 feature) +@code{Ada_2005} +@tab -@itemize * +– GNAT -@item -`AI-0072 Task signalling using ‘Terminated (0000-00-00)' +@item -This AI clarifies that task signalling for reading @code{'Terminated} only -occurs if the result is True. GNAT semantics has always been consistent with -this notion of task signalling. +@code{Ada_2012} -RM References: 9.10 (6.1/1) -@end itemize +@tab -@geindex AI-0108 (Ada 2012 feature) +– GNAT +@item -@itemize * +@code{Address} -@item -`AI-0108 Limited incomplete view and discriminants (0000-00-00)' +@tab -This AI confirms that an incomplete type from a limited view does not have -discriminants. This has always been the case in GNAT. +@item -RM References: 10.01.01 (12.3/2) -@end itemize +@code{Alignment} -@geindex AI-0129 (Ada 2012 feature) +@tab +@item -@itemize * +@code{Atomic} -@item -`AI-0129 Limited views and incomplete types (0000-00-00)' +@tab -This AI clarifies the description of limited views: a limited view of a -package includes only one view of a type that has an incomplete declaration -and a full declaration (there is no possible ambiguity in a client package). -This AI also fixes an omission: a nested package in the private part has no -limited view. GNAT always implemented this correctly. +@item -RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2) -@end itemize +@code{Atomic_Components} -@geindex AI-0077 (Ada 2012 feature) +@tab +@item -@itemize * +@code{Bit_Order} -@item -`AI-0077 Limited withs and scope of declarations (0000-00-00)' +@tab -This AI clarifies that a declaration does not include a context clause, -and confirms that it is illegal to have a context in which both a limited -and a nonlimited view of a package are accessible. Such double visibility -was always rejected by GNAT. +@item -RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2) -@end itemize +@code{Component_Size} -@geindex AI-0122 (Ada 2012 feature) +@tab +@item -@itemize * +@code{Contract_Cases} -@item -`AI-0122 Private with and children of generics (0000-00-00)' +@tab -This AI clarifies the visibility of private children of generic units within -instantiations of a parent. GNAT has always handled this correctly. +– GNAT -RM References: 10.01.02 (12/2) -@end itemize +@item -@geindex AI-0040 (Ada 2012 feature) +@code{Discard_Names} +@tab -@itemize * +@item -@item -`AI-0040 Limited with clauses on descendant (0000-00-00)' +@code{External_Tag} -This AI confirms that a limited with clause in a child unit cannot name -an ancestor of the unit. This has always been checked in GNAT. +@tab -RM References: 10.01.02 (20/2) -@end itemize +@item -@geindex AI-0132 (Ada 2012 feature) +@code{Favor_Top_Level} +@tab -@itemize * +– GNAT -@item -`AI-0132 Placement of library unit pragmas (0000-00-00)' +@item -This AI fills a gap in the description of library unit pragmas. The pragma -clearly must apply to a library unit, even if it does not carry the name -of the enclosing unit. GNAT has always enforced the required check. +@code{Inline} -RM References: 10.01.05 (7) -@end itemize +@tab -@geindex AI-0034 (Ada 2012 feature) +@item +@code{Inline_Always} -@itemize * +@tab -@item -`AI-0034 Categorization of limited views (0000-00-00)' +– GNAT -The RM makes certain limited with clauses illegal because of categorization -considerations, when the corresponding normal with would be legal. This is -not intended, and GNAT has always implemented the recommended behavior. +@item -RM References: 10.02.01 (11/1) 10.02.01 (17/2) -@end itemize +@code{Invariant} -@geindex AI-0035 (Ada 2012 feature) +@tab +– GNAT -@itemize * +@item -@item -`AI-0035 Inconsistencies with Pure units (0000-00-00)' +@code{Machine_Radix} -This AI remedies some inconsistencies in the legality rules for Pure units. -Derived access types are legal in a pure unit (on the assumption that the -rule for a zero storage pool size has been enforced on the ancestor type). -The rules are enforced in generic instances and in subunits. GNAT has always -implemented the recommended behavior. +@tab -RM References: 10.02.01 (15.1/2) 10.02.01 (15.4/2) 10.02.01 (15.5/2) 10.02.01 (17/2) -@end itemize +@item -@geindex AI-0219 (Ada 2012 feature) +@code{No_Return} +@tab -@itemize * +@item -@item -`AI-0219 Pure permissions and limited parameters (2010-05-25)' +@code{Object_Size} -This AI refines the rules for the cases with limited parameters which do not -allow the implementations to omit ‘redundant’. GNAT now properly conforms -to the requirements of this binding interpretation. +@tab -RM References: 10.02.01 (18/2) -@end itemize +– GNAT -@geindex AI-0043 (Ada 2012 feature) +@item +@code{Pack} -@itemize * +@tab -@item -`AI-0043 Rules about raising exceptions (0000-00-00)' +@item -This AI covers various omissions in the RM regarding the raising of -exceptions. GNAT has always implemented the intended semantics. +@code{Persistent_BSS} -RM References: 11.04.01 (10.1/2) 11 (2) -@end itemize +@tab -@geindex AI-0200 (Ada 2012 feature) +– GNAT +@item -@itemize * +@code{Post} -@item -`AI-0200 Mismatches in formal package declarations (0000-00-00)' +@tab -This AI plugs a gap in the RM which appeared to allow some obviously intended -illegal instantiations. GNAT has never allowed these instantiations. +@item -RM References: 12.07 (16) -@end itemize +@code{Pre} -@geindex AI-0112 (Ada 2012 feature) +@tab +@item -@itemize * +@code{Predicate} -@item -`AI-0112 Detection of duplicate pragmas (2010-07-24)' +@tab -This AI concerns giving names to various representation aspects, but the -practical effect is simply to make the use of duplicate -@code{Atomic[_Components]}, -@code{Volatile[_Components]}, and -@code{Independent[_Components]} pragmas illegal, and GNAT -now performs this required check. +@item -RM References: 13.01 (8) -@end itemize +@code{Preelaborable_Initialization} -@geindex AI-0106 (Ada 2012 feature) +@tab +@item -@itemize * +@code{Pure_Function} -@item -`AI-0106 No representation pragmas on generic formals (0000-00-00)' +@tab -The RM appeared to allow representation pragmas on generic formal parameters, -but this was not intended, and GNAT has never permitted this usage. +– GNAT -RM References: 13.01 (9.1/1) -@end itemize +@item -@geindex AI-0012 (Ada 2012 feature) +@code{Remote_Access_Type} +@tab -@itemize * +– GNAT -@item -`AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)' +@item -It is now illegal to give an inappropriate component size or a pragma -@code{Pack} that attempts to change the component size in the case of atomic -or aliased components. Previously GNAT ignored such an attempt with a -warning. +@code{Shared} -RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21) -@end itemize +@tab -@geindex AI-0039 (Ada 2012 feature) +– GNAT +@item -@itemize * +@code{Size} -@item -`AI-0039 Stream attributes cannot be dynamic (0000-00-00)' +@tab -The RM permitted the use of dynamic expressions (such as @code{ptr.all})` -for stream attributes, but these were never useful and are now illegal. GNAT -has always regarded such expressions as illegal. +@item -RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2) -@end itemize +@code{Storage_Pool} -@geindex AI-0095 (Ada 2012 feature) +@tab + +@item + +@code{Storage_Size} + +@tab + +@item +@code{Stream_Size} -@itemize * +@tab -@item -`AI-0095 Address of intrinsic subprograms (0000-00-00)' +@item -The prefix of @code{'Address} cannot statically denote a subprogram with -convention @code{Intrinsic}. The use of the @code{Address} attribute raises -@code{Program_Error} if the prefix denotes a subprogram with convention -@code{Intrinsic}. +@code{Suppress} -RM References: 13.03 (11/1) -@end itemize +@tab -@geindex AI-0116 (Ada 2012 feature) +@item +@code{Suppress_Debug_Info} -@itemize * +@tab -@item -`AI-0116 Alignment of class-wide objects (0000-00-00)' +– GNAT -This AI requires that the alignment of a class-wide object be no greater -than the alignment of any type in the class. GNAT has always followed this -recommendation. +@item -RM References: 13.03 (29) 13.11 (16) -@end itemize +@code{Test_Case} -@geindex AI-0146 (Ada 2012 feature) +@tab +– GNAT -@itemize * +@item -@item -`AI-0146 Type invariants (2009-09-21)' +@code{Thread_Local_Storage} -Type invariants may be specified for private types using the aspect notation. -Aspect @code{Type_Invariant} may be specified for any private type, -@code{Type_Invariant'Class} can -only be specified for tagged types, and is inherited by any descendent of the -tagged types. The invariant is a boolean expression that is tested for being -true in the following situations: conversions to the private type, object -declarations for the private type that are default initialized, and -[`in'] `out' -parameters and returned result on return from any primitive operation for -the type that is visible to a client. -GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and -@code{Invariant'Class} for @code{Type_Invariant'Class}. +@tab -RM References: 13.03.03 (00) -@end itemize +– GNAT -@geindex AI-0078 (Ada 2012 feature) +@item +@code{Type_Invariant} -@itemize * +@tab -@item -`AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)' +@item -In Ada 2012, compilers are required to support unchecked conversion where the -target alignment is a multiple of the source alignment. GNAT always supported -this case (and indeed all cases of differing alignments, doing copies where -required if the alignment was reduced). +@code{Unchecked_Union} -RM References: 13.09 (7) -@end itemize +@tab -@geindex AI-0195 (Ada 2012 feature) +@item +@code{Universal_Aliasing} -@itemize * +@tab -@item -`AI-0195 Invalid value handling is implementation defined (2010-07-03)' +– GNAT -The handling of invalid values is now designated to be implementation -defined. This is a documentation change only, requiring Annex M in the GNAT -Reference Manual to document this handling. -In GNAT, checks for invalid values are made -only when necessary to avoid erroneous behavior. Operations like assignments -which cannot cause erroneous behavior ignore the possibility of invalid -values and do not do a check. The date given above applies only to the -documentation change, this behavior has always been implemented by GNAT. +@item -RM References: 13.09.01 (10) -@end itemize +@code{Unmodified} -@geindex AI-0193 (Ada 2012 feature) +@tab +– GNAT -@itemize * +@item -@item -`AI-0193 Alignment of allocators (2010-09-16)' +@code{Unreferenced} -This AI introduces a new attribute @code{Max_Alignment_For_Allocation}, -analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead -of size. +@tab -RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1) -13.11.01 (2) 13.11.01 (3) -@end itemize +– GNAT -@geindex AI-0177 (Ada 2012 feature) +@item +@code{Unreferenced_Objects} -@itemize * +@tab -@item -`AI-0177 Parameterized expressions (2010-07-10)' +– GNAT -The new Ada 2012 notion of parameterized expressions is implemented. The form -is: +@item -@example -function-specification is (expression) -@end example +@code{Unsuppress} -This is exactly equivalent to the -corresponding function body that returns the expression, but it can appear -in a package spec. Note that the expression must be parenthesized. +@tab -RM References: 13.11.01 (3/2) -@end itemize +@item -@geindex AI-0033 (Ada 2012 feature) +@code{Value_Size} +@tab -@itemize * +– GNAT -@item -`AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)' +@item -Neither of these two pragmas may appear within a generic template, because -the generic might be instantiated at other than the library level. +@code{Volatile} -RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2) -@end itemize +@tab -@geindex AI-0161 (Ada 2012 feature) +@item +@code{Volatile_Components} -@itemize * +@tab -@item -`AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)' +@item -A new restriction @code{No_Default_Stream_Attributes} prevents the use of any -of the default stream attributes for elementary types. If this restriction is -in force, then it is necessary to provide explicit subprograms for any -stream attributes used. +@code{Warnings} -RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2) -@end itemize +@tab -@geindex AI-0194 (Ada 2012 feature) +– GNAT +@end multitable -@itemize * -@item -`AI-0194 Value of Stream_Size attribute (0000-00-00)' +@quotation -The @code{Stream_Size} attribute returns the default number of bits in the -stream representation of the given type. -This value is not affected by the presence -of stream subprogram attributes for the type. GNAT has always implemented -this interpretation. +Note that for aspects with an expression, e.g. @code{Size}, the expression is +treated like a default expression (visibility is analyzed at the point of +occurrence of the aspect, but evaluation of the expression occurs at the +freeze point of the entity involved). -RM References: 13.13.02 (1.2/2) -@end itemize +RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6) +3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03 +(2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2) +9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2) +12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1) +13.03.01 (0) +@end quotation -@geindex AI-0109 (Ada 2012 feature) +@geindex AI-0185 (Ada 2012 feature) @itemize * @item -`AI-0109 Redundant check in S’Class’Input (0000-00-00)' +`AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)' -This AI is an editorial change only. It removes the need for a tag check -that can never fail. +Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide +classification functions for @code{Wide_Character} and +@code{Wide_Wide_Character}, as well as providing +case folding routines for @code{Wide_[Wide_]Character} and +@code{Wide_[Wide_]String}. -RM References: 13.13.02 (34/2) +RM References: A.03.05 (0) A.03.06 (0) @end itemize -@geindex AI-0007 (Ada 2012 feature) +@geindex AI-0188 (Ada 2012 feature) @itemize * @item -`AI-0007 Stream read and private scalar types (0000-00-00)' +`AI-0188 Case expressions (2010-01-09)' -The RM as written appeared to limit the possibilities of declaring read -attribute procedures for private scalar types. This limitation was not -intended, and has never been enforced by GNAT. +Case expressions are permitted. This allows use of constructs such as: -RM References: 13.13.02 (50/2) 13.13.02 (51/2) +@example +X := (case Y is when 1 => 2, when 2 => 3, when others => 31) +@end example + +RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33) @end itemize -@geindex AI-0065 (Ada 2012 feature) +@geindex AI-0189 (Ada 2012 feature) @itemize * @item -`AI-0065 Remote access types and external streaming (0000-00-00)' +`AI-0189 No_Allocators_After_Elaboration (2010-01-23)' -This AI clarifies the fact that all remote access types support external -streaming. This fixes an obvious oversight in the definition of the -language, and GNAT always implemented the intended correct rules. +This AI introduces a new restriction @code{No_Allocators_After_Elaboration}, +which says that no dynamic allocation will occur once elaboration is +completed. +In general this requires a run-time check, which is not required, and which +GNAT does not attempt. But the static cases of allocators in a task body or +in the body of the main program are detected and flagged at compile or bind +time. -RM References: 13.13.02 (52/2) +RM References: D.07 (19.1/2) H.04 (23.3/2) @end itemize -@geindex AI-0019 (Ada 2012 feature) +@geindex AI-0190 (Ada 2012 feature) @itemize * @item -`AI-0019 Freezing of primitives for tagged types (0000-00-00)' +`AI-0190 pragma Default_Storage_Pool (2010-09-15)' -The RM suggests that primitive subprograms of a specific tagged type are -frozen when the tagged type is frozen. This would be an incompatible change -and is not intended. GNAT has never attempted this kind of freezing and its -behavior is consistent with the recommendation of this AI. +This AI introduces a new pragma @code{Default_Storage_Pool}, which can be +used to control storage pools globally. +In particular, you can force every access +type that is used for allocation (`new') to have an explicit storage pool, +or you can declare a pool globally to be used for all access types that lack +an explicit one. -RM References: 13.14 (2) 13.14 (3/1) 13.14 (8.1/1) 13.14 (10) 13.14 (14) 13.14 (15.1/2) +RM References: D.07 (8) @end itemize -@geindex AI-0017 (Ada 2012 feature) +@geindex AI-0193 (Ada 2012 feature) @itemize * @item -`AI-0017 Freezing and incomplete types (0000-00-00)' +`AI-0193 Alignment of allocators (2010-09-16)' -So-called ‘Taft-amendment types’ (i.e., types that are completed in package -bodies) are not frozen by the occurrence of bodies in the -enclosing declarative part. GNAT always implemented this properly. +This AI introduces a new attribute @code{Max_Alignment_For_Allocation}, +analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead +of size. -RM References: 13.14 (3/1) +RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1) +13.11.01 (2) 13.11.01 (3) @end itemize -@geindex AI-0060 (Ada 2012 feature) +@geindex AI-0194 (Ada 2012 feature) @itemize * @item -`AI-0060 Extended definition of remote access types (0000-00-00)' +`AI-0194 Value of Stream_Size attribute (0000-00-00)' -This AI extends the definition of remote access types to include access -to limited, synchronized, protected or task class-wide interface types. -GNAT already implemented this extension. +The @code{Stream_Size} attribute returns the default number of bits in the +stream representation of the given type. +This value is not affected by the presence +of stream subprogram attributes for the type. GNAT has always implemented +this interpretation. -RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18) +RM References: 13.13.02 (1.2/2) @end itemize -@geindex AI-0114 (Ada 2012 feature) +@geindex AI-0195 (Ada 2012 feature) @itemize * @item -`AI-0114 Classification of letters (0000-00-00)' +`AI-0195 Invalid value handling is implementation defined (2010-07-03)' -The code points 170 (@code{FEMININE ORDINAL INDICATOR}), -181 (@code{MICRO SIGN}), and -186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered -lower case letters by Unicode. -However, they are not allowed in identifiers, and they -return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}. -This behavior is consistent with that defined in Ada 95. +The handling of invalid values is now designated to be implementation +defined. This is a documentation change only, requiring Annex M in the GNAT +Reference Manual to document this handling. +In GNAT, checks for invalid values are made +only when necessary to avoid erroneous behavior. Operations like assignments +which cannot cause erroneous behavior ignore the possibility of invalid +values and do not do a check. The date given above applies only to the +documentation change, this behavior has always been implemented by GNAT. -RM References: A.03.02 (59) A.04.06 (7) +RM References: 13.09.01 (10) @end itemize -@geindex AI-0185 (Ada 2012 feature) +@geindex AI-0196 (Ada 2012 feature) @itemize * @item -`AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)' +`AI-0196 Null exclusion tests for out parameters (0000-00-00)' -Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide -classification functions for @code{Wide_Character} and -@code{Wide_Wide_Character}, as well as providing -case folding routines for @code{Wide_[Wide_]Character} and -@code{Wide_[Wide_]String}. +Null exclusion checks are not made for @code{out} parameters when +evaluating the actual parameters. GNAT has never generated these checks. -RM References: A.03.05 (0) A.03.06 (0) +RM References: 6.04.01 (13) @end itemize -@geindex AI-0031 (Ada 2012 feature) +@geindex AI-0198 (Ada 2012 feature) @itemize * @item -`AI-0031 Add From parameter to Find_Token (2010-07-25)' +`AI-0198 Inheriting abstract operators (0000-00-00)' -A new version of @code{Find_Token} is added to all relevant string packages, -with an extra parameter @code{From}. Instead of starting at the first -character of the string, the search for a matching Token starts at the -character indexed by the value of @code{From}. -These procedures are available in all versions of Ada -but if used in versions earlier than Ada 2012 they will generate a warning -that an Ada 2012 subprogram is being used. +This AI resolves a conflict between two rules involving inherited abstract +operations and predefined operators. If a derived numeric type inherits +an abstract operator, it overrides the predefined one. This interpretation +was always the one implemented in GNAT. -RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51) -A.04.05 (46) +RM References: 3.09.03 (4/3) @end itemize -@geindex AI-0056 (Ada 2012 feature) +@geindex AI-0199 (Ada 2012 feature) @itemize * @item -`AI-0056 Index on null string returns zero (0000-00-00)' +`AI-0199 Aggregate with anonymous access components (2010-07-14)' -The wording in the Ada 2005 RM implied an incompatible handling of the -@code{Index} functions, resulting in raising an exception instead of -returning zero in some situations. -This was not intended and has been corrected. -GNAT always returned zero, and is thus consistent with this AI. +A choice list in a record aggregate can include several components of +(distinct) anonymous access types as long as they have matching designated +subtypes. -RM References: A.04.03 (56.2/2) A.04.03 (58.5/2) +RM References: 4.03.01 (16) @end itemize -@geindex AI-0137 (Ada 2012 feature) +@geindex AI-0200 (Ada 2012 feature) @itemize * @item -`AI-0137 String encoding package (2010-03-25)' +`AI-0200 Mismatches in formal package declarations (0000-00-00)' -The packages @code{Ada.Strings.UTF_Encoding}, together with its child -packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings}, -and @code{Wide_Wide_Strings} have been -implemented. These packages (whose documentation can be found in the spec -files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads}, -@code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of -@code{String}, @code{Wide_String}, and @code{Wide_Wide_String} -values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and -UTF-16), as well as conversions between the different UTF encodings. With -the exception of @code{Wide_Wide_Strings}, these packages are available in -Ada 95 and Ada 2005 mode as well as Ada 2012 mode. -The @code{Wide_Wide_Strings} package -is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95 -mode since it uses @code{Wide_Wide_Character}). +This AI plugs a gap in the RM which appeared to allow some obviously intended +illegal instantiations. GNAT has never allowed these instantiations. -RM References: A.04.11 +RM References: 12.07 (16) @end itemize -@geindex AI-0038 (Ada 2012 feature) +@geindex AI-0201 (Ada 2012 feature) @itemize * @item -`AI-0038 Minor errors in Text_IO (0000-00-00)' +`AI-0201 Independence of atomic object components (2010-07-22)' -These are minor errors in the description on three points. The intent on -all these points has always been clear, and GNAT has always implemented the -correct intended semantics. +If an Atomic object has a pragma @code{Pack} or a @code{Component_Size} +attribute, then individual components may not be addressable by independent +tasks. However, if the representation clause has no effect (is confirming), +then independence is not compromised. Furthermore, in GNAT, specification of +other appropriately addressable component sizes (e.g. 16 for 8-bit +characters) also preserves independence. GNAT now gives very clear warnings +both for the declaration of such a type, and for any assignment to its components. -RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.10.08 (10) A.10.08 (24) +RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2) @end itemize -@geindex AI-0044 (Ada 2012 feature) +@geindex AI-0203 (Ada 2012 feature) @itemize * @item -`AI-0044 Restrictions on container instantiations (0000-00-00)' +`AI-0203 Extended return cannot be abstract (0000-00-00)' -This AI places restrictions on allowed instantiations of generic containers. -These restrictions are not checked by the compiler, so there is nothing to -change in the implementation. This affects only the RM documentation. +A return_subtype_indication cannot denote an abstract subtype. GNAT has never +permitted such usage. -RM References: A.18 (4/2) A.18.02 (231/2) A.18.03 (145/2) A.18.06 (56/2) A.18.08 (66/2) A.18.09 (79/2) A.18.26 (5/2) A.18.26 (9/2) +RM References: 3.09.03 (8/3) @end itemize -@geindex AI-0127 (Ada 2012 feature) +@geindex AI-0205 (Ada 2012 feature) @itemize * @item -`AI-0127 Adding Locale Capabilities (2010-09-29)' +`AI-0205 Extended return declares visible name (0000-00-00)' -This package provides an interface for identifying the current locale. +This AI corrects a simple omission in the RM. Return objects have always +been visible within an extended return statement. -RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06 -A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13 +RM References: 8.03 (17) @end itemize -@geindex AI-0002 (Ada 2012 feature) +@geindex AI-0206 (Ada 2012 feature) @itemize * @item -`AI-0002 Export C with unconstrained arrays (0000-00-00)' +`AI-0206 Remote types packages and preelaborate (2010-07-24)' -The compiler is not required to support exporting an Ada subprogram with -convention C if there are parameters or a return type of an unconstrained -array type (such as @code{String}). GNAT allows such declarations but -generates warnings. It is possible, but complicated, to write the -corresponding C code and certainly such code would be specific to GNAT and -non-portable. +Remote types packages are now allowed to depend on preelaborated packages. +This was formerly considered illegal. -RM References: B.01 (17) B.03 (62) B.03 (71.1/2) +RM References: E.02.02 (6) @end itemize -@geindex AI-0216 (Ada 2012 feature) +@geindex AI-0207 (Ada 2012 feature) @itemize * @item -`AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)' +`AI-0207 Mode conformance and access constant (0000-00-00)' -It is clearly the intention that @code{No_Task_Hierarchy} is intended to -forbid tasks declared locally within subprograms, or functions returning task -objects, and that is the implementation that GNAT has always provided. -However the language in the RM was not sufficiently clear on this point. -Thus this is a documentation change in the RM only. +This AI confirms that access_to_constant indication must match for mode +conformance. This was implemented in GNAT when the qualifier was originally +introduced in Ada 2005. -RM References: D.07 (3/3) +RM References: 6.03.01 (16/2) @end itemize -@geindex AI-0211 (Ada 2012 feature) +@geindex AI-0208 (Ada 2012 feature) @itemize * @item -`AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)' +`AI-0208 Characteristics of incomplete views (0000-00-00)' -The restriction @code{No_Relative_Delays} forbids any calls to the subprogram -@code{Ada.Real_Time.Timing_Events.Set_Handler}. +The wording in the Ada 2005 RM concerning characteristics of incomplete views +was incorrect and implied that some programs intended to be legal were now +illegal. GNAT had never considered such programs illegal, so it has always +implemented the intent of this AI. -RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2) +RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2) @end itemize -@geindex AI-0190 (Ada 2012 feature) +@geindex AI-0210 (Ada 2012 feature) @itemize * @item -`AI-0190 pragma Default_Storage_Pool (2010-09-15)' +`AI-0210 Correct Timing_Events metric (0000-00-00)' -This AI introduces a new pragma @code{Default_Storage_Pool}, which can be -used to control storage pools globally. -In particular, you can force every access -type that is used for allocation (`new') to have an explicit storage pool, -or you can declare a pool globally to be used for all access types that lack -an explicit one. +This is a documentation only issue regarding wording of metric requirements, +that does not affect the implementation of the compiler. -RM References: D.07 (8) +RM References: D.15 (24/2) @end itemize -@geindex AI-0189 (Ada 2012 feature) +@geindex AI-0211 (Ada 2012 feature) @itemize * @item -`AI-0189 No_Allocators_After_Elaboration (2010-01-23)' +`AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)' -This AI introduces a new restriction @code{No_Allocators_After_Elaboration}, -which says that no dynamic allocation will occur once elaboration is -completed. -In general this requires a run-time check, which is not required, and which -GNAT does not attempt. But the static cases of allocators in a task body or -in the body of the main program are detected and flagged at compile or bind -time. +The restriction @code{No_Relative_Delays} forbids any calls to the subprogram +@code{Ada.Real_Time.Timing_Events.Set_Handler}. -RM References: D.07 (19.1/2) H.04 (23.3/2) +RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2) @end itemize -@geindex AI-0171 (Ada 2012 feature) +@geindex AI-0214 (Ada 2012 feature) @itemize * @item -`AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)' +`AI-0214 Defaulted discriminants for limited tagged (2010-10-01)' -A new package @code{System.Multiprocessors} is added, together with the -definition of pragma @code{CPU} for controlling task affinity. A new no -dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains}, -is added to the Ravenscar profile. +Ada 2012 relaxes the restriction that forbids discriminants of tagged types +to have default expressions by allowing them when the type is limited. It +is often useful to define a default value for a discriminant even though +it can’t be changed by assignment. -RM References: D.13.01 (4/2) D.16 +RM References: 3.07 (9.1/2) 3.07.02 (3) @end itemize -@geindex AI-0210 (Ada 2012 feature) +@geindex AI-0216 (Ada 2012 feature) @itemize * @item -`AI-0210 Correct Timing_Events metric (0000-00-00)' +`AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)' -This is a documentation only issue regarding wording of metric requirements, -that does not affect the implementation of the compiler. +It is clearly the intention that @code{No_Task_Hierarchy} is intended to +forbid tasks declared locally within subprograms, or functions returning task +objects, and that is the implementation that GNAT has always provided. +However the language in the RM was not sufficiently clear on this point. +Thus this is a documentation change in the RM only. -RM References: D.15 (24/2) +RM References: D.07 (3/3) @end itemize -@geindex AI-0206 (Ada 2012 feature) +@geindex AI-0219 (Ada 2012 feature) @itemize * @item -`AI-0206 Remote types packages and preelaborate (2010-07-24)' +`AI-0219 Pure permissions and limited parameters (2010-05-25)' -Remote types packages are now allowed to depend on preelaborated packages. -This was formerly considered illegal. +This AI refines the rules for the cases with limited parameters which do not +allow the implementations to omit ‘redundant’. GNAT now properly conforms +to the requirements of this binding interpretation. -RM References: E.02.02 (6) +RM References: 10.02.01 (18/2) @end itemize -@geindex AI-0152 (Ada 2012 feature) +@geindex AI-0220 (Ada 2012 feature) @itemize * @item -`AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)' +`AI-0220 Needed components for aggregates (0000-00-00)' -Restriction @code{No_Anonymous_Allocators} prevents the use of allocators -where the type of the returned value is an anonymous access type. +This AI addresses a wording problem in the RM that appears to permit some +complex cases of aggregates with nonstatic discriminants. GNAT has always +implemented the intended semantics. -RM References: H.04 (8/1) +RM References: 4.03.01 (17) @end itemize @node GNAT language extensions,Security Hardening Features,Implementation of Ada 2012 Features,Top From patchwork Tue May 21 07:30:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90530 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31D303858424 for ; Tue, 21 May 2024 07:33:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 0A2D23858C66 for ; Tue, 21 May 2024 07:30:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A2D23858C66 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A2D23858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; cv=none; b=IDEfyiDXnZF7gCOerVoqlX6o+6kPPSMQ8EUMkuETSiWz/vWI8q6Mze3lbYNva7tAlG4j4rn6HVySTyGiCUTw1CoduL2Y5oQHHFf2F3vFa+b3K21eCDnv5BFfGQyWFWMJYn+ViJJI0pZIjW5HNZY3D8fFfmr95GkvcfVKrGUDFMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; c=relaxed/simple; bh=r6W6THgAZLQt5NVBlBiYwxgIYguJq0YXyMuRQLG53C4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ye96M3BVm/IqaEwQtoVWFJ8zWbTXTMz9H9fzbETv8ylCn3Vu0Vv9+7c4THqdaRuDPZwz6st782Pe/qB3F2W8Ob1TULZopbQU7m99yKJ7FH1mQkQWD/GaFHCXXZOQdQt5xnfG4UUVsMgl+hT57LrIluSgp++E89P4WWKcqMMBj+k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-420180b5922so39016225e9.2 for ; Tue, 21 May 2024 00:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276656; x=1716881456; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MV9OQ0t8Upx1go8MqfR1o0lNzpg5CX+iqOsgjpZxrns=; b=VexlBGqkrvsOwHM7+TcAJkmWABqpsm103U/dtDnCpRDJb+AkPbnMMT9x2l0EEdki2/ kMqoGxO0EoeEwMOWp4vFoMH52S3wCmvBuHRUglvif4Di9FyiHjYOr5KQwO7qbumgSvw7 ip9X+NOyXfx5jMy3/Dp3aTVoRpb+JZJXqhrZZrhidDL/tLb/DXmpcKZr/xN+gIwTruJl b57B2if5CJRF1NehY9AOviLz7eEQKdCh5zmZvMkFEmFhcyBdoyMABUz7KeQGes52Ck3g TnR4HgqO5Dsm2Kotgf/5liT6BgbVqA6tVEx0+HjN5A8gjSGpPGIHx2yNcxy7HmZ4rS9t rKkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276656; x=1716881456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MV9OQ0t8Upx1go8MqfR1o0lNzpg5CX+iqOsgjpZxrns=; b=ThIDnQqIDE6Z6gTqqbLs73g28v4aQ7h+QAlMDxItyb7kMQ6pnHu/f4BGdKiYma7pzQ BjXKxqLKNLgoMQ03jlmJoTIk4nECRWQ0NhFq7JnN+qCDEWiIXHx5tkpvS6IC/syC8RZ2 fJnCxQ9BYFuXKTRDTc4s4RO4JuH06JGvPQ7x2S+pd9TPouZ4LJIq+gtqvuR73cTzhU1k YGKJtTkOw1YPuQ/IDP37VFkURISRrOeAMo8+IQ+Y9yhdbwX8MnA0TaGqPa4S+9ru8P5I KmcGGqt0P8hc1+Yr+SQzxlwG8U1o6IO9YuE9oocTPQ4p6pUIlsP0+LEduPDmMsUs+jAk 2Cqw== X-Gm-Message-State: AOJu0YwyYsFQzLGhfPBpwg1ZG+w2OH4p41cya+3hgoGZk4M4Nzhv4lpV SCBfYNMJTKvw6jotMczwZMkb6vpBiXnVR5m83JYovFjHp1Oe6xd9lTqFWd+st7XhcDLBG4GaAGU = X-Google-Smtp-Source: AGHT+IELB85R6Z8iiEi2HUjf9zR38sEoehim9TGj/0Hn9Wio9PMTwlLqaPZqXieI2LAV9FPFvLvSDQ== X-Received: by 2002:a05:600c:584d:b0:420:e949:41b4 with SMTP id 5b1f17b1804b1-420e94942camr55117595e9.19.1716276655378; Tue, 21 May 2024 00:30:55 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:54 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 09/31] ada: Fix formatting in list of implemented Ada 2012 features Date: Tue, 21 May 2024 09:30:12 +0200 Message-ID: <20240521073035.314024-9-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Fix formatting; meaning is unaffected. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst: Fix formatting. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst | 6 +++--- gcc/ada/gnat_rm.texi | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst index 706de492301..9708e15de8d 100644 --- a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst +++ b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst @@ -255,7 +255,7 @@ http://www.ada-auth.org/ai05-summary.html. * *AI-0039 Stream attributes cannot be dynamic (0000-00-00)* - The RM permitted the use of dynamic expressions (such as ``ptr.all``)` + The RM permitted the use of dynamic expressions (such as ``ptr.all``) for stream attributes, but these were never useful and are now illegal. GNAT has always regarded such expressions as illegal. @@ -555,7 +555,7 @@ http://www.ada-auth.org/ai05-summary.html. This AI clarifies that 'needs finalization' is part of dynamic semantics, and therefore depends on the run-time characteristics of an object (i.e. its tag) and not on its nominal type. As the AI indicates: "we do not expect - this to affect any implementation''. + this to affect any implementation". RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) @@ -812,7 +812,7 @@ http://www.ada-auth.org/ai05-summary.html. The new syntax for iterating over arrays and containers is now implemented. Iteration over containers is for now limited to read-only iterators. Only - default iterators are supported, with the syntax: ``for Elem of C``. + default iterators are supported, with the syntax: ``for Elem of C``. RM References: 5.05 diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index df6969f98b7..776dd4a4afc 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -26913,7 +26913,7 @@ RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.1 @item `AI-0039 Stream attributes cannot be dynamic (0000-00-00)' -The RM permitted the use of dynamic expressions (such as @code{ptr.all})` +The RM permitted the use of dynamic expressions (such as @code{ptr.all}) for stream attributes, but these were never useful and are now illegal. GNAT has always regarded such expressions as illegal. @@ -27358,7 +27358,7 @@ RM References: 3.10.01 (6) 3.10.01 (9.2/2) This AI clarifies that ‘needs finalization’ is part of dynamic semantics, and therefore depends on the run-time characteristics of an object (i.e. its tag) and not on its nominal type. As the AI indicates: “we do not expect -this to affect any implementation’’. +this to affect any implementation”. RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) @end itemize @@ -27730,7 +27730,7 @@ RM References: A.04.11 The new syntax for iterating over arrays and containers is now implemented. Iteration over containers is for now limited to read-only iterators. Only -default iterators are supported, with the syntax: @code{for Elem of C}. +default iterators are supported, with the syntax: @code{for Elem of C}. RM References: 5.05 @end itemize From patchwork Tue May 21 07:30:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90539 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70ED33858283 for ; Tue, 21 May 2024 07:36:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 025723858401 for ; Tue, 21 May 2024 07:30:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 025723858401 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 025723858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; cv=none; b=dhv/lf4x7enh3Z5NPUm5wT59muGDV0E4J0sf/QyaA9jHl7ANkgB04sl4wNKb4W4jXGAJXcL7e2TklvgZxy/cYOELpq1gqhM0+U35Wi/ZhZViKKJ8Lhj7Vg3T2NW6zoaenCc1ltIIKv7CaJB7l445byFV0YIhJ4SXclQ01/VufYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; c=relaxed/simple; bh=FCQFr4K15TgjINtx+i9vAmEtQZ0u4rpm5R+GwsdxzTQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=E+QzVla652CgQJjaEqMhDYVAK5UaHeYZQCzeVDps+1XKwfPFSbhipLQmFzqva60gDEF3Rh7yJ6foNRgm6VtnwWaROi5Kl/cXsyi/VbnjaIiTXFZsBI7EcIXrW9kXuctDB7LrNOPaJKBzepFzPlULPIlDRTJiIZ+goz2TYgZp8No= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-34d7b0dac54so1787521f8f.0 for ; Tue, 21 May 2024 00:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276656; x=1716881456; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZNjb+/yqFBEgZZDHNYoUMuKHP17dJfSqQXptAtdoRxA=; b=CdXl0sUXQCkpXMTropsCY3vJ/6wny3O0ro6eBHcnEqUSCtUQawfY5itJfCXPA4Tsg7 MH3uFlkeMkCrtYN90cktNWwMcsjxV/JdZHjdbmU9KrI3TuOdgT1peuBUsSEsJO3mTaiQ Gdr17dCvhE1H82rwf3N1J2kcXkXHHCiiIqHlnRIZMIIEtUOjM6ZV5bBD95xH5hLvGE3a d5bEB2YOlpumLLV0i7jLO6zpP0F1q7vMSw0hMgiQoNaUanzi+RDjelV13YPg+h6bmHx1 evpFtp2pmlrbI0obnjh/cmYb+zlVpDjRhpZe5em3TxnK/v2GLG/QaSWB7NE2oi0PXgDt Lmeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276656; x=1716881456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZNjb+/yqFBEgZZDHNYoUMuKHP17dJfSqQXptAtdoRxA=; b=eyKir9H33SRzTfEzeIZLEAGqVz8ItMAuMPyeU24bShWly9bkRp/Uwl/ekdEj7mIs+C /AiTZqkuNzUmP78HycyGOQHVDTyaOdFUBKeATYMhsMXhRex5tFprklBLV9xCEKSpGrEJ Ktxjdc4xx8LOmD/K1wXFhGbbG8IBxCD7+Dcl9+btGmQspyeoKnch7aAKTiKAc6T1O4ub B8N/jyiNy8+uaIlpLgjrc+kANm3RqIP6v3gH/Cg0XBNs14r1YDhj2wrgHUPxuAuFuOJR OfOmwLxnPKF8gV785uPP4UszePT3cY5zRdota7x1MBMmAiNBMOM1LKDwblmyw9iF9FNS BO+w== X-Gm-Message-State: AOJu0YxaMZuEsklIK4HluuTArQhyYNy/7UIukpnm+BRtU1oucHdnevZF Q6rQHoN0K6WtDo4oSIZQShVUdUNhSbT91Dzb5ROOfVHA5Kf5/t8J7FWw8jPr3PiOh7+WYE1HY7Y = X-Google-Smtp-Source: AGHT+IGmGDMYSbt2CM4w2hUcR54qEe8w5DGGIVw8THDvsktgR/zklTe46CzHrxTT5KMCRoYcQeFXIg== X-Received: by 2002:a05:6000:1943:b0:34d:ce05:29ef with SMTP id ffacd0b85a97d-354b8e0945amr6947426f8f.17.1716276656080; Tue, 21 May 2024 00:30:56 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:55 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 10/31] ada: Remove some explicit yields in tasking run-time Date: Tue, 21 May 2024 09:30:13 +0200 Message-ID: <20240521073035.314024-10-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Ronan Desplanques This patch removes three occurrences where tasking run-time subprograms yielded control shortly before conditional calls to Sleep, in order to avoid these calls more often. It was intended as an optimization on systems where calls to Sleep are costly and in particular VMS. A problem was that two of the yields contained data races that were reported by thread sanitizing tools on some platforms, and that's the motivation for removing them. gcc/ada/ * libgnarl/s-taenca.adb (Wait_For_Completion): Remove call to Yield. * libgnarl/s-tasren.adb (Timed_Selective_Wait, Wait_For_Call): Remove calls to Yield. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnarl/s-taenca.adb | 12 ------------ gcc/ada/libgnarl/s-tasren.adb | 24 ------------------------ 2 files changed, 36 deletions(-) diff --git a/gcc/ada/libgnarl/s-taenca.adb b/gcc/ada/libgnarl/s-taenca.adb index cd9c53b19fe..1dc8ec518bd 100644 --- a/gcc/ada/libgnarl/s-taenca.adb +++ b/gcc/ada/libgnarl/s-taenca.adb @@ -410,18 +410,6 @@ package body System.Tasking.Entry_Calls is Self_Id.Common.State := Entry_Caller_Sleep; - -- Try to remove calls to Sleep in the loop below by letting the caller - -- a chance of getting ready immediately, using Unlock & Yield. - -- See similar action in Wait_For_Call & Timed_Selective_Wait. - - STPO.Unlock (Self_Id); - - if Entry_Call.State < Done then - STPO.Yield; - end if; - - STPO.Write_Lock (Self_Id); - loop Check_Pending_Actions_For_Entry_Call (Self_Id, Entry_Call); diff --git a/gcc/ada/libgnarl/s-tasren.adb b/gcc/ada/libgnarl/s-tasren.adb index d65b9f011b0..6face7ef8d4 100644 --- a/gcc/ada/libgnarl/s-tasren.adb +++ b/gcc/ada/libgnarl/s-tasren.adb @@ -1317,18 +1317,6 @@ package body System.Tasking.Rendezvous is Self_Id.Common.State := Acceptor_Delay_Sleep; - -- Try to remove calls to Sleep in the loop below by letting the - -- caller a chance of getting ready immediately, using Unlock - -- Yield. See similar action in Wait_For_Completion/Wait_For_Call. - - Unlock (Self_Id); - - if Self_Id.Open_Accepts /= null then - Yield; - end if; - - Write_Lock (Self_Id); - -- Check if this task has been aborted while the lock was released if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then @@ -1510,18 +1498,6 @@ package body System.Tasking.Rendezvous is begin Self_Id.Common.State := Acceptor_Sleep; - -- Try to remove calls to Sleep in the loop below by letting the caller - -- a chance of getting ready immediately, using Unlock & Yield. - -- See similar action in Wait_For_Completion & Timed_Selective_Wait. - - Unlock (Self_Id); - - if Self_Id.Open_Accepts /= null then - Yield; - end if; - - Write_Lock (Self_Id); - -- Check if this task has been aborted while the lock was released if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then From patchwork Tue May 21 07:30:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90533 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 99B51385842D for ; Tue, 21 May 2024 07:34:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 1C7F5385840C for ; Tue, 21 May 2024 07:30:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C7F5385840C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1C7F5385840C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; cv=none; b=p9khytaGQOasQqK/7eMmbJ59t9UnKUe5JEF2X5aT7p1ZmPqFwMa4LxKQjxQ97GQ7fdFfUR2Rynv7ntQQdTEyx/x1GrFf7DkUY7TZnuUUHBOMXTiqbqD9k37imiBpoNHAs7Bws1eaRaq5fG2uTLPU5XXzy7Y3a2F4KwAHxHJMRG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; c=relaxed/simple; bh=wH3WYbhq3R4cc/Ktn30nZVHYEeQXKhDMyrKLq72Xhbo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LKKByw8+AidXVbwgDMSt5qJvbAnDyh99LKpFn8hC/Wxv03MtHEO6saDW/rzp3SzoIet7dIKd+phZHGBmn/DXY7bqobquGwyRf/PMw0IVRLHNiiUcNWdcZjcUfik7E8YC09Ap+4TYn+XAJMuhJ8gWqGACymFPk70alA6nxtZUQ2Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41fc5645bb1so25612595e9.1 for ; Tue, 21 May 2024 00:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276657; x=1716881457; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vuf4WGfyuOLi1r2aI5FRczlqMI7ScbbeRzx0Bbv4Ah4=; b=i3WXqYL7jqWkzA6IMckipnuwCeMXM7GnBAwAXRhKOZTOkHCZwea0Bm0/n1T/K11G9G IxM0ktIDPT8lARLUeOTV9uS0TGbME20gTG94cFZZxoOK2ug4/9zXQolzcmz5F3+WgkLw AmdVc2OlzIWerUdsjuoH7RHy9T+BoKGqMeqi2lx9Uu++SsZvN0/JVuKOE+zrQ9gAqDgZ aHHhGzbfQSfL9747+gpQFVpGzTiznDTYnlZo/Bj0t7Pfl1ot70P2I64y03KP5nJzKtqS ZUSsoA9wqIpKuCglWCZTr4ywOehg4o6v8L6Cxc/n6QovzFrLvBdh1i/Wx/tclgzw9Cym 2iBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276657; x=1716881457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vuf4WGfyuOLi1r2aI5FRczlqMI7ScbbeRzx0Bbv4Ah4=; b=Vt8cFU/UajgU1BaKmNZP2MwmqV9JUnAfP/DdOKMQbGs6/gAZjaQghsS1A41033SlQa mq8YCoB4nCPq0n/HWTvDV503OjqA2LXSjyntVI0I9yphrcH9rTSkcZsjhCGl9F0Y1CrM mQS8YdpS5gMnlj4DrGuSbqt77YttUsmlfrjt8CsTKXC5HrFKMEYHgFTiRlJMp3iyzFUY dGvMQ3+w0vZr2VGr5R/mCmFGV2f7ztcjgTtvVrIz/1JWbuhe8JtZR2aJJLIcyHDKO4oK 7Df5HPxYM0i4vYQ1Ra1q+AGyP5EJBPcJph55/RQbhC4v1BS2AYnuMTFeVkjBpO3mCoa3 OOGw== X-Gm-Message-State: AOJu0YzXm+5psf3xc8itQa9h5jXpARTtJxuQcK7V0YyZEX4I/238/lca rcoqzZmHY9RSgFmUWZMtyk0IPr8X29OQHczOeDmGHistFpO2a1r/e94xZLH54/tc1fUDgUYhKWc = X-Google-Smtp-Source: AGHT+IFAsMWRqN+DS+riR6VsDFPS00S9YQt+shokDETLziOKOendNx1cp0Ao6BlWG4fNKaegOi/VOA== X-Received: by 2002:a05:600c:1d13:b0:41e:1bc1:36de with SMTP id 5b1f17b1804b1-41feac59cb4mr249542685e9.26.1716276656840; Tue, 21 May 2024 00:30:56 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:56 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 11/31] ada: Simplify management of scopes while inlining Date: Tue, 21 May 2024 09:30:14 +0200 Message-ID: <20240521073035.314024-11-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * inline.adb (Add_Scope_To_Clean): Use Append_Unique_Elmt. (Analyze_Inlined_Bodies): Refine type of a local counter; remove extra whitespace. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/inline.adb | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index a628a59e145..17b3099e6a6 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -845,19 +845,8 @@ package body Inline is ------------------------ procedure Add_Scope_To_Clean (Scop : Entity_Id) is - Elmt : Elmt_Id; - begin - Elmt := First_Elmt (To_Clean); - while Present (Elmt) loop - if Node (Elmt) = Scop then - return; - end if; - - Next_Elmt (Elmt); - end loop; - - Append_Elmt (Scop, To_Clean); + Append_Unique_Elmt (Scop, To_Clean); end Add_Scope_To_Clean; -------------- @@ -915,7 +904,7 @@ package body Inline is procedure Analyze_Inlined_Bodies is Comp_Unit : Node_Id; - J : Int; + J : Nat; Pack : Entity_Id; Subp : Subp_Index; S : Succ_Index; @@ -2569,8 +2558,8 @@ package body Inline is (Proc_Id : out Entity_Id; Decl_List : out List_Id) is - Formals : constant List_Id := New_List; - Subp_Name : constant Name_Id := New_Internal_Name ('F'); + Formals : constant List_Id := New_List; + Subp_Name : constant Name_Id := New_Internal_Name ('F'); Body_Decls : List_Id := No_List; Decl : Node_Id; From patchwork Tue May 21 07:30:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90529 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 253C13858283 for ; Tue, 21 May 2024 07:32:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id B38D23858C39 for ; Tue, 21 May 2024 07:30:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B38D23858C39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B38D23858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276663; cv=none; b=qh8lLW+vwZX+n/tYMb4bkSFeP1LVoIswGrcGHCo35HrZxct2PwT8lEa7u+IhYsXMSPc/3HtBT4Q+O3PvOWi4a59qqMAN0+xqkcAANe9PeqLYr7gVcF/GLCqJyCwN4sJKzuht7/QpFhONTq7bs+3yx6gPC9MWDmMDEJaBZnpu+Ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276663; c=relaxed/simple; bh=PLSCBuwPclCziwDqN7hTN5MO3hP5vhVCcaX/ddxeEHA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IUnAjpX53zrKlXbR28Rop2Adv2PgZjFwRu16rvZmSqEeBznmselXZhyf8eepG4aSVq/ap3QYk76zUetszfivDfxQ0JqQ59tCEMbXJUBG/r/Gwd/O58JDqIGfagmwW2V2O5zc1tYjYskXdU2XjWkaqGO7be+pWvzxtzBjpkK80iM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4202cea98daso27537725e9.0 for ; Tue, 21 May 2024 00:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276657; x=1716881457; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sqGEJkxfzpgy/BnlFTCqPo8ronFU0hTDWPliH9ChJ3E=; b=YSdyl20E0WF+jcbsS70y2mnr45myXa9sv8kw3SaTF3jw0aAXUSCw42IO+bPMU8J7EK hZHlYpbWKLeDuKjU5WDCXfNAMqn5H9oaAHLvaeFHm3D/ayaU/j647kheTzgOF7x9a8td k2ji0bYfhTc/UaJobR0Sg+9Qyyjd7bpVJeRf1WyYtuzjkLKQPow3zG0Fg2c/M2NefQRD sGyZlkMpNwK2Dwi966UyfAnzID0Pj2ypodRhwSTQ5Ejl+6Ns6swg9otDUzNSG//LpOe0 N0v6sYX0XFnWTsmfiTN9f4eJ5X4H0cLYMsfMg/+Y1f+axw4dog1ryvWdEJoh9TPUMPtV v6GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276657; x=1716881457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sqGEJkxfzpgy/BnlFTCqPo8ronFU0hTDWPliH9ChJ3E=; b=GtyWZolO/m7wkahi3nPzAlwoHQFT+WuLgzRfcSQHw8eojmTTU4Z+KNiWfpBGiOVsoW VqMO1lg6VD0hErWQd5jGBnbWtGueHejdfh2SbpUJob1lN1uw7BPuRoT2nSf5u7pHNeHO zosFtU8B//vr2lEhG6MUKeL2YmkG0X9uBNBLn6YR/G7b42eYD3hV9zqI4gojTeLf7WAe uswgBmxUSn29yGfelCnq5TsOmU3PIfdCatdbfHJ6KExV1bL4/n5FQ/tzyXFrT3/0kbXv eFrB1arPgcPW7k48811zB2TnGrWdARWRg07rc8VULqx0izaXIRbNF90pNQIoCWA5+6fU eVkg== X-Gm-Message-State: AOJu0YxCC64PiK4qhB6A/imPR6BeIPUpwM8nuyYAaE8Z1XhXiDBd4zWR bXovnAqbSyYjY0V35D3VGGCbBdjdi+Cy8rhZjtZiDZyJY5Dm11NrvmqbKPSUenQksBwrUIo3xS4 = X-Google-Smtp-Source: AGHT+IFkC8N9Z7w3My2QpF/t3hGQMeIM+RaOt5p5ab2lc6m+PlDbpzAr8TQGyqPof2kPoWa0EUP5aQ== X-Received: by 2002:a05:600c:4e88:b0:420:1551:96ab with SMTP id 5b1f17b1804b1-42015519952mr198193855e9.10.1716276657532; Tue, 21 May 2024 00:30:57 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:57 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 12/31] ada: Add elaboration switch tags to info messages Date: Tue, 21 May 2024 09:30:15 +0200 Message-ID: <20240521073035.314024-12-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Viljar Indus Add the ?$? insertion characters for elaboration message so they would be marked with the [-gnatel] tag. Note that these insertion characters were not added for SPARK elaboration messages: gcc/ada/ * sem_elab.adb: Add missing elaboration insertion characters to info messages. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_elab.adb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 9205f4cef82..4d6e14cc49c 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -4920,7 +4920,7 @@ package body Sem_Elab is and then not New_In_State.Suppress_Info_Messages then Error_Msg_NE - ("info: access to & during elaboration", Attr, Subp_Id); + ("info: access to & during elaboration?$?", Attr, Subp_Id); end if; -- Warnings are suppressed when a prior scenario is already in that @@ -5027,7 +5027,7 @@ package body Sem_Elab is and then not New_In_State.Suppress_Info_Messages then Error_Msg_NE - ("info: activation of & during elaboration", Call, Obj_Id); + ("info: activation of & during elaboration?$?", Call, Obj_Id); end if; -- Nothing to do when the call activates a task whose type is defined @@ -6461,7 +6461,7 @@ package body Sem_Elab is if In_SPARK then return " in SPARK"; else - return ""; + return "?$?"; end if; end Suffix; @@ -8277,7 +8277,9 @@ package body Sem_Elab is Error_Msg_Name_1 := Prag_Nam; Error_Msg_Qual_Level := Nat'Last; - Error_Msg_NE ("info: missing pragma % for unit &", N, Unit_Id); + Error_Msg_NE + ("info: missing pragma % for unit &?$?", N, + Unit_Id); Error_Msg_Qual_Level := 0; end if; end Info_Missing_Pragma; @@ -8406,7 +8408,8 @@ package body Sem_Elab is Error_Msg_Qual_Level := Nat'Last; Error_Msg_NE - ("info: implicit pragma % generated for unit &", N, Unit_Id); + ("info: implicit pragma % generated for unit &?$?", + N, Unit_Id); Error_Msg_Qual_Level := 0; Output_Active_Scenarios (N, In_State); From patchwork Tue May 21 07:30:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90537 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 759DE3858C66 for ; Tue, 21 May 2024 07:35:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id 9F9343858414 for ; Tue, 21 May 2024 07:30:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F9343858414 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9F9343858414 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276664; cv=none; b=tYGwoF6DNvCl39Ki2fKbYXjVmLWLzbypOLIMD8U7NqMJCi4m84bhJ0bJOiQrTisnxTq2f8++PSG9esJHUg9aOP3TesnBUbwfDMduoAJEl5iDF9FIEdZSz04MOtq9A85arc1vipRUVYSSyC9x6onqlWCO/djQO8bYbDqa4fmvCJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276664; c=relaxed/simple; bh=xqH6fwc+bC0NTHUSgXqLHiNOxPV9Um9d7apK0JmmXhI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xJlpr0hruE8T6fzj6V5JZjR02pSvwdfIoq9s3QfKK9gOpZy3VUVuvdDNU/cn1G93rd5JOSQxiZ/3iebtiXkaHLCEF2QO4MvkOGHzmPJ75IWpoj/il5AOofh3apiO21F54UcpBnqDBxISBd5AC6HXgrJbrv9LO8fRaXF/CSR3GCQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e576057c56so38878411fa.3 for ; Tue, 21 May 2024 00:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276658; x=1716881458; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hp6FHk886dw8tutJUGrs9O0+SKU9DGSzjmfJ2aASCEk=; b=d4kqL7WM40kfC3gaurH7/FrAcjTJmZwSpEcF+PdulqLGgcSl5jXZasWXvDB69YeFon UBkSoU8ZlI8M7ExjXCOJ0hK5sbaqNqiD5Cc9wjtS2VvyY79vvU/8FtAquC/JFNg6/AvE kGOCCmBciaX6/jEzsMJJ+62qG7eJcLTfRdscjwUI135abmg2jG56jSxrPZpU8lokrbwN 1GCtJpZT6ly511sShX4KD6B/swESFSmlUE+TvPfvQwO6ugUULe9fbMIsYZN4LJtI2qt3 ooxRBdks1WGn6G1k2TXxIqBaRJH1BSvotM9FCmbwljGPEzE4+Ag1Pk7fe2YnHY57hyDX OsaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276658; x=1716881458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hp6FHk886dw8tutJUGrs9O0+SKU9DGSzjmfJ2aASCEk=; b=Uk8QR9SihQfLEg66Hs1NibfBLcQXEDzVFuXmNnobiWb28TdY6agcrqxPhOFcgDy5A+ LAtiWBt7aWsfTBtj9ochu6QF0LSXwPv7zWmotavYNggr/Zja0mQNz/vG0HLlf4NfKRfA 5ZgGvpvCzKF2BiOgB2l5L9kEE7w3ObO1OfHsUdkt1Ncn4jNpCfZ4Prgs3U83bRQSImqG PvVF2gmIgPqL+dh4IRc/2QirUCKoZ+RJBwsYDxeUoLiadFM6pQzheLfX0hlahCJaeV79 5FKw8kFAvKvjEZ3PrfLwxOaLYBIMmkz5in/tP2Nl8uMDjfxzdK3+orfnTPtQZw4WyVim degg== X-Gm-Message-State: AOJu0YyEbozcjz1qvc0npd5OXlRzeO7ilcqj0hj+UtAt8goLLMI+k4Et OGiQbrXV7N0jZ350XrItclzbYDXH4U1/UUd023o09J3tRadyExsA+5YUWuQNa1j2I25A0EPnJ84 = X-Google-Smtp-Source: AGHT+IHYLFj21mC+iy45Xtjg23v3urwG1khhY5n45k3XWgKXPgzgYqO0pA70T7luvbtz/uIlDxJkMw== X-Received: by 2002:a05:651c:14f:b0:2df:eee9:c71f with SMTP id 38308e7fff4ca-2e51fc36881mr189791041fa.7.1716276658271; Tue, 21 May 2024 00:30:58 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:57 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 13/31] ada: Remove useless trampolines caused by Unchecked_Conversion Date: Tue, 21 May 2024 09:30:16 +0200 Message-ID: <20240521073035.314024-13-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou The partial solution implemented in Validate_Unchecked_Conversion to support unchecked conversions between addresses and pointers to subprograms, for the platforms where pointers to subprograms do not all have the same size, turns out to be counter-productive for others because it may cause the creation of useless trampolines, which in turn makes the stack executable. gcc/ada/ * sem_ch13.adb (Validate_Unchecked_Conversion): Restrict forcing the Can_Use_Internal_Rep flag to platforms that require unnesting. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 59c80022c20..4cf6fc9a645 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -18132,20 +18132,23 @@ package body Sem_Ch13 is Set_No_Strict_Aliasing (Implementation_Base_Type (Target)); end if; - -- If the unchecked conversion is between Address and an access - -- subprogram type, show that we shouldn't use an internal - -- representation for the access subprogram type. + -- For code generators that do not support nested subprograms, if the + -- unchecked conversion is between Address and an access subprogram + -- type, show that we shouldn't use an internal representation for the + -- access subprogram type. - if Is_Access_Subprogram_Type (Target) - and then Is_Descendant_Of_Address (Source) - and then In_Same_Source_Unit (Target, N) - then - Set_Can_Use_Internal_Rep (Base_Type (Target), False); - elsif Is_Access_Subprogram_Type (Source) - and then Is_Descendant_Of_Address (Target) - and then In_Same_Source_Unit (Source, N) - then - Set_Can_Use_Internal_Rep (Base_Type (Source), False); + if Unnest_Subprogram_Mode then + if Is_Access_Subprogram_Type (Target) + and then Is_Descendant_Of_Address (Source) + and then In_Same_Source_Unit (Target, N) + then + Set_Can_Use_Internal_Rep (Base_Type (Target), False); + elsif Is_Access_Subprogram_Type (Source) + and then Is_Descendant_Of_Address (Target) + and then In_Same_Source_Unit (Source, N) + then + Set_Can_Use_Internal_Rep (Base_Type (Source), False); + end if; end if; -- Generate N_Validate_Unchecked_Conversion node for back end in case From patchwork Tue May 21 07:30:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90543 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50AC53858C33 for ; Tue, 21 May 2024 07:37:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 2037F3858424 for ; Tue, 21 May 2024 07:31:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2037F3858424 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2037F3858424 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276664; cv=none; b=VlfIewKzFK4hrRJ2YyY5YqKWBFs/y93+gywXOmG21NuWTN8Sl4eR7uFoluPMmwZ6BhgC1FS4K4ewWC32GRcrCmPqSdI+tfVq3/ZkzS6h794val2XAHwY1lXAqnSfsM8zv7L6XPq5gSxlyreI8CLoZcpN01WPsA0rxPuZNHiPDaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276664; c=relaxed/simple; bh=ExJWawZ9+Ll15E2mOLZj+rGYD1iy5I/WD+NKnEHG6iA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ai9CE/iOaipYMfWWKBcQ5TvSzamSFbzjaCzevXE1WdYy5mds7z6TCUpzSp94QMQ7dp6bkIaiVM6gD1qcQME2m29cmcZydFWvOKBMSl31lXgXUHbjzGPqtVi+KBmmcKexOUINwU3D8gsaxKIzteIlBueY0i5SBH7Ox90xv+0g3Y0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41fd5dc04f0so20788885e9.0 for ; Tue, 21 May 2024 00:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276659; x=1716881459; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=06ZfP5QJci5mRvtonyPky0jsVRmRyKToo1R43A2MmOo=; b=Z7QGPFITJ0SLd/OwC/hdOYqhLNHEkYrUz7cvsQ5HapV30U4xK3P+eG4zBJQv8KJHbB C35s2cKyyI5vDcaYw3Aidnn6qwJRMPUAoaxFauXQwuK89663SQ7a5AwlkzR787e2uym3 umEPxtn4jV1ca6o5ztzNwyjI7sevXDBHIGcromF3wqwK2e72+YRG5emQ7/NsmsNyIC9L tLbC8/H9f70FiMn9LIB0eNhuwe1uRuL+fqoSDJl1FR324f4wipdDQK7p7uRUiXv11AhR CBv26EW5L5oVSQN/zch4ZBBdmc/mTh2gy+YuMzFCYR+8yy09oh3qx6B1P42znO5Yl599 seCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276659; x=1716881459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=06ZfP5QJci5mRvtonyPky0jsVRmRyKToo1R43A2MmOo=; b=qLjOBa2c8C9b0I9Any/4ZwAEjc3kXL6uxAc4OhuTQnq4/SqBVkjzJnAzLkAC8Wqk4j BGFMNTb2TSLnQMyLFJMBtGshLVEP4k58Z9KJAcAfNHANhKZcsz7lOunvIW8fhw/Pnu5x 4kOUlvr3djNE+z7KCn5cEMyAyesqXHLH2yrdekDFALknbihBbtH0J/uHbVDJvpb41hgl cjpL2VvRfW8HUVKzCqbgGXKimxwUq37EoSqg66JHO3Qpsha8zTeWJe33LjR+u98UjEie cUNjfZpZ78yKrjUzMgc4L52W9MRah8kTwWX0GSM4seuWAm2+jd41LhWEtKYQ6e69qPg4 bpgw== X-Gm-Message-State: AOJu0YzzZBlvKmE03Aoh054y1zTEqm1G0zKLlG0NfysHRt9E8ai22QBH m5jzSo6XCHoNiW5Ac6atT30bLybKgnHmeH01azviKiI87uKeT26FH8AYTu6IozLy3nsBj2yX0mM = X-Google-Smtp-Source: AGHT+IHxKRMs7N4V84oaosg/VhF8TkmGeypzysni31tXbitR8e3z7cQ77t5dt1Q22AW/jKoLszm24w== X-Received: by 2002:a05:600c:1d0a:b0:41c:2699:dd9d with SMTP id 5b1f17b1804b1-41feac55694mr311562895e9.28.1716276658929; Tue, 21 May 2024 00:30:58 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:58 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 14/31] ada: Remove duplicate statement Date: Tue, 21 May 2024 09:30:17 +0200 Message-ID: <20240521073035.314024-14-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Ronan Desplanques This patch removes a duplicate statement that was useless and could be misleading to the reader by suggesting that there are multiple global variables named Style_Check, while there is just one. gcc/ada/ * frontend.adb (Frontend): Remove duplicate statement. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/frontend.adb | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb index bd0f0c44ff4..ece0e728e4a 100644 --- a/gcc/ada/frontend.adb +++ b/gcc/ada/frontend.adb @@ -158,7 +158,6 @@ begin -- intended -gnatg or -gnaty compilations. We also disconnect checking -- for maximum line length. - Opt.Style_Check := False; Style_Check := False; -- Capture current suppress options, which may get modified From patchwork Tue May 21 07:30:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90541 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E773384AB4F for ; Tue, 21 May 2024 07:36:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 2A63E3858D38 for ; Tue, 21 May 2024 07:31:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A63E3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A63E3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276665; cv=none; b=trmOHN/WNwEZCaEW8F4slgc77A4dMX+/CrG7Suq44Vf6Vh056N/QEdBcEI7UiP4fRRboLLTjMIipHO2E5fjSh18C0qaHBHY0y6nQ6LOfo8ntVjTk8o5ow+a2lSBa2flySYDZkzPROSsBbFCm9I8CHHcIBdMFOpVL5VoS/uU3aTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276665; c=relaxed/simple; bh=sbKFqlw7EHkr2v0X7sXpIbnFevZv4mNu3fsaXZfBzKI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MZhjhmvc2fM6n+9WiPU1FbDYZKvI9B2r9/oWjZ6UXQJle65PNSMKbmOGnRvY5rgmu2KC/C83AytOFvgvWhEIW3ukaELWJe5nHt8pAgftk4ieE0nAx62L6y2cKtK2gWm2DSkAztirJ8sfIsJ9u3Qvcq5aIJBt87JxI4kPa9g2UqU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-420160f8f52so27209645e9.0 for ; Tue, 21 May 2024 00:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276660; x=1716881460; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1WaJbap7/vcovB1GrI+EtbHqGpYwkCZAaPRnsOm6JrQ=; b=IzRN5Qn4uJvPBMh0GMavnQPBukGY5MURivCtfgC8VVc3bBTb035GzB75JkLjkO/fG+ kFIfYiqqoG6LaVuVm+nd4Thwmth13ZvYQ8rpeS3V8+eVCd8RY6B3BcKsCYd4i3wySHzP s7bK6idaoBp1wOawBtFQ8ncxZ0zuvmsXvcquNa81Oe8gT/iR16aylZXSeO7oJcrMw2Z0 COPwPhVhiEuCY4CKymGzObWCT+wUTlDh6hj+PvlBt8rmEDGGKGBj+ewUu43GrnEApW5e 7z2E3GvuPoAFL2AGgW716YJ/H2oYEutiu6VT7bNq7/W9iL+YXDLyu8gEgqMEc5B6Rren l/nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276660; x=1716881460; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1WaJbap7/vcovB1GrI+EtbHqGpYwkCZAaPRnsOm6JrQ=; b=w9EQrOP8TJj/30QdGYF6yB8iPrC8wrJO75LcCE2SsPX5oFhNFAWFP3IUVqx1DYhBQi mGmeJ4KWKForimNGOdwE3/vljERRFyXzGZm9JgDlzVb5vYiVWj8PJqk/oVnHrAaCcy3+ LRTTuxMy77EGyAVF8ZY5nkmHzytslz8irtBn0wm39LhuE/oTc3y8xH3UFvTcf2RihRF8 PVCJJn45UBoXrExsIu+mQdy+PoDVB/tqLV8tZ/rYNha/eeUI4YZOrfzhZOCNexwoXw1H No2jrutCwuq9xILu/u7VwIfvrLl4Sjl/1+KbX4a0jQbAgSFFbpCzzaX6NNrq/V6skx44 DlCQ== X-Gm-Message-State: AOJu0Yxx8oIq2QA5fkjy37sUa8dyLIB9bhbBMPW3XmTPzNYc9jJ6QRu5 B1b9n1M4BZMyq9zxv7fRmobFfpQFiytWlAhfIxI9HfQ9wZvJHUNL9fdprodQ5acxKTorFimriZA = X-Google-Smtp-Source: AGHT+IETwlzdPADUzlx+JnYZ3i+gYCwRL+QXZI83mIuW4Nz8MBeEyk51w6Zny9wOBpN2ARK9n7yR+g== X-Received: by 2002:a05:600c:5251:b0:420:10fa:67c4 with SMTP id 5b1f17b1804b1-42010fa6864mr195603965e9.19.1716276659732; Tue, 21 May 2024 00:30:59 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:59 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 15/31] ada: Fix layout in a list of aspects Date: Tue, 21 May 2024 09:30:18 +0200 Message-ID: <20240521073035.314024-15-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * aspects.ads (Nonoverridable_Aspect_Id): Fix layout. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/aspects.ads | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index ce393d4f602..3cc62de3411 100644 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -237,14 +237,17 @@ package Aspects is -- Aspect_Id's excluding No_Aspect subtype Nonoverridable_Aspect_Id is Aspect_Id with - Static_Predicate => Nonoverridable_Aspect_Id in - Aspect_Default_Iterator | Aspect_Iterator_Element | - Aspect_Implicit_Dereference | Aspect_Constant_Indexing | - Aspect_Variable_Indexing | Aspect_Aggregate | - Aspect_Max_Entry_Queue_Length - | Aspect_No_Controlled_Parts - -- ??? No_Controlled_Parts not yet in Aspect_Id enumeration - ; -- see RM 13.1.1(18.7) + Static_Predicate => + Nonoverridable_Aspect_Id in Aspect_Aggregate + | Aspect_Constant_Indexing + | Aspect_Default_Iterator + | Aspect_Implicit_Dereference + | Aspect_Iterator_Element + | Aspect_Max_Entry_Queue_Length + | Aspect_No_Controlled_Parts + | Aspect_Variable_Indexing; + -- ??? No_Controlled_Parts not yet in Aspect_Id enumeration see RM + -- 13.1.1(18.7). -- The following array indicates aspects that accept 'Class From patchwork Tue May 21 07:30:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90538 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 506D43858000 for ; Tue, 21 May 2024 07:35:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 9B02A3858D33 for ; Tue, 21 May 2024 07:31:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B02A3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9B02A3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276665; cv=none; b=U+7ot/xNsHAqEhnnQRS+c1fczJOAK+u6ZHSY40EOQEelFLZ5MycOPsrvtaycwZkv1uJic7qKWSsXqDO7xwGztivERq9PE7hBdXkFMUCBajKar5ehMUukJGrGYha2SlXX4x6+aT4A2c3YALWzmKXrHolT9YTA23wfwBgTIIrMDCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276665; c=relaxed/simple; bh=ent+4kcX2f1HeWUYP2oYhcmIOYOL7t1Z+X5yXgW9r4E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SeGHX54x6Va+SdPDix4De/ePqwzTbaFSNa6odIhtpNz6bQJAG0kyIecRw0KNuLhLHgJeVqVup6Dx/50n7xIjsS/KSfOxKH3pE9+FTkmo2JQKEkt/58HVZhAr++vYTJ5GlMH+ybZWmOlMCrRemlCBqXRw46QkVBt1ak6RzSlhmwE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41fd5dc0439so29735475e9.0 for ; Tue, 21 May 2024 00:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276660; x=1716881460; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D4g/nLHDGSsUgMbUyLEhiOKUPnMkdET+FBkdNm98beM=; b=JlRhgYSbOvNBnr36Ejq7zxhjaqguoPTV1F7igPAsR+K7aWVX1qMU8pojUjOBsF2Xpr lrvv2i5V5qZpvS3RVKZjlb+GXYO3JlxgFih3OYCLMix02XEDH0Y16+p+x9phAkH3VKOD MkqYJhtDYuxEu6as/IUU0FRhjCf3bbPFLXLRpEIILL3RECzNow6HwyW3PXb4geXiegpg Aq0Ly/fMippY6UxAgS8ET/PftMBDun/vtuVnht6uxvnJOq8KVJkhbex45sPBZa06GHxN y0ZiGD9UeBxxxUwDg+oTIrhQjA9eq4TM2ykV0xwnbnCIOJP6hJ/DM8Y2zYdVwbKlmpxZ lA8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276660; x=1716881460; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D4g/nLHDGSsUgMbUyLEhiOKUPnMkdET+FBkdNm98beM=; b=dc2wONECpo7BFeNdyFyZJ3yHyGJhLgnUFnTrdE/TyXAkdI0cNyHq/nNOq/ZwNNk8qn wUwkSCX0M9OE3musuQDequWjnZebp8RW6NyYPadN3mPgB44H6oYlysTwTBGXoe5B9cT9 JUO7HqERmus+qKoBsWtPJdKcGGVWVvPk8inRQhznofHZ4cZplrCZS4S1RvZnMIz94FtM +5jTmwkAGwoeOUu9qTWIjT15B774cGRBJjhbnHy2mRVDVXuTufDleySjWjJ/3u6BnDg3 tbBMJt+SOYaI13ADPzOKHn1eBaCo0eNOmopFJ2VHz3TF3H8Qv9tin53mbm/E8Pro83In DmMg== X-Gm-Message-State: AOJu0Yz4rndCOU1IJ+HiRdT5zmJRlUy3f6tCeWiyDsBV1QmCGjw/Lb1M gQ6+SVq34pwvAPWLC9Vc8p7vNuIeABhF3N2h3ftx2E333/SUWNWXSnBYAwZWIYWB73w2mN3MH9g = X-Google-Smtp-Source: AGHT+IHPNFdz98lYLxGu+ndUgEkX9SN14wDiSwYBGuNVYUteZ2nk82zZ5f0ioUjCH104Zj25a0f5FQ== X-Received: by 2002:a05:600c:314e:b0:418:3eb7:e8c6 with SMTP id 5b1f17b1804b1-41fea927e69mr268087615e9.5.1716276660420; Tue, 21 May 2024 00:31:00 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:00 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 16/31] ada: Missing constraint check for initial value of object with address clause Date: Tue, 21 May 2024 09:30:19 +0200 Message-ID: <20240521073035.314024-16-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Steve Baird In some cases where an object is declared with an initial value that is an aggregate and also with a specified Address (either via an aspect_specification or via an attribute_definition_clause), the check that the initial value satisfies the constraints of the object's subtype was incorrectly omitted. gcc/ada/ * exp_util.adb (Remove_Side_Effects): Make_Reference assumes that the referenced object satisfies the constraints of the designated subtype of the access type. Ensure that this assumption holds by introducing a qualified expression if needed (and then ensuring that checking associated with evaluation of the qualified expression is not suppressed). Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.adb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index b71f7739481..654ea7d9124 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -12772,6 +12772,35 @@ package body Exp_Util is -- since we know it cannot be null and we don't want a check. else + -- Make_Reference assumes that the referenced + -- object satisfies the constraints of the designated + -- subtype of the access type. Ensure that this assumption + -- holds by introducing a qualified expression if needed. + + if not Analyzed (Exp) + and then Nkind (Exp) = N_Aggregate + and then (Is_Array_Type (Exp_Type) + or else Has_Discriminants (Exp_Type)) + and then Is_Constrained (Exp_Type) + then + -- Do not suppress checks associated with the qualified + -- expression we are about to introduce (unless those + -- checks were already suppressed when Remove_Side_Effects + -- was called). + + if Is_Array_Type (Exp_Type) then + Scope_Suppress.Suppress (Length_Check) + := Svg_Suppress.Suppress (Length_Check); + else + Scope_Suppress.Suppress (Discriminant_Check) + := Svg_Suppress.Suppress (Discriminant_Check); + end if; + + E := Make_Qualified_Expression (Loc, + Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc), + Expression => E); + end if; + New_Exp := Make_Reference (Loc, E); Set_Is_Known_Non_Null (Def_Id); end if; From patchwork Tue May 21 07:30:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90546 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A25E23858430 for ; Tue, 21 May 2024 07:38:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id C0CE23858D1E for ; Tue, 21 May 2024 07:31:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C0CE23858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C0CE23858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276666; cv=none; b=s6ewTTgHBiIFEFsGPkp9QN8/Lwyn9hPK3a1P1kLtfl9P9u7qezs7MRty3EGkMm5u0AnHr9YD1B0gWqxuXUjSQ2FjfxLzx86Zud0riewn2hvRlMO/zZ5zRHXM4aBMPu/5J0E6ZVBSHrVS1nIBCOk9z4/ivhx7pyy8pFSk5vAu0HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276666; c=relaxed/simple; bh=Vml24HHbGuDV2HHROexFfhu7o9auC4rbfcjuqp3NlRM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qkVirfEoJ4VK8PKQzH1bKlTZCzxs8biZqg4QP52FJKEEi7EQQjQToNOP0Jf7PGt7QUOXuO8uJQyJ3lsI/nNBbiR7oPdeCKnEUfnPESVFnch4jS9hN78B90unpTOhNYB+9cxm7HM/gUdx0VekuUv5GLge7N+H6QRUnzTgEewvT4c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4202cea9941so27151485e9.1 for ; Tue, 21 May 2024 00:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276661; x=1716881461; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lzlciYcLFa2L8PMz45xDa0GSkdoxmwQI4KExM6bD4ic=; b=PrkioJ5nEfYwLYoODRvmjQuAVk+Rz+nexlctMNxDoBnGZYGrRRrdpIO5FojvZlBsnd qIbLaG4nHtN4sw3+nFNuoJ3gAKStKodY82KUQeeMYfNvc9NIBLv2D3wQ146sjdylwoxJ UmGaV/pLmj848OzgooeGVqQAngu1f9Ud8tNsM+QvMv2xjCfrjrOUfxsD82losC+6QUyB UhGgYrSfN0d0TUPgaIjjy2Sfl87zQD3u8hjsg+WRjdK/F136qUs4fnh21yPWJMrxHzwX gWS9WVJ02gY0jt7hjyQovu86EkzkEdmIEMXAzPCkXflw8g9IriM+Cw4k5o7CH0yAoNOi PMaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276661; x=1716881461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lzlciYcLFa2L8PMz45xDa0GSkdoxmwQI4KExM6bD4ic=; b=HtktoxGODYUpk0yevfRhhASIq8lBZckT2+xTbS+fZD1iD1USJqQoK9al5qpc/C5l/v 935BaMRp9iPIyiWfTfno6MIGIKbFsTwAMSu4UzaskAjA8uU9iDevOMW4dWwHpU7PBC/g bTgOaqSIwkBWvI5yR17isSjqdYGdl25nIOR8QvKfa8jwSh2wNVwcp6Rz/DdCbzKTmYNK +HQnA62v+uSmTWPskX7sieT36SM7KhTBgtMFp5llRyRfNn5j79wQC56wK1W6fFcfkv7S 1gAYE3vqs8EZwoteDjLXJ6Hvhp1RhXiOVACMEW1+I89l7lHBf71gIha8vnZwlR9Rpmzp E7ng== X-Gm-Message-State: AOJu0YzhSjIu0PtvsGu6U89q/H/C2bOHQQsqoTuYQzCe9V31qyHN76Pt qyqcq7scwfAEygPhyH8QHCilQdYphGm+pWGsGF+nClPxy/WY8zCrfVrkfGDt0vfoD3GdAGbhRYY = X-Google-Smtp-Source: AGHT+IEfKcnRI+1A+C0/bm6JQS7seaZKfj7m84Z5Q3j0VG+LrRcYQICWMrG+laQ7ePIkZxGEgPPyEQ== X-Received: by 2002:a05:600c:5487:b0:41b:851a:af43 with SMTP id 5b1f17b1804b1-41feaa38f9dmr214483365e9.11.1716276661188; Tue, 21 May 2024 00:31:01 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:00 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 17/31] ada: Fix oversight in previous change Date: Tue, 21 May 2024 09:30:20 +0200 Message-ID: <20240521073035.314024-17-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou In rare cases, types using structural equality may reach relate_alias_sets. gcc/ada/ * gcc-interface/utils.cc (relate_alias_sets): Restore previous code when the type uses structural equality. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index b628481335d..ae520542ace 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -1867,8 +1867,11 @@ relate_alias_sets (tree new_type, tree old_type, enum alias_set_op op) && TYPE_NONALIASED_COMPONENT (new_type) != TYPE_NONALIASED_COMPONENT (old_type))); - /* The alias set always lives on the TYPE_CANONICAL. */ - TYPE_ALIAS_SET (TYPE_CANONICAL (new_type)) = get_alias_set (old_type); + /* The alias set is a property of the TYPE_CANONICAL if it exists. */ + if (TYPE_STRUCTURAL_EQUALITY_P (new_type)) + TYPE_ALIAS_SET (new_type) = get_alias_set (old_type); + else + TYPE_ALIAS_SET (TYPE_CANONICAL (new_type)) = get_alias_set (old_type); break; case ALIAS_SET_SUBSET: From patchwork Tue May 21 07:30:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90545 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B61D3858427 for ; Tue, 21 May 2024 07:38:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 910933858C60 for ; Tue, 21 May 2024 07:31:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 910933858C60 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 910933858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; cv=none; b=S/BcC+l98WEk8X9FwAjE2Xa7V3cz54kNxKzyCwm8Z90K3tYb9pOwZn6i57uX5R+LYB0vGkHYu7fD/cqw3yCHElmiQqjvO/nK2lTwFc1VwDVYyV6Tt6F6Z7QT808+kat7iarSlrHuq66xoYEg4u3ORV2HoWX2rsAnFCk4Ia6AVrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; c=relaxed/simple; bh=rkyb0GeaLFDrwV00ouhKyWQfH0xDuqlSD7QyP3bcqCw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Hrp9GD5vUNhtBYMHAshFozbhT9QJacx09rEEHq0HP6oQqn5K+dkBgZ/PBaQbP/3OIjERwxK4LXaMA6qS7H14V3AZVX3F4ouhP/Lkuwj/FGoqNqiGd8kjJk2o7GAyeqNAfSqpcsDdzdVz7U5w0r5oBTS5+JEGUU2m7kPbYwMPGFU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41f9ce16ed8so39180555e9.0 for ; Tue, 21 May 2024 00:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276662; x=1716881462; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2UUHjj3ez5iIp0vFuqvvFdUk/o/jtVJMao3rxFX2RQc=; b=UdPPqUJPhL3JNI5UwDAB+vB7t94QPNzwhplIlyu0gcetmCYPbdjq+zThYdh98IRD9A zc3oTlYm071XDUbRAtD5ss+c2fhAkwzTOkaI958DxHLkD0Kl20rERPEpEnOUSxwKHF5/ 9DDhe9SAyCRcGihUqlPfqCjwAkJ3ySSWA8alh1eBSZDjKkYh+rZ/nmBORhAvYaqYUSOx PWCIe05kMJBFV9qJ6u5JWdkyn9SsToda4NXhaN5TdJIrtQGMQYRqzzHh1scuMj7yJO6z pzxEhhroO+ngp7DwCGEwuU9mEilV3E5P9VXCa5dDSeedVqhn/bdBKaipGA42vN7++0Kb QNgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276662; x=1716881462; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2UUHjj3ez5iIp0vFuqvvFdUk/o/jtVJMao3rxFX2RQc=; b=xNYG43lHV1/QxUry8FSZRzXIjjHIOcm5AdW7chOjBwSVKlD8ubiuRVrNjdOkIuv7Wh xRtT4d75MJ6vlrPPS9t8vyNLJdGz5IxmWQYoWOYeGlnAjjSROpWgmeEknb6GSy2GYToI YOyuqpltbpfpbORC1PrOz9obkP6j2MZa+UEBYjoymbTTRj9+90UE1CALKpomMaZKANOQ SJFUpiztx4JXGkjW8NpGn4dWnVIlkC/Ueq6wr1jnSi3YKp8OPPUWmYV+93+qiECwspzu 2tFdYXS6Knlm820GFucubSM+3xJ51ceS2Jo0vMmvWkcCHxX6QbxEu0BzoPJcIIQTJQrO puyQ== X-Gm-Message-State: AOJu0YyiEKg8vOa2wZY+mg4bpzfps1Z40XvkvbAa7jPpsxgZoMbUB/1L vMOUuTcy4BqQGDoZZhJEkgpTcr1h/V/hCqwfYgQsdbkxeEAWYSEL269nFKlLPube0G4GPJ+vn80 = X-Google-Smtp-Source: AGHT+IFULkz79uGVKtOlyuoAXDUBKqB6mWA/WoJ1PF64YPfwQTCxHBnsw6cv09SNsy4f5AskZol9WA== X-Received: by 2002:a05:600c:3508:b0:41b:f116:8868 with SMTP id 5b1f17b1804b1-41feaa38a79mr340252565e9.12.1716276661896; Tue, 21 May 2024 00:31:01 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:01 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 18/31] ada: Fix small inaccuracy for Size attribute applied to objects Date: Tue, 21 May 2024 09:30:21 +0200 Message-ID: <20240521073035.314024-18-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou This reverts a change made some time ago in lvalue_required_for_attribute_p whereby the Size attribute applied to objects would no longer be considered as requiring an lvalue. While not wrong in principle, this turns out to be problematic because the implementation in Attribute_to_gnu needs to look at the translated prefix to spot particular cases and not only at the actual type of its value. This of course requires a small adjustment in gnat_to_gnu to compensate. gcc/ada/ * gcc-interface/trans.cc (access_attribute_p): New predicate. (lvalue_required_for_attribute_p): Return again 1 for Size and add the missing terminating call to gcc_unreachable. (gnat_to_gnu): Return the result unmodified for a reference to an unconstrained array only if it is the prefix of an access attribute. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 8c7ffbf5687..6f761766559 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -745,6 +745,26 @@ build_raise_check (int check, enum exception_info_kind kind) return result; } +/* Return true if GNAT_NODE, which is an N_Attribute_Reference, is one of the + access attributes. */ + +static bool +access_attribute_p (Node_Id gnat_node) +{ + switch (Get_Attribute_Id (Attribute_Name (gnat_node))) + { + case Attr_Access: + case Attr_Unchecked_Access: + case Attr_Unrestricted_Access: + return true; + + default: + return false; + } + + gcc_unreachable (); +} + /* Return a positive value if an lvalue is required for GNAT_NODE, which is an N_Attribute_Reference. */ @@ -760,7 +780,6 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) case Attr_Range_Length: case Attr_Length: case Attr_Object_Size: - case Attr_Size: case Attr_Value_Size: case Attr_Component_Size: case Attr_Descriptor_Size: @@ -786,11 +805,14 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) case Attr_First_Bit: case Attr_Last_Bit: case Attr_Bit: + case Attr_Size: case Attr_Asm_Input: case Attr_Asm_Output: default: return 1; } + + gcc_unreachable (); } /* Return a positive value if an lvalue is required for GNAT_NODE. GNU_TYPE @@ -8472,7 +8494,7 @@ gnat_to_gnu (Node_Id gnat_node) return slot optimization in this case. 5. If this is a reference to an unconstrained array which is used either - as the prefix of an attribute reference that requires an lvalue or in + as the prefix of an attribute reference for an access attribute or in a return statement without storage pool, return the result unmodified because we want to return the original bounds. @@ -8539,7 +8561,7 @@ gnat_to_gnu (Node_Id gnat_node) else if (TREE_CODE (TREE_TYPE (gnu_result)) == UNCONSTRAINED_ARRAY_TYPE && Present (Parent (gnat_node)) && ((Nkind (Parent (gnat_node)) == N_Attribute_Reference - && lvalue_required_for_attribute_p (Parent (gnat_node))) + && access_attribute_p (Parent (gnat_node))) || (Nkind (Parent (gnat_node)) == N_Simple_Return_Statement && No (Storage_Pool (Parent (gnat_node)))))) ; From patchwork Tue May 21 07:30:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90544 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C9CF384AB53 for ; Tue, 21 May 2024 07:38:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 02F4E3858CDB for ; Tue, 21 May 2024 07:31:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02F4E3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 02F4E3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; cv=none; b=hSA9vqRydsp7jRx7RayD7CeT2qqmQZTu3nCeUmqtg/lDZ3XECD6LALFyMq4NCOakIbnC7F/B4+9De5jb086WjO0dExn0n9/nQTo2KjS7dpEkKyyVg78DIB+HOmnPI6Ksu0iPvXSSRE/DvYlWNY80CHPdXJi+nTCUM2PLL39uiQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; c=relaxed/simple; bh=6cNQWvPndZxn1uEBk6Xf2a0To2aqdSOb81todAntLOM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WWSSQxQH+7dmHkekpRm4BBBKYNBV81VuhMdpVeDOL/DXev0/iGNF5RM3dyvVJM9hhW2DXK0iEWifMivvQHavVyATKGFOhYzsH6zDRBgPtYmyUUvU97igjrIXAzVgWLe8arBrasUixIZ+KCn8Ncsa2YiHK4g0Jh2zJs0t4GqQi/o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4202cea98daso27538305e9.0 for ; Tue, 21 May 2024 00:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276662; x=1716881462; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i1iuHneDgsuTxmhLXxqu75W7ltdc2T57viUTyPg3N+I=; b=kUgU7V7Z3S/AeVt0M299xiv6nNrtyIMIRnn6cXQ6vts0knpsX9NTadbbKJ23zbSe5L xDc5waEafDwf43hLSYeyFni+63xwsop9Gf9nDVDCyQXJgvNz4GBe3YsV8snylRXqoFVI KXFzSkfpw/rpcKA5lfpAkJMOOwc9IkDIreevfRvgBYjXrWVWpEsGOxFN0G8QmlZaiG2b kZXgSOHy9k1QG86W8TfKWuwzeFLeIXGhZk+X01rywmRODbppjgR61MHilu9ayUN0qXTw LPyXmGw7sn1IVxC28ElkEIEIfMjT6bgm/MBAbD3Dvm8Z9/hze0SCLJpHbkAxbH1IxZi3 sFYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276662; x=1716881462; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i1iuHneDgsuTxmhLXxqu75W7ltdc2T57viUTyPg3N+I=; b=VHMIA3Zkhu4AerVVbV6PByS5MOUi196w070A7Gu+LKOf8i7gBui1F2L3usP2xw56yK fz05VdsrNmGF76Gw32hUw8jvF8DO+8/CIlYlFNQFBUDPW1yJasjPejsVgYGsfo9MpmlY brJ7p1ZtIeSuPtVUMGcTj5mTeGt5uOdReEleoreR1pcRL50Y4CM8BbqWSUt5IAmNqDeT dPOS8jlMNBf3+00dyjdhp0ckptxeA+6LScTryDSFWwH0Y+4yYK0nLD7iLFU3SFOTG0AF ZBI+cCjQQQPjPt3VG9Fg6GUT1H60bBjfYDnKWcDUAJBzAO6/SgaMEJdY769VDxrm04po MvlA== X-Gm-Message-State: AOJu0Yz/fXcCgw0PcfNepdA4bPSh3NaBfHWin9egZXrWvXjAsjBmf8nx MzYFzbBHO1jk25x/8sO44UwEoAjGNSZN932oKHQ13KhigIL7V57X/u7MF5Hx59UZuO1KHoTS1UI = X-Google-Smtp-Source: AGHT+IF8Gwt4dmijvIT2YVrg/aTJ2NHnEiwJZqYzQ6s8vLwncyDwXEAC0u4ArjvKh1ZG7P4rrJ6ubg== X-Received: by 2002:a05:600c:444e:b0:418:9d5a:f680 with SMTP id 5b1f17b1804b1-41feac56006mr244426925e9.25.1716276662559; Tue, 21 May 2024 00:31:02 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:02 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 19/31] ada: Fix crash on aliased constant with packed array type and -g switch Date: Tue, 21 May 2024 09:30:22 +0200 Message-ID: <20240521073035.314024-19-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou The problem is that we build a template whose array field is not an array in the case of an aliased object with nominal unconstrained array subtype. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : For an array allocated with its bounds, make sure to have an array type to build the template. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index ca174bff009..41d5c29a17c 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -939,6 +939,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && !type_annotate_only) { tree gnu_array = gnat_to_gnu_type (Base_Type (gnat_type)); + /* Make sure to have an array type for the template. */ + if (TYPE_IS_PADDING_P (gnu_type)) + gnu_type = TREE_TYPE (TYPE_FIELDS (gnu_type)); gnu_type = build_unc_object_type_from_ptr (TREE_TYPE (gnu_array), gnu_type, From patchwork Tue May 21 07:30:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90542 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9A01384AB66 for ; Tue, 21 May 2024 07:36:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 8BF9C385840E for ; Tue, 21 May 2024 07:31:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8BF9C385840E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8BF9C385840E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276666; cv=none; b=D67+jUd7hpkmL7MtHhL1iU2sAHjX8H5OUdXSJF6AJLec5T6YFe4aOP+uT0P4qbT5niEjEfAY6CmOOYid0pKOc/dOnZIN1MSSJQiDkUPYAGBErS/S0BjH5AiVCRl3N8LJsXZJz1INWOx+wI063Yqkbn14Q0Oq6MnT5zmXBizvTKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276666; c=relaxed/simple; bh=wrOnUtHdL086TpPAr8cudej+QqWjAW9UxtaF807eTfc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dkIdblpIoVIc/fLw+7V6ABqXrx4fTBq9sGRcGnQkqRh6vpREjRnt5GkiCwwW5+zZaYtUqCouWhKiPIQTeX8AGTdX42mePZugSvQJL/HY9CMI6Elv7RYUBm8e1abKZfnTTG+kmSsiR9tnW8ZbgSYzs/xL61m6znprof6tmATgO/4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-420180b5922so39017435e9.2 for ; Tue, 21 May 2024 00:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276663; x=1716881463; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SrikpdvD3JnPdw7JoU5zROZzg2iHdpAkl8VhZZT2Llk=; b=Rd5inL20oPR5m8n6ytX8Aa4ZBZkgoGbSdPkUcvb3u311Rmjh46EcSGqa2Mu9JXDNJc OSMTRvxVaq+5U6vhRa0CrXusFGiAR00xI+GELtNZPzs7VEeZvpd7yppO25sVmnbTgpln 7Va0Jpw2BAB0LoLYop2IhdUmxWR093yavVgrvfy+V6pYovM/15KFhbh0tpAwHN+LipIZ FqzVbUQ6aq0A4+ab1CMpqkiWobvpLenGRYudLqbBPrVgwc1kZ+Kk+Tfw+lrlr4ZPmWJ5 SBjgIqoVF+6X0ZbCFArjwgCHqqTudmxfbdGAGBkylOBvbvWszH6vlCX/+o8uaumklPPu rAxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276663; x=1716881463; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SrikpdvD3JnPdw7JoU5zROZzg2iHdpAkl8VhZZT2Llk=; b=EbhVW02GxfWpG6JT5iFoPI+xNe3FM+mCOKFqRlcFtDzBoYMk5xoc40rDq6MnwcFjT7 LsYrG8QOhYW5Fm6KXHBw6QB9hYMKWho2A6MaMGD7IGlW5kMMjjW+arOV+oUc/bOdKEyH lrqM0SxMUMAwQMhehj8Q8KG9pC4dDye+jGdo64K6ERJkuvaem5t74qVptWhm/QbBhu9j zfEXR1UfQPQs+C7T7jQ+SERJNVzinaLtwrL0NxnbIdldlYtd4gZUFDClmIqvKaFVwda+ sTGFvh4wConMndTOjd4oBV0Tlv/eqD2PkLI8uYjetc5+z1sGLO7PVSju/q9Xu5IXo6ff zrHg== X-Gm-Message-State: AOJu0YxXEE9c4Vx7l20LkbYdEWMnvk76p0sxkgjXw6xZFigOyTdC3Pkt EQ2YM5kmznooVAAWbSL9esdmkLPWwf9wTBYcpZkLEMk8RtGbAzlEErmOTvRtwTtv1s3BzXcdDtw = X-Google-Smtp-Source: AGHT+IGO3eA020TTS+Cubo83zHGKZEUKnOmwNLD5Y13YUHVwi8xTTghHlkKWMVa35QdawsXBPo2zqg== X-Received: by 2002:a05:600c:3508:b0:41b:f116:8868 with SMTP id 5b1f17b1804b1-41feaa38a79mr340253205e9.12.1716276663262; Tue, 21 May 2024 00:31:03 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:02 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 20/31] ada: Fix assembler error for gigantic library-level object on 64-bit Windows Date: Tue, 21 May 2024 09:30:23 +0200 Message-ID: <20240521073035.314024-20-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou Most small 64-bit code models have a limit of 2 GB on the span of binaries, so we also use the limit for the size of the largest statically allocatable object by the compiler. If the limit is topped, the compiler switches over to a dynamic allocation (if not forbidden) after giving a warning. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : Give a warning for a statically allocated object whose size is constant, valid but too large. (allocatable_size_p): In the static case, return false for a size that is constant, valid but too large. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 41d5c29a17c..e16ee6edac5 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -1415,10 +1415,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) false); } - if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST - && !valid_constant_size_p (TYPE_SIZE_UNIT (gnu_alloc_type))) - post_error ("??Storage_Error will be raised at run time!", - gnat_entity); + /* Give a warning if the size is constant but too large. */ + if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST) + { + if (valid_constant_size_p (TYPE_SIZE_UNIT (gnu_alloc_type))) + { + post_error + ("??too large object cannot be allocated statically", + gnat_entity); + post_error ("\\?dynamic allocation will be used instead", + gnat_entity); + } + + else + post_error ("??Storage_Error will be raised at run time!", + gnat_entity); + } gnu_expr = build_allocator (gnu_alloc_type, gnu_expr, gnu_type, @@ -6822,9 +6834,12 @@ constructor_address_p (tree gnu_expr) static bool allocatable_size_p (tree gnu_size, bool static_p) { - /* We can allocate a fixed size if it is a valid for the middle-end. */ + /* We can allocate a fixed size if it is a valid for the middle-end but, for + a static allocation, we do not allocate more than 2 GB because this would + very likely be unintended and problematic for usual code models. */ if (TREE_CODE (gnu_size) == INTEGER_CST) - return valid_constant_size_p (gnu_size); + return valid_constant_size_p (gnu_size) + && (!static_p || tree_to_uhwi (gnu_size) <= INT_MAX); /* We can allocate a variable size if this isn't a static allocation. */ else From patchwork Tue May 21 07:30:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90535 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FED7384AB45 for ; Tue, 21 May 2024 07:35:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 20823385842A for ; Tue, 21 May 2024 07:31:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 20823385842A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 20823385842A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; cv=none; b=KiP/i5TsC83wgnSpuIpOAQv9qJWeBoWSFUYv4wcA2ZwmYPDuuHi6J4tOnFkeTN8DYiAe893m4HERIIN8WuFbqSvoUfdNxNbkcF04uC8vmJ/Tt3Zxcguft9SWQLutEbt14z/MGjLptRqvMxIU/uvNlWeHgM69x2g0z7I/arutx/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; c=relaxed/simple; bh=Kw5P2H9cj2NgN+cxPQk1NoO03UEZcUOB/NqfE+kZVlA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=abcNewTdtE2NVXo9nThhuzZFXSv1CZ1XcLLQEPT192p2vYfJBPlklRaMrry7aDgMCsq4oOGK+40wDKYCOmbQvR2g0xOElcZYLfyt1QSql+oIlNs7uonmlMzHxd44w7r3iHaGFyx2rgOV/lkZULP9Z7A8wyS5Onvm5CV6RgFdUqY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4202ca70270so38992545e9.3 for ; Tue, 21 May 2024 00:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276664; x=1716881464; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RD5LnbxRps9KTing+y38Xt6IXsVYvYSRwSD5beI09Lg=; b=gt3VjTE2CbuWIBROuApc0JAcKlC5DtIT90wZNZdnCHeB0oZzzbGEWutm27c9hZnAwA lHNt7fZpfRFMjIXezYgqUqtGhFtL2PSnrA7gymutFgDfKLwlDn9KH/qJ7C4i/9QATuzE HVcDcGu4sVuV0LfsL0QBMRLVgS/IqbfeQ+BiD2igYp/vsssJAwnFQJKVWs+m3a5BA2K5 t0hu4HTEl0Ax+ErvP07oxkAHwnF5o8rmBtQYtImm7H2KJKlW/QKEcxtFMDZfzeZiEYes 1AHmys22MmIcAQmeLwVJBqavJqkgsOF/pMqij5XkcARrrNDWHdU4OIcjaIIJBk3Pqwz5 sYGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276664; x=1716881464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RD5LnbxRps9KTing+y38Xt6IXsVYvYSRwSD5beI09Lg=; b=m3dSTg6b9vgsKlevZH4inZ9C9ZfEugB147f+WlxbzwHv5wSoOmeLZsY2xyYnT57fMw KxCNVYNXgitd/+oeGiM3BAc9phOdLjk2ssGFQQrfOjwmt5DPuNmk36JANxOq4p8901mf F9duS/ZMWSeW18diLvtNJXkIb/UPN9qTvxlAWUOl3VtDutkUrKmBqaFfWBpFOBRqI8UL N9lRRzObHAywJZ+IFefYuZvIqi8OV/2WmgSQH4fyorqzkbZvuWQJful2I7qrqtSESWIc 3Ww4a1wF5/MyQ7IKe9lady6GJ8v7ElNao0QkvsFFW2G1SfMMBdqF91U+hxWqKQkDg1cd +6WQ== X-Gm-Message-State: AOJu0Yw6KXuN6v+2WQEZ+0F7ss9UgSNG2DwQ53YMhtwI/JK7YS9qyUik J6VT7JcMcG5D/hcICTt85MwkXGHTB8qJ6Ht53khqwpJltsCq31halTJVie2oZLzjMd30NYsbDPM = X-Google-Smtp-Source: AGHT+IHSrqIe6duPKyOJWD0N3gGONQffHUln/Ua/K1NAIy/Jv8kPKBf7IrY25/bm85ngCFcEpH5syQ== X-Received: by 2002:a05:600c:2042:b0:41c:8754:8793 with SMTP id 5b1f17b1804b1-41fead790ecmr254142075e9.41.1716276663980; Tue, 21 May 2024 00:31:03 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:03 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 21/31] ada: Remove unused dependencies from gnatbind object list Date: Tue, 21 May 2024 09:30:24 +0200 Message-ID: <20240521073035.314024-21-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek The gnatbind executable does not depend on aspects, SCIL, style checks, etc. Also, these dependencies are not needed to actually build the executable. Cleanup. gcc/ada/ * gcc-interface/Make-lang.in (GNATBIND_OBJS): Remove unused dependencies. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/Make-lang.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index f6404c0b1eb..4f1b310fb84 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -572,7 +572,6 @@ GNATBIND_OBJS = \ ada/ali-util.o \ ada/ali.o \ ada/alloc.o \ - ada/aspects.o \ ada/atree.o \ ada/bcheck.o \ ada/binde.o \ @@ -602,12 +601,10 @@ GNATBIND_OBJS = \ ada/exit.o \ ada/final.o \ ada/fmap.o \ - ada/fname-uf.o \ ada/fname.o \ ada/gnatbind.o \ ada/gnatvsn.o \ ada/hostparm.o \ - ada/krunch.o \ ada/lib.o \ ada/link.o \ ada/namet.o \ @@ -618,7 +615,6 @@ GNATBIND_OBJS = \ ada/output.o \ ada/rident.o \ ada/scans.o \ - ada/scil_ll.o \ ada/scng.o \ ada/sdefault.o \ ada/seinfo.o \ @@ -631,7 +627,6 @@ GNATBIND_OBJS = \ ada/snames.o \ ada/stand.o \ ada/stringt.o \ - ada/style.o \ ada/styleg.o \ ada/stylesw.o \ ada/switch-b.o \ From patchwork Tue May 21 07:30:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90547 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 821E3385840B for ; Tue, 21 May 2024 07:39:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id C654A3858433 for ; Tue, 21 May 2024 07:31:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C654A3858433 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C654A3858433 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; cv=none; b=YbrFewcrzuziyF+sy/JLbcRagcgJb1mhZOKg1euDenqmsaH9PFU2qz4qZnTcLqdFtMxA6GC6CL83bg00RShiv0O4bmxuYOwnQtDPTZbl8GYGZfaZVbb0x225t57Z0I7SZTHeQB5I9/Q4YFwE0kbwxfeAzXqkhVakjgjaS5dwfOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; c=relaxed/simple; bh=i3/9DJvOqeTXtt/1GWRMxveR2Qiaj8qhKiJkvVJFRJA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rMDesvZA2BIv9QAdlTF+moRj7T9SE3924T/NifHAMHCsyKDxclIBoryi8xXWKamlUcbL74p1flYe4X4yXxIqO57dLdF1zigm/xr5NJWy/SMmpbUhmzj161SYDFVklVx3cFPpfZGNAPeOwcFZXxuUXiRfIq4JHcCS6h3UMPqcCkA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42016c8daa7so27115625e9.2 for ; Tue, 21 May 2024 00:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276664; x=1716881464; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GwQDMFIXUXSC0Z8l2EpUO06P7piyZYBT/EJGIqjctCU=; b=S0uJxEaE5fwuXTXjGDyYo4U9jdi9hS3XQJ1jv3gRTAFPbXmZTG0a6aOU9Iku8cjdBd JwZyOF65SSjyOA0bwH/K49+Uh5fS0KbkL+6gnqbKyV8OCObKftwUw7PpjaeoxYGjEl5W 2+aOl6jzB9plgucLvMEdprr1QJm89vK1X0tZ1oben0JxEbhtTue3mfdzF5B3RNw5sFPY rgYPOT2eyxgsWgeRSWBvTMlCOlo9fJmY65/YwHpW/8hV5wJJpuWOVl7sUw74EZaWY6Fr 8gPur8s7qtQZcacvRvEEd/gW2vl6cINLC+O+JVsuJzNlnLWTvdoEnJs+VssvztCWNoaQ 1mzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276664; x=1716881464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GwQDMFIXUXSC0Z8l2EpUO06P7piyZYBT/EJGIqjctCU=; b=Ca9iyUFG09knCBKiC9X0XX+gmRaJJPmCK9qAR3iT3MQOMXQ108vpx+u3+52Km6ez50 2becqHPCHblNY4rx/cjefu775CTyxLb+tifz0MEMUN5fkK5nXKj68yEZRmk4K49tBuZr mhqpIh6DMPLfttlCLpkoyKp1ODJ5RzyLznRgYLE/MA2R0KfW4fgeayyb1wQL/Zyu9+U2 RUqu9qYiXAsocrwso0+Pt0s3iDwuq9k605ArZrs+93ZTl6CkXZVdmUiz4dgG3XaHDxO4 GDKgnxqNQxANADDIql6+tWGnxc6hKZnzB4rf/Z/K2fD7SlhTITAElQ0WCFOLd4+SkQlV GHEA== X-Gm-Message-State: AOJu0YwpnLE5Zu3asUTI0rQhjrPjRFhO5GfIrRJGJDs2cOZLHIfxUwqC nP8shEayDPurUdL9ZoJcSjLSeEm5z0ExzL0PXYB45s4jhllf9pMeC52LW+VVq0RhtMhbk1d1tso = X-Google-Smtp-Source: AGHT+IHXR3rZYCAoMvZuyraajVZOn4np+9TWT9Ay94avDzxeSqPLzDcALp3yEf5aypLYM5F8TtWn8w== X-Received: by 2002:a05:600c:1914:b0:420:112e:6c1 with SMTP id 5b1f17b1804b1-420112e06d1mr214851465e9.13.1716276664637; Tue, 21 May 2024 00:31:04 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:04 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 22/31] ada: Avoid temporary for conditional expression of discriminated record type Date: Tue, 21 May 2024 09:30:25 +0200 Message-ID: <20240521073035.314024-22-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou This just aligns the definite case (discriminants with default) with the indefinite case (discriminants without default), the latter case having been properly handled for long. In the former case, the maximum size is used so a temporary can be much larger than the actual data it contains. gcc/ada/ * gcc-interface/utils2.cc (build_cond_expr): Use the indirect path for all types containing a placeholder. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index a953b070ed8..fb0ccf59224 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1715,8 +1715,8 @@ build_cond_expr (tree result_type, tree condition_operand, then dereference the result. Likewise if the result type is passed by reference, because creating a temporary of this type is not allowed. */ if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE - || TYPE_IS_BY_REFERENCE_P (result_type) - || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) + || type_contains_placeholder_p (result_type) + || TYPE_IS_BY_REFERENCE_P (result_type)) { result_type = build_pointer_type (result_type); true_operand = build_unary_op (ADDR_EXPR, result_type, true_operand); From patchwork Tue May 21 07:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90551 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AD9B3858C52 for ; Tue, 21 May 2024 07:41:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 810123858289 for ; Tue, 21 May 2024 07:31:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 810123858289 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 810123858289 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276668; cv=none; b=Lhbc+3oSCI3DkAM4CNlQTE+mOtn0BpX6sTRCLQSI2wra2bnerfTiz6TMoircbeoxvoDJF3GNL2yfAz+L1McnoFAPIGGlOyww+WU7zlmV166ZHNfE2d09qANbJef3mZMiSowpa4WvjvZB2xQ40AIjlvEsQC+2kc3aL9jrW8Qq+4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276668; c=relaxed/simple; bh=8gkC+UPbS8uz5JNljtoRiuZdKC3Apfvd71ft/bEvTiY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vc8hY+Gn5mmlejWyxSRoEVKrMqDS2QoN/3Uc5AabvIUPE+Q12BvcKP81Mk2YbtQJZQQA5sStgjsmpQkXUnkGE6TmTpwl1X2zMgGbD2qS2EUbCpcNIEk3XpfRsHdmhKQ/xdNG0gJ+kAm8urLViyZ41sLuK4VdLBEoKWCAR3wlnz4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4200ee78e56so27098695e9.3 for ; Tue, 21 May 2024 00:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276665; x=1716881465; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qz40HiZEjKKT6evlnA9+S+cKwMvwjAvLKE8kC96wmHU=; b=T57omQB3WdB+HXw4rZPVmFbaPn8Sf3UlbINrUU6mJfgvk8SGMbzHwBptpL813xQHmX m3Gd61rb9nryHUVV+ZfMvKMKe9xwkE4v8onPYivVYXhwi+CBCuqj32BpOpEDgCxmisTL 9Pkda9gWoa1akbaeqv0qDy+qdnJ4MI4KAlzWczxkrwSNru3H9t7S8xpLU+V45h4TPAoz VNXEhUX6c7lfvQasYn8pOxCb69UGy6s6TieKb54R28kjik4TabsO/BDTqyilpKCZljYI JwNuemMVeOtemzBtysGomZ27OsKjQ1BEjFRHi/vqgv1s9xWPgRrI3QhST2X2QGIkVOvR vEsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276665; x=1716881465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qz40HiZEjKKT6evlnA9+S+cKwMvwjAvLKE8kC96wmHU=; b=kantv7xBd1pDbfDfibm61kZ4FOuu+IEoAVYUwpwRynuj8ZxCETisiSOiPzCBowf8/B cm2tGX+lM1rvZaNGeUmMWXAZPGzONn+wpMIyGgKe5iBvVtt9ckCX47nIsENrWKXSK7hx g1LON1SngcntcEJYubrlhajl91jLFNCDpbpIR5YVZ6hegDXwkXuKgCn23Up/eIQTCETd PO9BQULId7yyTrO28ai3dPsYqzIsKtNvMMkexkooLhNJBSEehtikdQHgbqGvkPXXe/dV NQc0E8Z06LFAqW+IKRUuUILZYdgPyACvmUQan0ULGiK9H1DFWKT1E+2aurdYSWZuxUpk LoTw== X-Gm-Message-State: AOJu0Yz4yp6QSX1KOoM9M3W/WlROT8dAZbVde2slSr3xJ+MVx55DuCAB F//UU7GdkI1ja91IHGUMpzxggnGfByuonbbBkokStyTr+1fOAOcIXmqunRPDRQX65EBZ4ygkiWk = X-Google-Smtp-Source: AGHT+IG2kXsZU8BqIu8aGDKEJCf//b9P5FLxl79DYqt8VYoj4E3GODSHAFNdoXgXLcnhu5hK7aTm5g== X-Received: by 2002:a05:600c:45ce:b0:420:171c:3d70 with SMTP id 5b1f17b1804b1-420171c3e17mr186701925e9.16.1716276665331; Tue, 21 May 2024 00:31:05 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:04 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 23/31] ada: Follow-up adjustment to earlier fix in Build_Allocate_Deallocate_Proc Date: Tue, 21 May 2024 09:30:26 +0200 Message-ID: <20240521073035.314024-23-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou The deallocation call of the return and secondary stacks no longer matches the profile built in Exp_Util.Build_Allocate_Deallocate_Proc, so this just removes the code as unreachable and adds an assertion to that effect. gcc/ada/ * gcc-interface/utils2.cc (build_call_alloc_dealloc_proc): Add an assertion that this is not a deallocation of the return or secondary stack and remove subsequent unreachable code. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index fb0ccf59224..64712cb9962 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -2187,15 +2187,16 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type, = Etype (Next_Formal (First_Formal (gnat_proc))); tree gnu_size_type = gnat_to_gnu_type (gnat_size_type); + /* Deallocation is not supported for return and secondary stacks. */ + gcc_assert (!gnu_obj); + gnu_size = convert (gnu_size_type, gnu_size); gnu_align = convert (gnu_size_type, gnu_align); if (DECL_BUILT_IN_CLASS (gnu_proc) == BUILT_IN_FRONTEND && DECL_FE_FUNCTION_CODE (gnu_proc) == BUILT_IN_RETURN_SLOT) { - /* This must be an allocation of the return stack in a function that - returns by invisible reference. */ - gcc_assert (!gnu_obj); + /* This must be a function that returns by invisible reference. */ gcc_assert (current_function_decl && TREE_ADDRESSABLE (TREE_TYPE (current_function_decl))); tree gnu_ret_size; @@ -2221,11 +2222,6 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type, N_Raise_Program_Error)); } - /* The first arg is the address of the object, for a deallocator, - then the size. */ - else if (gnu_obj) - gnu_call = build_call_n_expr (gnu_proc, 2, gnu_obj, gnu_size); - else gnu_call = build_call_n_expr (gnu_proc, 2, gnu_size, gnu_align); } From patchwork Tue May 21 07:30:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90548 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A122385842D for ; Tue, 21 May 2024 07:39:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 692DE3858C3A for ; Tue, 21 May 2024 07:31:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 692DE3858C3A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 692DE3858C3A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276669; cv=none; b=E+99W17T9Qts5mA3IKoqq5dVALHXQZW4x0w550xM5Kix/2XOa/7NaeJwVqQxhpDS23rPBND61t2V6421XyyCW5NJfHObewNlYtT4C41V7Q1zWAFMr8yzJ/LMLkCmQgogi3Br6o3OrCpXzVQYb+q7uc18iYyXq2HzZI0hlzmicRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276669; c=relaxed/simple; bh=A5hoUGNamqINoLPC61xx5O6iHgQtno5T4CvJtA5SoBc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FJYPFKUW4qrUGY63BsSCzojZ+ITH/rhZS8tATS9R0f1ZC7rEotW6to4/Eso2bHtrfWBZMA8zfMRH6THpuKM8un7a/5LqAMm4aYSxPQCr8gFzAPn47kncwvh/x12WKSKijYQMoFDmXtrsy2Fw8afWgcJI4Kj5FS6gmYGudVTbSZY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-51f2ebbd8a7so6185516e87.2 for ; Tue, 21 May 2024 00:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276666; x=1716881466; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nEEvYPoET72cnaO0eYC3KG6XlFXcHLVjICWBaIwuQQg=; b=iGM2mKixlU6rkR9ucATpKeaTEU32bwxxV2DJ6AdwrJKJhfWIvKgCEidrvVAH87ypYG kAfq9T9G2XzwATbmWbfL2KBf7CDQ7/PZREPGv/B+8UXRzCcSIGR9VvBFxIBb74mNCRjI b9hY+GIO5FNMR5d8FzhwOtrZrl0nYTaN6sFRA2EEFyvxnRlYQgpaeV0b+PNlTBrokzVf SmA+HsMpraSyJI4kCUy/afyk88Lm6Hs5F5mCmCWs3N+xz8xLu0SWEOqOUx/QkGmpamni jPPr4RZtnEl7vxLeyaTX2fqxNhMJvMy3/MEYC3fomHBeFKn7ZL8liO84VljX/LY0dCvs vTPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276666; x=1716881466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nEEvYPoET72cnaO0eYC3KG6XlFXcHLVjICWBaIwuQQg=; b=Vd/QLwvWns4LhPgMpLCnJlk1ucPrN5chz4KIn5Q9LQuWktJ88Bygu7xIgbqBxv1mPT dfNRQ/8VTh2thwBMPuCq78yI6KKUYHG+X+rUKutF78x67mvr+C5C5x2JcYgCeWDdfL3n 1ovVJM7chZ9ZjcfAYuGMuME5fCGJrj3N0OXycxchFRJJOQuCmZMBwF6GqZP97zTQDw9B YGQCvlevPlxA/HOI/0/ElXWoWnSnaNOP9nNlivkaWJWTTViwT/7uhHevfEDnoK49x+Zk ortON/eWC7gWRHH40rJButHlG5y3oir5e4rPVx5vsAWFHbKDmW4veUlSmzdk8lo8SZi5 ir2A== X-Gm-Message-State: AOJu0YySYh6A0TY5MGq70z0zffKuLP1NbVC53GFtOjEXvKeXIAgj/WAE uOqvIwm/jhBEHTk8P7qs8CaRFyKv4uE9vQ6wpd2hNgrf8P/H9G9kKD1PyiXpmDibWv7t6VeTDIA = X-Google-Smtp-Source: AGHT+IEBBOulgeJwaZ/AqUY1WJfWo1ztNg/Bf0/H0tV/IIXrL2XtBXcdOVbgpczb45ZK+R3UpA2uNQ== X-Received: by 2002:a05:6512:2201:b0:520:36ab:10b9 with SMTP id 2adb3069b0e04-5221006cdbdmr26609847e87.61.1716276665945; Tue, 21 May 2024 00:31:05 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:05 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: =?utf-8?q?Marc_Poulhi=C3=A8s?= Subject: [COMMITTED 24/31] ada: Minor typo fix in comment Date: Tue, 21 May 2024 09:30:27 +0200 Message-ID: <20240521073035.314024-24-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org gcc/ada/ * gcc-interface/decl.cc: Fix typo in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index e16ee6edac5..0987d534e69 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -5629,7 +5629,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, tree gnu_param_type, bool first, by_ref = true; } - /* If we were requested or muss pass by reference, do so. + /* If we were requested or must pass by reference, do so. If we were requested to pass by copy, do so. Otherwise, for foreign conventions, pass In Out or Out parameters or aggregates by reference. For COBOL and Fortran, pass all From patchwork Tue May 21 07:30:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90553 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EAA333858C53 for ; Tue, 21 May 2024 07:42:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 17937385B529 for ; Tue, 21 May 2024 07:31:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17937385B529 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17937385B529 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276669; cv=none; b=kdh48NkaZ/InTZVcndr89oQLVosAwB+qRedleHR7D/WCsUJ7OrhtJfqn1709vFRBiuBmMJKYWI+bkPTWpjYxZ1W/S5myhtx4fjcW37w625u64HKK0LvJBybHPF5HLJFzxfvQdBeprPN9xjVOd3YQyB4/7aceW1C2vv3MeXDYWtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276669; c=relaxed/simple; bh=4nOVYnkFEZdHvv5wPi4BaTbn5rchArcNnsN4N96NERY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=CskaXl8cK551YmgRY6ZaJUOnmesspkel0gMdsE08cjvTZ36cx42ZvYKtIK3p7m+W8zX+i8bofY+2PojKsI0fJ+vQ1B42tjZ114ozJB654dicIJ+0x4ggGI+p4QU9ZihaO8vMoSZps4L0GQ4fO27a7PUeqaFpSHb2BBZzkv60jAI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-420298ff5b1so39080825e9.1 for ; Tue, 21 May 2024 00:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276667; x=1716881467; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UPyXHXE4bxvM9mMk6j8Hnamf3T5TRSULCgvNXfS2EMM=; b=fPuWAId3YqiQYIZFHIq6ZKqIg3yTlF2HlTE+YqMPI6pSnRFJ3bt9RSmn82Kb6l3/vp IzeK8GUBjOq5lsLrTVAHIHwZNi3nutCO7+E6r237i+OTWKdVac88UgyQhtHBhJkNBzZG a6Ut3BDy2v3mfWEPwudqjEcT5nizrNaHSbgyCysANNqK28nyq+2ZjrR3t/QVO31SnY+W exeoOLc029EJYbAA4pCcRwiSVziLWcxf2CQg5IHlcHSTXhp52U7P3k4hMxB17WZpPPER sWEydvqncPJQTmHE56M3/+OH0OzujiaZbAYyUwyfxEzp61/EVHtaXLlFZBBuRb0U0uKv /z4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276667; x=1716881467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UPyXHXE4bxvM9mMk6j8Hnamf3T5TRSULCgvNXfS2EMM=; b=m4W8BySWAG6mclE9jXyqmoeyxjfDBzQ8tX6dudEWAoT4XrGsKYoLAVyoLnTz0Jmfiq pXR3yDa3YcS+Wo0FXBDJOqS6v+6oc8yWU6FiYC+qKDHRYv8siUM7j/edna84pVyKMIGH g+JxPS6LJC5afUZyfXr7C2xhDjh23Iu9vjjYjH+7vtYpZhaS9VBoqdlqShq/pX5LbCVd 8G+D57tCvDI/aIOYxsJYE2cazNm+cHNomVxM6EoBbtG+kX3kV/gbhRSm8JOqucWFG7tt 62POCLik6ZBMNinPF2mUrj3sU053EZxCclx2RNlR1rIplmnslUSEcDdknWUUy97sxPQR D3+A== X-Gm-Message-State: AOJu0YzDbLasj8N1XJwBcsi9g7olkQULLJWz1qteGbES8HlE+2c07jg1 LLSjBPfG7XNWiMINZ9lXHKl74+atXApWblEF4jq93qlqT/b1vJ0XnAKxT7rLcQy61WPUu+Nd2Dk = X-Google-Smtp-Source: AGHT+IE6nTArwqT2hRYBv0BI6sMUELEgT9qvOMg1WamV8dP6vZXXwYlKombYR7hdaXzezeXA5J1rCw== X-Received: by 2002:adf:f60d:0:b0:34d:8fac:9540 with SMTP id ffacd0b85a97d-3504aa631cbmr27894709f8f.59.1716276666806; Tue, 21 May 2024 00:31:06 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:06 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 25/31] ada: Fix crash with aliased array and if expression Date: Tue, 21 May 2024 09:30:28 +0200 Message-ID: <20240521073035.314024-25-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Ronan Desplanques The way if expressions were translated led the gimplifying phase to attempt to create a temporary of a variable-sized type in some cases. This patch fixes this by adding an address indirection layer in those cases. gcc/ada/ * gcc-interface/utils2.cc (build_cond_expr): Also apply an indirection when the result type is variable-sized. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 64712cb9962..161f0f11e5c 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1711,11 +1711,13 @@ build_cond_expr (tree result_type, tree condition_operand, true_operand = convert (result_type, true_operand); false_operand = convert (result_type, false_operand); - /* If the result type is unconstrained, take the address of the operands and - then dereference the result. Likewise if the result type is passed by - reference, because creating a temporary of this type is not allowed. */ + /* If the result type is unconstrained or variable-sized, take the address + of the operands and then dereference the result. Likewise if the result + type is passed by reference, because creating a temporary of this type is + not allowed. */ if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE || type_contains_placeholder_p (result_type) + || !TREE_CONSTANT (TYPE_SIZE (result_type)) || TYPE_IS_BY_REFERENCE_P (result_type)) { result_type = build_pointer_type (result_type); From patchwork Tue May 21 07:30:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90554 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52ED93858C62 for ; Tue, 21 May 2024 07:43:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id E04813858C62 for ; Tue, 21 May 2024 07:31:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E04813858C62 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E04813858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276674; cv=none; b=adLm02JR4MHXTn2BKlWslnmQveUnOfIIe1q7BMYUKJHg1hSdNa11eHBlJAF2mgHJsnxMpgeVbKkJ3DTQttF7usZT59trQ9SaHCI5e74sjsDskcQTKJK/oy96LSEej8IZxX2j8OBEZ9L5/vh5odJ0txogEovycLB5/YQ8FBEGNR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276674; c=relaxed/simple; bh=WVMKvC0J+U1gRcHhJnvF0NWrBcHEoPYq9EJ1gaOkeQ8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vfqzZrdlWJK6FBu0H7jSwiWbQa0/JCFyyZ5ZiBpqtPs8GKReY2ijyCoL2QwVCaJl5IsT5ao6PwqfErqgj8ya5spoxTtvDASEG64HhyJZL6jQ8p3BB35Q5fqlrPfYdHm/RcJKI/k8rd8eL425DHbYW+RN/QFbfx/lOCCwHGFsHII= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41fd5dc04f0so20789855e9.0 for ; Tue, 21 May 2024 00:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276668; x=1716881468; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hUhbi8KTwl+i/0cddL9F5HBhm88pAoeH4SW/tl3D7IM=; b=NExE4x3ogcX4syjS7NtcSpE/oBTPLyCpqJggt0lfdcjWzIU8JP2yg6wzw/vGcYmWUK ydvjFHFxnir7B6pi+H7WLkqthqI+izxSPxKdcxPTkmnglcTTmUDsGQglbRkYsPgqitGA te4SV5lf8uvnLsk41vNdsvdY04B70ZeDF7jWizoemxd9m/zN8lzPE/pmHJfdfvXtWUCk dNB70z11clU9Q/QPDPq65XZRb9lsTiQDCNWx+Edxbh0aiTNFU915j7Idt+/l+g30YqoJ 3eotB3+egDADQRQBHXLnNnMzrVrfmEZu67LXh3F53ZQMWj6CCL8OW5solp8aImxEMYYi O2Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276668; x=1716881468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hUhbi8KTwl+i/0cddL9F5HBhm88pAoeH4SW/tl3D7IM=; b=UoEghY4Cq/E7SAELDSLD0R5Pm2hbBqyuE1JWpYmUDOXufZuoULgbkHuPRfvpQWEh01 VSLTnpRsqNv+Lyka/ZyD6n8JT5mSWFtEWEDWbPWPPUl1inMB1bbYZ53ayusn87+Uu4uD SsQj3E7bYyGNIelZJjDrtKaUP9CcMWqbTkrt513s1sVI4LBDASVjhV2xh65B2tHY03HY K77avbRcB+3GcMTD/ZmsjjAOse/0YEq1kV83YzFdgXn0sH4ueKenHuIV/PXYk+/H3Fq/ feOXovzpwKVO7fhgl+b8l/13nqxApMR0H+HmIUjnLTmpXWT6LNsivzRWi9Zzjr1lY0Wl ZnQg== X-Gm-Message-State: AOJu0Yz09vXT1eh3YEUYrDKB9bpJOn0xSEo2Y7o0QQapbHRS4Rm+N2Zc 57ar3JOmorwZVYHu9qtji1HEl4/rXuf5WMxBPqnOXwr4P16EuziRxJKamAH51EUIOPfZ94Ij2Lw = X-Google-Smtp-Source: AGHT+IFzAgbinYBuZFObEitWZITFGaPnIEyBH3UkgQ3m4QrRogJTns/shWFvJ6IqWWQndzbGGde6Tg== X-Received: by 2002:a05:600c:4fcd:b0:41b:9e4f:d2b2 with SMTP id 5b1f17b1804b1-41fea931aaamr319363555e9.2.1716276667678; Tue, 21 May 2024 00:31:07 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:07 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 26/31] ada: Fix strict aliasing violation in parameter passing Date: Tue, 21 May 2024 09:30:29 +0200 Message-ID: <20240521073035.314024-26-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou This fixes a long-standing (implicit) violation of the strict aliasing rules that occurs when the result of a call to an instance of Unchecked_Conversion is directly passed as an actual parameter in a call to a subprogram and the passing mechanism is by reference. In this case, the reference passed to the subprogram may be to a type that has nothing to do with the type of the underlying object, which is the definition of such a violation. This implements the following two-pronged approach: first, the problematic cases are detected and a reference to a temporary is passed instead of the direct reference to the underlying object; second, the implementation of pragma Universal_Aliasing is enhanced so that it is propagated from the component type of an array type to the array type itself, or else can be applied to the array type directly, and may therefore be used to prevent the violation from occurring in the first place, when the array type is involved in the Unchecked_Conversion. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : Set TYPE_TYPELESS_STORAGE on the array types if Universal_Aliasing is set on the type or its component type. : Likewise. For other aggregate types, set TYPE_TYPELESS_STORAGE in this case. (set_typeless_storage_on_aggregate_type): New function. (set_universal_aliasing_on_type): Likewise. * gcc-interface/trans.cc (Call_to_gnu): Add const to local variable. Adjust comment. Pass GNAT_NAME in the call to addressable_p and add a bypass for atomic types in case it returns false. (addressable_p): Add GNAT_EXPR third parameter with default value and add a default value to the existing second parameter. : Return false if the expression comes from a function call and if the alias sets of source and target types are both distinct from zero and each other. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 40 ++++++++++++++++++++++- gcc/ada/gcc-interface/trans.cc | 60 ++++++++++++++++++++++++---------- 2 files changed, 82 insertions(+), 18 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 0987d534e69..ab54d2ccf13 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -205,6 +205,8 @@ static Entity_Id Gigi_Cloned_Subtype (Entity_Id); static tree gnu_ext_name_for_subprog (Entity_Id, tree); static void set_nonaliased_component_on_array_type (tree); static void set_reverse_storage_order_on_array_type (tree); +static void set_typeless_storage_on_aggregate_type (tree); +static void set_universal_aliasing_on_type (tree); static bool same_discriminant_p (Entity_Id, Entity_Id); static bool array_type_has_nonaliased_component (tree, Entity_Id); static bool compile_time_known_address_p (Node_Id); @@ -2385,6 +2387,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) set_reverse_storage_order_on_array_type (tem); if (array_type_has_nonaliased_component (tem, gnat_entity)) set_nonaliased_component_on_array_type (tem); + if (Universal_Aliasing (gnat_entity) + || Universal_Aliasing (Component_Type (gnat_entity))) + set_typeless_storage_on_aggregate_type (tem); } /* If this is a packed type implemented specially, then process the @@ -2790,6 +2795,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) set_reverse_storage_order_on_array_type (gnu_type); if (array_type_has_nonaliased_component (gnu_type, gnat_entity)) set_nonaliased_component_on_array_type (gnu_type); + if (Universal_Aliasing (gnat_entity) + || Universal_Aliasing (Component_Type (gnat_entity))) + set_typeless_storage_on_aggregate_type (gnu_type); /* Clear the TREE_OVERFLOW flag, if any, for null arrays. */ if (gnu_null_ranges[index]) @@ -4757,7 +4765,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* Record whether a pragma Universal_Aliasing was specified. */ if (Universal_Aliasing (gnat_entity) && !TYPE_IS_DUMMY_P (gnu_type)) - TYPE_UNIVERSAL_ALIASING_P (gnu_type) = 1; + { + /* Set TYPE_TYPELESS_STORAGE if this is an aggregate type and + TYPE_UNIVERSAL_ALIASING_P otherwise, since the former is not + available in the latter case Both will effectively put alias + set 0 on the type, but the former is more robust because it + will be streamed in LTO mode. */ + if (AGGREGATE_TYPE_P (gnu_type)) + set_typeless_storage_on_aggregate_type (gnu_type); + else + set_universal_aliasing_on_type (gnu_type); + } /* If it is passed by reference, force BLKmode to ensure that objects of this type will always be put in memory. */ @@ -6641,6 +6659,26 @@ set_reverse_storage_order_on_array_type (tree type) TYPE_REVERSE_STORAGE_ORDER (TYPE_CANONICAL (type)) = 1; } +/* Set TYPE_TYPELESS_STORAGE on an aggregate type. */ + +static void +set_typeless_storage_on_aggregate_type (tree type) +{ + TYPE_TYPELESS_STORAGE (type) = 1; + if (TYPE_CANONICAL (type)) + TYPE_TYPELESS_STORAGE (TYPE_CANONICAL (type)) = 1; +} + +/* Set TYPE_UNIVERSAL_ALIASING_P on a type. */ + +static void +set_universal_aliasing_on_type (tree type) +{ + TYPE_UNIVERSAL_ALIASING_P (type) = 1; + if (TYPE_CANONICAL (type)) + TYPE_UNIVERSAL_ALIASING_P (TYPE_CANONICAL (type)) = 1; +} + /* Return true if DISCR1 and DISCR2 represent the same discriminant. */ static bool diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 6f761766559..a6b86ec8b51 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -254,7 +254,8 @@ static tree emit_check (tree, tree, int, Node_Id); static tree build_unary_op_trapv (enum tree_code, tree, tree, Node_Id); static tree build_binary_op_trapv (enum tree_code, tree, tree, tree, Node_Id); static tree convert_with_check (Entity_Id, tree, bool, bool, Node_Id); -static bool addressable_p (tree, tree); +static bool addressable_p (tree gnu_expr, tree gnu_type = NULL_TREE, + Node_Id gnat_expr = Empty); static tree assoc_to_constructor (Entity_Id, Node_Id, tree); static tree pos_to_constructor (Node_Id, tree); static void validate_unchecked_conversion (Node_Id); @@ -4845,7 +4846,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gnat_formal = Next_Formal_With_Extras (gnat_formal), gnat_actual = Next_Actual (gnat_actual)) { - Entity_Id gnat_formal_type = Etype (gnat_formal); + const Entity_Id gnat_formal_type = Etype (gnat_formal); tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type); tree gnu_formal = present_gnu_tree (gnat_formal) ? get_gnu_tree (gnat_formal) : NULL_TREE; @@ -4861,10 +4862,11 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, because we need the real object in this case, either to pass its address if it's passed by reference or as target of the back copy done after the call if it uses the copy-in/copy-out mechanism. - We do it in the In case too, except for an unchecked conversion - to an elementary type or a constrained composite type because it - alone can cause the actual to be misaligned and the addressability - test is applied to the real object. */ + We do it in the In case too, except for a formal passed by reference + and an actual which is an unchecked conversion to an elementary type + or constrained composite type because it itself can cause the actual + to be misaligned or the strict aliasing rules to be violated and the + addressability test needs to be applied to the real object. */ const bool suppress_type_conversion = ((Nkind (gnat_actual) == N_Unchecked_Type_Conversion && (!in_param @@ -4894,7 +4896,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, out after the call. */ if (is_by_ref_formal_parm && (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name))) - && !addressable_p (gnu_name, gnu_name_type)) + && !addressable_p (gnu_name, gnu_name_type, gnat_name)) { tree gnu_orig = gnu_name, gnu_temp, gnu_stmt; @@ -4903,6 +4905,11 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, if (TREE_CODE (remove_conversions (gnu_name, true)) == CONSTRUCTOR) ; + /* Likewise for an atomic type, which is defined to be by-reference + if it is not by-copy but actually behaves more like a scalar. */ + else if (TYPE_ATOMIC (gnu_formal_type)) + ; + /* If the formal is passed by reference, a copy is not allowed. */ else if (TYPE_IS_BY_REFERENCE_P (gnu_formal_type) || Is_Aliased (gnat_formal)) @@ -10061,7 +10068,8 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflow_p, unless it is an expression involving computation or if it involves a reference to a bitfield or to an object not sufficiently aligned for its type. If GNU_TYPE is non-null, return true only if GNU_EXPR can - be directly addressed as an object of this type. + be directly addressed as an object of this type. GNAT_EXPR is the + GNAT expression that has been translated into GNU_EXPR. *** Notes on addressability issues in the Ada compiler *** @@ -10118,7 +10126,7 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflow_p, generated to connect everything together. */ static bool -addressable_p (tree gnu_expr, tree gnu_type) +addressable_p (tree gnu_expr, tree gnu_type, Node_Id gnat_expr) { /* For an integral type, the size of the actual type of the object may not be greater than that of the expected type, otherwise an indirect access @@ -10184,8 +10192,8 @@ addressable_p (tree gnu_expr, tree gnu_type) case COND_EXPR: /* We accept &COND_EXPR as soon as both operands are addressable and expect the outcome to be the address of the selected operand. */ - return (addressable_p (TREE_OPERAND (gnu_expr, 1), NULL_TREE) - && addressable_p (TREE_OPERAND (gnu_expr, 2), NULL_TREE)); + return (addressable_p (TREE_OPERAND (gnu_expr, 1)) + && addressable_p (TREE_OPERAND (gnu_expr, 2))); case COMPONENT_REF: return (((!DECL_BIT_FIELD (TREE_OPERAND (gnu_expr, 1)) @@ -10200,22 +10208,40 @@ addressable_p (tree gnu_expr, tree gnu_type) >= TYPE_ALIGN (TREE_TYPE (gnu_expr)))) /* The field of a padding record is always addressable. */ || TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))) - && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE)); + && addressable_p (TREE_OPERAND (gnu_expr, 0))); case ARRAY_REF: case ARRAY_RANGE_REF: case REALPART_EXPR: case IMAGPART_EXPR: case NOP_EXPR: - return addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE); + return addressable_p (TREE_OPERAND (gnu_expr, 0)); case CONVERT_EXPR: return (AGGREGATE_TYPE_P (TREE_TYPE (gnu_expr)) - && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE)); + && addressable_p (TREE_OPERAND (gnu_expr, 0))); case VIEW_CONVERT_EXPR: { - /* This is addressable if we can avoid a copy. */ - tree type = TREE_TYPE (gnu_expr); tree inner_type = TREE_TYPE (TREE_OPERAND (gnu_expr, 0)); + tree type = TREE_TYPE (gnu_expr); + alias_set_type inner_set, set; + + /* Taking the address of a VIEW_CONVERT_EXPR of an expression violates + strict aliasing rules if the source and target types are unrelated. + This would happen in an Ada program that itself does *not* contain + such a violation, through type punning done by means of an instance + of Unchecked_Conversion. Detect this case and force a temporary to + prevent the violation from occurring, which is always allowed by + the semantics of function calls in Ada, unless the source type or + the target type have alias set 0, i.e. may alias anything. */ + if (Present (gnat_expr) + && Nkind (gnat_expr) == N_Unchecked_Type_Conversion + && Nkind (Original_Node (gnat_expr)) == N_Function_Call + && (inner_set = get_alias_set (inner_type)) != 0 + && (set = get_alias_set (type)) != 0 + && inner_set != set) + return false; + + /* Otherwise this is addressable if we can avoid a copy. */ return (((TYPE_MODE (type) == TYPE_MODE (inner_type) && (!STRICT_ALIGNMENT || TYPE_ALIGN (type) <= TYPE_ALIGN (inner_type) @@ -10227,7 +10253,7 @@ addressable_p (tree gnu_expr, tree gnu_type) || TYPE_ALIGN (inner_type) >= BIGGEST_ALIGNMENT || TYPE_ALIGN_OK (type) || TYPE_ALIGN_OK (inner_type)))) - && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE)); + && addressable_p (TREE_OPERAND (gnu_expr, 0))); } default: From patchwork Tue May 21 07:30:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90549 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 764A0385828E for ; Tue, 21 May 2024 07:40:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id BFF843858410 for ; Tue, 21 May 2024 07:31:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFF843858410 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BFF843858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276673; cv=none; b=Tb+N7GqGJLgkFauQXhsZlFxuT1j5DnFIRh0hKtU3ELHGpaT7we0l45DXHMUUhSCfEjueGlNlpegGXl32ZKLrTA5Dryz7wgTZVJQJQyoYg0x/I327pwmvAg0z4yIUT4yBU876khJlWKGXYtb/GP76X5OvxsrRpIWESP8u492zLO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276673; c=relaxed/simple; bh=iV9xLAPEB4BQJU1k7WuXF2TAOHXoHC6jHFhIMUV0dKc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wOum9AreWMYNujosttY5Ik0X9l6rz0RvJiCGCctRP6jSzNIz0rCaNV8Dt/Jv8oTHegXZIBHD6lnSDYb7+H2jNmKhctTUjGVE9wKVhm/fnynqFcCwlSbYNegRFUwSgjlcQVE51+EwMC6mCfOLpc9A3/GxBibqFrBsU/uiWv18EtU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2e72b8931caso17719311fa.0 for ; Tue, 21 May 2024 00:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276668; x=1716881468; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jZf0erDPoNSnir1D7bJlTDYPeUNJ0sHNSvTCMWgvYKw=; b=envdQl5zXLQP859MHPOhHM6hNW2xSE7+dLAUap/r2ZDTZv4i3PxwYkwxvnadTIx0nB ZovN0OUHWEtOrMZ6mez8ijRCbPbIqQC2yYZiQ1ZcYUhAyYsDCv0QPgsaXYQ12/kwWQmO SQJkgrTL+B5qe205fhSvJtSArOiV9h2NvW1wtYyFW1E1gqhCYzFrNiWMLnzBqB/VwOyH fRiWJ9SU10HctYDviYn0pV+0IhIrFTNwa3/wDihuMClZ4jwyKRGwwRuG6LNmn4LZfy6a IJnjJbXGyycuS0pY0v6BIVy4hjWjMaTjTpjiFfvQ8tK4IOyKqo4GjsQyIZ7gKH9vs8Y6 TVUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276668; x=1716881468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jZf0erDPoNSnir1D7bJlTDYPeUNJ0sHNSvTCMWgvYKw=; b=VOGSDApZBz4i5FileZRLMwJdjoWQaV4WRjZj6KhLENmYCRy4BI5kGoAE4nkTfhyxLd wEjJAUHM3LJcd7S6cqhUsqv0g+6tO6i6uslYtJQkxIdfLsSFYcqG4Q4KfzdPElTE+gxD 2qEVnEEhvLSXeahpzfRyJGnDWz/BNz7VGltnzhx6u26oui5z8aRfh9j1e+A5ILhT4yon i/00SdUHq7oqXPbAdJtF2n4qI47Azi2CrXRp6jqOn2uNWka4fJIGOss9FOvSlgvaHuEQ mW6/rPwSsahvO+jK/9AdWlq9zpsGX0rI1YJpTQXl5se5kHjCGdg6dzt477KgPqaKQpcd GYLg== X-Gm-Message-State: AOJu0YwSaX1zFrbI9bAXqiKusTdykFSw00gM8ujmLKkMaXKYChvdomnS SCeavYx4UALEHv88J95eRLmxxA1q5u535wBep4fEIUoA58xp1133eFoUxB6QyLiLcbaUrSrPsMo = X-Google-Smtp-Source: AGHT+IG1Ltt+SKAojE95t5p0VNtqOJjOYI6gM8PhrNB/sOUasqMeXlosMrdclUf2rOO9DJI9/SvkvQ== X-Received: by 2002:a2e:b0d5:0:b0:2e0:2ef4:a985 with SMTP id 38308e7fff4ca-2e5204ccd6bmr195038411fa.35.1716276668361; Tue, 21 May 2024 00:31:08 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:08 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 27/31] ada: Make detection of useless copy for return more robust Date: Tue, 21 May 2024 09:30:30 +0200 Message-ID: <20240521073035.314024-27-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou In the return-by-invisible-reference case, the return object of an extended return statement is allocated directly on the return stack and, therefore, the copy operation on return is useless. The code detecting this was not robust enough and missed some complex cases. gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu) : In the return-by-invisible-reference case, remove conversions before looking for a dereference in the return values and building the test protecting against a useless copy operation. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index a6b86ec8b51..4ae599b8b4c 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -7767,11 +7767,12 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = build2 (INIT_EXPR, void_type_node, gnu_ret_deref, gnu_ret_val); /* Avoid a useless copy with __builtin_return_slot. */ - if (INDIRECT_REF_P (gnu_ret_val)) + tree gnu_inner_val = remove_conversions (gnu_ret_val, false); + if (INDIRECT_REF_P (gnu_inner_val)) gnu_result = build3 (COND_EXPR, void_type_node, fold_build2 (NE_EXPR, boolean_type_node, - TREE_OPERAND (gnu_ret_val, 0), + TREE_OPERAND (gnu_inner_val, 0), gnu_ret_obj), gnu_result, NULL_TREE); add_stmt_with_node (gnu_result, gnat_node); From patchwork Tue May 21 07:30:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90540 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF6C7384AB47 for ; Tue, 21 May 2024 07:36:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id E95DE385828E for ; Tue, 21 May 2024 07:31:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E95DE385828E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E95DE385828E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; cv=none; b=baLMmp628hKIXRjCjMg5ozpBwkHJy/CIx21b/Eguy0ZlXB4ZZHu2ZlD2ON44UluH/Nt0fn5eddByUjVO0OFWt5/w12e2iKQkDcM672f0ZRoqPFTLxTaDmVno9Xe7uNUloaxhXkHB/PGG2lfIt0woJ1GTz9g+Z0+mg/rM4hVnrQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; c=relaxed/simple; bh=Wvg0ix2OisnySj1yFBFHXiJAE11qIh79Hrw9X3U9DsU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YzUw+n9uBUvlEaov8+gxXd5Ig+K+xxPFe1oDgcSWNLAClvZNcYBMu9Oq6dNCS6vunBE8+0OHKawHvIUQCgV+x80lopzOdWGFARUx5YG91W9F7hhbtXj/YWejR6pIVgoPR3fWAyIOjXRcjP4W7yhmyBAGUql1YFEG2LZLAPdqg0E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-420180b59b7so25682375e9.0 for ; Tue, 21 May 2024 00:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276669; x=1716881469; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yQbbWJ1W1wTZ5tg/LWV1ZQHh5aqb5FoB4UqxCpNxWVg=; b=BFXbFAYIlg53itZWZap9nmkjBrci0ZQSQQtkptGVTLVooC4qhvzkIlzsU8nU+qvUzS YT1fyLRbLtZDb1368Zu6Jh21+BzliIzNLnLj9tgPvXln9k5/VIlaymKkDY4wUT4yKBI/ hOHPYB/4oLKNJwBnN6MrAKtZg26OfwwMfpdzd87pLfyYqOD+IkDmBw9fDivrhFuXcqAP T6LH6ozOI18wiDCjqOHvbDLVUATxKQRpEhz+sCJWy3GVJXYMOSjxNvxdDAveGMq5M7qQ OCmhzmzv3vu4Wm3zPN6+hbr22eI7UmbF9ajf0lOTeuMJAmn3+TipMuHPBajAdT8PktL4 teQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276669; x=1716881469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yQbbWJ1W1wTZ5tg/LWV1ZQHh5aqb5FoB4UqxCpNxWVg=; b=ONBLdkb+BeotuQig7rjMyQ+UdLnjK550gksMUTnkSdkyAALVKrrbSkyCwj8flD3fH0 JDJUIM+Z5D5JdLkysbuSPJxAfibY1EvknwRQ/Pswj8ZOd2j6pAXAZhSydPK8015tET5X dqJ6MOu++4VKZN6K+Rc5Mq+Gx8s/wmYDZ4a8KMq/iTar4EqNGoXxbT+GznAIydOqZBEz cXDME/BFbG4wxYmg1dpvnRdzFriDRUEYAb5tHBXkRr/hFalIBqyIduUQZnzkY4q8R6KZ HqKAxsBtN6urxnVpTU6h1WhX11bVHDy8n2CT6QfJwDaTH+lYVBYWtCsh9jFrg/uqJXmY 3GUQ== X-Gm-Message-State: AOJu0YynVE8EXWMSWYi5Ow8Z4rF62UXwBfpMKWigZmi1Ar9fOT/1mYu8 tqn4s9DsCFBP/Ik/2bmtqQgFZ0meJbjNt2rK5nLDobjC2iZlTEU2w/9Ny8+WUXwgrlc7pj7PAfo = X-Google-Smtp-Source: AGHT+IF6LcA6vknm3BalrLdQiZ9K2CRA2nLbp9W8o8f2/0gt6eW2OXPHKVF+M4kgov1nKqIFaKQ9rg== X-Received: by 2002:a05:600c:a44:b0:41a:34c3:2297 with SMTP id 5b1f17b1804b1-41fea93a34cmr270732375e9.5.1716276669180; Tue, 21 May 2024 00:31:09 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:08 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 28/31] ada: Fix strict aliasing violation in parameter passing (continued) Date: Tue, 21 May 2024 09:30:31 +0200 Message-ID: <20240521073035.314024-28-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou This fixes another long-standing (implicit) violation of the strict aliasing rules that occurs when the result of a value conversion is directly passed as an actual parameter in a call to a subprogram and the passing mechanism is by reference. In this case, the reference passed to the subprogram may be to a type that is too different from the type of the underlying object, which is the definition of such a violation. The change reworks and strengthens the previous fix as follows: first, the detection of these violations is moved into a dedicated predicate; second, an assertion is added to check that none of them has been missed, which is triggered by either -fchecking or -fstrict-aliasing, as the closely related assertion that is present in relate_alias_sets. The assertion uncovered two internal sources of violations: implementation types for packed array types with peculiar index types and interface types, which are fixed by propagating alias sets in the first case and resorting to universal aliasing in the second case. Finally, an unconditional warning is implemented to inform the user that the temporary is created and to suggest a possible solution to prevent that. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : For a packed type implemented specially, temporarily save the XUA type as equivalent to the entity before processing the implementation type. For this implementation type, if its component type is the same as that of the original type, copy the alias set from the latter. : Resort to universal aliasing for all interface types. * gcc-interface/trans.cc (Call_to_gnu): Add GNU_ACTUAL_TYPE local variable and rename existing one to GNU_UNPADDED_ACTUAL_TYPE. If the formal is passed by reference and the actual is a conversion, call aliasable_p to detect aliasing violations, issue a warning upon finding one and create the temporary in the target type. Add an assertion that no such violation has been missed above. (addressable_p): Revert latest changes. (aliasable_p): New predicate. * gcc-interface/utils2.cc (build_binary_op) : When creating a new array type on the fly, preserve the alias set of the operation type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 48 ++++++--- gcc/ada/gcc-interface/trans.cc | 167 +++++++++++++++++++++++--------- gcc/ada/gcc-interface/utils2.cc | 6 +- 3 files changed, 159 insertions(+), 62 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index ab54d2ccf13..6e40a157734 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -2119,6 +2119,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) case E_Array_Type: { + const Entity_Id OAT = Original_Array_Type (gnat_entity); const Entity_Id PAT = Packed_Array_Impl_Type (gnat_entity); const bool convention_fortran_p = (Convention (gnat_entity) == Convention_Fortran); @@ -2392,14 +2393,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) set_typeless_storage_on_aggregate_type (tem); } - /* If this is a packed type implemented specially, then process the - implementation type so it is elaborated in the proper scope. */ - if (Present (PAT)) - gnat_to_gnu_entity (PAT, NULL_TREE, false); - - /* Otherwise, if an alignment is specified, use it if valid and, if - the alignment was requested with an explicit clause, state so. */ - else if (Known_Alignment (gnat_entity)) + /* If an alignment is specified for an array that is not a packed type + implemented specially, use the alignment if it is valid and, if it + was requested with an explicit clause, preserve the information. */ + if (Known_Alignment (gnat_entity) && No (PAT)) { SET_TYPE_ALIGN (tem, validate_alignment (Alignment (gnat_entity), @@ -2418,7 +2415,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) TYPE_BIT_PACKED_ARRAY_TYPE_P (tem) = (Is_Packed_Array_Impl_Type (gnat_entity) - ? Is_Bit_Packed_Array (Original_Array_Type (gnat_entity)) + ? Is_Bit_Packed_Array (OAT) : Is_Bit_Packed_Array (gnat_entity)); if (Treat_As_Volatile (gnat_entity)) @@ -2447,8 +2444,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) TYPE_ARRAY_MAX_SIZE (tem) = gnu_max_size; /* See the above description for the rationale. */ - create_type_decl (create_concat_name (gnat_entity, "XUA"), tem, - artificial_p, debug_info_p, gnat_entity); + tree gnu_tmp_decl + = create_type_decl (create_concat_name (gnat_entity, "XUA"), tem, + artificial_p, debug_info_p, gnat_entity); TYPE_CONTEXT (tem) = gnu_fat_type; TYPE_CONTEXT (TYPE_POINTER_TO (tem)) = gnu_fat_type; @@ -2475,6 +2473,25 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) TYPE_REFERENCE_TO (gnu_type) = gnu_fat_type; SET_TYPE_MODE (gnu_type, BLKmode); SET_TYPE_ALIGN (gnu_type, TYPE_ALIGN (tem)); + + /* If this is a packed type implemented specially, then process the + implementation type so it is elaborated in the proper scope. */ + if (Present (PAT)) + { + /* Save the XUA type as our equivalent temporarily for the call + to gnat_to_gnu_type on the OAT below. */ + save_gnu_tree (gnat_entity, gnu_tmp_decl, false); + gnat_to_gnu_entity (PAT, NULL_TREE, false); + save_gnu_tree (gnat_entity, NULL_TREE, false); + } + + /* If this is precisely the implementation type and it has the same + component as the original type (which happens for peculiar index + types), copy the alias set from the latter; this ensures that all + implementation types built on the fly have the same alias set. */ + if (Is_Packed_Array_Impl_Type (gnat_entity) + && Component_Type (gnat_entity) == Component_Type (OAT)) + relate_alias_sets (gnu_type, gnat_to_gnu_type (OAT), ALIAS_SET_COPY); } break; @@ -4763,8 +4780,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && align_clause)) TYPE_USER_ALIGN (gnu_type) = 1; - /* Record whether a pragma Universal_Aliasing was specified. */ - if (Universal_Aliasing (gnat_entity) && !TYPE_IS_DUMMY_P (gnu_type)) + /* Record whether a pragma Universal_Aliasing was specified. Also + consider that it is always present on interface types because, + while they are abstract tagged types and thus no object of these + types exists anywhere, they are used to access objects of types + that implement them. */ + if ((Universal_Aliasing (gnat_entity) || Is_Interface (gnat_entity)) + && !TYPE_IS_DUMMY_P (gnu_type)) { /* Set TYPE_TYPELESS_STORAGE if this is an aggregate type and TYPE_UNIVERSAL_ALIASING_P otherwise, since the former is not diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 4ae599b8b4c..93978c0f0ba 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -254,8 +254,8 @@ static tree emit_check (tree, tree, int, Node_Id); static tree build_unary_op_trapv (enum tree_code, tree, tree, Node_Id); static tree build_binary_op_trapv (enum tree_code, tree, tree, tree, Node_Id); static tree convert_with_check (Entity_Id, tree, bool, bool, Node_Id); -static bool addressable_p (tree gnu_expr, tree gnu_type = NULL_TREE, - Node_Id gnat_expr = Empty); +static bool addressable_p (tree, tree); +static bool aliasable_p (tree, tree); static tree assoc_to_constructor (Entity_Id, Node_Id, tree); static tree pos_to_constructor (Node_Id, tree); static void validate_unchecked_conversion (Node_Id); @@ -4850,6 +4850,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type); tree gnu_formal = present_gnu_tree (gnat_formal) ? get_gnu_tree (gnat_formal) : NULL_TREE; + tree gnu_actual_type = gnat_to_gnu_type (Etype (gnat_actual)); const bool in_param = (Ekind (gnat_formal) == E_In_Parameter); const bool is_true_formal_parm = gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL; @@ -4865,8 +4866,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, We do it in the In case too, except for a formal passed by reference and an actual which is an unchecked conversion to an elementary type or constrained composite type because it itself can cause the actual - to be misaligned or the strict aliasing rules to be violated and the - addressability test needs to be applied to the real object. */ + to be misaligned and the addressability test needs to be applied to + the real object. */ const bool suppress_type_conversion = ((Nkind (gnat_actual) == N_Unchecked_Type_Conversion && (!in_param @@ -4878,6 +4879,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, Node_Id gnat_name = suppress_type_conversion ? Expression (gnat_actual) : gnat_actual; tree gnu_name = gnat_to_gnu (gnat_name), gnu_name_type; + bool aliasing = false; /* If it's possible we may need to use this expression twice, make sure that any side-effects are handled via SAVE_EXPRs; likewise if we need @@ -4893,10 +4895,14 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* If we are passing a non-addressable parameter by reference, pass the address of a copy. In the In Out or Out case, set up to copy back - out after the call. */ + out after the call. Moreover, in the case of a conversion, if we + are passing a non-aliasable parameter, also pass the address of a + copy to avoid breaking strict aliasing rules. */ if (is_by_ref_formal_parm && (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name))) - && !addressable_p (gnu_name, gnu_name_type, gnat_name)) + && (!addressable_p (gnu_name, gnu_name_type) + || (node_is_type_conversion (gnat_actual) + && (aliasing = !aliasable_p (gnu_name, gnu_actual_type))))) { tree gnu_orig = gnu_name, gnu_temp, gnu_stmt; @@ -4922,6 +4928,37 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, post_error ("misaligned actual cannot be passed by reference??", gnat_actual); + /* If the copy needs to be made because of aliasing considerations, + issue a warning because this was historically not necessary. */ + else if (aliasing) + { + if (Nkind (gnat_actual) == N_Unchecked_Type_Conversion) + { + post_error + ("unchecked conversion implemented by copy??", + gnat_actual); + post_error + ("\\?use pragma Universal_Aliasing on either type", + gnat_actual); + post_error + ("\\?to enable RM 13.9(12) implementation permission", + gnat_actual); + } + + else + { + post_error + ("value conversion implemented by copy??", + gnat_actual); + post_error + ("\\?use pair of types with same root type", + gnat_actual); + post_error + ("\\?to avoid new object in RM 4.6(58.5/5)", + gnat_actual); + } + } + /* If the actual type of the object is already the nominal type, we have nothing to do, except if the size is self-referential in which case we'll remove the unpadding below. */ @@ -4952,6 +4989,17 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, TREE_TYPE (gnu_name)))) gnu_name = convert (gnu_name_type, gnu_name); + /* If the temporary is created because of aliasing considerations, + it must be in the target type of the (unchecked) conversion. */ + if (aliasing) + { + if (Nkind (gnat_actual) == N_Unchecked_Type_Conversion) + gnu_name = unchecked_convert (gnu_actual_type, gnu_name, + No_Truncation (gnat_actual)); + else + gnu_name = convert (gnu_actual_type, gnu_name); + } + /* If this is an In Out or Out parameter and we're returning a value, we need to create a temporary for the return value because we must preserve it before copying back at the very end. */ @@ -5011,6 +5059,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, } /* Start from the real object and build the actual. */ + tree gnu_unpadded_actual_type = get_unpadded_type (Etype (gnat_actual)); tree gnu_actual = gnu_name; /* If atomic access is required for an In or In Out actual parameter, @@ -5025,8 +5074,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, So do it here for the part we will use as an input, if any. */ if (Ekind (gnat_formal) != E_Out_Parameter && TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual))) - gnu_actual - = convert (get_unpadded_type (Etype (gnat_actual)), gnu_actual); + gnu_actual = convert (gnu_unpadded_actual_type, gnu_actual); /* Put back the conversion we suppressed above in the computation of the real object. And even if we didn't suppress any conversion there, we @@ -5036,12 +5084,11 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, pointer to it, but that's OK when the formal is passed by reference. We also do not put back a conversion between an actual and a formal that are unconstrained array types to avoid creating local bounds. */ - tree gnu_actual_type = get_unpadded_type (Etype (gnat_actual)); - if (TYPE_IS_DUMMY_P (gnu_actual_type)) + if (TYPE_IS_DUMMY_P (gnu_unpadded_actual_type)) gcc_assert (is_true_formal_parm && DECL_BY_REF_P (gnu_formal)); else if (suppress_type_conversion && Nkind (gnat_actual) == N_Unchecked_Type_Conversion) - gnu_actual = unchecked_convert (gnu_actual_type, gnu_actual, + gnu_actual = unchecked_convert (gnu_unpadded_actual_type, gnu_actual, No_Truncation (gnat_actual)); else if ((TREE_CODE (TREE_TYPE (gnu_actual)) == UNCONSTRAINED_ARRAY_TYPE || (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE @@ -5049,7 +5096,16 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, && TREE_CODE (gnu_formal_type) == UNCONSTRAINED_ARRAY_TYPE) ; else - gnu_actual = convert (gnu_actual_type, gnu_actual); + gnu_actual = convert (gnu_unpadded_actual_type, gnu_actual); + + /* If the formal parameter is passed by reference, check that building + the address of the actual parameter below will not end up violating + strict aliasing rules; that's the case for a VIEW_CONVERT_EXPR when + the source and target types may not alias each other. */ + if (is_by_ref_formal_parm + && TREE_CODE (gnu_actual) == VIEW_CONVERT_EXPR + && (flag_checking || flag_strict_aliasing)) + gcc_assert (aliasable_p (gnu_actual, gnu_actual_type)); gigi_checking_assert (!Do_Range_Check (gnat_actual)); @@ -5065,8 +5121,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* If we have a padded type, be sure we've removed padding. */ if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual))) - gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)), - gnu_actual); + gnu_actual = convert (gnu_unpadded_actual_type, gnu_actual); /* If it is the constructed subtype of an array allocated with its bounds, the type of the actual includes the template, @@ -5076,7 +5131,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (gnu_actual)) && Is_Constr_Array_Subt_With_Bounds (Etype (gnat_actual))) - gnu_actual = convert (gnu_actual_type, gnu_actual); + gnu_actual = convert (gnu_unpadded_actual_type, gnu_actual); } /* There is no need to convert the actual to the formal's type before @@ -5087,7 +5142,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* Put back the conversion we suppressed above for In Out or Out parameters, since it may set the bounds of the actual. */ if (!in_param && suppress_type_conversion) - gnu_actual = convert (gnu_actual_type, gnu_actual); + gnu_actual = convert (gnu_unpadded_actual_type, gnu_actual); gnu_actual = convert (gnu_formal_type, gnu_actual); } @@ -10065,12 +10120,11 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflow_p, return convert (gnu_type, gnu_result); } -/* Return true if GNU_EXPR can be directly addressed. This is the case +/* Return true if GNU_EXPR may be directly addressed. This is the case unless it is an expression involving computation or if it involves a reference to a bitfield or to an object not sufficiently aligned for its type. If GNU_TYPE is non-null, return true only if GNU_EXPR can - be directly addressed as an object of this type. GNAT_EXPR is the - GNAT expression that has been translated into GNU_EXPR. + be directly addressed as an object of this type. *** Notes on addressability issues in the Ada compiler *** @@ -10127,7 +10181,7 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflow_p, generated to connect everything together. */ static bool -addressable_p (tree gnu_expr, tree gnu_type, Node_Id gnat_expr) +addressable_p (tree gnu_expr, tree gnu_type) { /* For an integral type, the size of the actual type of the object may not be greater than that of the expected type, otherwise an indirect access @@ -10193,8 +10247,8 @@ addressable_p (tree gnu_expr, tree gnu_type, Node_Id gnat_expr) case COND_EXPR: /* We accept &COND_EXPR as soon as both operands are addressable and expect the outcome to be the address of the selected operand. */ - return (addressable_p (TREE_OPERAND (gnu_expr, 1)) - && addressable_p (TREE_OPERAND (gnu_expr, 2))); + return (addressable_p (TREE_OPERAND (gnu_expr, 1), NULL_TREE) + && addressable_p (TREE_OPERAND (gnu_expr, 2), NULL_TREE)); case COMPONENT_REF: return (((!DECL_BIT_FIELD (TREE_OPERAND (gnu_expr, 1)) @@ -10209,40 +10263,22 @@ addressable_p (tree gnu_expr, tree gnu_type, Node_Id gnat_expr) >= TYPE_ALIGN (TREE_TYPE (gnu_expr)))) /* The field of a padding record is always addressable. */ || TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))) - && addressable_p (TREE_OPERAND (gnu_expr, 0))); + && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE)); case ARRAY_REF: case ARRAY_RANGE_REF: case REALPART_EXPR: case IMAGPART_EXPR: case NOP_EXPR: - return addressable_p (TREE_OPERAND (gnu_expr, 0)); + return addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE); case CONVERT_EXPR: return (AGGREGATE_TYPE_P (TREE_TYPE (gnu_expr)) - && addressable_p (TREE_OPERAND (gnu_expr, 0))); + && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE)); case VIEW_CONVERT_EXPR: { - tree inner_type = TREE_TYPE (TREE_OPERAND (gnu_expr, 0)); + /* This is addressable only if a copy need not be made downstream. */ tree type = TREE_TYPE (gnu_expr); - alias_set_type inner_set, set; - - /* Taking the address of a VIEW_CONVERT_EXPR of an expression violates - strict aliasing rules if the source and target types are unrelated. - This would happen in an Ada program that itself does *not* contain - such a violation, through type punning done by means of an instance - of Unchecked_Conversion. Detect this case and force a temporary to - prevent the violation from occurring, which is always allowed by - the semantics of function calls in Ada, unless the source type or - the target type have alias set 0, i.e. may alias anything. */ - if (Present (gnat_expr) - && Nkind (gnat_expr) == N_Unchecked_Type_Conversion - && Nkind (Original_Node (gnat_expr)) == N_Function_Call - && (inner_set = get_alias_set (inner_type)) != 0 - && (set = get_alias_set (type)) != 0 - && inner_set != set) - return false; - - /* Otherwise this is addressable if we can avoid a copy. */ + tree inner_type = TREE_TYPE (TREE_OPERAND (gnu_expr, 0)); return (((TYPE_MODE (type) == TYPE_MODE (inner_type) && (!STRICT_ALIGNMENT || TYPE_ALIGN (type) <= TYPE_ALIGN (inner_type) @@ -10254,7 +10290,7 @@ addressable_p (tree gnu_expr, tree gnu_type, Node_Id gnat_expr) || TYPE_ALIGN (inner_type) >= BIGGEST_ALIGNMENT || TYPE_ALIGN_OK (type) || TYPE_ALIGN_OK (inner_type)))) - && addressable_p (TREE_OPERAND (gnu_expr, 0))); + && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE)); } default: @@ -10262,6 +10298,45 @@ addressable_p (tree gnu_expr, tree gnu_type, Node_Id gnat_expr) } } +/* Return true if GNU_EXPR may be aliased by an object of GNU_TYPE in the + context of by-reference parameter passing. This is the case when the + object (ultimately) referenced through GNU_EXPR has a type whose alias + set is either effectively 0, or equal to, or a subset of the alias set + of GNU_TYPE. + + When the predicate returns true, it is possible to take the address of + GNU_EXPR without violating strict aliasing rules. When it does not, no + such guarantee holds, so a temporary with GNU_TYPE needs to be created + and its address passed instead (provided that this be legal of course). */ + +static bool +aliasable_p (tree gnu_expr, tree gnu_type) +{ + /* This is the source of the possible violation: taking the address of an + object in a type that does not correspond to its declared type. */ + if (TREE_CODE (gnu_expr) == VIEW_CONVERT_EXPR) + gnu_expr = TREE_OPERAND (gnu_expr, 0); + + /* Work around get_deref_alias_set and alias_set_subset_of being disabled + when flag_strict_aliasing is 0. */ + const bool saved_flag_strict_aliasing = flag_strict_aliasing; + + flag_strict_aliasing = 1; + + /* Call get_deref_alias_set to catch ref-all and void* pointers. */ + const alias_set_type set1 + = TREE_CODE (gnu_expr) == INDIRECT_REF + ? get_deref_alias_set (TREE_OPERAND (gnu_expr, 0)) + : get_alias_set (TREE_TYPE (gnu_expr)); + const alias_set_type set2 = get_alias_set (gnu_type); + + bool ret = set1 == 0 || set1 == set2 || alias_set_subset_of (set1, set2); + + flag_strict_aliasing = saved_flag_strict_aliasing; + + return ret; +} + /* Do the processing for the declaration of a GNAT_ENTITY, a type or subtype. If a Freeze node exists for the entity, delay the bulk of the processing. Otherwise make a GCC type for GNAT_ENTITY and set up the correspondence. */ diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 161f0f11e5c..c1346cfadeb 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1036,9 +1036,9 @@ build_binary_op (enum tree_code op_code, tree result_type, if (op_code == ARRAY_RANGE_REF && TREE_TYPE (operation_type) != TREE_TYPE (left_type)) { - operation_type - = build_nonshared_array_type (TREE_TYPE (left_type), - TYPE_DOMAIN (operation_type)); + operation_type = copy_type (operation_type); + TREE_TYPE (operation_type) = TREE_TYPE (left_type); + /* Declare it now since it will never be declared otherwise. This is necessary to ensure that its subtrees are properly marked. */ create_type_decl (TYPE_NAME (operation_type), operation_type, true, From patchwork Tue May 21 07:30:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90550 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 05B49385E83E for ; Tue, 21 May 2024 07:40:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 2092E3858430 for ; Tue, 21 May 2024 07:31:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2092E3858430 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2092E3858430 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; cv=none; b=Dy51DHG6l2OUre6jXqzoHJ6wm1d8ZSIiTM4muju36fQqYO2QVTOrdg6+mzEJ2iDXsdwZwCtqUwyRWsuKjSYMcU/vf86IYAXI/hUzzvCpIKCH7HKXOd2lSIz73Jzq+ISfSaCJ0Rqd7Pg6sD/Rk+bFU6R8rghA+4gONZuW7RDoHRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; c=relaxed/simple; bh=KG86oMXf9/afv7Ivj1Js9Gaz1ajkMayj/ht1nM+wvu4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AFSMA1PM+118vgM7TpaHNBNo3+fXfADkatuCvxjJjR2up3V1FcfRxsTyfclE6SVu1qw39oMQAIZ+bKUqujDy1dPTa0ifHMP1+Zuleig5Tbt3hM6a6aW/bx/bCp+QHsbwobrSk6RHRUsLw+Wn4yKQvX4SaT5Mwf+isGEZLvSmNUs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4202ca70270so38993455e9.3 for ; Tue, 21 May 2024 00:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276670; x=1716881470; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cD3DQCHy7uAAvXcNJwNjX5AzG9skbgX8eYJyzkAMufk=; b=iQyKacATnk0W9JuyYP52E2SLYC1KP8bYxW7RQPTgFsg06CWkI9IRL8dnU4RsnxNlLR ruC7osHw0gZs4i9hGNA80Y86yMLTXYSaNqtTIM7SKAQybJ3NLTSInSNa2P0/XBA7bBz6 GO9jnz1zsESpcdPWSxNKJOu5Og8Kq/VJEbeRDz1ok4RUq9fNjjRA6LpUN65UBGKGjxld ISIn3eqf+EpUDXXSb8HX3maCLPkpR4Jj9vIUX9egQamleS5UfYbFtiDyVqnyBub4aBfQ /rnA9VTxpCg86rKgHQuSameqEFrA8y699w4xH1u/yCEHPyrIE9Qb5NIhdLHHFCUWWU8Q L61g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276670; x=1716881470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cD3DQCHy7uAAvXcNJwNjX5AzG9skbgX8eYJyzkAMufk=; b=VoqwRq+ntorgaz4MAd0gHlfwFyBUBaf7kq1Lv1mt6ZRe5VMblAnUwrCXODeBVySBV5 4/s74boIkcBzaYrZllRfaBCEjdf9HoHwPFAfF3UQ2o1OIKYx8sKZshOgKe12C+FxZ31m p++rpJeVgNMjNu/1h8r5H2Tbex5Pzzh/DTv63pkbc3TIvG1Rq9L8uo3wIY/ivasp6STK YRWD6f2A/ycZjsVL5YUR5oMY7a5jHwf2KRN5AM5CSDSxgLMVbefwgWMU6FuCmztUnZNt /eeZddQOLJXgjtQvUpal4KavOJJuOqwm7lr7lK58RLOXWFATNI6LM1WVxEG68VmqrxZD +s7Q== X-Gm-Message-State: AOJu0Yz2zrFdELFx/cxGtCmQI3DkF2QQbsMw0TPz/O27EVRLTm5KTHSb aiJHTHYt3EY0TyvxewcBlt/Idr5PhoSdQMc3TfXULxXNrSaBec8feeKtEyz9VzZDQdDzMy/Thdo = X-Google-Smtp-Source: AGHT+IHNhvtQky3fr3541Rd/pGrlyBD/qNwuXl6N1hP4QdiwNjdFxWQDLMC9H8c5O4A5wqJ3fBMjqA== X-Received: by 2002:a05:600c:3ca3:b0:41c:23f3:65fa with SMTP id 5b1f17b1804b1-41feac55e3cmr294760655e9.28.1716276669935; Tue, 21 May 2024 00:31:09 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:09 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 29/31] ada: Fix internal error on discriminated record with Atomic aspect in Ada 2022 Date: Tue, 21 May 2024 09:30:32 +0200 Message-ID: <20240521073035.314024-29-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou It occurs in build_load_modify_store where the pattern matching logic cannot find the atomic load that is present in the tree because it has been wrapped in a SAVE_EXPR by gnat_protect_expr, which is unnecessary. gcc/ada/ * gcc-interface/utils2.cc (gnat_protect_expr): Deal specifically with atomic loads. Document the relationship with gnat_save_expr. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index c1346cfadeb..8fb86ab29e3 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -2887,7 +2887,11 @@ gnat_save_expr (tree exp) /* Protect EXP for immediate reuse. This is a variant of gnat_save_expr that is optimized under the assumption that EXP's value doesn't change before - its subsequent reuse(s) except through its potential reevaluation. */ + its subsequent reuse(s) except potentially through its reevaluation. + + gnat_protect_expr guarantees that multiple evaluations of the expression + will not generate multiple side effects, whereas gnat_save_expr further + guarantees that all evaluations will yield the same result. */ tree gnat_protect_expr (tree exp) @@ -2932,6 +2936,13 @@ gnat_protect_expr (tree exp) return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)), TREE_OPERAND (exp, 1), NULL_TREE); + /* An atomic load is an INDIRECT_REF of its first argument, so apply the + same transformation as in the INDIRECT_REF case above. */ + if (code == CALL_EXPR && call_is_atomic_load (exp)) + return build_call_expr (TREE_OPERAND (CALL_EXPR_FN (exp), 0), 2, + gnat_protect_expr (CALL_EXPR_ARG (exp, 0)), + CALL_EXPR_ARG (exp, 1)); + /* If this is a COMPONENT_REF of a fat pointer, save the entire fat pointer. This may be more efficient, but will also allow us to more easily find the match for the PLACEHOLDER_EXPR. */ From patchwork Tue May 21 07:30:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90555 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 97E7B3858C39 for ; Tue, 21 May 2024 07:44:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id C6A203858D28 for ; Tue, 21 May 2024 07:31:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6A203858D28 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C6A203858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; cv=none; b=cx4EjMW40oUi+SlehPcx+/ZXhJEGFYIH6huYJZWIFJRSEz2/k3y2E7H9hyHs1l5GjmW0Rd/io7oXm1zDkGrIKOXmuZH3We6PVh/keiuIY9e0YqhWpP1yLwCZakA6Aj96Y9qN/6Jln9NfQht+ZQhfn8bE2GiDWViplsk3et5Obws= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; c=relaxed/simple; bh=adpWe3wlnWRP6+KNxi7qFxp1EcepaZjjHzSwfbEM6k8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YEMfPApTY96ibJOsBpw0k851H509dOGu79y93cF83zcsg9Q1EBVEMXpR5VNBqxh+R0qhkwMoipKJbygiYp0yvBWByX7gZWrXDYu07t0ISUuCPyYISQCeXrkTL6EJwL+qmO3fK+YvlcrMqoL+Kh+rm6Ubck1Iy5In7HHfDEQRHXk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-34d7b0dac54so1787670f8f.0 for ; Tue, 21 May 2024 00:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276670; x=1716881470; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LWujDKnxgUXd4fKlQ1Y5Y82lqoZrNZbc5iVOoacaOYc=; b=ZjpJH5BsaRwXZ8h30dsVsi5R5/oAy6d8frcCFbxdJp6y8gikSIH49XpG87Fk4cHEqm Ulv3CDFyAz15ne7gtD051bFQJtlWEQjN4mF6DXp3jNai9rRu/DbFyhftq3WO+TiXmXNh OqN7cnvFsHbUjg9a9/x3+XjHnjg4Z9ZXIzN7K26kT2vftMYfODvgs7w2jvuZe7bGrR38 BgSWefDiB7FivKn2+f7EuoPjfUxRwEUlO9bW9yHXRayMb6KK6/TJcq2MCsdoJf9vTjBj SGdT8XnX1fwRkwti8jwkKhkQDeprBWbEDp1FxvKP2mu09K1XEhk0QHEtS3O1lyzgpzOk eh1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276670; x=1716881470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LWujDKnxgUXd4fKlQ1Y5Y82lqoZrNZbc5iVOoacaOYc=; b=CIzHlyTqmotxfc/26UWudOn7dYWEnj46apOLSkCRYkPBt6L76i9gyKnsPOGC+YDad+ hPMRS5fntE2eRDJJrCRLlhBvhh05JbPkrG0EPvGc98JnAWr2aiRAPoUXaVRSQJZsdyor dLML6YtLqlZ+88vRhnzwAu5zgfppKhH5f3mqGxKFS5hCkcOc1I0/CIiMCzrPbHoD3lpi JSxoumNfBxijZAqaglwkYIQ0EEQ9EgRDkCA9aCcv+2Mt8wlSsXYVGpheNnQ8Jhm5LcV6 zolvfuDzqev81pDBHF7i3cwx/iMuS6S0e6bhKLYLl3idMilQZRzcI4o2OQrkCadHe3aB NjAg== X-Gm-Message-State: AOJu0YzXJmPWilkYsWmdbA11Ag0+3nFS0wqLxFuyP9gUDKbxTOHqZfMk 4pT0w8deuNMWEzFww+wygLvb+G+IdKYjwUpbIfVuw4A3igfRXo4Vh54Qm24w++U/ZHbyL/m5x/E = X-Google-Smtp-Source: AGHT+IEWVeuz8ke2esBuvf4WqsjtgsqjhGxsut4hzB8WSe4gTEeZ+GDqLfjoYM163zkZ+cCVVQYW5g== X-Received: by 2002:adf:f88c:0:b0:354:b95c:4fe0 with SMTP id ffacd0b85a97d-354b95c5305mr7353076f8f.13.1716276670569; Tue, 21 May 2024 00:31:10 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:10 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 30/31] ada: Simplify test for propagation of attributes to subtypes Date: Tue, 21 May 2024 09:30:33 +0200 Message-ID: <20240521073035.314024-30-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou This changes the test to use the Is_Base_Type predicate and also removes the superfluous call to Base_Type before First_Subtype. No functional changes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Use the Is_Base_Type predicate and remove superfluous calls to Base_Type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 6e40a157734..f6a4c0631b6 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -506,11 +506,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* Machine_Attributes on types are expected to be propagated to subtypes. The corresponding Gigi_Rep_Items are only attached to the first subtype though, so we handle the propagation here. */ - if (Base_Type (gnat_entity) != gnat_entity + if (!Is_Base_Type (gnat_entity) && !Is_First_Subtype (gnat_entity) - && Has_Gigi_Rep_Item (First_Subtype (Base_Type (gnat_entity)))) - prepend_attributes (&attr_list, - First_Subtype (Base_Type (gnat_entity))); + && Has_Gigi_Rep_Item (First_Subtype (gnat_entity))) + prepend_attributes (&attr_list, First_Subtype (gnat_entity)); /* Compute a default value for the size of an elementary type. */ if (Known_Esize (gnat_entity) && Is_Elementary_Type (gnat_entity)) From patchwork Tue May 21 07:30:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 90552 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3C9E3858D35 for ; Tue, 21 May 2024 07:41:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 6F9203858288 for ; Tue, 21 May 2024 07:31:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F9203858288 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F9203858288 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; cv=none; b=nxDg0O99BR0X1qn3YFcCJisFxomDDCamWExZbR5eH5Vb52INc7Bk3K8tYprJ0QgTfm3QIs3cky0vne5eRiUmpyLSHe+XdAd6OIWyyOrOi8oxwqkDKCQYIk+o9L9WS/j1Iy4avLAyBLXuySTRjbGcfnvkbhVGe5hzVfM6TBLW7HA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276676; c=relaxed/simple; bh=lD9aWBSduKcHlt++7ip4I4xBYz/fY1ZIyEOx/ZUXJAo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xbuQcwAufHIOYyO7IAArCM3+ACH/OFDfXoqaRumsBSHQaBbpxUFj9e2MfWIEhUFo8uN/GXKGnYNFPXtlT6flQsx5xa0ZReZ3RvJbZ3AuqZEDsoKxZHfVS+GutgnYEBSbZYpRCX0X2w/bezsGVGck6TNPAePqm1qEGf30aMqYfvY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-420180b5838so20672795e9.2 for ; Tue, 21 May 2024 00:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276671; x=1716881471; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XINQgTgn2II1Ib30Lr7lsMk49xM397g49zogKB6z+ck=; b=iXYVsTmNJMhLPovrBYBRCCI689mgzxQSgqTTIhUq3yIGQqqxBzz5e5TPio7kPzRsSJ 9UX79V/8EDeflUdRzs7oo1rpy+/KjLSs9irpZy8CbkhZUiZBNflXv3GZ7laqxR0ugpYR OhCitSWiBtt24tJZ+6wrbxylBx8anDVLliKCAesoWDsoFurc1/vwSOyq7rXi01UFnylS ZoY/l0PLH7rxhZ9uIePEld9GTOYpxk4EFQwy8mQc9FScMEMp5fuy8Y5nbTquQPzzARTm AWKFxQXMLtEc6YgK+4CZ+Ym33qnE/nnkCpdnykUQdD9jBgG4sv3M2dvR26V4oQY7aDzO iTkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276671; x=1716881471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XINQgTgn2II1Ib30Lr7lsMk49xM397g49zogKB6z+ck=; b=jxu5GrvVdMmXf6bLymX3o4RxtwPIovlNLT82t/vr8Q/8KUGvgku5aHbtOFFITqIz/8 AAUZPWkBgW7MV67fKdGD1pCr7IikCfmwssvLdntKOCW1QtIYP4Yyd91Itghv4BUFw0Sj iBrXURd/fVOFWt9ZrjxPu7San0Kq5OYMIA6fUg/Qg1xV3bDqD1K0o1TBsIq+cRz1TGqT uxRYUdEll/7thh4BAZneoGM4Grbst05UQhcM4w7coFQnW2Wv/38jKBhLz5XIGt7eGG0g 4simTcoa7I6JKXYeWnwU01trYEZMCKIOIsTIx/fXMnBYAD93DsOksCWCjR2+jXUSYEmS 9KNA== X-Gm-Message-State: AOJu0YxKkZltf07dzrlgT3iWigrH8aXsYS3KcO6ve9E6wJFwQ9G22jza /6wrBJ91WpGPYETSkGTZTcba3Tv7ZR+sm54xVX5ElFw/Pc2pM306NxXcuvG44mBIy3Q97nE9JDE = X-Google-Smtp-Source: AGHT+IEQsSrcnlKjCXz2QZtan7s5ylSy0NaJFiGVpTZK2dPuwa8CLY/g24Q718fUgAfCw+z3/iscmQ== X-Received: by 2002:a05:600c:4f93:b0:416:7b2c:df0f with SMTP id 5b1f17b1804b1-41fea931f13mr296534585e9.7.1716276671224; Tue, 21 May 2024 00:31:11 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:10 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 31/31] ada: Streamline implementation of simple nonbinary modular operations Date: Tue, 21 May 2024 09:30:34 +0200 Message-ID: <20240521073035.314024-31-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou They are implemented by the nonbinary_modular_operation routine, which is complex and, in particular, creates signed types and types with a partial precision each time a subtraction or a multiplication resp. is generated. Both are unnecessary and a simple approach even generates better code for the subtraction on architectures with conditional moves. gcc/ada/ * gcc-interface/utils2.cc (nonbinary_modular_operation): Rewrite. Do not create signed types for subtraction, do not create types with partial precision, call fold_convert instead of convert throughout. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 91 ++++++++++----------------------- 1 file changed, 28 insertions(+), 63 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 8fb86ab29e3..4b7e2739f6a 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -535,85 +535,50 @@ compare_fat_pointers (location_t loc, tree result_type, tree p1, tree p2) } /* Compute the result of applying OP_CODE to LHS and RHS, where both are of - type TYPE. We know that TYPE is a modular type with a nonbinary - modulus. */ + TYPE. We know that TYPE is a modular type with a nonbinary modulus. */ static tree nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs, tree rhs) { tree modulus = TYPE_MODULUS (type); - unsigned int needed_precision = tree_floor_log2 (modulus) + 1; - unsigned int precision; - bool unsignedp = true; - tree op_type = type; - tree result; + unsigned precision = tree_floor_log2 (modulus) + 1; + tree op_type, result; - /* If this is an addition of a constant, convert it to a subtraction - of a constant since we can do that faster. */ - if (op_code == PLUS_EXPR && TREE_CODE (rhs) == INTEGER_CST) - { - rhs = fold_build2 (MINUS_EXPR, type, modulus, rhs); - op_code = MINUS_EXPR; - } - - /* For the logical operations, we only need PRECISION bits. For - addition and subtraction, we need one more and for multiplication we - need twice as many. But we never want to make a size smaller than - our size. */ + /* For the logical operations, we only need PRECISION bits. For addition and + subtraction, we need one more, and for multiplication twice as many. */ if (op_code == PLUS_EXPR || op_code == MINUS_EXPR) - needed_precision += 1; + precision += 1; else if (op_code == MULT_EXPR) - needed_precision *= 2; - - precision = MAX (needed_precision, TYPE_PRECISION (op_type)); + precision *= 2; - /* Unsigned will do for everything but subtraction. */ - if (op_code == MINUS_EXPR) - unsignedp = false; - - /* If our type is the wrong signedness or isn't wide enough, make a new - type and convert both our operands to it. */ - if (TYPE_PRECISION (op_type) < precision - || TYPE_UNSIGNED (op_type) != unsignedp) + /* If the type is not wide enough, make a new type of the needed precision + and convert modulus and operands to it. Use a type with full precision + for its mode since operations are ultimately performed in the mode. */ + if (TYPE_PRECISION (type) < precision) { - /* Copy the type so we ensure it can be modified to make it modular. */ - op_type = copy_type (gnat_type_for_size (precision, unsignedp)); - modulus = convert (op_type, modulus); - SET_TYPE_MODULUS (op_type, modulus); - TYPE_MODULAR_P (op_type) = 1; - lhs = convert (op_type, lhs); - rhs = convert (op_type, rhs); + const scalar_int_mode m = smallest_int_mode_for_size (precision); + op_type = gnat_type_for_mode (m, 1); + modulus = fold_convert (op_type, modulus); + lhs = fold_convert (op_type, lhs); + rhs = fold_convert (op_type, rhs); } + else + op_type = type; /* Do the operation, then we'll fix it up. */ result = fold_build2 (op_code, op_type, lhs, rhs); - /* For multiplication, we have no choice but to do a full modulus - operation. However, we want to do this in the narrowest - possible size. */ - if (op_code == MULT_EXPR) - { - /* Copy the type so we ensure it can be modified to make it modular. */ - tree div_type = copy_type (gnat_type_for_size (needed_precision, 1)); - modulus = convert (div_type, modulus); - SET_TYPE_MODULUS (div_type, modulus); - TYPE_MODULAR_P (div_type) = 1; - result = convert (op_type, - fold_build2 (TRUNC_MOD_EXPR, div_type, - convert (div_type, result), modulus)); - } + /* Unconditionally add the modulus to the result for a subtraction, this gets + rid of all its peculiarities by cancelling out the addition of the binary + modulus in the case where the subtraction wraps around in OP_TYPE, and may + even generate better code on architectures with conditional moves. */ + if (op_code == MINUS_EXPR) + result = fold_build2 (PLUS_EXPR, op_type, result, modulus); - /* For subtraction, add the modulus back if we are negative. */ - else if (op_code == MINUS_EXPR) - { - result = gnat_protect_expr (result); - result = fold_build3 (COND_EXPR, op_type, - fold_build2 (LT_EXPR, boolean_type_node, result, - build_int_cst (op_type, 0)), - fold_build2 (PLUS_EXPR, op_type, result, modulus), - result); - } + /* For a multiplication, we have no choice but to use a modulo operation. */ + if (op_code == MULT_EXPR) + result = fold_build2 (TRUNC_MOD_EXPR, op_type, result, modulus); /* For the other operations, subtract the modulus if we are >= it. */ else @@ -627,7 +592,7 @@ nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs, result); } - return convert (type, result); + return fold_convert (type, result); } /* This page contains routines that implement the Ada semantics with regard