In Fortran, Cactus passes all grid functions as arguments to routines, and the size of the grid functions are declared in DECLARE_CCTK_ARGUMENTS. In these declarations, Cactus assumes that the size of each grid variable group can be different, and the compiler thus does not see that all grid functions have (locally) the same array shape. The compiler can thus not simplify array index calculations. This is probably only relevant in short loops accessing grid functions from multiple groups (GRHydro?).
The attached patch passes three additional integer arguments (cctk_lsh) which contain the shape of grid functions, and uses these to declare grid functions.
This patch is quite old, but was never applied. It comes from a time when g77 didn't support declaring array shapes via an integer array (since this is not allowed in Fortran 77). If this is now possible, one could use the array cctk_lsh instead of passing three extra integer arguments.