aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-03-20 23:19:35 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-20 09:47:03 +0200
commitfbe275e2458458ad517645d64619d3aac4467cf1 (patch)
tree4504041621dd6f3978dfbb3a20c725bd16b8ddef /gcc/ada/sem_attr.adb
parent16cdeadb33400238ea522541009ecd2a24769f0c (diff)
downloadgcc-fbe275e2458458ad517645d64619d3aac4467cf1.zip
gcc-fbe275e2458458ad517645d64619d3aac4467cf1.tar.gz
gcc-fbe275e2458458ad517645d64619d3aac4467cf1.tar.bz2
ada: Fix for attribute Width on enumeration types with Discard_Name
Fix computation of attribute 'Width for enumeration types with Discard_Name aspect enabled. gcc/ada/ * exp_imgv.adb (Expand_Width_Attribute): Fix for 'Width that is computed at run time. * sem_attr.adb (Eval_Attribute): Fix for 'Width that is computed at compilation time.
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index a921909..96f216c 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -10906,9 +10906,10 @@ package body Sem_Attr is
-- that accommodates the Pos of the largest value, which
-- is the high bound of the range + one for the space.
- W := 1;
- T := Hi;
- while T /= 0 loop
+ W := 1; -- one character for the leading space
+ W := W + 1; -- one character for the 0 .. 9 digit
+ T := Hi; -- one character for every decimal digit
+ while T >= 10 loop
T := T / 10;
W := W + 1;
end loop;