On Wed, Feb 09, 2022 at 10:03:02AM +0100, Richard Biener wrote: > I see there are still targets doing sth like > > 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;
Sure, that is the typical embedded target case. And the user option is in case users are using a typically non-embedded target case in an embedded way, even on x86_64-linux one can mmap something at address 0 if one tweaks some kernel config parameters. I guess I could change default_addr_space_zero_address_valid from return false; to if (!flag_delete_null_pointer_checks) return true; if (folding_initializer) return false; if (current_function_decl && sanitize_flags_p (SANITIZE_NULL | SANITIZE_NONNULL_ATTRIBUTE | SANITIZE_RETURNS_NONNULL_ATTRIBUTE, current_function_decl)) return true; return false; and change the i386 one to also call the default version. Replacing all the flag_delete_null_pointer_checks uses with some wrappers around the target hook will be less fun, not sure if the pointer type will be always visible there... > Did you replace all flag_delete_null_pointer_checks uses? I did. > Can you rename the flag just to be sure? Sure. Jakub