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 <vishnu....@atmel.com> * 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 <l...@redhat.com> 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 <vishnu....@atmel.com > > >> > >> * 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 > > > >