[MINC-development] Problem with casting hid_t to pointer in hdf_convenience.c

Jordi Gutiérrez Hermoso jordigh at octave.org
Thu May 3 16:05:57 EDT 2012


Hi, I'm trying to compile this MINC 2 git repo, at revision
2c967639bb:

    https://github.com/BIC-MNI/minc

However, I'm facing the following warnings, which I am pretty sure are
not safe to ignore:

    cc1: warnings being treated as errors

    minc/libsrc/hdf_convenience.c: In function ‘hdf_attput’:
    minc/libsrc/hdf_convenience.c:1110: error: cast to pointer from
    integer of different size

    minc/libsrc/hdf_convenience.c: In function ‘hdf_copy_attr’:
    minc/libsrc/hdf_convenience.c:2054: error: cast from pointer to
    integer of different size

The problem is that at these two locations, hid_t are being cast to
and from pointers. Now, hid_t is an int on my machine, but on a 64-bit
machine, ints are 32-bits, so they can't hold pointers, which are
64-bits wide. So this casting won't work.

Furthermore, this seems to be breaking the HDF5 API. I don't see in
the API documentation any mention that hid_t can be used as a pointer,
so it's not clear to me that HDF5 itself needs a patch to
conditionally define hid_t according to the architecture. This looks
like an unsafe hack that minc tools are doing.

This all matters to me because I'm trying to debug a segfault with
dcm2mnc, but first I need to be able to cleanly compile minc-tools, if
nothing else, to compile in debug symbols.

Thanks,
- Jordi G. H.


More information about the MINC-development mailing list