https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102011
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Ralph Trenkler from comment #0) > Created attachment 51346 [details] > The fortran program, which does the infinite loop with compiler version > 10.3.0 > > I wrote a function in gfortran-10.3.0, which computes the square root with > the heron iteration method. Without optimization the program is okay, but if > I turn on optimization, then it does an infinite loop. I use Kubuntu 20.04. If I compile your program with -Wall, I get gfcx -o z -fcheck=all -Wall a.f90 && ./z a.f90:11:13: 11 | if (abs((x2-x1)/(x1+x2)) < epsilon) exit | ^ Warning: 'epsilon' may be used uninitialized [-Wmaybe-uninitialized] Sure, enough. real(8), parameter :: epilson = 1.0e-15 ^^^^^^^ if (abs((x2-x1)/(x1+x2)) < epsilon) exit ^^^^^^^ One of these is wrong.