https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148
--- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot
Uni-Bielefeld.DE> ---
To investigate further, I've added comparison functions to a reduced
version of pr106010-7b.c, with
void
cmp_epi8 (_Complex unsigned char* a, _Complex unsigned char* b)
{
for (int i = 0; i != N; i++)
if (a[i] != b[i])
{
printf ("cmp_epi8: i = %d: a[i].r = %x a[i].i = %x b[i].r = %x b[i].i =
%x\n",
i, __real__ a[i], __imag__ a[i], __real__ b[i], __imag__ b[i]);
}
}
This shows (when using _Complex unsigned char since on Solaris, char is
signed by default)
cmp_epi8: i = 76: a[i].r = 0 a[i].i = 0 b[i].r = 88 b[i].i = 33
cmp_epi8: i = 77: a[i].r = 0 a[i].i = 0 b[i].r = 6 b[i].i = 8
cmp_epi8: i = 80: a[i].r = 0 a[i].i = 0 b[i].r = 3 b[i].i = 0
I've also noticed that the test result depends on the implementation of
malloc used:
* With Solaris libc malloc, libmalloc, and watchmalloc, the test aborts.
* However, when using one of libbsdmalloc, libmapmalloc, libmtmalloc, or
libumem, the test works.
However, ISTM that the test is simply bogus: in avx_test
* epi8_src, epi8_dst are allocated with malloc, buffer contents undefined
* epi8_dst is cleared
* epi8_dst is initialized from p_init
* in foo_epi8, epi8_src[0] (an undefined value) is copied into first N
elements of epi8_dst
* epi8_dst is compared to epi8_src (with the remaining members of epi8_src
still undefined)
Why on earth would the rest of epi8_dst and epi8_src be identical if
epi8_src was never initialized?