public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102011] New: Infinite loop in heron iteration when optimization is enabled with gfortran 10.3.0
@ 2021-08-22 10:27 Ralph-Trenkler@t-online.de
  2021-08-22 16:58 ` [Bug fortran/102011] " kargl at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: Ralph-Trenkler@t-online.de @ 2021-08-22 10:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102011

            Bug ID: 102011
           Summary: Infinite loop in heron iteration when optimization is
                    enabled with gfortran 10.3.0
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Ralph-Trenkler@t-online.de
  Target Milestone: ---

Created attachment 51346
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51346&action=edit
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.

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

* [Bug fortran/102011] Infinite loop in heron iteration when optimization is enabled with gfortran 10.3.0
  2021-08-22 10:27 [Bug fortran/102011] New: Infinite loop in heron iteration when optimization is enabled with gfortran 10.3.0 Ralph-Trenkler@t-online.de
@ 2021-08-22 16:58 ` kargl at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-08-22 16:58 UTC (permalink / raw)
  To: gcc-bugs

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.

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

end of thread, other threads:[~2021-08-22 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 10:27 [Bug fortran/102011] New: Infinite loop in heron iteration when optimization is enabled with gfortran 10.3.0 Ralph-Trenkler@t-online.de
2021-08-22 16:58 ` [Bug fortran/102011] " kargl 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).