From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72363 invoked by alias); 16 Apr 2015 04:42:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 72260 invoked by uid 89); 16 Apr 2015 04:42:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 16 Apr 2015 04:42:18 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 1157239A5B0; Thu, 16 Apr 2015 04:42:16 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-48.phx2.redhat.com [10.3.113.48]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3G4gFTb013342; Thu, 16 Apr 2015 00:42:16 -0400 Message-ID: <552F3DA7.5090305@redhat.com> Date: Thu, 16 Apr 2015 04:42:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Sandra Loosemore , GCC Patches CC: chertykov@gmail.com, rsonar.jayant@gmail.com, Jeff Prothero Subject: Re: [rfc, stage 1] default to -fno-delete-null-pointer-checks on nios2-elf References: <551852E1.6050505@codesourcery.com> In-Reply-To: <551852E1.6050505@codesourcery.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00790.txt.bz2 On 03/29/2015 01:30 PM, Sandra Loosemore wrote: > As the outcome of this discussion last month about unexpected behavior > of -fisolate-erroneous-paths-dereference > > https://gcc.gnu.org/ml/gcc/2015-02/msg00163.html > > Altera has asked us to turn off -fdelete-null-pointer-checks on > nios2-elf targets. Presently, the AVR and CR16 back ends completely > disable this option, but it seems to me that a better solution is to > simply default it to off. That's what the attached patch does for > nios2, with appropriate adjustments to the testsuite. > > The rationale for defaulting to -fno-delete-null-pointer-checks on a > bare-metal target is that it is the "safe" setting on targets where 0 is > a valid memory address, and where the hardware may even require > placement of e.g. a reset vector at that address. Also, library code > should be built to be "safe", especially things like memcpy that might > be used by implicit compiler-generated calls. > > The rationale for allowing the default to be overridden on the command > line, instead of disabling -fdelete-null-pointer-checks entirely, is > that it's much more common for programs *not* to manipulate code or data > at address 0, and we can generate smaller/faster code by enabling the > option. > > So.... > > (1) Is the change to the default for this flag in common.opt OK? I > verified that all existing uses just check for zero/non-zero-ness. > > (2) If the AVR and CR16 maintainers agree that defaulting the option to > off rather than being completely disabling it is a better solution for > their targets, too, I think being consistent across the three targets > would simplify ongoing support -- e.g., the testsuite bits could be > greatly simplified by getting rid of > check_effective_target_keeps_null_pointer_checks and checks for > keeps_null_pointer_checks entirely. WDYT? > > I haven't done a full bootstrap with this patch yet.... I'd just like > to get it out there for discussion to see if there is consensus that > this is a reasonable approach, first. This is stage 1 material in any > case. It looks very sane to me. This is probably how the AVR and CR16 should have been handled to begin with IMHO. FWIW, I generally discourage ports overriding default options, but this is a case where I believe it makes some sense. Please move forward with an official submission. jeff