Out of bounds exception handling as in CVF

Out of bounds exception handling as in CVF

Helle everyone,

I'm having a migration problem from CVF to IVF of a project  in a quite old and poor-quality Fortran code.

Problem is sometimes, the index during runtime exceeds the size of the array.

subroutine suba (val) !assuming val=20
implicit none
integer arr(10), val, i
   do i=1, val
      print*, arr(i)    !i will have eventually have the value 11...
   enddo
end

Seeing this, CVF would not crash. Wow, I know ! The value printed would be a memory location corresponding at something else than arr, but that's not the point !

Unfortunately for me, IVF does crash everytime it sees this (and so do I). But is there any way (options ?) to make IVF behaving like CVF for this project ?

I'm aware that results can be void, but I just want the project not to crash on such errors.

Thanks a lot for your help

Cheers,

Renaud

3 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

CVF would certainly give you an error for this, if you enabled bounds checking. If you didn't enable it, you wouldn't. Same goes for Intel Fortran.  You can turn off bounds checking if you want. As with CVF, it is on by default in a Debug configuration, off in Release.

Steve

Hey Steve,

Than you very much for your answer. I didn't know about this option concerning bounds checking. Turns out that it was disabled in my CVF project and enabled in IVF

Now that's working

Renaud

Faça login para deixar um comentário.