Resolving problem when building HDF5* with Intel® compiler 14.0


To build the latest HDF5* with Intel® compiler 14.0, a segmantation fault occurs when running "make check". This article is to provide a solution in resolving this issue. The information in this article is assuming you already undertand how to build HDF5* with Intel compilers by reading Building HDF5* with Intel® compilers.

Version information

HDF5 1.8.11 
Intel® C++ Compiler  14.0
Intel® Fortran Compiler 14.0

Problem Statement

When build HDF5 1.8.11 with Intel® compiler 14.0, after run "make check", a segmentation fault was caught in Fortran tests:

                               FORTRAN tests
 FORTRANLIB_TEST is linked with HDF5 Library version 1.8 release  11

 Mounting test                                                          PASSED
 Reopen test                                                            PASSED
 File open/close test                                                   PASSED
 File free space test                                                   PASSED
 Dataset test                                                           PASSED
 Extendible dataset test                                                PASSED
 Basic dataspace test                                                   PASSED
 Reference to object test                                               PASSED
 Reference to dataset region test                                       PASSED
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source
lt-fortranlib_tes  000000000049E169  Unknown               Unknown  Unknown
lt-fortranlib_tes  000000000049CAE0  Unknown               Unknown  Unknown
lt-fortranlib_tes  0000000000472A62  Unknown               Unknown  Unknown
lt-fortranlib_tes  0000000000458953  Unknown               Unknown  Unknown
lt-fortranlib_tes  000000000042F16B  Unknown               Unknown  Unknown    0000003B8FE0F4C0  Unknown               Unknown  Unknown
libhdf5_fortran.s  00007FAAE945177C  Unknown               Unknown  Unknown
libhdf5_fortran.s  00007FAAE9445CED  Unknown               Unknown  Unknown
lt-fortranlib_tes  000000000042058B  Unknown               Unknown  Unknown
lt-fortranlib_tes  000000000040D76C  Unknown               Unknown  Unknown
lt-fortranlib_tes  000000000040D356  Unknown               Unknown  Unknown          0000003B8F21EC5D  Unknown               Unknown  Unknown
lt-fortranlib_tes  000000000040D249  Unknown               Unknown  Unknown

Root cause

This is caused by a program error in the fortran source code under "hdf5-1.8.11/fortran/src". In file "H5Sff.f90", line 1315 declares an explicit interface of function "h5sselect_hyperslab_c":

              INTEGER FUNCTION h5sselect_hyperslab_c(space_id, operator, &
                               start, count, stride, block)
              USE H5GLOBAL
              !DEC$IF DEFINED(HDF5F90_WINDOWS)
              !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_HYPERSLAB_C'::h5sselect_hyperslab_c
              INTEGER(HID_T), INTENT(IN) :: space_id
              INTEGER, INTENT(IN) :: operator
              INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start
              INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count
              INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: stride
              END FUNCTION h5sselect_hyperslab_c
            END INTERFACE

From which, dummy arguments stride and block are declared with "OPTIONAL" attributes. This is inconsistent with the definition of function "h5sselect_hyperslab_c" in "fortran/src/H5Sf.c", where it does not contain the "OPTIOINAL" attribute for those arguments.

According to Fortran 2003 standard, section, it says:

"If an explicit specific interface is specified by an interface body or a procedure declaration statement ( for an external procedure, the characteristics shall be consistent with those specified in the procedure definition, except that the interface may specify a procedure that is not pure if the procedure is defined to be pure."



Modify those two lines: 1326 and 1327 in file "fortran/src/H5Sff.f90" to remove the "OPTIONAL" attributes:

              INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: stride
              INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: block

Run "make" and "make check" again, the test will finish successfully.

For more complete information about compiler optimizations, see our Optimization Notice.