public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103766] New: [12 Regression] Initialization of variable passed via static chain is lost.
@ 2021-12-18 23:31 iains at gcc dot gnu.org
  2021-12-18 23:33 ` [Bug fortran/103766] " iains at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: iains at gcc dot gnu.org @ 2021-12-18 23:31 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-12-21 19:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 23:31 [Bug fortran/103766] New: [12 Regression] Initialization of variable passed via static chain is lost iains at gcc dot gnu.org
2021-12-18 23:33 ` [Bug fortran/103766] " iains at gcc dot gnu.org
2021-12-18 23:36 ` iains at gcc dot gnu.org
2021-12-19  7:43 ` [Bug ipa/103766] " pinskia at gcc dot gnu.org
2021-12-19  7:51 ` pinskia at gcc dot gnu.org
2021-12-19 16:03 ` kargl at gcc dot gnu.org
2021-12-19 16:57 ` hubicka at gcc dot gnu.org
2021-12-19 20:52 ` hubicka at gcc dot gnu.org
2021-12-19 21:33 ` iains at gcc dot gnu.org
2021-12-19 21:39 ` hubicka at kam dot mff.cuni.cz
2021-12-19 21:40 ` cvs-commit at gcc dot gnu.org
2021-12-19 21:42 ` hubicka at gcc dot gnu.org
2021-12-19 21:58 ` pinskia at gcc dot gnu.org
2021-12-19 22:11 ` hubicka at kam dot mff.cuni.cz
2021-12-21 19:10 ` fxcoudert at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).