| 1 |
#include "../../gcc.dg/analyzer/analyzer-decls.h" |
| 2 |
|
| 3 |
void *test_1 (void) |
| 4 |
{ |
| 5 |
int *p = (int *)__builtin_malloc (sizeof (int)); |
| 6 |
if (__builtin_expect (p != NULL, 1)) |
| 7 |
{ |
| 8 |
*p = 42; |
| 9 |
return p; |
| 10 |
} |
| 11 |
return NULL; |
| 12 |
} |
| 13 |
|
| 14 |
void *test_2 (void) |
| 15 |
{ |
| 16 |
int *p = (int *)__builtin_malloc (sizeof (int)); |
| 17 |
if (__builtin_expect (p == NULL, 1)) |
| 18 |
return NULL; |
| 19 |
|
| 20 |
*p = 42; |
| 21 |
return p; |
| 22 |
} |
| 23 |
|
| 24 |
void *test_3 (void) |
| 25 |
{ |
| 26 |
int *p = (int *)__builtin_malloc (sizeof (int)); |
| 27 |
if (__builtin_expect_with_probability (p == NULL, 1, 0.5f)) |
| 28 |
return NULL; |
| 29 |
|
| 30 |
*p = 42; |
| 31 |
return p; |
| 32 |
} |