Skip gcc.dg/tree-ssa/isolate-*.c for AVR Target

2014-03-28 Thread K_s, Vishnu
Hi all,

The tests added in gcc.dg/tree-ssa/isolate-*.c is failing for AVR target,
Because the isolate erroneous path pass needs -fdelete-null-pointer-checks
option to be enabled. For AVR target that option is disabled, this cause 
the tests to fail. Following Patch skip the isolate-* tests if 
"keeps_null_pointer_checks" is true. 

2014-03-28  Vishnu K S 

* gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c: Skip test for AVR 
* gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c: Ditto 
* gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c: Ditto
* gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c: Ditto
* gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c: Ditto

--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c
@@ -1,6 +1,7 @@

 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-isolate-paths" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


 struct demangle_component
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
index bfcaa2b..912d98e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fisolate-erroneous-paths-attribute 
-fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


 int z;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
index 780..9c2c5d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-isolate-paths" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


 typedef long unsigned int size_t;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
index c9c074d..d50a2b2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fisolate-erroneous-paths-attribute 
-fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


 extern void foo(void *) __attribute__ ((__nonnull__ (1)));
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
index 4d01d5c..e6ae37a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-optimized" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */

Regards,
Vishnu KS


Changing INT to SI mode

2014-03-28 Thread K_s, Vishnu
Test pr59940.c is failing for AVR target because the test assumes the size
of int as 32 bit and test expect to generate warnings for overflow and
conversion while assigning 36-bit and 32 bit value respectively to variable si.
Following patch define a 32 bit type with SI mode and use it.

2014-03-28  Vishnu K S 

* gcc/testsuite/gcc.dg/pr59940.c: Using 32-bit SI mode instead of int


diff --git a/gcc/testsuite/gcc.dg/pr59940.c b/gcc/testsuite/gcc.dg/pr59940.c
index b0fd17f..21d93ad 100644
--- a/gcc/testsuite/gcc.dg/pr59940.c
+++ b/gcc/testsuite/gcc.dg/pr59940.c
@@ -3,11 +3,12 @@
 /* { dg-options "-Wconversion -Woverflow" } */

 int f (unsigned int);
