https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122640
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:f24307422d1d15f99b2f8af19894e573f7036fb1 commit r15-10502-gf24307422d1d15f99b2f8af19894e573f7036fb1 Author: Eric Botcazou <[email protected]> Date: Wed Nov 12 09:03:18 2025 +0100 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. gcc/testsuite/ * gnat.dg/warn34.adb: New test.
