]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
avr.c (avr_option_override): Move disabling of -fdelete-null-pointer-checks to...
authorGeorg-Johann Lay <avr@gjlay.de>
Thu, 1 Feb 2018 15:54:20 +0000 (15:54 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Thu, 1 Feb 2018 15:54:20 +0000 (15:54 +0000)
gcc/
* config/avr/avr.c (avr_option_override): Move disabling of
-fdelete-null-pointer-checks to...
* common/config/avr/avr-common.c (avr_option_optimization_table):
...here.
testsuite/
* gcc.dg/tree-ssa/vrp111.c (dg-options): Add
-fdelete-null-pointer-checks.

From-SVN: r257301

gcc/ChangeLog
gcc/common/config/avr/avr-common.c
gcc/config/avr/avr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/vrp111.c

index e62b93d9a38a5db38bbc5f0689f5ed81da08258a..4dcc3644f366ebbe8ba28edfae9a481f678b8451 100644 (file)
@@ -1,3 +1,10 @@
+2018-02-01  Georg-Johann Lay  <avr@gjlay.de>
+
+       * config/avr/avr.c (avr_option_override): Move disabling of
+       -fdelete-null-pointer-checks to...
+       * common/config/avr/avr-common.c (avr_option_optimization_table):
+       ...here.
+
 2018-02-01  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR tree-optimization/81635
index 078584d53c3bd2edfdc3043c298cf118177a2fbb..d6293b1192e255d55adb77ae116665010eda4a25 100644 (file)
 /* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
 static const struct default_options avr_option_optimization_table[] =
   {
+    // With -fdelete-null-pointer-checks option, the compiler assumes
+    // that dereferencing of a null pointer would halt the program.
+    // For AVR this assumption is not true and a program can safely
+    // dereference null pointers.  Changes made by this option may not
+    // work properly for AVR.  So disable this option.
+    { OPT_LEVELS_ALL, OPT_fdelete_null_pointer_checks, NULL, 0 },
     // The only effect of -fcaller-saves might be that it triggers
     // a frame without need when it tries to be smart around calls.
     { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 },
index ad15512574118632aa20365e1e6293dd6036d1a6..81c35e7fbc2b06bc06cc7fb7406694bbe48860e5 100644 (file)
@@ -730,14 +730,6 @@ avr_set_core_architecture (void)
 static void
 avr_option_override (void)
 {
-  /* Disable -fdelete-null-pointer-checks option for AVR target.
-     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
      to pseudos that cross calls and tries so save-restore them around calls
      in order to reduce the number of stack slots needed.
index 465ae15296a707924995c3ddc0fc8e606d4cff23..da557b80629b49ae88d14c7b7edf92b1af23a2ce 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-01  Georg-Johann Lay  <avr@gjlay.de>
+
+       * gcc.dg/tree-ssa/vrp111.c (dg-options): Add
+       -fdelete-null-pointer-checks.
+
 2018-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/83796
index 2511c1964bb4053e2a8b66946d09b69225d30eee..631442358be2c19c2c2a5350eb4ae252b77d8493 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp -fdelete-null-pointer-checks" } */
 
 void foo (void *p) __attribute__((nonnull(1)));