[Bug c/81568] attribute always_inline honored even after attribute noinline
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81568 --- Comment #5 from Dave Pagan --- Thanks for the update, Martin.
[Bug c/81568] attribute always_inline honored even after attribute noinline
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81568 Martin Sebor changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=81544 --- Comment #4 from Martin Sebor --- Fixed in r255469.
[Bug c/81568] attribute always_inline honored even after attribute noinline
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81568 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Known to fail||5.4.0, 6.4.0, 7.2.0 --- Comment #3 from Martin Sebor --- Thanks for the ping! I just committed a fix for pr81544 (and pr81566) that makes attribute validation more consistent. With the patch applied, the output for the test case in comment #0 is as follows. There's just one warning and no error because (as the warning says) the conflicting attribute is dropped. I think with that this bug can be resolved as fixed as well (I forgot about it and so didn't mention it in the commit). Let me go ahead and do that, but please feel free to take the freshly committed patch for a spin and open new bugs if/when you find them or if you have suggestions for further refinements or enhancements in this area. $ cat z.c && gcc -O2 -S -Wall -Wextra -Wpedantic z.c int __attribute__ ((noinline)) f (int); int __attribute__ ((always_inline)) f (int); int f (int i) { return i > 1 ? i * f (i - 1) * f (i - 2) : i > 0 ? i * f (i - 1) : 1; } int f1 (void) { return f (123); } z.c:2:1: warning: ignoring attribute ‘always_inline’ because it conflicts with attribute ‘noinline’ [-Wattributes] int __attribute__ ((always_inline)) f (int); ^~~ z.c:1:32: note: previous declaration here int __attribute__ ((noinline)) f (int); ^
[Bug c/81568] attribute always_inline honored even after attribute noinline
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81568 Dave Pagan changed: What|Removed |Added CC||dave.pagan at oracle dot com --- Comment #2 from Dave Pagan --- Martin, have you (or has anyone else) spent time on this, or have a fix already? I was thinking about looking into it further but don't want to duplicate effort.
[Bug c/81568] attribute always_inline honored even after attribute noinline
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81568 Martin Sebor changed: What|Removed |Added Keywords||diagnostic, wrong-code Severity|normal |minor --- Comment #1 from Martin Sebor --- The cause of the problem is in the validation for these two attributes being done in two places: one in handle_always_inline_attribute and handle_noinline_attribute in c-attribs.c, and another in diagnose_mismatched_attributes. The former rejects the attribute if it's found to conflict with the other on the same declaration, but it doesn't detect conflicts across declarations. The latter does detect those conflicts but it doesn't reject them. As a result, the same problem gets handled differently in the two situations.