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

    <tr>
        <th>Summary</th>
        <td>
            Clang accepts invalid GNU C vector code
        </td>
    </tr>

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

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

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

<pre>
    https://gcc.godbolt.org/z/Y9oE58dYY

Line 93 is wrong. It should be t.u8, not t.u64, but Clang accepts it anyway due to an issue with its type checking. If you change the compiler to GCC (e.g. carm64g1310), GCC will output:

```
<source>: In function 'fletcher_4_generic_byteswap_impl':
<source>:95:21: note: use '-flax-vector-conversions' to permit conversions between vectors with differing element types or numbers of subparts
   95 | 20, 19, 18, 17, 16, 31, 30, 29, 28, 27, 26, 25, 24);
      | ^~
<source>:93:25: error: incompatible types when assigning to type 'u64x4' {aka '__vector(4) long unsigned int'} from type '__vector(32) unsigned char'
   93 |                 t.u64 = __builtin_shufflevector(t.u8, t.u8, 7, 6, 5,
      | ^~~~~~~~~~~~~~~~~~~~~~~
Compiler returned: 1
```

Interestingly, Clang still generates code as if the assignment had been to t.u8.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxslEFvqzgQxz-NcxkVgU0gHHJo0-ap0mpve-gpMmYA7zM2ssfNyx72s69s2r5uVRQNEGb-9vw8MzIEPVnEI9s_sP3jTkaanT_6m3S73g2340y0BibuGT8zfp6UKiY39M5Q4fzE-Pkfxs8vnXvaH4aXF1Y-svJ-s39oi9AJ0AGu3tmpgGeCMLtoBugRqIgHxk9gHaXnpk4vfSQ4GWknkErhSgE0gbS3q7zBEBHIgbSgQ4gIV00zaApAtxVBzah-6rzKCDcXQc3STgg0Iyi3rNqgT-E_Tidg_IDFVICSfmnqqRJVyXiX1k9fr9oYcJHWSCntTxmxpnz7ba_iFFz0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