https://gcc.gnu.org/g:1f4e0e7381eef373037294f746424fd655f80ddb

commit r15-6143-g1f4e0e7381eef373037294f746424fd655f80ddb
Author: Ronan Desplanques <desplanq...@adacore.com>
Date:   Tue Nov 19 10:43:44 2024 +0100

    ada: Fix validity check for private types
    
    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.

Diff:
---
 gcc/ada/exp_attr.adb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index cb068c102a2c..904293bbd1d6 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -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

Reply via email to