* error: ‘__Y’ is used uninitialized for immintrin.h when compiled with -O3 -Wall -Winit-self -Werror
@ 2022-07-12 9:43 Joshi, Tejas Sanjay
0 siblings, 0 replies; only message in thread
From: Joshi, Tejas Sanjay @ 2022-07-12 9:43 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]
[Public]
Hello,
For the following testcase (and maybe similar others):
#include <immintrin.h>
void foo(double *c)
{
__m256d ymm0 = _mm256_undefined_pd ();
_mm256_store_pd (c, ymm0);
}
gcc (GCC) 12.1.1 20220711 gives following error when compiled with ‘gcc -O3 -Wall -Winit-self -Werror -mavx foo.c -c’:
In file included from /home/tejas/community/GCC-12/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/immintrin.h:43,
from foo.c:1:
In function ‘_mm256_store_pd’,
inlined from ‘foo’ at foo.c:6:2:
/home/tejas/community/GCC-12/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/avxintrin.h:875:19: error: ‘__Y’ is used uninitialized [-Werror=uninitialized]
875 | *(__m256d *)__P = __A;
| ~~~~~~~~~~~~~~~~^~~~~
/home/tejas/community/GCC-12/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/avxintrin.h: In function ‘foo’:
/home/tejas/community/GCC-12/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/avxintrin.h:1210:11: note: ‘__Y’ was declared here
1210 | __m256d __Y = __Y;
| ^~~
cc1: all warnings being treated as errors
This behavior is seen with GCC 12 and not with older GCC versions (tried with system GCC 9.4.0 and GCC 11.2). I see -Wuninitialized is introduced newly : <https://gcc.gnu.org/gcc-12/changes.html > (I don’t know though, if -Wuninitialized has anything to do with -Winit-self).
While I understand -Winit-self is supposed to give warnings for such, should it give a warning for immintrin.h itself? The testcase seems to be correct. Is it a bug in GCC 12 or is it supposed to behave like this?
Thanks and Regards,
Tejas
[-- Attachment #2: foo.c --]
[-- Type: text/plain, Size: 118 bytes --]
#include <immintrin.h>
void foo(double *c)
{
__m256d ymm0 = _mm256_undefined_pd ();
_mm256_store_pd (c, ymm0);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-12 9:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 9:43 error: ‘__Y’ is used uninitialized for immintrin.h when compiled with -O3 -Wall -Winit-self -Werror Joshi, Tejas Sanjay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).