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

    <tr>
        <th>Summary</th>
        <td>
            `-Wshift-sign-overflow` should be included in `-Wall`/`-Wextra`/`-Wpedantic`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    The expression `1 << 31` is UB (at least on platforms where `int` is 32 bits wide) and will trigger UBSan, but it is not warned by any of the "usual" warning groups (`-Wall`, `-Wextra` or `-Wpedantic`). 

https://godbolt.org/z/s68eh6Yfn

```c
#include <stdio.h>

int main(void) {
    printf("%d": 1 << 31);
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcUsFu2zoQ_JrVZWFDWtqydNDBTp4u79gGRY-UuJK2pUmDpOykX1_QcdGkgABihBlydmZ1jDI75g72J9g_F3pNiw_d_2fWP8UVgzdv3deFkV8vgWMU7xDqskJQT6CeUFVQlygRX04I1OiElnVM6B1erE6TD-eIt4UDZ5m49KArwkFSxJsYBmpRO4M3sRZTkHnmgC-nL9oBPeGwJpSUNc4nvOng2ODwhtq9oZ8wLYxAtMZVWyC6E8TNOAe_XmL2BHW5-aathbrM990hv6agsxUf3n9c2GiXZLyT2i1CeYTyuKR0iaCOQD1QP3szeJu2PsxA_S-gPtYNL_X3yb3Ts_j-jRmQEjfa1XDOKiYjfruA-u-dKi7hWYsDaq5eTI4ADicoj4iIlyAuTdk6EdDe5EMd8WPo1ILKdDg8f3y4MJ0yrWp1wV11UNSWbXloiqWbuDUDNzzshnrcV82O6kbrQREbNm3ZFtJRSbuqorZq1WHfbNvdeKjajKaSqmqEXclnLXZr7fWcMygkxpW7qmoqOhRWD2zjfYuIRqvdDOpoRM_OxyRjzDPsn4vQZflmWOcIu9JKTPHvhUmS5e7eR1xkSpu8mht_5TBZf8t1xcWv1uDA-MjWoDj81HD_qeA_-EO_xRps90-zkpZ12I7-DNRnO49jcwn-B48JqL8PG4H6x7zXjn4HAAD__89X-Ck">