On 9/12/21 6:40 PM, Dimitry Sibiryakov wrote:
Alex Peshkoff via Firebird-devel wrote 15.05.2018 12:13:
On 05/15/18 13:06, Dimitry Sibiryakov wrote:
15.05.2018 11:58, Alex Peshkoff via Firebird-devel wrote:
  Do alignment of fields in C struct matches alignment of the same fields in MessageBuffer?   If at compile/preprocess time construct a struct to be used directly in OO API, will it be reliable?

Not always.  For example, on 32-bit linux int64 values are aligned at 4, not 8, bytes.

  Perhaps, I could handle it by adding of __attribute__((aligned(8))) to the declaration of ISC_INT64...


Yes, it does the trick.

  I see that alignment of dtype_int128 is set to sizeof(Firebird::Decimal64) which is 8 bytes, but alignment requirement of native __int128 is 16 bytes and cannot be decreased using alignas().
  Shouldn't it to be fixed?


Yes, that should be fixed. If one builds FB with native __int128 it fails on unaligned data access. But changing alignment requirement to 16 bytes is not enough - appears some buffers are not aligned at 16-bit cause FB fails exactly in the same place. I'm going to fix all that when have time. BTW, DecFloat(34) is also 16-bit object and I'm afraid that in a case of PPC build (it has HW support of decfloats) this will cause same problems.




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to