This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/46596] misbehavior when mixing always_inline and alias attributes in the same compilation unit
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 Nov 2010 11:09:02 +0000
- Subject: [Bug c/46596] misbehavior when mixing always_inline and alias attributes in the same compilation unit
- Auto-submitted: auto-generated
- References: <bug-46596-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46596
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2010.11.22 11:08:59
CC| |hubicka at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-22 11:08:59 UTC ---
Confirmed. That -Winline changes behavior is definitely a bug.
I'm not so sure about the rest, what probably happens is that the
later extern declaration overrides the former (but inherits the
always-inline attribute), removing the body.
What you seem to want is always inline foo(), but still have an
out-of-line copy that dispatches to __foo. That seems - backward, no?
Complete testcase:
extern void __in(int i);
extern inline __attribute__((always_inline,gnu_inline))
void foo(int i) { __in(i); }
void bar(int i) { foo(i + 1234); }
void __foo(int i) { }
extern void foo(int i) __attribute__((alias("__foo")));
> ./cc1 -quiet /tmp/t.c -O -Winline
/tmp/t.c: In function 'bar':
/tmp/t.c:6:13: sorry, unimplemented: inlining failed in call to 'foo': function
body not available
/tmp/t.c:4:22: sorry, unimplemented: called from here
expected: bar calls __in (i + 1234).