The __tm_abort instruction doesn't seem to work properly to roll back the transaction under Linux. A case is as follows(almost the same as in the previous post).
No matter if I mark foo as tm_callable or not, the output is 4. (Actually it doesn't matter if there is a foo. An "a++" will also cause the output to be 1 forever). And if I put on "if(b==0)", the compilation will simply abort because of "(0): internal error: backend signals".
The Windows version works cool here (I mean it does roll back the transaction and produce NO internal error).
Btw, I'm using gcc4.2.3 here so I added an intel_compatibility.h to get everything compiled. It basicly redefines __sync_fetch_and_add as _InterlockedExchangeAdd.
#include "intel_compatibility.h"
#include <iostream>
using namespace std;
__attribute__((tm_callable))
int foo(int a){
return a+3;
}
int main(){
int a=0;
int b=0;
__tm_atomic{
a++;
a=foo(a);
// if(b==0)
__tm_abort;
}
cout<<"new a "<<a<<endl;
}