subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@wandisco.com>
Subject Re: random-test failure on powerpc64le and x86_64
Date Sat, 09 Aug 2014 18:08:21 GMT
On 09.08.2014 15:55, Alan Modra wrote:
> Using current git sources compiled with gcc-4.9.1 or mainline gcc at
> -O3 results in failure of random-test.
>
> On powerpc64le we see
> PASS:  random-test 1: random delta test
> svn_tests: E200006: mismatch at position xxxxx
> FAIL:  random-test 2: random combine delta test
>
> x86_64 gives
> PASS:  random-test 1: random delta test
> svn_tests: E200006: Test crashed (run in debugger with '--allow-segfaults')
> FAIL:  random-test 2: random combine delta test
>
> After some digging, I narrowed the failure down to
> subversion/libsvn_delta/text_delta.c, and the specific -O3 options
> causing the failure to -ftree-loop-vectorize -fvect-cost-model=dynamic. 
> At first I thought I'd found a vectorizer bug, but the real problem is
> a bug in the source, specifically this line in patterning_copy:
>
>       *(apr_uint32_t *)(target) = *(apr_uint32_t *)(source);
>
> Quoting from ISO/IEC 9899:1999
> 6.3.2.3 Pointers
> ...
> 7 A pointer to an object or incomplete type may be converted to a
> pointer to a different object or incomplete type. If the resulting
> pointer is not correctly aligned for the pointed-to type, the behavior
> is undefined.
>
> So here we have undefined behaviour if "source" and "target" are not
> 4-byte aligned..  Fixed as follows.

Nope. This code won't fly because it's not portable across compilers and
platforms.

The way to fix this is to make sure that the macro
SVN_UNALIGNED_ACCESS_IS_OK gives the correct answer; and it's OK if that
answer compiler-specific, not just platform-specific. In other words,
it's fine if the macro gives a different answer depending on GCC
vectorizer options.

-- Brane


-- 
Branko ─îibej | Director of Subversion
WANdisco | Realising the impossibilities of Big Data
e. brane@wandisco.com

Mime
View raw message