From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125059 invoked by alias); 29 Mar 2015 19:31:35 -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 125031 invoked by uid 89); 29 Mar 2015 19:31:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 29 Mar 2015 19:31:29 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1YcIvd-0006Hx-UD from Sandra_Loosemore@mentor.com ; Sun, 29 Mar 2015 12:31:25 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Sun, 29 Mar 2015 12:31:25 -0700 Message-ID: <551852E1.6050505@codesourcery.com> Date: Sun, 29 Mar 2015 19:31:00 -0000 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: GCC Patches CC: , , Jeff Prothero Subject: [rfc, stage 1] default to -fno-delete-null-pointer-checks on nios2-elf Content-Type: multipart/mixed; boundary="------------050006010702050807010205" X-SW-Source: 2015-03/txt/msg01510.txt.bz2 --------------050006010702050807010205 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1993 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. -Sandra --------------050006010702050807010205 Content-Type: text/x-log; name="nullptr.log" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nullptr.log" Content-length: 1953 2015-03-29 Sandra Loosemore gcc/ * common.opt (fdelete-null-pointer-checks): Init to -1. * config/nios2/elf.h (SUBTARGET_OVERRIDE_OPTIONS): Define to override flag_delete_null_pointer_checks default. * doc/invoke.texi (-fdelete-null-pointer-checks): Clarify behavior re address zero. Better document target-specific behavior. (-fisolate-errneous-paths-dereference): Mention relationship to -fdelete-null-pointer-checks. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_keeps_null_pointer_checks): Clarify that this is for targets that disable -fdelete-null-pointer-checks, not default it to off. * gcc.dg/ipa/ipa-pta-14.c: Make dependence on -fdelete-null-pointer-checks explicit. * gcc.dg/tree-ssa/20030730-1.c: Likewise. * gcc.dg/tree-ssa/20030730-2.c: Likewise. * gcc.dg/tree-ssa/isolate-1.c: Likewise. * gcc.dg/tree-ssa/isolate-2.c: Likewise. * gcc.dg/tree-ssa/isolate-3.c: Likewise. * gcc.dg/tree-ssa/isolate-4.c: Likewise. * gcc.dg/tree-ssa/isolate-5.c: Likewise. * gcc.dg/tree-ssa/nonzero-1.c: Likewise. * gcc.dg/tree-ssa/pr20318.c: Likewise. * gcc.dg/tree-ssa/pr20701.c: Likewise. * gcc.dg/tree-ssa/pr20702.c: Likewise. * gcc.dg/tree-ssa/pr21086.c: Likewise. * gcc.dg/tree-ssa/pr21090.c: Likewise. * gcc.dg/tree-ssa/pr58480.c: Likewise. * gcc.dg/tree-ssa/pta-escape-1.c: Likewise. * gcc.dg/tree-ssa/pta-escape-2.c: Likewise. * gcc.dg/tree-ssa/pta-escape-3.c: Likewise. * gcc.dg/tree-ssa/ssa-vrp-thread-1.c: Likewise. * gcc.dg/tree-ssa/unreachable.c: Likewise. * gcc.dg/tree-ssa/vrp02.c: Likewise. * gcc.dg/tree-ssa/vrp07.c: Likewise. * gcc.dg/tree-ssa/vrp08.c: Likewise. * gcc.dg/tree-ssa/vrp55.c: Likewise. * g++.dg/cpp0x/static_assert9.C: Likewise. * g++.dg/tree-ssa/nonzero-1.C: Likewise. * g++.dg/tree-ssa/pr19476-1.C: Likewise. * g++.dg/tree-ssa/pr19476-2.C: Likewise. * g++.dg/tree-ssa/pr19476-5.C: Likewise. * g++.dg/tree-ssa/pr26406.C: Likewise. --------------050006010702050807010205 Content-Type: text/x-patch; name="nullptr.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nullptr.patch" Content-length: 23225 Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 221677) +++ gcc/common.opt (working copy) @@ -1065,7 +1065,7 @@ Common Report Var(flag_delete_dead_excep Delete dead instructions that may throw exceptions fdelete-null-pointer-checks -Common Report Var(flag_delete_null_pointer_checks) Init(1) Optimization +Common Report Var(flag_delete_null_pointer_checks) Init(-1) Optimization Delete useless null pointer checks fdevirtualize-at-ltrans Index: gcc/config/nios2/elf.h =================================================================== --- gcc/config/nios2/elf.h (revision 221677) +++ gcc/config/nios2/elf.h (working copy) @@ -50,3 +50,12 @@ /* The ELF target doesn't support the Nios II Linux ABI. */ #define TARGET_LINUX_ABI 0 +/* Default -fdelete-null-pointer-checks to off, to prevent the compiler + from treating accesses to address zero as traps. On bare-metal Nios II + targets address zero may legitimately be mapped to memory (e.g., the + hardware description may specify this as the address of the interrupt + vector). Users can override this on the command line to get the + additional optimizations it enables. */ +#define SUBTARGET_OVERRIDE_OPTIONS \ + if (flag_delete_null_pointer_checks < 0) \ + flag_delete_null_pointer_checks = 0 Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 221677) +++ gcc/doc/invoke.texi (working copy) @@ -7993,10 +7993,12 @@ Enabled by @option{-Os}. @item -fdelete-null-pointer-checks @opindex fdelete-null-pointer-checks Assume that programs cannot safely dereference null pointers, and that -no code or data element resides there. This enables simple constant +no code or data element resides at address zero. +This option enables simple constant folding optimizations at all optimization levels. In addition, other optimization passes in GCC use this flag to control global dataflow analyses that eliminate useless checks for null pointers; these assume +that a memory access to address zero always results in a trap, so that if a pointer is checked after it has already been dereferenced, it cannot be null. @@ -8004,9 +8006,10 @@ Note however that in some environments t Use @option{-fno-delete-null-pointer-checks} to disable this optimization for programs that depend on that behavior. -Some targets, especially embedded ones, disable this option at all levels. -Otherwise it is enabled at all levels: @option{-O0}, @option{-O1}, -@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information +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. + +Passes that use the dataflow information are enabled independently at different optimization levels. @item -fdevirtualize @@ -8489,7 +8492,8 @@ This flag is enabled by default at @opti Detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main control flow and turn the statement with erroneous or undefined behavior into a trap. -This flag is enabled by default at @option{-O2} and higher. +This flag is enabled by default at @option{-O2} and higher and depends on +@option{-fdelete-null-pointer-checks} also being enabled. @item -fisolate-erroneous-paths-attribute @opindex fisolate-erroneous-paths-attribute Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp (revision 221677) +++ gcc/testsuite/lib/target-supports.exp (working copy) @@ -458,9 +458,11 @@ proc check_effective_target_trampolines } # Return 1 if according to target_info struct and explicit target list -# target is supposed to keep null pointer checks. This could be due to -# use of option fno-delete-null-pointer-checks or hardwired in target. - +# target disables -fdelete-null-pointer-checks. Targets should return 0 +# if they simply default to -fno-delete-null-pointer-checks but obey +# -fdelete-null-pointer-checks when passed explicitly (and tests that +# depend on this option should do that). + proc check_effective_target_keeps_null_pointer_checks { } { if [target_info exists keeps_null_pointer_checks] { return 1 Index: gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c =================================================================== --- gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c (revision 221677) +++ gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta-details" } */ +/* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta-details -fdelete-null-pointer-checks" } */ struct X { int i; Index: gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-dom2" } */ +/* { dg-options "-O2 -fdump-tree-dom2 -fdelete-null-pointer-checks" } */ extern void exit (int); extern void *ggc_alloc (__SIZE_TYPE__); @@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset exit (0); } -/* There should be no IF conditionals, unless target has fno-delete-null-pointer-checks */ +/* There should be no IF conditionals, unless target disables -fdelete-null-pointer-checks */ /* { dg-final { scan-tree-dump-times "if " 0 "dom2" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-dom2" } */ +/* { dg-options "-O2 -fdump-tree-dom2 -fdelete-null-pointer-checks" } */ extern void exit (int); extern void *ggc_alloc (__SIZE_TYPE__); @@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset exit (0); } -/* There should be no IF conditionals, unless target has fno-delete-null-pointer-checks */ +/* There should be no IF conditionals, unless target disables -fdelete-null-pointer-checks */ /* { dg-final { scan-tree-dump-times "if " 0 "dom2" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-isolate-paths" } */ +/* { dg-options "-O2 -fdump-tree-isolate-paths -fdelete-null-pointer-checks" } */ /* { dg-skip-if "" keeps_null_pointer_checks } */ Index: gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ +/* { dg-options "-O2 -fdelete-null-pointer-checks -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ /* { dg-skip-if "" keeps_null_pointer_checks } */ Index: gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-isolate-paths" } */ +/* { dg-options "-O2 -fdump-tree-isolate-paths -fdelete-null-pointer-checks" } */ /* { dg-skip-if "" keeps_null_pointer_checks } */ Index: gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ +/* { dg-options "-O2 -fdelete-null-pointer-checks -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ /* { dg-skip-if "" keeps_null_pointer_checks } */ Index: gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdelete-null-pointer-checks -fdump-tree-isolate-paths -fdump-tree-optimized" } */ /* { dg-skip-if "" keeps_null_pointer_checks } */ struct demangle_component Index: gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c (working copy) @@ -1,5 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -fdelete-null-pointer-checks" } */ + +/* { dg-skip-if "" keeps_null_pointer_checks } */ extern int a; /* { dg-error "declared weak after being used" } */ int t() Index: gcc/testsuite/gcc.dg/tree-ssa/pr20318.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr20318.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pr20318.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! keeps_null_pointer_checks } } } */ -/* { dg-options "-O2 -fdump-tree-original -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-original -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ extern int* f(int) __attribute__((returns_nonnull)); extern void eliminate (); Index: gcc/testsuite/gcc.dg/tree-ssa/pr20701.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr20701.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pr20701.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fdelete-null-pointer-checks" } */ typedef struct { int code; @@ -35,7 +35,7 @@ can_combine_p (rtx insn, rtx elt) return 0; } -/* Target with fno-delete-null-pointer-checks should not fold checks */ +/* Target disabling -fdelete-null-pointer-checks should not fold checks */ /* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/pr20702.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr20702.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pr20702.c (working copy) @@ -4,7 +4,7 @@ immediate successors of the basic block. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ extern void bar (int); @@ -25,7 +25,7 @@ foo (int *p, int b) return a; } -/* Target with fno-delete-null-pointer-checks should not fold checks */ +/* Target disabling -fdelete-null-pointer-checks should not fold checks */ /* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/pr21086.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr21086.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pr21086.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce1" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce1 -fdelete-null-pointer-checks" } */ int foo (int *p) @@ -15,7 +15,7 @@ foo (int *p) return 0; } -/* Target with fno-delete-null-pointer-checks should not fold checks */ +/* Target disabling -fdelete-null-pointer-checks should not fold checks */ /* { dg-final { scan-tree-dump "Folding predicate " "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate " 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-not "b_. =" "dce1" { target { ! avr-*-* } } } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/pr21090.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr21090.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pr21090.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ int g, h; Index: gcc/testsuite/gcc.dg/tree-ssa/pr58480.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr58480.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pr58480.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! keeps_null_pointer_checks } } } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ extern void eliminate (void); extern void* f1 (void *a, void *b) __attribute__((nonnull)); Index: gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O -fdump-tree-alias-details" } */ +/* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */ int *i; void __attribute__((noinline)) Index: gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O -fdump-tree-alias-details" } */ +/* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */ int *i; void __attribute__((noinline)) Index: gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O -fdump-tree-alias-details" } */ +/* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */ int *i; void __attribute__((noinline)) Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ +/* { dg-skip-if "" keeps_null_pointer_checks } */ void oof (void); struct basic_block_def; Index: gcc/testsuite/gcc.dg/tree-ssa/unreachable.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/unreachable.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/unreachable.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized -fdelete-null-pointer-checks" } */ static void bad_boy() { } Index: gcc/testsuite/gcc.dg/tree-ssa/vrp02.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/vrp02.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/vrp02.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ struct A { @@ -20,7 +20,7 @@ foo (struct A *p, struct A *q) if (p) return x + p->b; } -/* Target with fno-delete-null-pointer-checks should not fold check */ +/* Target disabling -fdelete-null-pointer-checks should not fold check */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/vrp07.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/vrp07.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/vrp07.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ int foo (int i, int *p) @@ -30,7 +30,7 @@ foo (int i, int *p) return i; } -/* Target with fno-delete-null-pointer-checks should not fold checks */ +/* Target disabling -fdelete-null-pointer-checks should not fold checks */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/vrp08.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/vrp08.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/vrp08.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ /* Compile with -fno-tree-fre -O2 to prevent CSEing *p. */ int @@ -18,7 +18,7 @@ foo (int a, int *p) return a; } -/* Target with fno-delete-null-pointer-checks should not fold checks */ +/* Target disabling -fdelete-null-pointer-checks should not fold checks */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ Index: gcc/testsuite/gcc.dg/tree-ssa/vrp55.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/vrp55.c (revision 221677) +++ gcc/testsuite/gcc.dg/tree-ssa/vrp55.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-blocks-vops-details" } */ +/* { dg-options "-O2 -fdump-tree-vrp1-blocks-vops-details -fdelete-null-pointer-checks" } */ void arf (void); Index: gcc/testsuite/g++.dg/cpp0x/static_assert9.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/static_assert9.C (revision 221677) +++ gcc/testsuite/g++.dg/cpp0x/static_assert9.C (working copy) @@ -1,5 +1,7 @@ // PR c++/58837 // { dg-require-effective-target c++11 } +// { dg-skip-if "" keeps_null_pointer_checks } +// { dg-options "-fdelete-null-pointer-checks" } void f(); static_assert(f, ""); Index: gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C (revision 221677) +++ gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C (working copy) @@ -1,5 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-ccp1" } */ +/* { dg-options "-O2 -fdump-tree-ccp1 -fdelete-null-pointer-checks" } */ +/* { dg-skip-if "" keeps_null_pointer_checks } */ + inline void t() { } Index: gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C (revision 221677) +++ gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -fdump-tree-ccp1" } */ +/* { dg-options "-O -fdump-tree-ccp1 -fdelete-null-pointer-checks" } */ +/* { dg-skip-if "" keeps_null_pointer_checks } */ // See pr19476-5.C for a version without including . #include Index: gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C (revision 221677) +++ gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdelete-null-pointer-checks" } */ +/* { dg-skip-if "" keeps_null_pointer_checks } */ #include Index: gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C (revision 221677) +++ gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -fdump-tree-ccp1" } */ +/* { dg-options "-O -fdump-tree-ccp1 -fdelete-null-pointer-checks" } */ +/* { dg-skip-if "" keeps_null_pointer_checks } */ // See pr19476-1.C for a version that includes . Index: gcc/testsuite/g++.dg/tree-ssa/pr26406.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/pr26406.C (revision 221677) +++ gcc/testsuite/g++.dg/tree-ssa/pr26406.C (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdelete-null-pointer-checks" } */ +/* { dg-skip-if "" keeps_null_pointer_checks } */ int *f(int *b) { --------------050006010702050807010205--