On 05/18/17 10:57, marius adrian popa wrote:
firebird 3.0.3 current crashes on a non sse4 host even when i try to force
the nonsse4.2 function (i have removed the sse detection and crc32
optimized function)

https://github.com/FirebirdSQL/firebird/commit/52d9a05a0f3d

Anyone tried to compile 3.0.3 on nonsse hosts and x64 ?


Did not, but working with master noticed a bug in non-SSE version which may cause invalid hash values.
Can you try with this patch?

diff --git a/src/common/classes/Hash.cpp b/src/common/classes/Hash.cpp
index 6614708889..336c916bab 100644
--- a/src/common/classes/Hash.cpp
+++ b/src/common/classes/Hash.cpp
@@ -43,12 +43,11 @@ namespace
 	{
 		unsigned int hash_value = 0;
 
-		UCHAR* p;
+		UCHAR* const p = (UCHAR*) &hash_value;
 		const UCHAR* q = value;
 
 		while (length >= 4)
 		{
-			p = (UCHAR*) &hash_value;
 			p[0] += q[0];
 			p[1] += q[1];
 			p[2] += q[2];
@@ -57,25 +56,24 @@ namespace
 			q += 4;
 		}
 
-		p = (UCHAR*) &hash_value;
-
 		if (length >= 2)
 		{
 			p[0] += q[0];
 			p[1] += q[1];
 			length -= 2;
+			q += 2;
 		}
 
 		if (length)
 		{
-			q += 2;
 			*p += *q;
 		}
 
 		return hash_value;
 	}
 
-#if defined(_M_IX86) || defined(_M_X64) || defined(__x86_64__) || defined(__i386__)
+//#if defined(_M_IX86) || defined(_M_X64) || defined(__x86_64__) || defined(__i386__)
+#ifdef NEVERDEF
 
 	bool SSE4_2Supported()
 	{
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to