From: Ghjuvan Lacambre Date: Tue, 22 Jun 2021 08:15:36 +0000 (+0200) Subject: [Ada] Work around CodePeer bug by declaring variable X-Git-Tag: basepoints/gcc-13~4625 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3afd5368f50f7a5060fddd652a41b141691172d1;p=thirdparty%2Fgcc.git [Ada] Work around CodePeer bug by declaring variable gcc/ada/ * atree.adb (Get_32_Bit_Field): Declare result before returning. --- diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index c7e295bc8f7b..3be7e0395e0f 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -513,8 +513,13 @@ package body Atree is function Cast is new Unchecked_Conversion (Field_Size_32_Bit, Field_Type); + + Result : constant Field_Type := Cast (Get_32_Bit_Val (N, Offset)); + -- Note: declaring Result here instead of directly returning + -- Cast (...) helps CodePeer understand that there are no issues + -- around uninitialized variables. begin - return Cast (Get_32_Bit_Val (N, Offset)); + return Result; end Get_32_Bit_Field; function Get_32_Bit_Field_With_Default