This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fortran/2408: g77.f-torture/execute/short.f -Os failure



>Number:         2408
>Category:       fortran
>Synopsis:       g77.f-torture/execute/short.f -Os failure
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 27 18:16:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Billinghurst
>Release:        gcc 3.0 (prerelease) and gcc 3.1 (experimental)
>Organization:
>Environment:
i686-pc-cygwin
mips-sgi-irix6.5
i686-pc-linux-gnu
>Description:
Test g77.f-torture/execute/short.f -Os execution fails on i?86-pc-cygwin, mips-sgi-irix6.5 and i?86-pc-linux-gnu.  This is a regression from gcc-2.95.  

I looked into this briefly last September.  See:
 * http://gcc.gnu.org/ml/gcc-bugs/2000-09/msg00172.html
 * http://gcc.gnu.org/ml/gcc-bugs/2000-09/msg00315.html


The bug was introduced/triggered a patch by Bernd Schmidt <bernds@cygnus.co.uk> on 2000-03-14.

I have reduced the test case to 

###############  sub2.f ###################
      subroutine sub()
      real sig(0:2), h(2,2), r, z, yzin1(0:2)
      common /a/ sig
      common /b/ h
      common /c/ r

c  function subprograms
      z(i,j,k) = h(i,j)*(sig(k)-1.)

      do 260  k = 0, 0
         yzin1(k) = z(2,2,k)
  260 continue

      do 270  k = 0, 0
	 rtmp1 = z(2,2,k)
  270 continue

c     should be -2*h(2,2)
      r = rtmp1

      return
      end
##########################################

Compiled with "g77 -Os -da -c sub2.f" it is apparent that the rtl in sub2.f.08.gcse is OK, but sub2.f.09.loop is wrong.

#####   In sub2.f.08.gcse we have 

(insn/i 57 56 58 (set (reg:SF 82)
        (mem/u/f:SF (symbol_ref/u:SI ("*LC1")) 0)) 88 {*movsf_1} (nil)
    (expr_list:REG_EQUAL (const_double:SF (mem/u/f:SF (symbol_ref/u:SI ("*LC1")) 0) 0 [0x0] 0 [0x0] 1073709056 [0x3fff8000] 0 [0x0] 0 [0x0])
        (nil)))

.....

(insn/i 127 126 128 (set (reg:SF 101)
        (mem/u/f:SF (symbol_ref/u:SI ("*LC1")) 0)) 88 {*movsf_1} (nil)
    (expr_list:REG_EQUAL (const_double:SF (mem/u/f:SF (symbol_ref/u:SI ("*LC1")) 0) 0 [0x0] 0 [0x0] 1073709056 [0x3fff8000] 0 [0x0] 0 [0x0])
        (nil)))

### In sub2.f.09.loop 

Loop manages to:
 * deleted insn 57, so SF 82 is never defined
 * use SF 82 where insn 127 had been

(insn 206 190 209 (set (reg/v:SF 106)
        (reg:SF 82)) -1 (nil)
    (nil))

End result is that the subroutine returns an undefined variable.
 





 

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]