This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: exceptions and threads---a survival tactic!
- To: Kaz Kylheku <bill at cafe dot net>
- Subject: Re: exceptions and threads---a survival tactic!
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Sat, 14 Mar 98 12:11:03 +0100
- Cc: egcs at cygnus dot com
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <Pine.LNX.3.91.980312221956.2806A-100000@espresso.cafe.net>
> It could be that the compiler is able to optimize the
> bound checking. I mean, if you have a loop of the form
>
> for (i = 0; i < 100; i++) { /*...*/ }
>
> and the array runds from 0 to 99, and i is not messed
> with in the loop, the compiler can figure out that no
> range check is actually needed.
Yep, however, peeking into the assembler output produced by DEC's
Fortran compiler, it doesn't do that for loops like this:
subroutine aap(x, y, n)
integer n
real x(n,n), y(n,n)
integer i
do i = 2, n
do j = 2, n
x(j, i) = (y(j-1,i) + y(j,i) + y(j,i-1))/3.
enddo
enddo
end
which are somewhat more representative of the programs I was
thinking of. Apparently, the analysis necessary to move the
index-to-bounds comparison out of the loop is too much for this
compiler.
Cheers,
Toon.