integer(8) vs integer(4) - fortran kind parameter issue

Hello everyone.

My fortran code using hdf5 compiles nicely on a number of machines. After
losing my laptop (sad, but true) I am now installing hdf5 (and other stuff)
on my machine to be able to compile my code again. Needless to say, I have
made no changes to my code, so compilation should be a breeze after
installing all dependencies.

However, I get a number of errors of this kind (one per subroutine call, I
am doing several):
/home/paulanto/Code/Rayleigh2D/Rayleigh2D_Modules/R_save.f90:121.29:

            (/ i_surface /), int(1, kind=hsize_t), hdferr)
                             1
Error: Type mismatch in argument 'size' at (1); passed INTEGER(8) to
INTEGER(4)

The relevant subroutine call looks like this:
        call h5ltset_attribute_int_f(file_id, root, n_surfaces_name, &
            (/ i_surface /), int(1, kind=hsize_t), hdferr)
My preliminary conclusion is that hsize_t is somehow not the type that the
hdf5 subroutine is expecting. Probably it coincides with the correct type on
some CPUs or some operating systems, hence it has worked until now.

My hdf5 library (1.8.7) and my code are both compiled with gfortran 4.6.1,
which I have used with success before. One potential difference is that this
PC (which I'm borrowing) is running 32 bit linux. Is the error in my code,
is there a bug in hdf5, does gfortran handle this incorrectly, or something
else?

Thanks in advance,
Paul

Hello everyone.

My fortran code using hdf5 compiles nicely on a number of machines.
After losing my laptop (sad, but true) I am now installing hdf5 (and
other stuff) on my machine to be able to compile my code again.
Needless to say, I have made no changes to my code, so compilation
should be a breeze after installing all dependencies.

However, I get a number of errors of this kind (one per subroutine
call, I am doing several):
/home/paulanto/Code/Rayleigh2D/Rayleigh2D_Modules/R_save.f90:121.29:

        \(/ i\_surface /\), int\(1, kind=hsize\_t\), hdferr\)
                          1

Error: Type mismatch in argument 'size' at (1); passed INTEGER(8) to
INTEGER(4)

The relevant subroutine call looks like this:
call h5ltset_attribute_int_f(file_id, root,
n_surfaces_name, &
(/ i_surface /), int(1, kind=hsize_t),
hdferr)

h5ltset_attribute_int_f (and probably the other functions) is expecting "size" to be size_t, not hsize_t.
hsize_t and size_t will only be the same depending on the OS , compiler flags, etc../

Changing hsize_t to size_t should fix the problem(s).

···

On Sun, 4 Sep 2011 16:12:41 +0200, Paul Anton Letnes wrote:

My preliminary conclusion is that hsize_t is somehow not the type
that the hdf5 subroutine is expecting. Probably it coincides with the
correct type on some CPUs or some operating systems, hence it has
worked until now.

My hdf5 library (1.8.7) and my code are both compiled with gfortran
4.6.1, which I have used with success before. One potential difference
is that this PC (which I'm borrowing) is running 32 bit linux. Is the
error in my code, is there a bug in hdf5, does gfortran handle this
incorrectly, or something else?

Thanks in advance,
Paul

Hello everyone.

My fortran code using hdf5 compiles nicely on a number of machines.
After losing my laptop (sad, but true) I am now installing hdf5 (and
other stuff) on my machine to be able to compile my code again.
Needless to say, I have made no changes to my code, so compilation
should be a breeze after installing all dependencies.

However, I get a number of errors of this kind (one per subroutine
call, I am doing several):
/home/paulanto/Code/Rayleigh2D/Rayleigh2D_Modules/R_save.f90:121.29:

            (/ i_surface /), int(1, kind=hsize_t), hdferr)
                              1
Error: Type mismatch in argument 'size' at (1); passed INTEGER(8) to
INTEGER(4)

The relevant subroutine call looks like this:
        call h5ltset_attribute_int_f(file_id, root,
n_surfaces_name, &
             (/ i_surface /), int(1, kind=hsize_t),
hdferr)

h5ltset_attribute_int_f (and probably the other functions) is expecting "size" to be size_t, not hsize_t.
hsize_t and size_t will only be the same depending on the OS , compiler flags, etc../

Changing hsize_t to size_t should fix the problem(s).

I had the same issue when changing compilers (between ifort and gfortran) that I resolved thanks to your help.

Pierre

···

Le 4 sept. 11 à 23:08, brtnfld@hdfgroup.org a écrit :

