Commit 3927713b by Ajit Agarwal Committed by Jeff Law

split-path-1.c: Fix the testcase to avoid undefined behaviour.

	* gcc.dg/tree-ssa/split-path-1.c: Fix the testcase
	to avoid undefined behaviour.

From-SVN: r230555
parent f25c3cc0
2015-11-18 Ajit Agarwal <ajitkum@xilinx.com>
* gcc.dg/tree-ssa/split-path-1.c: Fix the testcase
to avoid undefined behaviour.
2015-11-18 Jakub Jelinek <jakub@redhat.com> 2015-11-18 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/68157 PR tree-optimization/68157
......
...@@ -3,16 +3,17 @@ ...@@ -3,16 +3,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#define RGBMAX 255 #define RGBMAX 255
int unsigned char
test() test()
{ {
int i, Pels; int i, Pels;
unsigned char sum = 0; int sum = 0;
unsigned char xr, xg, xb; unsigned char xr, xg, xb;
unsigned char xc, xm, xy, xk; unsigned char xc, xm, xy, xk = 0;
unsigned char *ReadPtr, *EritePtr; unsigned char *ReadPtr, *EritePtr;
ReadPtr = ( unsigned char *) malloc (sizeof (unsigned char) * 100); ReadPtr = ( unsigned char *) malloc (sizeof (unsigned char) * 100);
...@@ -23,7 +24,7 @@ test() ...@@ -23,7 +24,7 @@ test()
ReadPtr[i] = 100 - i; ReadPtr[i] = 100 - i;
} }
for (i = 0; i < 100; i++) for (i = 0; i < 24; i++)
{ {
xr = *ReadPtr++; xr = *ReadPtr++;
xg = *ReadPtr++; xg = *ReadPtr++;
...@@ -50,7 +51,8 @@ test() ...@@ -50,7 +51,8 @@ test()
*EritePtr++ = xm; *EritePtr++ = xm;
*EritePtr++ = xy; *EritePtr++ = xy;
*EritePtr++ = xk; *EritePtr++ = xk;
sum += *EritePtr; sum += *(--EritePtr);
} }
return sum; return sum;
} }
...@@ -58,7 +60,7 @@ test() ...@@ -58,7 +60,7 @@ test()
int int
main() main()
{ {
if (test() != 33) if (test() != 196)
abort(); abort();
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment