diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2015-05-04 15:55:06 -0400 |
---|---|---|
committer | Sandra Loosemore <sandra@gcc.gnu.org> | 2015-05-04 15:55:06 -0400 |
commit | 467d8d51f1304b955136060db0a34e1f80f098bb (patch) | |
tree | 9669d1ea198b31f17f6a7dc062d04c07446517f7 | |
parent | 100c8e9e9d896bbfd6d92b8ac7ab506d0090829b (diff) | |
download | gcc-467d8d51f1304b955136060db0a34e1f80f098bb.zip gcc-467d8d51f1304b955136060db0a34e1f80f098bb.tar.gz gcc-467d8d51f1304b955136060db0a34e1f80f098bb.tar.bz2 |
common.opt (fdelete-null-pointer-checks): Init to -1.
2015-05-04 Sandra Loosemore <sandra@codesourcery.com>
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.
From-SVN: r222777
36 files changed, 120 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4837a91..116a6d6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-05-04 Sandra Loosemore <sandra@codesourcery.com> + + * 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. + 2015-05-04 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/65984 diff --git a/gcc/common.opt b/gcc/common.opt index 380848c..51833c1 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1070,7 +1070,7 @@ Common Report Var(flag_delete_dead_exceptions) Init(0) Optimization 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 diff --git a/gcc/config/nios2/elf.h b/gcc/config/nios2/elf.h index 243596a..84b44d4 100644 --- a/gcc/config/nios2/elf.h +++ b/gcc/config/nios2/elf.h @@ -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 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 7d2f6e5..972d355 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -8014,10 +8014,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. @@ -8025,9 +8027,10 @@ Note however that in some environments this assumption is not true. 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 @@ -8510,7 +8513,8 @@ This flag is enabled by default at @option{-O2} and @option{-Os}. 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9525115..3673938 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,41 @@ +2015-05-04 Sandra Loosemore <sandra@codesourcery.com> + + * 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. + 2015-05-04 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/65984 diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert9.C b/gcc/testsuite/g++.dg/cpp0x/static_assert9.C index fccaa44..46d7f25 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert9.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert9.C @@ -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, ""); diff --git a/gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C b/gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C index 60da49d..7b422db 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C @@ -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() { } diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C b/gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C index cbdad90..8379751 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C @@ -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 <new>. #include <new> diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C b/gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C index 70002db..e72a8fb 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C @@ -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 <new> diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C b/gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C index bec0bb5..921d730 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C @@ -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 <new>. diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr26406.C b/gcc/testsuite/g++.dg/tree-ssa/pr26406.C index c2d1605..d70e804 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr26406.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr26406.C @@ -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) { diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c index b62b08f..091a375 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c index bb474ff..9f8f274 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c @@ -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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c b/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c index 1768d45..0be596e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c @@ -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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c index 3ed98aeb..be67e4e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c index 912d98e..a7e7514 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c index 8dd2f2b..0fe7e62 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c index d50a2b2..0da4134 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c index 131d319..2978413 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c @@ -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 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c b/gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c index e94ad5f..18ccc60 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c @@ -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() diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c index 1b302ae..f36184b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c @@ -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 (); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c index 3ddf48e..c49ff7a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c index ce62fa3..8313f1a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c index f924d26..6f96f40 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c @@ -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-*-* } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c index 40d960d..30abc20 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c b/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c index a42edf9..90e4cc0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c @@ -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)); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c index dcfae5d..f02d32a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c @@ -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)) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c index e613959..b97e515 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c @@ -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)) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c index 870dcf6..280b4b2 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c @@ -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)) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c index a4fdf89..4f4d967 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/unreachable.c b/gcc/testsuite/gcc.dg/tree-ssa/unreachable.c index c4caeaf..11ff47b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/unreachable.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/unreachable.c @@ -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() { } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c index 4373d52..994c1db 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c index ba813f2..a59a3e8 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c @@ -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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c index b7111db..9aff505 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c @@ -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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c index 7d1825f..d4014ab 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c @@ -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); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index c5d0ffe..d68b48b 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -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 |