A comment in Analyze_Case_Statement describes an "interesting
optimization" that was applied to all assignable objects. This patch
extends it to all objects, in particular, to formal parameters of mode
IN.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch5.adb (Analyze_Case_Statement): Extend optimization to
all objects; fix typo in comment.
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -1456,7 +1456,7 @@ package body Sem_Ch5 is
if Is_Entity_Name (Exp) then
Ent := Entity (Exp);
- if Is_Assignable (Ent) then
+ if Is_Object (Ent) then
if List_Length (Choices) = 1
and then Nkind (First (Choices)) in N_Subexpr
and then Compile_Time_Known_Value (First (Choices))
@@ -1475,7 +1475,7 @@ package body Sem_Ch5 is
end if;
end if;
- -- Case where expression is not an entity name of a variable
+ -- Case where expression is not an entity name of an object
Analyze_Statements (Statements (Alternative));
end Process_Statements;