diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-09-11 19:37:08 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-10-08 10:37:15 +0200 |
commit | cfbee1856f5125bbabc28088f62a86f3dee5a159 (patch) | |
tree | e422e67cc0a02f42962b9e8f4abf590128b266e2 | |
parent | da2a85ac53cbb9a9162cfb9a6da1c2bd47fc0b1b (diff) | |
download | gcc-cfbee1856f5125bbabc28088f62a86f3dee5a159.zip gcc-cfbee1856f5125bbabc28088f62a86f3dee5a159.tar.gz gcc-cfbee1856f5125bbabc28088f62a86f3dee5a159.tar.bz2 |
ada: Fix negative value returned by 'Image for array with nonnegative component
The problem is that Exp_Put_Image.Build_Elementary_Put_Image_Call uses the
signedness of the base type but the size of the first subtype, hence the
discrepancy between them.
gcc/ada/ChangeLog:
PR ada/115535
* exp_put_image.adb (Build_Elementary_Put_Image_Call): Use the size
of the underlying type to find the support type.
-rw-r--r-- | gcc/ada/exp_put_image.adb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index 190ac99..36254ff 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -293,10 +293,9 @@ package body Exp_Put_Image is Loc : constant Source_Ptr := Sloc (N); P_Type : constant Entity_Id := Entity (Prefix (N)); U_Type : constant Entity_Id := Underlying_Type (P_Type); - FST : constant Entity_Id := First_Subtype (U_Type); Sink : constant Node_Id := First (Expressions (N)); Item : constant Node_Id := Next (Sink); - P_Size : constant Uint := Esize (FST); + P_Size : constant Uint := Esize (U_Type); Lib_RE : RE_Id; begin |