Are legacy functions all the functions that are not marked with any annotations?
Yes.
When I compile this program in Windows, it causes error like:
User abort function is called inside an irrevocable transaction
So it seems it applies the rules on page7 of the manual and treats foo as legacy function.
Correct, the execution has been serialized to allow the irrevocable execution of foo, and you cannot therefore abort after that.
However, if I compile this program in Linux, no error occurs. And it makes me think the compiler applies the rules in Table3 of the manual and performes a serialzed execution?
I think you are seeing the same bug here that you reported in your other post.
btw, is there any way I can know whether a transaction is under serialized execution?
We do not currently provide a function to let you discover the execution mode. As a general principle it seems wrong to have behavior which depends on the execution mode.
Jim Cownie
(Intel Performance, Analysis and Threading Lab)