public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RE:  [Patch,testsuite]: Fix the tree-ssa/split-path-1.c testcase
@ 2015-11-18 14:21 Ajit Kumar Agarwal
  2015-11-18 16:57 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Ajit Kumar Agarwal @ 2015-11-18 14:21 UTC (permalink / raw)
  To: Jeff Law, Richard Biener, GCC Patches
  Cc: Vinod Kathail, Shail Aditya Gupta, Vidhumouli Hunsigida, Nagaraju Mekala

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]


Hello Jeff:

Please ignore my previous mails as they bounced back. Sorry for that.

I have fixed the problem with the testcase. The splitting path optimization remains intact.
Attached is the patch.

The problem was related to the testcase as the loop bound goes beyond the malloced array.
There was also a problem with accessing the elements of EritePtr.

ChangeLog:
2015-11-18  Ajit Agarwal  <ajitkum@xilinx.com>

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

Signed-off-by:Ajit Agarwal ajitkum@xilinx.com

Thanks & Regards
Ajit

[-- Attachment #2: testcase.patch --]
[-- Type: application/octet-stream, Size: 1831 bytes --]

From fbad2a0e56159811a9342eac657772989f77eab3 Mon Sep 17 00:00:00 2001
From: Ajit Kumar Agarwal <ajitkum@xilix.com>
Date: Wed, 18 Nov 2015 19:25:39 +0530
Subject: [PATCH] [Patch,testuite]: Fix the tree-ssa/split-path-1.c testcase

The problem was related to the testcase as the loop bound goes beyond the malloced array.
There was also a problem with accessing the elements of EritePtr.

ChangeLog:
2015-11-18  Ajit Agarwal  <ajitkum@xilinx.com>

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

Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
---
 gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
index 1239892..5c96241 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
@@ -3,16 +3,17 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <ctype.h>
 
-#define RGBMAX 255
+#define RGBMAX 255 
 
-int
+unsigned char
 test()
 {
   int i, Pels;
-  unsigned char sum = 0;
+  int sum = 0;
   unsigned char xr, xg, xb;
-  unsigned char xc, xm, xy, xk;
+  unsigned char xc, xm, xy, xk = 0;
   unsigned char *ReadPtr, *EritePtr;
 
   ReadPtr = ( unsigned char *) malloc (sizeof (unsigned char) * 100);
@@ -23,7 +24,7 @@ test()
        ReadPtr[i] = 100 - i;
      }
 
-  for (i = 0; i < 100; i++)
+  for (i = 0; i < 24; i++)
      {
        xr = *ReadPtr++;
        xg = *ReadPtr++;
@@ -50,7 +51,8 @@ test()
        *EritePtr++ = xm;
        *EritePtr++ = xy;
        *EritePtr++ = xk;
-       sum += *EritePtr;
+       sum += *(--EritePtr);
+       
     }
   return sum;
 }
@@ -58,7 +60,7 @@ test()
 int
 main()
 {
-  if (test() != 33)
+  if (test() != 196)
     abort();
 
   return 0;
-- 
1.7.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch,testsuite]: Fix the tree-ssa/split-path-1.c testcase
  2015-11-18 14:21 [Patch,testsuite]: Fix the tree-ssa/split-path-1.c testcase Ajit Kumar Agarwal
@ 2015-11-18 16:57 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-11-18 16:57 UTC (permalink / raw)
  To: Ajit Kumar Agarwal, Richard Biener, GCC Patches
  Cc: Vinod Kathail, Shail Aditya Gupta, Vidhumouli Hunsigida, Nagaraju Mekala

On 11/18/2015 07:21 AM, Ajit Kumar Agarwal wrote:
>
> Hello Jeff:
>
> Please ignore my previous mails as they bounced back. Sorry for that.
>
> I have fixed the problem with the testcase. The splitting path optimization remains intact.
> Attached is the patch.
>
> The problem was related to the testcase as the loop bound goes beyond the malloced array.
> There was also a problem with accessing the elements of EritePtr.
>
> ChangeLog:
> 2015-11-18  Ajit Agarwal  <ajitkum@xilinx.com>
>
>          * gcc.dg/tree-ssa/split-path-1.c: Fix the testcase.
THanks.  Installed.

I wasn't sure why you needed <ctype.h>, but I left it as-is.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-18 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 14:21 [Patch,testsuite]: Fix the tree-ssa/split-path-1.c testcase Ajit Kumar Agarwal
2015-11-18 16:57 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).