Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

TBB 3.0 Compiler Error

AJ13
New Contributor I
375 Views
I get the following error when I compile a TBB program with -fPIC:

/usr/include/tbb/machine/linux_ia32.h(92): error: register "sp" has a fixed purpose and may not be clobbered in an asm statement

0 Kudos
3 Replies
Alexey-Kukanov
Employee
375 Views
The code in question has not changed since TBB 2.0 or so. What version of (presumably) GCC doyou use?

Anyway, it seems that declaring esp as clobbered is overcautious (or even wrong); as far as I remember, it was done since the assembly code pushes to and pops from stack; but since net change is zero, everything should be fine without that. So try removing "esp" from the clobbered list of the inlined assembly code.
0 Kudos
Alexey-Kukanov
Employee
375 Views
I have looked over the history of changes for this part of code, and I must say it was carefully crafted to satisfy a whole lot of different versions of Intel Compiler and GCC, on Linux and Mac OS X. That includes the "esp" in clobbered list which was not there originally but added later for a reason. So knowing the exact version of the compileris very important to reproduce the behavior, and understand what could/shouldbe changed, and in what way.
0 Kudos
AJ13
New Contributor I
375 Views
The compiler was nvcc from CUDA SDK 3.0. I was playing around with CUDA + TBB... and got this error from nvidia's compiler. I'm not going to use CUDA anymore anyways, so I don't care too much about this problem anymore.

For people who may have stumbled upon this thread, I got around this problem by cleanly separating the TBB-calling code behind an interface that nvcc would never see, and then doing separate compilation with gcc... using nvcc only for one file.
0 Kudos
Reply