aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhjuvan Lacambre <lacambre@adacore.com>2021-06-22 10:15:36 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-20 12:31:28 +0000
commit3afd5368f50f7a5060fddd652a41b141691172d1 (patch)
tree5addc11968bd14b77eb1c9d61d92f78a5cce4de8
parent2c5ed0df53131328cfd4e072b79d5f0d21eeff15 (diff)
downloadgcc-3afd5368f50f7a5060fddd652a41b141691172d1.zip
gcc-3afd5368f50f7a5060fddd652a41b141691172d1.tar.gz
gcc-3afd5368f50f7a5060fddd652a41b141691172d1.tar.bz2
[Ada] Work around CodePeer bug by declaring variable
gcc/ada/ * atree.adb (Get_32_Bit_Field): Declare result before returning.
-rw-r--r--gcc/ada/atree.adb7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index c7e295b..3be7e03 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