Ada: Fix variable initialized with if-expression not flagged as constant
This is a regression present on the mainline and 15 branch: the -gnatwk
switch no longer flags a string variable initialized with an if-expression
as constant when it is not modified in the program. The fix is to set the
Has_Initial_Value and Never_Set_In_Source flags earlier during analysis in
the Analyze_Object_Declaration procedure.
gcc/ada/
PR ada/122640
* sem_ch3.adb (Analyze_Object_Declaration): Set Is_True_Constant
on entry for constants and Never_Set_In_Source in all cases.
If an initialization expression is present, set Has_Initial_Value
and Is_True_Constant on variables.