public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Put_Image aspect spec incorrectly not inherited
@ 2022-11-07  8:39 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-11-07  8:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: Steve Baird

From: Steve Baird <baird@adacore.com>

In some cases, a Put_Image aspect specification for a scalar type was not
correctly inherited by a descendant of that type.

gcc/ada/

	* exp_put_image.adb
	(Image_Should_Call_Put_Image): Correctly handle the case of an
	inherited Put_Image aspect specification for a scalar type.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_put_image.adb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb
index 50e0569a801..c489ad41fd1 100644
--- a/gcc/ada/exp_put_image.adb
+++ b/gcc/ada/exp_put_image.adb
@@ -1039,13 +1039,13 @@ package body Exp_Put_Image is
       end if;
 
       --  In Ada 2022, T'Image calls T'Put_Image if there is an explicit
-      --  aspect_specification for Put_Image, or if U_Type'Image is illegal
-      --  in pre-2022 versions of Ada.
+      --  (or inherited) aspect_specification for Put_Image, or if
+      --  U_Type'Image is illegal in pre-2022 versions of Ada.
 
       declare
          U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N)));
       begin
-         if Present (TSS (U_Type, TSS_Put_Image)) then
+         if Present (Find_Aspect (U_Type, Aspect_Put_Image)) then
             return True;
          end if;
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-07  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07  8:39 [COMMITTED] ada: Put_Image aspect spec incorrectly not inherited Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).