I'd like to include cases in the gfortran testsuite to check that we correctly issue a run-time error, and exit with non-zero code.

I have the following example:

$ cat runtime_error.f90
! { dg-do run }
! { dg-options "-fbounds-check" }
  integer :: x(5), y(5)
  x = y((/0,2,3,4,6/))
  end
$ gfortran runtime_error.f90 -fbounds-check
$ ./a.out ; echo $?
Fortran runtime error: Array reference out of bounds for array 'y', lower bound of dimension 1 exceeded (in file 'runtime_error.f90', at line 4)
2


I'd like to be able to check that this code indeed issue the error message on stderr and indicate to dejagnu that non-zero exit codes does not mean that the test FAILed). How can I do that?

Thanks for any help,
FX

Reply via email to