From fbe275e2458458ad517645d64619d3aac4467cf1 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Wed, 20 Mar 2024 23:19:35 +0100 Subject: 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. --- gcc/ada/sem_attr.adb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc/ada/sem_attr.adb') 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; -- cgit v1.1