public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joshi, Tejas Sanjay" <TejasSanjay.Joshi@amd.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: error: ‘__Y’ is used uninitialized for immintrin.h when compiled with -O3 -Wall -Winit-self -Werror
Date: Tue, 12 Jul 2022 09:43:46 +0000	[thread overview]
Message-ID: <DM6PR12MB4795A4C1FA9B7414310FEC6BE3869@DM6PR12MB4795.namprd12.prod.outlook.com> (raw)

[-- 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);
} 


                 reply	other threads:[~2022-07-12  9:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR12MB4795A4C1FA9B7414310FEC6BE3869@DM6PR12MB4795.namprd12.prod.outlook.com \
    --to=tejassanjay.joshi@amd.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).