在 2024-11-08 21:04, Martin Storsjö 写道:
Can you elaborate about the reasoning here? Isn't volatile primarily needed if the assembly has some side effect that otherwise can't be modelled - e.g. if the outputs of the inline assembly isn't needed, we still can't skip the whole assembly.I don't quite see why that's specifically needed for thread local memory - but I have nothing against adding volatile here either. I'm just curious about the reasoning.
The TEB memory is not passed to the asm statement in any form, so it's necessary to notify the compiler about this effect.
However I just checked that `volatile` is not enough; it's better to clobber "memory" explicitly: https://gcc.godbolt.org/z/j9a4nKzb5 GCC thinks the handler (second element in `seh_node`) is unused and optimizes it out, so it's not correct.
I will propose an updated patch later. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public