+typedef sitype __attribute__((mode(SI)));

 int
 g (void)
 {
-  int si = 12;
+  sitype si = 12;
   unsigned int ui = -1; /* { dg-warning "21:negative integer implicitly 
converted to unsigned type" } */
   unsigned char uc;
   ui = si; /* { dg-warning "8:conversion" } */



RE: Changing INT to SI mode

2014-03-31 Thread K_s, Vishnu
I have found one more test with same issue.

2014-03-31  Vishnu K S  

* gcc.dg/pr59963-2.c (bazi): Use 32-bit SI mode instead of int.

diff --git a/gcc/testsuite/gcc.dg/pr59963-2.c b/gcc/testsuite/gcc.dg/pr59963-2.c
index ea05946..263ac37 100644
--- a/gcc/testsuite/gcc.dg/pr59963-2.c
+++ b/gcc/testsuite/gcc.dg/pr59963-2.c
@@ -2,11 +2,13 @@
 /* { dg-do compile } */
 /* { dg-options "-Woverflow -Wconversion" } */

+typedef int sitype __attribute__((mode(SI)));
+
 extern void bar (unsigned char);
 extern void bar8 (unsigned char, unsigned char, unsigned char, unsigned char,
  unsigned char, unsigned char, unsigned char, unsigned char);
 extern void bazu (unsigned int, ...);
-extern void bazi (char, int);
+extern void bazi (char, sitype);
 extern int f (short a, short b);

 int

> -Original Message-
> From: Mike Stump [mailto:mikest...@comcast.net]
> Sent: Saturday, March 29, 2014 12:49 AM
> To: K_s, Vishnu
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: Changing INT to SI mode
> 
> On Mar 28, 2014, at 6:23 AM, K_s, Vishnu  wrote:
> > Test pr59940.c is failing for AVR target because the test assumes the
> size
> > of int as 32 bit and test expect to generate warnings for overflow
> and
> > conversion while assigning 36-bit and 32 bit value respectively to
> variable si.
> > Following patch define a 32 bit type with SI mode and use it.
> >
> > 2014-03-28  Vishnu K S 
> >
> > * gcc/testsuite/gcc.dg/pr59940.c: Using 32-bit SI mode instead of
> int
> 
> [ see previous note ]
> 
> Ok.
> 
> 
> I checked this in for you, and formatted the ChangeLog slightly better.
> Two spaces after the name, no space before the >, no gcc/testsuite in
> the log, end sentence with a period, add name of what was changed (si
> in this case).
> 
> +2014-03-28  Vishnu K S  
> +
> + * gcc.dg/pr59940.c (si): Use 32-bit SI mode instead of int.


RE: Skip gcc.dg/tree-ssa/isolate-*.c for AVR Target

2014-03-31 Thread K_s, Vishnu
Changed the comment in log as the tests are not skipping for AVR only, but for 
all
The targets keeps_null_pointer_checks is true.
Corrected the log as per the comments. Please review it and commit it if it's 
OK.

Regards
Vishnu KS


2014-03-31  Vishnu K S  

  * gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c: Skip test if 
keeps_null_pointer_checks
  is true for target. 
  * gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c: Ditto 
  * gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c: Ditto
  * gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c: Ditto
  * gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c: Ditto

--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c
@@ -1,6 +1,7 @@

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-isolate-paths" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


struct demangle_component
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
index bfcaa2b..912d98e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fisolate-erroneous-paths-attribute 
-fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


int z;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
index 780..9c2c5d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-isolate-paths" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


typedef long unsigned int size_t;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
index c9c074d..d50a2b2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fisolate-erroneous-paths-attribute 
-fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */


extern void foo(void *) __attribute__ ((__nonnull__ (1)));
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c 
b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
index 4d01d5c..e6ae37a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-optimized" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */



> -Original Message-
> From: Mike Stump [mailto:mikest...@comcast.net]
> Sent: Saturday, March 29, 2014 12:52 AM
> To: Mike & Elizabeth Stump; K_s, Vishnu
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: Skip gcc.dg/tree-ssa/isolate-*.c for AVR Target
> 
> On Mar 28, 2014, at 12:04 PM, Mike Stump  wrote:
> >
> >> 2014-03-28  Vishnu K S 
> >>
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c: Skip test for AVR
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c: Ditto
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c: Ditto
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c: Ditto
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c: Ditto
> 
> So, no gcc/testsuite/ in the log,, no space before >, and two spaces
> after the name before the <, and end sentences with a ..

> -Original Message-
> From: Mike Stump [mailto:mikest...@comcast.net]
> Sent: Saturday, March 29, 2014 12:52 AM
> To: Mike & Elizabeth Stump; K_s, Vishnu
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: Skip gcc.dg/tree-ssa/isolate-*.c for AVR Target
> 
> On Mar 28, 2014, at 12:04 PM, Mike Stump  wrote:
> >
> >> 2014-03-28  Vishnu K S 
> >>
> >>* gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c: Skip test for AVR
> >>* gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c: Ditto
> >>* gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c: Ditto
> >>* gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c: Ditto
> >>* gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c: Ditto
> 
> So, no gcc/testsuite/ in the log,, no space before >, and two spaces
> after the name before the <, and end sentences with a ..


RE: Skip gcc.dg/tree-ssa/isolate-*.c for AVR Target

2014-04-07 Thread K_s, Vishnu
Added comment to avr.c on why disabling -fdelete-null-pointer-checks. Patch
Attached in the mail. 

Previously approved patch can be found here - 
http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01697.html.

I don't have commit access to the source, please commit both the patches
If they are OK.

Regards
Vishnu KS

2014-03-31  Vishnu K S  

  * gcc/config/avr/avr.c: Add comment on why disabling 
  -fdelete-null-pointer-checks


diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 8ca7de0..c400bff 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -290,6 +290,12 @@ avr_to_int_mode (rtx x)
 static void
 avr_option_override (void)
 {
+  /* Disable -fdelete-null-pointer-checks option for AVR target.
+ For this option compiler assumes that dereferencing of a null pointer
+ would halt the program. For AVR this assumption is not true and
+ programs can safely dereference null pointers. Changes made by this
+ option may not work properly for AVR. So disable this option. */
+
   flag_delete_null_pointer_checks = 0;

   /* caller-save.c looks for call-clobbered hard registers that are assigned
> -Original Message-
> From: Richard Biener [mailto:richard.guent...@gmail.com]
> Sent: Saturday, April 05, 2014 3:16 PM
> To: Jeff Law
> Cc: K_s, Vishnu; gcc-patches@gcc.gnu.org
> Subject: Re: Skip gcc.dg/tree-ssa/isolate-*.c for AVR Target
> 
> On Fri, Apr 4, 2014 at 5:37 PM, Jeff Law  wrote:
> > On 03/28/14 04:16, K_s, Vishnu wrote:
> >>
> >> Hi all,
> >>
> >> The tests added in gcc.dg/tree-ssa/isolate-*.c is failing for AVR
> target,
> >> Because the isolate erroneous path pass needs -fdelete-null-pointer-
> checks
> >> option to be enabled. For AVR target that option is disabled, this
> cause
> >> the tests to fail. Following Patch skip the isolate-* tests if
> >> "keeps_null_pointer_checks" is true.
> >>
> >> 2014-03-28  Vishnu K S 
> >>
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c: Skip test for
> AVR
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c: Ditto
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c: Ditto
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c: Ditto
> >> * gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c: Ditto
> >
> > This is fine for the trunk.  Please go ahead and install.
> >
> > However, we generally discourage ports from turning off passes like
> this and
> > particularly so without a comment as to why a pass is turned off.
> >
> > That code was added to the AVR port here:
> >
> > http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01968.html
> >
> >
> > If you could add a comment to the AVR port indicating that
> > delete-null-pointer-checks is disabled because the hardware does not
> fault
> > on a NULL dereference, it would be greatly appreciated.  Consider
> that
> > comment addition pre-approved, just post it to the list for archival
> > purposes.
> 
> Note that it is recommended (and documented) practice to treat
> -fdelete-null-pointer-checks that way for targets that support objects
> starting at 0.
> 
> Richard.
> 
> > Thanks,
> > Jeff
> >
> >