https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103766
Bug ID: 103766 Summary: [12 Regression] Initialization of variable passed via static chain is lost. Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: iains at gcc dot gnu.org Target Milestone: --- In the following code (by FX) program crash implicit none real :: a a = 1. call sub() contains subroutine sub() print *, a end subroutine sub end program crash when we build with O0, we get the correct result for O >= 1 we get a random number What appears to be happening is that the crash () routine is inlined into main () but the code that initialises the frame (including the 'a' variable) is dropped which means that sub() sees and prints an uninitialised var.