public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114178] incorrect -Wstringop-overflow with freestanding + new w/ initialization + no sse
Date: Thu, 29 Feb 2024 23:15:12 +0000	[thread overview]
Message-ID: <bug-114178-4-mF4nHgF14w@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114178-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Evan Teran from comment #4)
> @Andrew, thanks for the quick analysis! Just to confirm, the warning is in
> fact incorrect and the emitted code is not stomping outside of the buffer
> bounds?
> 
> I ask because I did also one last bit, which is that changing the buffer
> size can make the warning go away. That is if I make the buffer in the
> example something like 132, then it's happy again, which at the very least,
> makes me wonder if the vectorized code is in fact going out of bounds when
> the size doesn't align with the vectorized code's expectations.

The code is not incorrect, It is the peel part for unaligned part of the
stores. Just the warning is not using the same information that the peeling
part had available to it and getting confused by it.

Basically -ffreestanding is needed to hit the warning because GCC will use
memset rather than vectorize the store loop. Adding
-fno-tree-loop-distribute-patterns instead of -ffreestanding will also cause
the warning for the same reason.

      parent reply	other threads:[~2024-02-29 23:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 22:04 [Bug c++/114178] New: incorrect -Wstringop-overflow with freestanding + placement " evan.teran at gmail dot com
2024-02-29 22:18 ` [Bug tree-optimization/114178] incorrect -Wstringop-overflow with freestanding + " pinskia at gcc dot gnu.org
2024-02-29 22:18 ` pinskia at gcc dot gnu.org
2024-02-29 22:20 ` pinskia at gcc dot gnu.org
2024-02-29 23:03 ` evan.teran at gmail dot com
2024-02-29 23:15 ` pinskia at gcc dot gnu.org [this message]

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=bug-114178-4-mF4nHgF14w@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).