Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

__TBB_CPP11_STD_FORWARD_BROKEN

Petros_Mamales
Beginner
738 Views

Hi all,

In the newest distribution of tbb, in the config file one sees the macro

__TBB_CPP11_STD_FORWARD_BROKEN.

In my setup ( intel c++ 12.1 compiler for 64 bit windows, plugged to msvc2010 ) this seems to resolve to true.

As I have written a couple of functions using std::forward and they seemed to work fine, I suspect that this must refer to certain

pitfalls (?) of the feature( o/wise, I would expect a macro saying something like ...HAVE_STD_FORWARD ).

Of course there is a chance that the config file has a problem, but leaving this aside for the moment, what is the situation with std::forward ?

Is it indeed broken? If yes, is there some documentation as to how ? Should it be avoided ? Does it affect the stl when using the C++0x flag ?

Has it been fixed at a later distribution?

Thank you in advance for your help,

Petros

0 Kudos
18 Replies
SergeyKostrov
Valued Contributor II
738 Views
I just checked software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler article and I don't see anything related to std::forward. For all the rest questions: Do you use that feature and if Yes do you have any compilation problems? I have version 12.1 and if you post a small test case I'll be able to verify. Thanks.
0 Kudos
Petros_Mamales
Beginner
738 Views

Sergey,

std::forward is not referred there as a feature to be supported or not. Its basis (rvalue reference) is supported.

There should be no need for an example to inform me in what way intel considers it "broken". As I said, I have used it and noticed nothing broken.

But you know how template coding is. Maybe somewhere else the problem would surface.

The reason I am asking is that as a result I cannot use the argument forwarding constructors.

Thank you for your help,

Petros

0 Kudos
SergeyKostrov
Valued Contributor II
738 Views
>>In the newest distribution of tbb, in the config file one sees the macro >> >>__TBB_CPP11_STD_FORWARD_BROKEN There are several latest versions of TBB and could you be more specific? Thanks.
0 Kudos
Petros_Mamales
Beginner
738 Views

Hi Sergey,

Referring to the one (for windows) at page:

June 24, 2013: Intel® TBB 4.1 update 4 released

off the main page i.e.

http://threadingbuildingblocks.org/download

Thank you for your help,

Petros

0 Kudos
SergeyKostrov
Valued Contributor II
738 Views
Here is a consolidated set of pieces of codes where that macro is used: ... #if ( __INTEL_COMPILER ) || ( __clang__ && __TBB_GCC_VERSION <= 40300 ) #define __TBB_CPP11_STD_FORWARD_BROKEN 1 #else #define __TBB_CPP11_STD_FORWARD_BROKEN 0 #endif ... ... #if __TBB_CPP11_RVALUE_REF_PRESENT && !__TBB_CPP11_STD_FORWARD_BROKEN #include "utility" // std::forward #endif ... ... #if __TBB_CPP11_STD_FORWARD_BROKEN { ::new((void *)p) U((args)...); } #else { ::new((void *)p) U(std::forward(args)...); } #endif ... As you can see when any version of Intel C++ compiler is used macro __TBB_CPP11_STD_FORWARD_BROKEN is set to 1 and it means that simplified versions ( without C++11 features ) of some codes are used. There are the same restrictions for CLANG C++ compiler and TBB version 4 update 3.
0 Kudos
Petros_Mamales
Beginner
738 Views

Sergey,

Thank you for the summary. However if you go into the <utility> file  of msvc2010 you will see that forward exists (LN 77 is the definition following the #if _HAS_CPP0X at line 22).

Why does intel say that forward is broken when rvalue reference is supported ( and I know because I have used it ) ?

Is there a problem with the compiler ? If yes, is it documented and where ?

Thank you for your help,

Petros

0 Kudos
Petros_Mamales
Beginner
738 Views

Update: I will also take this to the tbb forum, since apparently other things seem problematic  as well.However from the compiler forum I would like a definite answer to my last question.

Thank you, Petros

0 Kudos
SergeyKostrov
Valued Contributor II
738 Views
Hi Petros, Please check these two web-links: . http://software.intel.com/en-us/articles/intel-parallel-studio-xe-2013-release-notes and http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler If you did not find answer on your question please inform Intel software engineers. Also, it is a right decision to ask for clarification on TBB forum. Thanks.
0 Kudos
Vladimir_P_1234567890
738 Views

hello Petros,

I've checked TBB unit tests and they works with std::forward now and we do not expect any pitfalls there at least for tbb code.

Intel TBB team will re-evaluate this particular condition.
--Vladimir 

0 Kudos
Petros_Mamales
Beginner
738 Views

Hi Vladimir,

Thank you for your response.

I am still not sure if the forward is broken at the compiler level in any way.

Petros

0 Kudos
Petros_Mamales
Beginner
738 Views

Vladimir,

to be clear: the current tbb_config file will not allow for std::forard on msvc10's stl and with icl 12.1.

So when you say that the tests were passed you either mean

a) on an internal (bleading edge) version of tbb

or

b) on linux (gcc?) system.

Which one do you mean ?

Thank you for your help and apologies if being pedantic,

Petros

0 Kudos
Vladimir_P_1234567890
738 Views

I've unconditionaly set __TBB_CPP11_STD_FORWARD_BROKEN to 0  in tbb_config file and run tests on the latest TBB open source release. I've used the update 4 of Composer XE 2013 and the latest update on visual studio 2012 (update 1, I believe).

And as I wrote before we need to check on several versions of compilers across windows, linux and OS X to set right condition there (if it still needed). It will take time.

--Vladimir

0 Kudos
Petros_Mamales
Beginner
738 Views

Vladimir,

I understand. Thank you very much!

Petros

ps: there will also need to change the variadic templates clauses. Btw the __VARIADIC_TEMPLATES macro, wht is it ? Is it icl internal ? is it gcc-specific? Thank you again!

0 Kudos
Petros_Mamales
Beginner
738 Views

Vladimir,

I understand. Thank you very much!

Petros

ps: there will also need to change the variadic templates clauses. Btw the __VARIADIC_TEMPLATES macro, wht is it ? Is it icl internal ? is it gcc-specific? Thank you again!

0 Kudos
SergeyKostrov
Valued Contributor II
738 Views
>>... __VARIADIC_TEMPLATES macro... Petros, Please download Developer's Edition of TBB ( with complete sources ) and search sources for that expression. You will be able to see how that macro is used.
0 Kudos
Petros_Mamales
Beginner
738 Views

Vladimir,

THank you,

Petros

0 Kudos
Petros_Mamales
Beginner
738 Views

Vladimir,

I did check the source code and am still in darkness as to where the __VARIADIC_TEMPLATES macro is defined.How it is used I can tell.

0 Kudos
Petros_Mamales
Beginner
738 Views

One would expect that if the variadic templates and the rvalue references are supported the line :

        { ::new((void *)p) U(std::forward<Args>(args)...); }
( from the tbb scalable_allocator ) would not give the error :

1>C:\_petros\_otc\src\otc\libBuffer\allocators.h(72): error : expected a ")"
1>                { ::new((void *)p) U(std::forward<Args>(args)...); }
1>                                                             ^

What is happening ?

(icl 12.1, sin7 64bit, msvc2010, C++0x flag on!)

0 Kudos
Reply