[Bug ipa/105685] New: Still Bogus `-Wsuggest-attribute=cold` on function already marked as `__attribute__((cold))`
sagebar at web dot de
gcc-bugzilla@gcc.gnu.org
Sat May 21 11:17:32 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105685
Bug ID: 105685
Summary: Still Bogus `-Wsuggest-attribute=cold` on function
already marked as `__attribute__((cold))`
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: sagebar at web dot de
CC: marxin at gcc dot gnu.org
Target Milestone: ---
I would re-open https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93087, but I don't
think I can so a new bug report it is... - Anyways: while my test-case from
back then remains fixed, the same problem still happens for the following code:
Run (`gcc -c -O2 -Wsuggest-attribute=cold infile.c`)
```
extern void external_fun(char *, char const *, int);
__attribute__((cold)) char *my_cold_fun(int x) {
static char b[42];
external_fun(b, "Without me, the warning disappears?", x);
return b;
}
__attribute__((cold)) char *my_other_cold_fun(int x) {
return my_cold_fun(x);
}
```
======== Output ========
>infile.c: In function 'my_other_cold_fun':
>infile.c:9:29: warning: function might be candidate for attribute 'cold' [-Wsuggest-attribute=cold]
> 9 | __attribute__((cold)) char *my_other_cold_fun(int x) {
> | ^~~~~~~~~~~~~~~~~
======== Output (Expected) ========
><no warning because 'my_other_cold_fun' already is cold>
More information about the Gcc-bugs
mailing list