Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/c-c++-common/cold-1.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
rev | line source |
---|---|
145 | 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 } |