public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/24542] potential unwanted truncation of operation overflow should be warned on assignment to wider variable
Date: Fri, 31 Mar 2023 09:33:34 +0000	[thread overview]
Message-ID: <bug-24542-4-PN0bHKgWiJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-24542-4@http.gcc.gnu.org/bugzilla/>

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #14 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Heh, was in the process of reopening this too, but Richard beat
me too it.

FWIW, I agree this is worth providing as an option.  Another justification
is the different promotion handling between u32 = u16 op u16 and
u64 = u32 op u32.

"auto" (which wasn't a thing when the PR was first filed) might also
increase the chances of accidentally pushing promotions to the root of
a multi-statement calculation.

I don't think the false positive/negative ratio matters too much for
the option itself.  If it works then I think it's worth having.
IMO the ratio only becomes important if we're considering enabling
this by default (unlikely), -Wall (unsure) or -Wextra (seems feasible).

  parent reply	other threads:[~2023-03-31  9:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-24542-4@http.gcc.gnu.org/bugzilla/>
2023-03-31  7:16 ` [Bug c/24542] potential integer " pinskia at gcc dot gnu.org
2023-03-31  8:15 ` zhangboyang.id at gmail dot com
2023-03-31  9:18 ` [Bug c/24542] potential unwanted truncation of operation " rguenth at gcc dot gnu.org
2023-03-31  9:33 ` rsandifo at gcc dot gnu.org [this message]
2023-08-07 11:00 ` mail+gcc at nh2 dot me
2023-08-07 14:34 ` pinskia at gcc dot gnu.org

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-24542-4-PN0bHKgWiJ@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).