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

    <tr>
        <th>Summary</th>
        <td>
            [libc] Unsequenced access to volatile var in file __support/math/log1p.h
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

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

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

<pre>
    When trying to improved -Wunsequenced by taking into account the volatile qualifier in PR
https://github.com/llvm/llvm-project/pull/180955 some tests failed.
The checker triggered in file libc/src/__support/math/log1p.h: 
```c++
volatile float tp = 1.0f;
volatile float tn = -1.0f;
bool rdp = (tp - 0x1p-25f != tp);
bool rdn = (tn - 0x1p-24f != tn)
```
For C and C++ standards order of evaluate binary operator !=  is unsequence and unsequence access for same volatile variable is UB(because read volatile qualified variable is side-effects).

https://github.com/llvm/llvm-project/blame/main/libc/src/__support/math/log1p.h#L947
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycU8FunDAQ_RpzGe3KmGWBA4dNIk49VG2jHKMBD-DG2MQ2q-7fV2aT3Y3aSm0lCwTzZvyenx96rwZDVLP8juUPCS5htK7-Sg7nUU0haa081U8jGQjupMwAwYKaZmePJGHztBhPrwuZjiS0Jwj4EjHKBAvYdXYxAcJIcLQag9IErwtq1StyoAx8_sL4YQxh9iw7MNEw0QwqjEu77ezERKP18f21mZ39Tl1gopkXrZlo0pJXeQ7eTgSBfPDQo9Ikt4wfvo0E3UjdCzkITg0DOZJxxz5y0KrtmGi8i8_nZ7_Ms3Vx8oRhjPvZIZ23I8sOwPiB7fl5dUzcxcUPFzW9thggzMCyB0i3vGfZ7-pmrW-ugNZaDU6e-5gowwwb4D_SeSPyHphI4_8wM1F9wJsL3lzwuyveRPwNYcYPjXVwD2gk3J_Zgw9oJDrpwTpJDmwPdES9YCBolUF3AjuTw2Dd-2BQHq4-r9NuP7uOvIfeOvA43Vh9RKew1RTbH--YKFvqcPEEjlD-eiPkhwavJG2o76kLnokqmvo_d6XVONHqrDKx-pfOi-xTtSsSWWeyyipMqE6LssiyIit3yVhjL4tClinud2WeYtUJUcq-LUW_51gJkahacLHnpUjTMtuL3baK4D7lec55xouC7ThNqPQ28t1aNyTK-4VqkRZVVSYaW9J-zaQQZ9IiptPVq752GTzbca188NcJQQW95nhtyB_g8Sabby4F-8GfSyT-fBbJ4nT9z-e-qvFMNG-CjrX4GQAA__8-vWtz">