epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

Serialization and alignment trouble, part 3 #74

Closed mdavidsaver closed 3 years ago

mdavidsaver commented 3 years ago

In looking to extend CI testing to RTEMS I find that testByteByffer is failing with 4.10 (passes with 4.9). A prime example of why we should be running tests for embedded targets more often.

The failure seen is:

testByteBuffer.tap ........ 1/? 
not ok 95 - buf.getPosition()==16

Printing some additional detail shows this to be:

testByteBuffer.tap ........ 1/? 
not ok 95 - buf.getPosition() (12) == 16 (16)

Investigating further. For at least RTEMS4.10 + pc386, the root cause seems to be that malloc() can return a pointer aligned only to 4 bytes. The test is checking for at least 8 byte alignment. The implementation of ByteBuffer::align() assumes this.

I'm don't know yet if this has any practical implications. Both 4.9 and 4.10 pass with a mvme3100 emulator, but this could be a coincidence.

cf. #54 #65

mdavidsaver commented 3 years ago

Never mind. It's all dead code...

ByteBuffer::align() exists to implement SerializableControl::alignBuffer() and DeserializableControl::alignData(). However, none of these methods are called in pvDataCPP or pvAccessCPP outside of test code.

mdavidsaver commented 3 years ago

Dead code removed with 07b79693af66812c02044c36f1eb2e7cc3cabe8c and https://github.com/epics-base/pvAccessCPP/commit/3b2261a61f15a3d2a46f53ca263112a4fc492d16. All remaining tests pass with RTEMS 4.x.