| 1 |
/* PR ipa/93087 */ |
| 2 |
/* { dg-do compile { target nonpic } } */ |
| 3 |
/* { dg-options "-O1 -Wsuggest-attribute=cold" } */ |
| 4 |
|
| 5 |
extern void *getdata (void); |
| 6 |
extern int set_error (char const *message) __attribute__((cold)); |
| 7 |
|
| 8 |
__attribute__((cold)) int |
| 9 |
set_nomem (void) /* { dg-bogus "function might be candidate for attribute 'cold'" } */ |
| 10 |
{ |
| 11 |
return set_error ("Allocation failed"); |
| 12 |
} |
| 13 |
|
| 14 |
void * |
| 15 |
getdata_or_set_error (void) |
| 16 |
{ |
| 17 |
void *result; |
| 18 |
result = getdata (); |
| 19 |
if (!result) |
| 20 |
set_nomem (); |
| 21 |
return result; |
| 22 |
} |