Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inlining failed: function body can be overwritten at link time

Tags:

c++

g++

I upgraded today from Ubuntu 12.04 which I think had g++-4.6 to Ubuntu 12.10 with g++-4.7.2. In my code I had a few functions marked as __attribute__((always_inline)). The reason for this was simply that profiling showed me that it increased the performance of the code significantly. It worked fine with g++ 4.6 but now with g++ 4.7 I get the error message:

error: inlining failed in call to always_inline 'void func_name(args)': function body can be overwritten at link time

I can't share my actual code, I've tried to narrow it down but when I change too much the error goes away, so that's not helpful. I'm interested in the root cause of this error message.

like image 620
Yexo Avatar asked Nov 20 '12 11:11

Yexo


1 Answers

It wasn't my intention to answer this myself, but I accidentally found the answer a few minutes after I had posted.

The reason for this (cryptic) error message was that the function was not marked as inline, only __attribute((always_inline)).

like image 169
Yexo Avatar answered Sep 29 '22 11:09

Yexo