xiaoyin0208 / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

pragma pack usage issue #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
lz4.c rev 97 line 179 contains: 

pragma pack(push, 1)

The push parameter is not supported on AIX; it is implied. To get this to work 
correctly I made the following change:

 #if !defined(LZ4_FORCE_UNALIGNED_ACCESS) && !defined(__GNUC__)
+# ifdef __IBMC__
+#  pragma pack(1)
+# else
 #  pragma pack(push, 1)
+# endif
 #endif

Refs:

IBM documentation: 
http://publib.boulder.ibm.com/infocenter/comphelp/v101v121/index.jsp?topic=/com.
ibm.xlcpp101.aix.doc/compiler_ref/pragma_pack.html

Same report on another project which explains the differences between pragma 
pack on this and other platforms:
https://bugzilla.mozilla.org/attachment.cgi?id=527070&action=diff

Original issue reported on code.google.com by l...@broadmeadow.eu on 13 Jun 2013 at 1:01

GoogleCodeExporter commented 8 years ago
Interesting.
Thanks for detailed report and solution.

Original comment by yann.col...@gmail.com on 13 Jun 2013 at 1:08

GoogleCodeExporter commented 8 years ago

Original comment by yann.col...@gmail.com on 13 Jun 2013 at 1:09

GoogleCodeExporter commented 8 years ago
I've been testing if the "push" parameter is implied on other systems as well.
It appears it is not.
Therefore, I think your proposed correction is the better way to go.

Original comment by yann.col...@gmail.com on 19 Jun 2013 at 11:46

GoogleCodeExporter commented 8 years ago
The following release candidate is using the proposed method, and should 
hopefully correct the issue.

Original comment by yann.col...@gmail.com on 20 Jun 2013 at 9:30

Attachments:

GoogleCodeExporter commented 8 years ago
Many thanks - I can confirm the code compiles and works for me on AIX p6 and p7 
(plus Windows with the Visual Studio compiler version 14.00.50727.762 and Linux 
with gcc 4.4.3).

Per the second link in the original report, I suspect that a similar issue will 
still affect HP and Sun users. I am not in a position to confirm that or test 
any fix.

Original comment by l...@broadmeadow.eu on 20 Jun 2013 at 11:13

GoogleCodeExporter commented 8 years ago
We'll wait for report from these platforms then.

Regards

Original comment by yann.col...@gmail.com on 20 Jun 2013 at 12:23

GoogleCodeExporter commented 8 years ago
Corrected into r98

Original comment by yann.col...@gmail.com on 1 Jul 2013 at 7:53