<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/127683>127683</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `volatile` writes are merged for volatile base class subobjects
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Eisenwave
      </td>
    </tr>
</table>

<pre>
    ```cpp
struct Base {
    int c;
};

struct Obj : Base { };

volatile Obj o;

void awoo() {
    o.c = 1;
    o.c = 2;
    o.c = 3;
}
```
## Expected output (GCC)

```asm
awoo():
 mov     DWORD PTR o[rip], 1
        mov     DWORD PTR o[rip], 2
 mov     DWORD PTR o[rip], 3
        ret
```

## Actual output (Clang)

```asm
awoo():
        mov     dword ptr [rip + o], 3
 ret
```

Note: `o.c` is a [volatile object](https://eel.is/c++draft/basic.type.qualifier#def:object,volatile), so why are its writes getting coalesced? This doesn't happen when `Base` is a data member of `Obj`, so this is almost certainly unintentional.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVE2vozYU_TWXzdUg5zohZMEiH5Pu-qrRSF0bcwE_GUxtk_T9-8pJhqTTSvMQEsY-PvccH9sqBNONzBVsDrA5ZWqOvfPVVxN4vKoLZ7VrPiooxP3V0wRiH6KfdcSDCoywPYDYIyKaMaIGmX5he3o0FvBb_Y4g98skfMVcnFXRWL6h3Eu3aVBdnQMqgXYvtVyuEeQJV3fsaxf9t0s-VYn94iW1SQJJ_Pr3xDpyg26O0xwRqPzteATa3WUsM1QYQOyfgkCmYRzcJVXD059v3074x_dv6GBz8GaCzQnoiKuHnPT8CkufIZQvhJ7jz6YWX3sdZ2VfXB2tGrtP-_pJcnN1vsEperyLQaBDEvaU9L9afneRU_BQCJdrKASagCpxLKm7-p11vDGVfYxTSALoDHRmtrkJQGcNdAA6NF61Eehcq2B0Hj8mzv-alTWtYQ8kG25B7h90dPxRIFmiIwaH1_4DlWc0MeDVm8gBO47RjB1qpywHzQ3IM37vTcDGcRiBthF7NU084rXnMflIe3gx0qiocOChZo-uTcNv9Xtyf68YE1MC2sGFiJp9VGa0HziPZow8RuNGZfOsqWSzkzuVcbXayt1OrNfrIuurjS65lVTuilqvNopl03Ip2u22LnaFEmVmKhK0EbQqV-V6S0Wu1kIWmkvSghrFAtaCB2Vsbu1lyJ3vMhPCzNWKtkUpM6tqtuF2_olGvuJtFIjSdeCrNOlLPXcB1sKaEMOTJppoOd0NyzoX4seqpkUe2HfcYOs8LlHX6fhrq0LAMNf3pEI2e1v9O_jOxH6uc-0GoHOq-Ph8mby7p3u-6Ux742HkUtE_AQAA__8CGGWC">