g77/egcs-19981019 - erro for a loop with assumed length array
Mako Sasaki
sasaki@tyo.sci.jri.co.jp
Fri Oct 23 08:04:00 GMT 1998
I found that g77 of egcs-19981019 snapshot can't compile some kind of loop and says "internal compiler error" when optimization is required.
# Sorry if some othe person has reported this already.
An example follows;
*--- easy.f ----------------------------------------
subroutine sub( r, r8, n )
implicit real*8 ( a-h,o-z )
real r(n)
real*8 r8(n)
c ... non assumed length array works
cok real r(1000)
cok real*8 r8(1000)
c ... fixed iteration count works
cok do i=1,1000
do i=1,n
r8(i) = r(i)*2.0
cxx r8(i) = 1.0d0 - r(i)*2.0
cxx r8(i) = 1.0 - r(i)*2.0
cok r8(i) = r(i)+2.0
cok r8(i) = r(i)*2.0d0
cok r8(i) = 1.0 - r(i)*2.0d0
end do
write(*,*) r8, r
end
*-------------------------------------------------
% g77 -c -O2 -funroll-loops -g easy.f
easy.f: In subroutine `sub':
easy.f:22: internal error--unrecognizable insn:
(insn:QI 299 190 184 (set (reg:SF 8 %st(0))
(mem/s:SF (mem/u:SI (plus:SI (reg:SI 6 %ebp)
(const_int 8)) 0) 0)) -1 (nil)
(nil))
toplev.c:1370: Internal compiler error in function fatal_insn
*-------------------------------------------------
In this case, error disappears when "-funroll-loops" is omitted, but for other more complicated source, error ocuurs without this option.
Conditions to cause this error are ;
(0) optimization is required.
(1) loop iteration count is not a constant.
(2) a single precision assumed-length array is referred.
( r(n) in the case above.)
(3) result of single presision floating multiplication is promoted to double precision.
Thanks, in advance
Mako Sasaki sasaki@tyo.sci.jri.co.jp
More information about the Gcc-bugs
mailing list