Skip to content

Commit ecb3509

Browse files
author
sewardj
committedOct 22, 2011
Add an excessively minimal testcase, from #279698, pertaining to the
propagation of V bits through saturated narrowing operations. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12194 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 2bd9a68 commit ecb3509

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed
 

‎memcheck/tests/amd64/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ EXTRA_DIST = \
1212
bt_everything.stderr.exp bt_everything.stdout.exp \
1313
bt_everything.vgtest \
1414
bug132146.vgtest bug132146.stderr.exp bug132146.stdout.exp \
15+
bug279698.vgtest bug279698.stderr.exp bug279698.stdout.exp \
1516
fxsave-amd64.vgtest fxsave-amd64.stdout.exp fxsave-amd64.stderr.exp \
1617
more_x87_fp.stderr.exp more_x87_fp.stdout.exp more_x87_fp.vgtest \
1718
sse_memory.stderr.exp sse_memory.stdout.exp sse_memory.vgtest \
@@ -21,6 +22,7 @@ EXTRA_DIST = \
2122
check_PROGRAMS = \
2223
bt_everything \
2324
bug132146 \
25+
bug279698 \
2426
fxsave-amd64 \
2527
more_x87_fp \
2628
sse_memory \

‎memcheck/tests/amd64/bug279698.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* A very trivial test for undefinedness propagation through
2+
saturating narrowing. Obviously need a much more thorough test.
3+
*/
4+
#include <stdio.h>
5+
#include <assert.h>
6+
#include "../../memcheck.h"
7+
int main()
8+
{
9+
unsigned char data[32], vbits[32];
10+
__asm__ __volatile__
11+
("movdqu (%0), %%xmm0 \n"
12+
"packuswb %%xmm0, %%xmm0 \n"
13+
"movdqu %%xmm0, 16(%0) \n"
14+
::"r"(data)
15+
:"memory","xmm0"
16+
);
17+
unsigned int res =
18+
VALGRIND_GET_VBITS( data, vbits, 32 );
19+
assert(res == 1); /* 1 == success */
20+
int i, j;
21+
for(i=0; i<2; i++) {
22+
for(j=0; j<16; j++)
23+
printf("%02x ", vbits[i*16+j]);
24+
printf("\n");
25+
}
26+
return 0;
27+
}

‎memcheck/tests/amd64/bug279698.stderr.exp

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
2+
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

‎memcheck/tests/amd64/bug279698.vgtest

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
prog: bug279698
2+
vgopts: -q

0 commit comments

Comments
 (0)
Please sign in to comment.