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

    <tr>
        <th>Summary</th>
        <td>
            Clang misses left shift count warning found by gcc
        </td>
    </tr>

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

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

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

<pre>
    Clang misses a shift count warning found by gcc.

cat shift.c
#include <stdio.h>
typedef enum shiftof {
 OFA_FM_POL_ERROR = (1<<32)
} shiftof_t;

int main()
{
 printf ("%u %lu %lu\n", OFA_FM_POL_ERROR, sizeof(OFA_FM_POL_ERROR), sizeof(shiftof_t));
}

./bin/clang -Wall shift.c
(no warning)
gcc -Wall shift.c
shift.c:3:26: warning: left shift count >= width of type [-Wshift-count-overflow]
     OFA_FM_POL_ERROR = (1<<32)
 ^~
gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10)

./bin/clang --version
clang version 16.0.0 (https://github.com/llvm/llvm-project 6daa983c9dde7608bcaa20b11e4a7d28fab4e003)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlE-P8yYQxj_N-IJiwWD85-BD1lm3h1Zb5fIeI4yxwyuCI4M32h762SvbySbp7qFvDkSeZwZ-zANI703vtC5BvIDYRXIKx2Esf_qgXW-1cb0Jx6mJmqH9KCsrXU9OxnvtiST-aLpA1DC5QC5ydMb1pBsm15Lmg_RKxUB3QLfrqGRYC2J1DSM3Ttmp1QR45UNrhvgI_HVVw8dZt7oj2k2ntW7oCGQvq0re6u2h_vPw19sfh9f9_m1PgO8IYM6AV8ArjoDFdZlsd6s_BOAvj0zGBXKSxgHmD_m3Nc6jcaEji4iAYiKAwl5HEJVbwtUXljnmzd966ADzr2LxpN_RZqG4A2a7R9IYsG5m0FotHmx-SGv_28_cDTcfPrfTK_Vd8u2DbznwLabAt5-lfEus7sKTvbMvfEcupg1HMnRktoeAeNn8WLI2S9ZmeNdjZ4cLiCs8mX__3ysC4vWfB-7Nux69Gdw9BJj_VlWABcljEVOCFBkVLJmFvW7J7zKsyobRu6Xft_B59jV4DRGWxjSm86zHEM4e-BawBqzX2xCr4QRYW_t--9ucx-GnVoGkrZRFzlXRtjpLad4oKZE2jOlEZi3mnWwSTSn_hIvakrcFL2SkS5ZmnGJRCBYdS4osSTjL06LgmHPkmAnaNKppsiZTHUamRIqcMpqyWWYxFyyjmolECK5U00JC9UkaG8-E8TD2kfF-0qUo8pRHVjba-uXeIzp9IYs4n2mxi8Zy2VUz9R4Sao0P_j5LMMHq58fgy4H57j2IptGWv9ZPwHrB8oD1gv1vAAAA___Ps2KV">