Is function call a memory barrier?

后端 未结 5 1990
情深已故
情深已故 2020-12-24 13:52

Consider this C code:

extern volatile int hardware_reg;

void f(const void *src, size_t len)
{
    void *dst = ;

    hardware_reg = 1;    
         


        
5条回答
  •  既然无缘
    2020-12-24 14:35

    As far as I can see your reasoning leading to

    the compiler would see no trouble in moving the memcpy call

    is correct. Your question is not answered by the language definition, and can only be addressed with reference to specific compilers.

    Sorry to not have any more-useful information.

提交回复
热议问题