From: Ronan Desplanques <desplanq...@adacore.com>

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.

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

---
 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 cb068c102a2..904293bbd1d 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
-- 
2.43.0

Reply via email to