bug: packet table funnyness with packed/unpacked compound types

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

bug: packet table funnyness with packed/unpacked compound types

Jason Newton
Packet tables have regularly given me grief over the years I've used
them - always regarding the same subject: structure padding.
Previously I've believed it to be in other libraries, such as h5py's
handling of compound types - and there have been bugs found and fixed
regarding those - but I'm still getting some confusing behavior as of
late.  So I've attached a test case where we can see something funky
is happening.  Maybe it's only on packet tables though.  The test case
uses C++11 (for brevity of the structure initialization), but
otherwise uses the C-api.


g++ -std=c++11 h5compound_test.cpp -lhdf5 -lhdf5_hl -o h5compound_test_unpacked
g++ -std=c++11 -DPACKED_STRUCT h5compound_test.cpp -lhdf5 -lhdf5_hl -o

Run both binaries - they will produce unpacked_test.h5 and
packed_test.h5 respectively.

With both 1.8.18 and 1.10, you will observe the
packed_test.h5/pt_testdata has some shifting (and thus corruption)
occurring at field 30 on my system (64-bit linux).  However while I
was not able to reproduce in this test case, I have seen simliar
behavior in unpacked structures as well, but I was not able to
reproduce it here - it may take certain definitions to trigger the bug
- in this later case the size of the structure was correct but
somewhere along the lines inside a struct the data gets skewed up (so
f1 is always good, but field fx may not be.  In contrast to the packed
case where the there is a cumulative skew such that record 2 doesn't
have field f1 correct.

Well it was about this late that I figured I'd check your git
repository logs for commits on H5PT.c - it looks like you fixed this
in git but haven't provided a release containing the fix yet.  Wahoo -
imagine my enthusiasm constructing a test case for something already
fixed and trying to understand the source of this bug for the nth
time, especially yesterday.  14e308b2e6eada778818abf53949ceef0e7b2a34
.  I saw this H5T_get_native_type call  in the H5PT.c source but
wasn't sure it was the bug...

By the way - is the mailing list the preferred (or should it be the
preferred) way to report bugs given you guys expose your bitbucket git
repository to the public now?


Hdf-forum is for HDF software users discussion.
[hidden email]
Twitter: https://twitter.com/hdf5

h5compound_test.cpp (5K) Download Attachment