From 427480bef0c54e967db5cd87b0ba1af2ffecc741 Mon Sep 17 00:00:00 2001 From: dj Date: Fri, 20 Oct 2017 04:49:57 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253921 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/msp430/msp430.c | 4 ++++ gcc/doc/invoke.texi | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/lib/target-supports.exp | 3 ++- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8c4d7589bb..a33dbb1e597 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-20 Orlando Arias + + * 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 * x86-tune-costs.h (generic_cost, core_cost): Correct costs diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 4f32fc855e5..9466d0989f0 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -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) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a2ef6fe023f..8dd32f559fc 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -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. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4aab328fae3..e950e339c5c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-20 Orlando Arias + + * lib/target-supports.exp (check_effective_target_keeps_null_pointer_checks): + Add msp430 to the list. + 2017-10-19 Paolo Carlini PR c++/82308 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 4f9bf460c22..63694ea51e2 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -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 -- 2.11.4.GIT