diff mbox series

[Ada] exp_pakd.adb: work around spurious Codepeer warnings

Message ID 20210921152613.GA3094698@adacore.com
State New
Headers show
Series [Ada] exp_pakd.adb: work around spurious Codepeer warnings | expand

Commit Message

Pierre-Marie de Rodat Sept. 21, 2021, 3:26 p.m. UTC
Codepeer erroneously emits a warning for this if expression. Replacing
it with a statement is enough to make the problem disappear.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* exp_pakd.adb (Expand_Packed_Not): Replace expression with
	statement.
diff mbox series

Patch

diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -2002,7 +2002,11 @@  package body Exp_Pakd is
       --  actual subtype of the operand. Preserve old behavior in case size is
       --  not set.
 
-      Size := (if Known_RM_Size (PAT) then RM_Size (PAT) else Uint_0);
+      if Known_RM_Size (PAT) then
+         Size := RM_Size (PAT);
+      else
+         Size := Uint_0;
+      end if;
       Lit := Make_Integer_Literal (Loc, 2 ** Size - 1);
       Set_Print_In_Hex (Lit);