2 c Check the handling of error strings from Fortran
9 character*(MPI_MAX_ERROR_STRING) errs
10 integer i, reslen, reserr, ierr
13 c Fill the string with 'x' to check that
14 c blank padding happens correctly.
17 do i = 1,MPI_MAX_ERROR_STRING
21 call mpi_error_string(mpi_err_buffer, errs, reslen, reserr)
23 if (errs(reslen+1:) .ne. ' ') then
24 print *,' Fortran strings are not correctly blank padded'
25 if (errs(reslen+1:reslen+1) .eq. char(0)) then
27 c Very strictly interpreted, an since an error string must be
28 c MPI_MAX_ERROR_STRING characters long, and the Fortran rules
29 c for such assignements is to blank pad them, there should not
30 c be a null character (C-like) in them. However, the standard
31 c is ambiguous on this.
33 print *, ' Fortran strings have bogus null character'
36 print *,' Fortran strings are assigned ok'
39 c Check that the length was right
40 if (errs(reslen:reslen) .eq. ' ') then
41 print *,' Length of result is wrong'
43 print *,' Length of result is correct'
46 call MPI_Finalize( ierr )