public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning
@ 2013-08-07  9:31 roland.kaufmann at uni dot no
  2013-08-13 14:47 ` [Bug fortran/58100] " dominiq at lps dot ens.fr
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: roland.kaufmann at uni dot no @ 2013-08-07  9:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58100

            Bug ID: 58100
           Summary: Spurious "DO loop at (1) will be executed zero times"
                    warning
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland.kaufmann at uni dot no

Minimum example to reproduce:

    program doloop
    integer, parameter :: i = 0
    if (i <= 0) then
       print *,'i is not positive'
    else
       do j=1,i
          print *,'Hello, World!'
       end do
    end if
    end program doloop

If I compile with:

    gfortran doloop.f90

I get the output:

    doloop.f90:6.15:

           do j=1,i
                   1
    Warning: DO loop at (1) will be executed zero times

which of course is correct, but should not be a warning since it is in the else
clause.


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

* [Bug fortran/58100] Spurious "DO loop at (1) will be executed zero times" warning
  2013-08-07  9:31 [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning roland.kaufmann at uni dot no
@ 2013-08-13 14:47 ` dominiq at lps dot ens.fr
  2013-08-17 22:22 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-08-13 14:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58100

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-08-13
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present after r201658 (pr56666, after it -Wall is needed).


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

* [Bug fortran/58100] Spurious "DO loop at (1) will be executed zero times" warning
  2013-08-07  9:31 [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning roland.kaufmann at uni dot no
  2013-08-13 14:47 ` [Bug fortran/58100] " dominiq at lps dot ens.fr
@ 2013-08-17 22:22 ` tkoenig at gcc dot gnu.org
  2013-08-18 20:24 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-08-17 22:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58100

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
To fix this would require folding of the IF in the front end,
something that we rely on the middle end to do.


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

* [Bug fortran/58100] Spurious "DO loop at (1) will be executed zero times" warning
  2013-08-07  9:31 [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning roland.kaufmann at uni dot no
  2013-08-13 14:47 ` [Bug fortran/58100] " dominiq at lps dot ens.fr
  2013-08-17 22:22 ` tkoenig at gcc dot gnu.org
@ 2013-08-18 20:24 ` burnus at gcc dot gnu.org
  2013-08-22  8:23 ` roland.kaufmann at uni dot no
  2013-08-28 13:57 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-08-18 20:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58100

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #1)
> Still present after r201658 (pr56666, after it -Wall is needed).

With that patch, -W(no-)zerotrip permits to toggle the warning, which I think
it sufficient. Everything else requires more analysis (e.g. the "if"'s else
branch is never executed in this case), which I believe is not worthwhile.

Roland: Is the new warning option -W(no-)zerotrip sufficient for you?

(Side remark: there are conflicts with early optimization: For debugging, no
folding/simplification should be done by front-ends. On the other hand, some
simplification is useful - and the ME is too late for it.]


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

* [Bug fortran/58100] Spurious "DO loop at (1) will be executed zero times" warning
  2013-08-07  9:31 [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning roland.kaufmann at uni dot no
                   ` (2 preceding siblings ...)
  2013-08-18 20:24 ` burnus at gcc dot gnu.org
@ 2013-08-22  8:23 ` roland.kaufmann at uni dot no
  2013-08-28 13:57 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: roland.kaufmann at uni dot no @ 2013-08-22  8:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58100

--- Comment #5 from Roland Kaufmann <roland.kaufmann at uni dot no> ---
(In reply to Tobias Burnus from comment #3)
> Roland: Is the new warning option -W(no-)zerotrip sufficient for you?

As a general principle: I believe that the compiler should not issue any
warnings if run without options on correct code.

If you are compiling code you didn't write yourself, on a new architecture,
then every warning should be a flag for further checking. Having spurious
warnings erodes this and increases the likelihood of real problems being
"drowned", because no-one pays attention anymore.

That said, I perfectly understand the problem of separating the various
compiler stages and Fortran is not the easiest language to do static analysis
for either.

It seems from r201658 of resolve.c it will not surface with no option anymore,
surface with -Wall and disappear again with -Wall -Wno-zerotrip, so that'll
have to be good enough.


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

* [Bug fortran/58100] Spurious "DO loop at (1) will be executed zero times" warning
  2013-08-07  9:31 [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning roland.kaufmann at uni dot no
                   ` (3 preceding siblings ...)
  2013-08-22  8:23 ` roland.kaufmann at uni dot no
@ 2013-08-28 13:57 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-08-28 13:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58100

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
So, let's close this as WONTFIX (because moving dead code
elimination into the front end will not happen anytime
soon - unless somebody volunteers, of course ;-)


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

end of thread, other threads:[~2013-08-28 13:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07  9:31 [Bug fortran/58100] New: Spurious "DO loop at (1) will be executed zero times" warning roland.kaufmann at uni dot no
2013-08-13 14:47 ` [Bug fortran/58100] " dominiq at lps dot ens.fr
2013-08-17 22:22 ` tkoenig at gcc dot gnu.org
2013-08-18 20:24 ` burnus at gcc dot gnu.org
2013-08-22  8:23 ` roland.kaufmann at uni dot no
2013-08-28 13:57 ` tkoenig 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).