On Wed, Aug 10, 2011 at 7:12 AM, Richard Guenther
<richard.guent...@gmail.com> wrote:
> On Wed, Aug 10, 2011 at 4:04 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>> On Wed, Aug 10, 2011 at 6:46 AM, Richard Guenther
>> <richard.guent...@gmail.com> wrote:
>>> On Sat, Mar 29, 2008 at 10:11 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>>>> This patch restores proper checking the third argument on blendpd and
>>>> and blendps.  It also adds 2 tests, including pblendw.  Tested on
>>>> Linux/Intel64. OK to install?
>>>
>>> The gcc.target/i386/sse4_1-blendps-2.c test randomly fails because
>>> src3 is used uninitialized.
>>>
>>
>> SRC2 may be uninitialized.  But I never saw random failures
>> since it checks if random value in SRC2 is properly blended.
>
> No, src2 is initialized via init_blendps (src1.f, src2.f), src3 is
> uninitialized.
> I see random execute fails on Nehalem.
>
> I suppose we might optimize the uninitialized memory (it's probably
> committed to registers) based on the undefined behavior.
>
> Please avoid this by initializing src3 properly.
>

Here is a patch.  OK for trunk?


-- 
H.J.
----
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
index b66bbfd..af56e14 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
@@ -6,6 +6,7 @@

 #include <smmintrin.h>
 #include <string.h>
+#include <stdlib.h>

 #define NUM 20

@@ -52,11 +53,15 @@ sse4_1_test (void)
     {
       __m128 x;
       float f[4];
+      int i[4];
     } src3;
   int i;

   init_blendps (src1.f, src2.f);

+  for (i = 0; i < 4; i++)
+    src3.i[i] = (int) random ();
+
   /* Check blendps imm8, m128, xmm */
   for (i = 0; i < NUM; i++)
     {

Reply via email to