On Sun, 4 Sep 2011 16:12:41 +0200, Paul Anton Letnes wrote:

My preliminary conclusion is that hsize_t is somehow not the type
that the hdf5 subroutine is expecting. Probably it coincides with the
correct type on some CPUs or some operating systems, hence it has
worked until now.

My hdf5 library (1.8.7) and my code are both compiled with gfortran
4.6.1, which I have used with success before. One potential difference
is that this PC (which I'm borrowing) is running 32 bit linux. Is the
error in my code, is there a bug in hdf5, does gfortran handle this
incorrectly, or something else?

Thanks in advance,
Paul

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Thanks, this was very helpful. I suppose I mis-read the documentation or
code at this point.

Cheers
Paul

···

On Mon, Sep 5, 2011 at 11:35 AM, Pierre de Buyl <pdebuyl@chem.utoronto.ca>wrote:

Le 4 sept. 11 à 23:08, brtnfld@hdfgroup.org a écrit :

On Sun, 4 Sep 2011 16:12:41 +0200, Paul Anton Letnes wrote:

Hello everyone.

My fortran code using hdf5 compiles nicely on a number of machines.
After losing my laptop (sad, but true) I am now installing hdf5 (and
other stuff) on my machine to be able to compile my code again.
Needless to say, I have made no changes to my code, so compilation
should be a breeze after installing all dependencies.

However, I get a number of errors of this kind (one per subroutine
call, I am doing several):
/home/paulanto/Code/**Rayleigh2D/Rayleigh2D_Modules/**R_save.f90:121.29:

           (/ i_surface /), int(1, kind=hsize_t), hdferr)
                             1
Error: Type mismatch in argument 'size' at (1); passed INTEGER(8) to
INTEGER(4)

The relevant subroutine call looks like this:
       call h5ltset_attribute_int_f(file_**id, root,
n_surfaces_name, &
            (/ i_surface /), int(1, kind=hsize_t),
hdferr)

h5ltset_attribute_int_f (and probably the other functions) is expecting
"size" to be size_t, not hsize_t.
hsize_t and size_t will only be the same depending on the OS , compiler
flags, etc../

Changing hsize_t to size_t should fix the problem(s).

I had the same issue when changing compilers (between ifort and gfortran)
that I resolved thanks to your help.

Pierre

My preliminary conclusion is that hsize_t is somehow not the type

that the hdf5 subroutine is expecting. Probably it coincides with the
correct type on some CPUs or some operating systems, hence it has
worked until now.

My hdf5 library (1.8.7) and my code are both compiled with gfortran
4.6.1, which I have used with success before. One potential difference
is that this PC (which I'm borrowing) is running 32 bit linux. Is the
error in my code, is there a bug in hdf5, does gfortran handle this
incorrectly, or something else?

Thanks in advance,
Paul

______________________________**_________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>

______________________________**_________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>

You probably looked at the C function for H5LTset_attribute_int and found "hsize_t size". The types usually match between Fortran and C and actually there is a mistake in the C documentation and "size" should be of type size_t and not hsize_t, we'll fix it in the documentation.

···

On Mon, 5 Sep 2011 12:00:34 +0200, Paul Anton Letnes wrote:

Thanks, this was very helpful. I suppose I mis-read the documentation
or code at this point.

Cheers
Paul

On Mon, Sep 5, 2011 at 11:35 AM, Pierre de Buyl wrote:

Le 4 sept. 11 à 23:08, brtnfld@hdfgroup.org [3] a écrit :

On Sun, 4 Sep 2011 16:12:41 +0200, Paul Anton Letnes wrote:

Hello everyone.

My fortran code using hdf5 compiles nicely on a number of
machines.
After losing my laptop (sad, but true) I am now installing
hdf5 (and
other stuff) on my machine to be able to compile my code
again.
Needless to say, I have made no changes to my code, so
compilation
should be a breeze after installing all dependencies.

However, I get a number of errors of this kind (one per
subroutine
call, I am doing several):

/home/paulanto/Code/Rayleigh2D/Rayleigh2D_Modules/R_save.f90:121.29:

       \(/ i\_surface /\), int\(1, kind=hsize\_t\),

hdferr)
1
Error: Type mismatch in argument 'size' at (1); passed
INTEGER(8) to
INTEGER(4)

The relevant subroutine call looks like this:
call h5ltset_attribute_int_f(file_id, root,
n_surfaces_name, &
(/ i_surface /), int(1, kind=hsize_t),
hdferr)

h5ltset_attribute_int_f (and probably the other functions) is
expecting "size" to be size_t, not hsize_t.
hsize_t and size_t will only be the same depending on the OS ,
compiler flags, etc../

Changing hsize_t to size_t should fix the problem(s).

I had the same issue when changing compilers (between ifort and
gfortran) that I resolved thanks to your help.

Pierre

My preliminary conclusion is that hsize_t is somehow not the
type
that the hdf5 subroutine is expecting. Probably it coincides
with the
correct type on some CPUs or some operating systems, hence it
has
worked until now.

My hdf5 library (1.8.7) and my code are both compiled with
gfortran
4.6.1, which I have used with success before. One potential
difference
is that this PC (which I'm borrowing) is running 32 bit linux.
Is the
error in my code, is there a bug in hdf5, does gfortran handle
this
incorrectly, or something else?

Thanks in advance,
Paul

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org [1]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
[2]

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org [4]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
[5]

Links:
------
[1] mailto:Hdf-forum@hdfgroup.org
[2] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
[3] mailto:brtnfld@hdfgroup.org
[4] mailto:Hdf-forum@hdfgroup.org
[5] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
[6] mailto:pdebuyl@chem.utoronto.ca

That does sound likely. I gathered the fortran and C functions are much the
same. It's good to get the documentation right. Thanks!

Paul

···

On Mon, Sep 5, 2011 at 6:10 PM, <brtnfld@hdfgroup.org> wrote:

You probably looked at the C function for H5LTset_attribute_int and found
"hsize_t size". The types usually match between Fortran and C and actually
there is a mistake in the C documentation and "size" should be of type
size_t and not hsize_t, we'll fix it in the documentation.

On Mon, 5 Sep 2011 12:00:34 +0200, Paul Anton Letnes wrote:

Thanks, this was very helpful. I suppose I mis-read the documentation
or code at this point.

Cheers
Paul

On Mon, Sep 5, 2011 at 11:35 AM, Pierre de Buyl wrote:

Le 4 sept. 11 à 23:08, brtnfld@hdfgroup.org [3] a écrit :

On Sun, 4 Sep 2011 16:12:41 +0200, Paul Anton Letnes wrote:

Hello everyone.

My fortran code using hdf5 compiles nicely on a number of
machines.
After losing my laptop (sad, but true) I am now installing
hdf5 (and
other stuff) on my machine to be able to compile my code
again.
Needless to say, I have made no changes to my code, so
compilation
should be a breeze after installing all dependencies.

However, I get a number of errors of this kind (one per
subroutine
call, I am doing several):

/home/paulanto/Code/**Rayleigh2D/Rayleigh2D_Modules/**

R_save.f90:121.29:

           (/ i_surface /), int(1, kind=hsize_t),
hdferr)
                             1
Error: Type mismatch in argument 'size' at (1); passed
INTEGER(8) to
INTEGER(4)

The relevant subroutine call looks like this:
       call h5ltset_attribute_int_f(file_**id, root,
n_surfaces_name, &
            (/ i_surface /), int(1, kind=hsize_t),
hdferr)

h5ltset_attribute_int_f (and probably the other functions) is
expecting "size" to be size_t, not hsize_t.
hsize_t and size_t will only be the same depending on the OS ,
compiler flags, etc../

Changing hsize_t to size_t should fix the problem(s).

I had the same issue when changing compilers (between ifort and
gfortran) that I resolved thanks to your help.

Pierre

My preliminary conclusion is that hsize_t is somehow not the

type
that the hdf5 subroutine is expecting. Probably it coincides
with the
correct type on some CPUs or some operating systems, hence it
has
worked until now.

My hdf5 library (1.8.7) and my code are both compiled with
gfortran
4.6.1, which I have used with success before. One potential
difference
is that this PC (which I'm borrowing) is running 32 bit linux.
Is the
error in my code, is there a bug in hdf5, does gfortran handle
this
incorrectly, or something else?

Thanks in advance,
Paul

______________________________**_________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org [1]

http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>
[2]

______________________________**_________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org [4]

http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>
[5]

Links:
------
[1] mailto:Hdf-forum@hdfgroup.org
[2] http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>
[3] mailto:brtnfld@hdfgroup.org
[4] mailto:Hdf-forum@hdfgroup.org
[5] http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>
[6] mailto:pdebuyl@chem.utoronto.**ca <pdebuyl@chem.utoronto.ca>

______________________________**_________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/**mailman/listinfo/hdf-forum_**hdfgroup.org<http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org>