For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2006 > Re: Bounds Check Overhead









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Bounds Check Overhead
Paul Van Delst

2006-05-26, 7:04 pm

Richard Maine wrote:
> Nasser Abbasi <nma@12000.org> wrote:
>
>
>
>
> I said
>
>
>
>
> (In context, I meant Fortran compilers, as I do in all cases below.) In
> terms of the standard, that is basically all there is to say. As I tried
> to elaborate, almost all compilers do enforce simpe cases. I don't know
> of a compiler that doesn't. However, that has nothing to do with any
> requirement of the standard.
>
> The standard has nothing at all to say about compiler switches in any
> context. That is not a concept defined by the standard.
>
>
>
>
>
> No, this is not a simple test. This is one of the complicated cases. The
> code is short, but that doesn't necessarily mean simple to diagnose.


For the OP, here's both cases, and the simple one is caught:

PROGRAM testit
IMPLICIT NONE
INTEGER :: i
DO i=1,10
CALL foo(i) ! The complicated case
PRINT *,i
i = i+2 ! The simple case
PRINT *,i
END DO
CONTAINS
SUBROUTINE foo(i)
INTEGER,INTENT(IN OUT) :: i
i=i+1
END SUBROUTINE foo
END PROGRAM testit

lnx:scratch : gfortran testit.f90
In file testit.f90:7

i = i+2
1
In file testit.f90:4

DO i=1,10
2
Error: Variable 'i' at (1) cannot be redefined inside loop beginning at (2)

(g95, lf95, and pgf95 give essentially the same error message.)


cheers,

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com