gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-optimized -fdelete-null-pointer-checks -fno-allocation-dce" } */ |
| 3 | /* { dg-skip-if "" keeps_null_pointer_checks } */ |
| 4 | |
| 5 | #include <new> |
| 6 | |
| 7 | int f(){ |
| 8 | int *p = new(std::nothrow) int; |
| 9 | return 33 + (0 == p); |
| 10 | } |
| 11 | int g(){ |
| 12 | int *p = new int[50]; |
| 13 | return 42 + (0 == p); |
| 14 | } |
| 15 | |
| 16 | /* { dg-final { scan-tree-dump "return 42" "optimized" } } */ |
| 17 | /* { dg-final { scan-tree-dump-not "return 33" "optimized" } } */ |