Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

icpc ignores attribute noinline

slyleo
Beginner
215 Views
Hi All,
The attached code compiled with inlining fails to link. Compile as:
[shell]$ icpc --version
icpc (ICC) 11.0 20090318
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

$ icpc -O2 main.cpp foo.cpp
/tmp/icpcGLJKre.o: In function `main':
main.cpp:(.text+0x2e): undefined reference to `foo::mem()'
[/shell]
From the documentation it seems icpc supports __attribute__((noinline)), hence no compiler complaints, but the effect is nil. If __attribute__ is not the way, then what is the preferred way to selectively disable inlining (i.e. we don't want to be using -fno-inline)?

(note: granted, using such non-included non-exported template defs is not a common use case but nevertheless the need happens)
0 Kudos
4 Replies
Judith_W_Intel
Employee
215 Views

The problem appears to be that the Intel compiler is ignoring the attribute if it is only on the definition.
If youput the attribute on the declaration then the example links as expected,i.e.:

template
class foo
{
public:

__attribute__((noinline)) void mem();
};

Judy

Om_S_Intel
Employee
215 Views

If we compile the test case with g++ it compiles without any issue.
Om_S_Intel
Employee
215 Views
The issue has been fixed by Intel compiler development team. I will update the thread when the compiler is available for download.
Om_S_Intel
Employee
215 Views
The issue is fixed in latest Intel C++ Composer XE 12.1. The compiler is availble for dowload from INtel download and registration center.

Om
Reply