- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi, i'm trying to build a project (https://github.com/riclas/rstm/) with ICC but i get the following error:
libstm/txthread.cpp(138): error: declaration is incompatible with "__attribute((regparm(3))) bool (*volatile stm::TxThread::tmbegin)(stm::TxThread *)" (declared at line 152 of "include/stm/txthread.hpp")
__attribute__((regparm(3))) bool (*volatile TxThread::tmbegin)(TxThread*) = begin_CGL;
txthread.cpp(138): bool TM_FASTCALL (*volatile TxThread::tmbegin)(TxThread*) = begin_CGL;
txthread.hpp(152): static TM_FASTCALL bool(*volatile tmbegin)(TxThread*);
TM_FASTCALL is a macro that expands into: __attribute__((regparm(3)))
This works fine in GCC. It also works if i don't define TM_FASTCALL, but then there are other problems, and i'm not sure if this is the root cause or not.
Thanks for any tips, cheers.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ricardo,
Can you please preprocess txthread.hpp for both gcc and icc and see what the macro TM_FASTCALL is being substituted with?
Regards,
Noga
Intel Developer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This does looks like a bug.
Here is a small reproducer:
// gives error with icpc but not g++
#define TM_FASTCALL __attribute__((regparm(3)))
struct TxThread {
static TM_FASTCALL void(*tmbegin)();
};
void TM_FASTCALL (*TxThread::tmbegin)();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you judith, i was trying to get the preprocessed headers, but compilers is not my strong suit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To preprocess on Linux you just need to add the -P option to your command line and the compiler will produce a file with the same name as the source file but it will have extension .i. Then just attach the .i file to a note so we can see it.
Anyway, I entered this defect in our bug tracking database as DPD200381744.
As a workaround you should be able to declare it this way -- note the change in position in the definition.
#define TM_FASTCALL __attribute__((regparm(3)))
struct TxThread {
static TM_FASTCALL void (*tmbegin)();
};
void (TM_FASTCALL *TxThread::tmbegin)();
I think this is the recommended syntax in the GNU documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
your workaround does work, thanks. the positioning of the macro was inconsistent across the project, in some places it was already correct. glad to expose a bug though.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page