From 3afd5368f50f7a5060fddd652a41b141691172d1 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Tue, 22 Jun 2021 10:15:36 +0200 Subject: [PATCH] [Ada] Work around CodePeer bug by declaring variable gcc/ada/ * atree.adb (Get_32_Bit_Field): Declare result before returning. --- gcc/ada/atree.adb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.47.2