title: What are cases where the MSVC c++ compiler option /volatile:ms and /volatile:iso show differences in the output assembler?
body: <p>The following msvc command line option suggests that memory fences are introduced using the option <code>/volatile:ms</code> (default) but not when using <code>/volatile:iso</code>. I have not been able to come up with any example code that does this.</p>
  <p>For example one of my random attempts</p>
  <p><a href="https://godbolt.org/z/qrz18j3h9" rel="nofollow noreferrer">https://godbolt.org/z/qrz18j3h9</a></p>
  <pre><code>volatile int A, B;
  
  
  void foo()
  {
      A = B+1;
      B = A+1;
  }
  
  </code></pre>
  <p>generates the following asm</p>
  <pre><code>int volatile A DD        01H DUP (?)                   ; A
  int volatile B DD        01H DUP (?)                   ; B
  voltbl  SEGMENT
  _volmd  DB  00H
          DB      08H
          DB      0eH
          DB      016H
  voltbl  ENDS
  
  void foo(void) PROC                                        ; foo, COMDAT
          mov     eax, DWORD PTR int volatile B                    ; B
          inc     eax
          mov     DWORD PTR int volatile A, eax                    ; A
          mov     eax, DWORD PTR int volatile A                    ; A
          inc     eax
          mov     DWORD PTR int volatile B, eax                    ; B
          ret     0
  void foo(void) ENDP  
  </code></pre>
  <p>irrespective of whether I use option <code>/volatile:ms</code> or <code>/volatile:iso</code> with Visual Studio 2019.</p>
  <p>Can somebody provide an example where the above two options do make a difference to the output assembly code?</p>