]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix validity check for private types
authorRonan Desplanques <desplanques@adacore.com>
Tue, 19 Nov 2024 09:43:44 +0000 (10:43 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 12 Dec 2024 09:57:57 +0000 (10:57 +0100)
Before this patch, the machinery to generate validity checks got
confused in some situations involving private views of types, and ended
up generating incorrect conversions from floating point types to integer
types. This patch fixes this.

gcc/ada/ChangeLog:

* exp_attr.adb (Expand_N_Attribute_Reference): Fix computation of type
category.

gcc/ada/exp_attr.adb

index cb068c102a2ce401d5db3b4819d9bcf5cb52e4b9..904293bbd1d6392c000b937ea0fba7e8909f7368 100644 (file)
@@ -7627,7 +7627,7 @@ package body Exp_Attr is
          --  Floating-point case. This case is handled by the Valid attribute
          --  code in the floating-point attribute run-time library.
 
-         if Is_Floating_Point_Type (Ptyp) then
+         if Is_Floating_Point_Type (PBtyp) then
             Float_Valid : declare
                Pkg : RE_Id;
                Ftp : Entity_Id;
@@ -7652,7 +7652,7 @@ package body Exp_Attr is
             --  Start of processing for Float_Valid
 
             begin
-               Find_Fat_Info (Ptyp, Ftp, Pkg);
+               Find_Fat_Info (PBtyp, Ftp, Pkg);
 
                --  If the prefix is a reverse SSO component, or is possibly
                --  unaligned, first create a temporary copy that is in