This commit works around a CodePeer bug where CodePeer thinks
Get_32_Bit_Val returns something uninitialized.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* atree.adb (Get_32_Bit_Field): Declare result before returning.
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
--- 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