public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/17926] New: infinite loop in LAPACK test at -Os and -O2
@ 2004-10-10 23:49 tobi at gcc dot gnu dot org
  2004-10-10 23:50 ` [Bug middle-end/17926] " tobi at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-10-10 23:49 UTC (permalink / raw)
  To: gcc-bugs

The LAPACK test slarrv.f ends up in an infinite loop, when compiled with -Os or
-O2. Closer look at the assembly reveals that we're inddeed generating an
infinite loop.

The relevant parts form the loop looks something like this:
   40    CONTINUE
         IF( NDONE.LT.IM ) THEN
            OLDNCL = NCLUS
            NCLUS = 0
            LSBDPT = 1 - LSBDPT
            DO 150 I = 1, OLDNCL
                ....
            150       CONTINUE
            NDEPTH = NDEPTH + 1
            GO TO 40
         END IF
And in the -Os assembly (I have the patch from PR17560 in tree in order to build
some other files from LAPACK with -Os):
   40    CONTINUE
         IF( NDONE.LT.IM ) THEN
 2ab:   8b bd 48 ff ff ff       mov    0xffffff48(%ebp),%edi
 2b1:   3b 7d ec                cmp    0xffffffec(%ebp),%edi
 2b4:   0f 8d 25 0a 00 00       jge    cdf <slarrv_+0xcdf>
          ....
            OLDNCL = NCLUS
            NCLUS = 0
            LSBDPT = 1 - LSBDPT
            DO 150 I = 1, OLDNCL
 2ba:   83 bd 3c ff ff ff 00    cmpl   $0x0,0xffffff3c(%ebp)
 2c1:   c7 45 ac 00 00 00 00    movl   $0x0,0xffffffac(%ebp)
 2c8:   0f 8e fd 09 00 00       jle    ccb <slarrv_+0xccb>
 2ce:   c7 45 b0 01 00 00 00    movl   $0x1,0xffffffb0(%ebp)
          ...
 ccb:   8b 45 ac                mov    0xffffffac(%ebp),%eax
 cce:   ff 85 44 ff ff ff       incl   0xffffff44(%ebp)
 cd4:   89 85 3c ff ff ff       mov    %eax,0xffffff3c(%ebp)
 cda:   e9 cc f5 ff ff          jmp    2ab <slarrv_+0x2ab>
  140          CONTINUE
  150       CONTINUE
            NDEPTH = NDEPTH + 1
            GO TO 40
         END IF

(gfortran doesn't output debug information for the end do statements, that's why
they appear after the relevant code)

If you look closely enough, you'll see the infinite loop: the condition at 2b4
can never be true if the jump at 2c8 is taken.

If anybody has good ideas on reducing the testcase, I'm all ears. I'll attach
the source file, and the output from objdump -s

-- 
           Summary: infinite loop in LAPACK test at -Os and -O2
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobi at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-11-27  6:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-10 23:49 [Bug middle-end/17926] New: infinite loop in LAPACK test at -Os and -O2 tobi at gcc dot gnu dot org
2004-10-10 23:50 ` [Bug middle-end/17926] " tobi at gcc dot gnu dot org
2004-10-10 23:51 ` tobi at gcc dot gnu dot org
2004-10-10 23:52 ` tobi at gcc dot gnu dot org
2004-10-10 23:56 ` pinskia at gcc dot gnu dot org
2004-10-11  0:01 ` tobi at gcc dot gnu dot org
2004-10-11  0:09 ` tobi at gcc dot gnu dot org
2004-10-11  0:12 ` tobi at gcc dot gnu dot org
2004-10-11  0:28 ` [Bug middle-end/17926] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-26 22:34 ` rakdver at gcc dot gnu dot org
2004-10-27 16:27 ` tobi at gcc dot gnu dot org
2004-11-08 23:25 ` pinskia at gcc dot gnu dot org
2004-11-11 20:14 ` rakdver at gcc dot gnu dot org
2004-11-11 20:17 ` pinskia at gcc dot gnu dot org
2004-11-27  6:13 ` pinskia at gcc dot gnu dot 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).