divyang4481 / lz4

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

gcc compiled high compresseion fails on sparc with bus error (misaligned access) #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. gmake
2. run ./lz4demo.exe ./lz4demo.exe /dev/null

What is the expected output? What do you see instead?
Successful compress. Bus  error. Core dump.

What version of the product are you using? On what operating system?
Solaris 10. sparc.

Please provide any additional information below.

When compiling with SolarisStudio I am forced to compile with -xmemalgin=1i 
anyway, and the problem does not appear. Guess it is a performance killer.
I have not found a similar option for gcc.

When I changed some *(U32*)x to A32(x) it worked .

212c211
< #define HASH_VALUE(p)         HASH_FUNCTION(A32(p))

---
> #define HASH_VALUE(p)         HASH_FUNCTION(*(U32*)(p))
345c344
<                   if (A32(ref) == A32(ip))

---
>               if (*(U32*)ref == *(U32*)ip)
388c387
<                   if (A32(ref) == A32(ip))

---
>               if (*(U32*)ref == *(U32*)ip)

Original issue reported on code.google.com by thwill...@gmail.com on 30 Nov 2012 at 10:51

GoogleCodeExporter commented 9 years ago
OK, thanks for clear report.

There are too many corrections ongoing for next release,
so this one will have to wait a little bit...

Original comment by yann.col...@gmail.com on 30 Nov 2012 at 10:57

GoogleCodeExporter commented 9 years ago
I'll handle it.

Original comment by yann.col...@gmail.com on 30 Nov 2012 at 1:58

GoogleCodeExporter commented 9 years ago
The following release candidate
is supposed to solve the reported issue
by using the proposed correction.

A32 is indeed there to handle unaligned access.
It's now properly used within lz4hc.c

Regards

Original comment by yann.col...@gmail.com on 21 Dec 2012 at 8:28

Attachments:

GoogleCodeExporter commented 9 years ago
Patch integrated into r87.

Original comment by yann.col...@gmail.com on 22 Dec 2012 at 5:57