1

I would like to temporarily disable a gfortran compiler option for a piece of Fortran code. I am looking for something like:

!GFORTRAN$ PUSH_OPTION(-fcheck=bounds)
SUBROUTINE FOO(BAR)
    INTEGER BAR(*)
    ! ...
END SUBROUTINE FOO
!GFORTRAN$ POP_OPTION

It looks like gcc/g++ do not have such compiler directive. Is that possible to achieve that with gfortran?

Community
  • 1
  • 1
Alexander Pozdneev
  • 1,289
  • 1
  • 13
  • 31
  • 1
    I have not heard of any such directive for GCC. – Vladimir F Героям слава Apr 15 '17 at 15:37
  • 1
    You can compile certain modules with different flags, though, but I don't know how that works when, for example, a module containing an array is compiled with bounds checking but the module using the array isn't. What exactly are you trying to do? – Ross Apr 16 '17 at 20:15
  • @Ross, I'd like to be able to disable bounds checking only for specific places inside subroutines. – Alexander Pozdneev Apr 22 '17 at 21:39
  • That's a pretty convoluted use case, in my opinion. The typical workflow is to compile everything with bounds checking (and other compile-time and run-time checks) when developing the code. Then, when you think everything is working right, you switch to production with faster execution times. – Ross Apr 22 '17 at 21:41

0 Answers0