https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148
--- Comment #4 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- (In reply to r...@cebitec.uni-bielefeld.de from comment #3) > 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) uoops, does below patch fix the testcase on Solaris/x86? memcpy (pd_src, p_init, 2 * N * sizeof (double)); - memcpy (ps_dst, p_init, 2 * N * sizeof (float)); - memcpy (epi64_dst, p_init, 2 * N * sizeof (long long)); - memcpy (epi32_dst, p_init, 2 * N * sizeof (int)); - memcpy (epi16_dst, p_init, 2 * N * sizeof (short)); - memcpy (epi8_dst, p_init, 2 * N * sizeof (char)); + memcpy (ps_src, p_init, 2 * N * sizeof (float)); + memcpy (epi64_src, p_init, 2 * N * sizeof (long long)); + memcpy (epi32_src, p_init, 2 * N * sizeof (int)); + memcpy (epi16_src, p_init, 2 * N * sizeof (short)); + memcpy (epi8_src, p_init, 2 * N * sizeof (char)); > > Why on earth would the rest of epi8_dst and epi8_src be identical if > epi8_src was never initialized? Guess, epi8_src is all zero, and epi8_dst if set as epi8_src[0] by foo_epi8.