gcc will simply remove functions if they're declared inline without optimizations. testinline.c: inline int testinline() { return 1; }
int main(int argc, char *argv[]) { return testinline(); } [EMAIL PROTECTED] src]$ gcc -std=gnu99 testinline.c; echo $? /home/peroyvind/tmp/ccKURkmv.o: In function `main': testinline.c:(.text+0x15): undefined reference to `testinline' collect2: ld returned 1 exit status 1 [EMAIL PROTECTED] src]$ Ouchy! test() is simply removed, making main() call a non-existing function.. [EMAIL PROTECTED] src]$ gcc -std=gnu99 -finline testinline.c; echo $? 0 [EMAIL PROTECTED] src]$ Works swell, function gets inlined. [EMAIL PROTECTED] src]$ gcc -std=gnu99 -fgnu89-inline testinline.c; echo $? 0 [EMAIL PROTECTED] src]$ Same behaviour as when using gnu89, function doesn't get inlined, nor does it get removed.. With -fgnu89-inline giving the expected behaviour, I feel a bit confused whether this is actually a bug or intended? I lack insight, but I sure hope using inline functions without gcc optimizations resulting in breakage isn't intended. -- Summary: inline functions are lost when defining c99/gnu99 without inline optimizations Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peroyvind at mandriva dot org GCC build triplet: x86_64-manbo-linux-gnu GCC host triplet: x86_64-manbo-linux-gnu GCC target triplet: x86_64-manbo-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37917