[Bug middle-end/106470] Subscribed access to __m256i casted to (uint16_t *) produces garbage or a warning

vt at altlinux dot org gcc-bugzilla@gcc.gnu.org
Thu Jul 28 22:08:34 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106470

--- Comment #4 from Vitaly Chikunov <vt at altlinux dot org> ---
Andrew, thanks for the quick answer and example! I wish that warning was a bit
more enlightening, and in the first case it is not quietly compiles producing
incorrect code (which is only found by testing).

I also found two variants that's producing correct output:

        for (size_t i = 0; i < 16; i++) {
                printf(" %04x", ((__v16hu)tmp)[i]);
        }

(`__v16hu` is defined in `avxintrin.h`) and similar to how `__v16hu` is defined
there:

        for (size_t i = 0; i < 16; i++) {
                printf(" %04x", ((uint16_t __attribute__ ((__vector_size__
(32)))) tmp)[i] );
        }


More information about the Gcc-bugs mailing list