diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-12-20 16:49:50 +0100 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-01-07 13:33:35 +0100 |
commit | 0f1bc0d5c0b7b77f3ec0704f9f999cceef13adea (patch) | |
tree | 58591efa29ed18083d9b840136fef9c697cc67de /gcc/ada | |
parent | 360cd3542e9d9bd6e101a9fc6509f8f6013664cc (diff) | |
download | gcc-0f1bc0d5c0b7b77f3ec0704f9f999cceef13adea.zip gcc-0f1bc0d5c0b7b77f3ec0704f9f999cceef13adea.tar.gz gcc-0f1bc0d5c0b7b77f3ec0704f9f999cceef13adea.tar.bz2 |
ada: Do not raise exceptions from Exp_Aggr.Packed_Array_Aggregate_Handled
An exception is now raised during bootstrap and this causes compatibility
issues with older compilers.
gcc/ada/ChangeLog:
* exp_aggr.adb (Packed_Array_Aggregate_Handled): Remove declaration
and handler for Not_Handled local exception. Check the return value
of Get_Component_Val instead.
(Get_Component_Val): Return No_Uint instead of raising Not_Handled.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 428115f..378168f 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -8962,9 +8962,6 @@ package body Exp_Aggr is Typ : constant Entity_Id := Etype (N); Ctyp : constant Entity_Id := Component_Type (Typ); - Not_Handled : exception; - -- Exception raised if this aggregate cannot be handled - begin -- Handle one- or two dimensional bit packed array @@ -8997,7 +8994,7 @@ package body Exp_Aggr is -- Given a expression value N of the component type Ctyp, returns a -- value of Csiz (component size) bits representing this value. If -- the value is nonstatic or any other reason exists why the value - -- cannot be returned, then Not_Handled is raised. + -- cannot be returned, then No_Uint is returned. ----------------------- -- Get_Component_Val -- @@ -9020,7 +9017,7 @@ package body Exp_Aggr is if not Compile_Time_Known_Value (N) or else Nkind (N) = N_String_Literal then - raise Not_Handled; + return No_Uint; end if; Val := Expr_Rep_Value (N); @@ -9098,6 +9095,9 @@ package body Exp_Aggr is -- justified modular type processing), so we do not have to -- worry about that here. + Val : Uint; + -- Temporary value + Lit : Node_Id; -- Integer literal for resulting constructed value @@ -9146,16 +9146,23 @@ package body Exp_Aggr is if Len = 0 then Aggregate_Val := Uint_0; + else Expr := First (Expressions (N)); - Aggregate_Val := Get_Component_Val (Expr) * Uint_2 ** Shift; + Val := Get_Component_Val (Expr); + if No (Val) then + return False; + end if; + Aggregate_Val := Val * Uint_2 ** Shift; for J in 2 .. Len loop Shift := Shift + Incr; Next (Expr); - Aggregate_Val := - Aggregate_Val + - Get_Component_Val (Expr) * Uint_2 ** Shift; + Val := Get_Component_Val (Expr); + if No (Val) then + return False; + end if; + Aggregate_Val := Aggregate_Val + Val * Uint_2 ** Shift; end loop; end if; @@ -9182,10 +9189,6 @@ package body Exp_Aggr is end; end; end; - - exception - when Not_Handled => - return False; end Packed_Array_Aggregate_Handled; ---------------------------- |