Skip to content

Commit

Permalink
GCC 8.3.0 bug workaround
Browse files Browse the repository at this point in the history
fixes #31
  • Loading branch information
scivision committed Jul 6, 2022
1 parent c598ee0 commit e6fe0ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/attr_write.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

integer(HID_T) :: attr_id, dtype_id
integer(HSIZE_T) :: attr_dims(0)
integer :: ier
integer :: ier, L

select type (A)
type is (real(real32))
Expand All @@ -30,7 +30,8 @@
call attr_create(self, dname, attr, H5T_STD_I64LE, attr_dims, attr_id)
call H5Awrite_f(attr_id, H5T_STD_I64LE, A, attr_dims, ier)
type is (character(*))
call attr_create(self, dname, attr, H5T_NATIVE_CHARACTER, attr_dims, attr_id, dtype_id, charlen=len(A))
L = len(A) !< workaround for GCC 8.3.0 bug
call attr_create(self, dname, attr, H5T_NATIVE_CHARACTER, attr_dims, attr_id, dtype_id, charlen=L)
call H5Awrite_f(attr_id, dtype_id, A, attr_dims, ier)
if (ier /= 0) error stop 'h5fortran:writeattr:string: could not write ' // dname // ":" // attr // " in " // self%filename
call h5tclose_f(dtype_id, ier)
Expand Down
5 changes: 3 additions & 2 deletions src/write_scalar.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

integer(HID_T) :: file_space_id, dset_id, dtype_id
integer(HSIZE_T) :: dims(0)
integer :: ier
integer :: ier, L

if(.not.self%is_open()) error stop 'h5fortran:write: file handle is not open'

Expand All @@ -29,7 +29,8 @@
call hdf_create(self, dname, H5T_STD_I64LE, dims, dims, file_space_id, dset_id, compact=compact)
call h5dwrite_f(dset_id, H5T_STD_I64LE, value, dims, ier)
type is (character(*))
call hdf_create(self, dname, H5T_NATIVE_CHARACTER, dims, dims, file_space_id, dset_id, dtype_id, charlen=len(value))
L = len(value) !< workaround for GCC 8.3.0 bug
call hdf_create(self, dname, H5T_NATIVE_CHARACTER, dims, dims, file_space_id, dset_id, dtype_id, charlen=L)
call h5dwrite_f(dset_id, dtype_id, value, dims, ier)
if (ier /= 0) error stop 'h5fortran:write:string: could not write ' // dname // ' to ' // self%filename
call h5tclose_f(dtype_id, ier)
Expand Down

0 comments on commit e6fe0ac

Please sign in to comment.