msp430.c (msp430_option_override): Disable -fdelete-null-pointer-checks.
authorOrlando Arias <oarias@knights.ucf.edu>
Fri, 20 Oct 2017 04:49:57 +0000 (04:49 +0000)
committerDJ Delorie <dj@gcc.gnu.org>
Fri, 20 Oct 2017 04:49:57 +0000 (00:49 -0400)
* config/msp430/msp430.c (msp430_option_override): Disable
-fdelete-null-pointer-checks.
* doc/invoke.text (-fdelete-null-pointer-checks): Document that.

* lib/target-supports.exp (check_effective_target_keeps_null_pointer_checks):
Add msp430 to the list.

From-SVN: r253921

gcc/ChangeLog
gcc/config/msp430/msp430.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp

index d8c4d7589bb7017ea5e24d1fd3b22000d2ab7219..a33dbb1e59798833927e3e8e101ff4dff787d942 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-20  Orlando Arias  <oarias@knights.ucf.edu>
+
+       * config/msp430/msp430.c (msp430_option_override): Disable
+       -fdelete-null-pointer-checks.
+       * doc/invoke.text (-fdelete-null-pointer-checks): Document that.
+
 2017-10-19  Jan Hubicka  <hubicka@ucw.cz>
 
        * x86-tune-costs.h (generic_cost, core_cost): Correct costs
index 4f32fc855e592d10472a86ca6eee4af64f312285..9466d0989f0892c83ae69729dc7154e75504db9c 100644 (file)
@@ -751,6 +751,10 @@ hwmult_name (unsigned int val)
 static void
 msp430_option_override (void)
 {
+  /* The MSP430 architecture can safely dereference a NULL pointer. In fact,
+  there are memory mapped registers there.  */
+  flag_delete_null_pointer_checks = 0;
+
   init_machine_status = msp430_init_machine_status;
 
   if (target_cpu)
index a2ef6fe023f535663d51ea8382a6b45231e650bb..8dd32f559fcecbc361d212fcd96a059c0024b275 100644 (file)
@@ -7837,7 +7837,7 @@ Use @option{-fno-delete-null-pointer-checks} to disable this optimization
 for programs that depend on that behavior.
 
 This option is enabled by default on most targets.  On Nios II ELF, it
-defaults to off.  On AVR and CR16, this option is completely disabled.  
+defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
 
 Passes that use the dataflow information
 are enabled independently at different optimization levels.
index 4aab328fae3fd68ec9cfad6a017801c4250e8a70..e950e339c5cafdb9531561f3dce8be0b1c309aa0 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-20  Orlando Arias  <oarias@knights.ucf.edu>
+
+       * lib/target-supports.exp (check_effective_target_keeps_null_pointer_checks):
+       Add msp430 to the list.
+
 2017-10-19  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/82308
index 4f9bf460c220aa88a1f1236e17ca6f93d6ca8a88..63694ea51e2aeb52900c72fe64fc8eb8f0ec76ba 100644 (file)
@@ -548,7 +548,8 @@ proc check_effective_target_keeps_null_pointer_checks { } {
     if [target_info exists keeps_null_pointer_checks] {
       return 1
     }
-    if { [istarget avr-*-*] } {
+    if { [istarget avr-*-*]
+        || [istarget msp430-*-*] } {
        return 1;   
     }
     return 0