public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Qing Zhao <qing.zhao@oracle.com>
Cc: "Arsen Arsenović" <arsen@aarsen.me>,
	"Andrew Pinski" <pinskia@gmail.com>,
	"Xi Ruoyao" <xry111@xry111.site>,
	"kees Cook" <keescook@chromium.org>,
	gcc-patches@gcc.gnu.org
Subject: Re: Question on -fwrapv and -fwrapv-pointer
Date: Fri, 15 Sep 2023 17:29:10 +0200	[thread overview]
Message-ID: <D97B4542-D393-4261-B85C-12EDD5CD70A2@gmail.com> (raw)
In-Reply-To: <F4C325CF-82E7-462E-8D6D-C779722CEF7B@oracle.com>



> Am 15.09.2023 um 17:25 schrieb Qing Zhao <qing.zhao@oracle.com>:
> 
> 
> 
>> On Sep 15, 2023, at 8:41 AM, Arsen Arsenović <arsen@aarsen.me> wrote:
>> 
>> 
>> Qing Zhao <qing.zhao@oracle.com> writes:
>> 
>>> Even though unsigned integer overflow is well defined, it might be
>>> unintentional, shall we warn user about this?
>> 
>> This would be better addressed by providing operators or functions that
>> do overflow checking in the language, so that they can be explicitly
>> used where overflow is unexpected.
> 
> Yes, that will be very helpful to prevent unexpected overflow in the program in general.
> However, this will mainly benefit new codes.
> 
> For the existing C codes, especially large applications, we still need to identify all the places 
> Where the overflow is unexpected, and fix them. 
> 
> One good example is linux kernel. 
> 
>> One could easily imagine a scenario
>> where overflow is not expected in some region of code but is in the
>> larger application.
> 
> Yes, that’s exactly the same situation Linux kernel faces now, the unexpected Overflow and 
> expected wrap-around are mixed together inside one module. 
> It’s hard to detect the unexpected overflow under such situation based on the current GCC. 

But that’s hardly GCCs fault nor can GCC fix that in any way.  Only the programmer can distinguish both cases.

Richard 

> Thanks.
> 
> Qing
>> -- 
>> Arsen Arsenović
> 

  reply	other threads:[~2023-09-15 15:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 13:41 Qing Zhao
2023-09-14 14:06 ` Richard Biener
2023-09-14 15:01   ` Qing Zhao
2023-09-14 15:12     ` Richard Biener
2023-09-14 15:57       ` Qing Zhao
2023-09-14 16:18         ` Xi Ruoyao
2023-09-14 20:48           ` Qing Zhao
2023-09-14 20:57             ` Andrew Pinski
2023-09-14 21:41               ` Qing Zhao
2023-09-15  7:43                 ` Xi Ruoyao
2023-09-15 15:12                   ` Qing Zhao
2023-09-15 15:18                     ` Andrew Pinski
2023-09-15 18:34                       ` Kees Cook
2023-09-15 12:41                 ` Arsen Arsenović
2023-09-15 15:24                   ` Qing Zhao
2023-09-15 15:29                     ` Richard Biener [this message]
2023-09-15 15:37                       ` Qing Zhao
2023-09-15 16:53                         ` Xi Ruoyao
2023-09-15 17:56                           ` Qing Zhao
2023-09-15 17:26                         ` Richard Biener
2023-09-15 17:47                           ` Qing Zhao
2023-09-15 18:43                             ` Kees Cook
2024-02-15  8:32                               ` Fangrui Song
2024-02-15 23:31                                 ` Kees Cook
2023-09-15  0:23               ` Kees Cook

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=D97B4542-D393-4261-B85C-12EDD5CD70A2@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=arsen@aarsen.me \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=keescook@chromium.org \
    --cc=pinskia@gmail.com \
    --cc=qing.zhao@oracle.com \
    --cc=xry111@xry111.site \
    /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).