linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Rong Tao <rtoax@foxmail.com>
Cc: sj@kernel.org, damon@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org, rongtao@cestc.cn, shuah@kernel.org,
	yuanchu@google.com
Subject: Re: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings
Date: Sat, 12 Nov 2022 18:30:50 +0000	[thread overview]
Message-ID: <20221112183050.85200-1-sj@kernel.org> (raw)
In-Reply-To: <tencent_5695C257F3D13F4417034BA1FBAC95CB3B07@qq.com>

Hi Rong,

On Sat, 12 Nov 2022 13:01:04 +0800 Rong Tao <rtoax@foxmail.com> wrote:

> Hi, Park, I just search on GCC source code, found GCC support
> "-Wstringop-overread" at least gcc-11.1.0, commit d14c547abd48("Add
> -Wstringop-overread for reading past the end by string functions.").
> 
> AND found a testsuite gcc/gcc/testsuite/gcc.dg/pragma-diag-10.c
> 
>  10 #pragma GCC diagnostic push
>  11 #pragma GCC diagnostic ignored "-Wstringop-overflow"
>  12 #pragma GCC diagnostic ignored "-Wstringop-overread"
>  13   if (c != 0)
>  14     return __builtin_memchr (s, c, (unsigned long)-1);
>  15 #pragma GCC diagnostic pop
> 
> it's totally same as this PATCH.
> 
> I think the motivation for this patch is to eliminate the compilation
> warning, maybe one day we will compile the kernel with "-Werror -Wall",
> at which point this compilation warning will turn into a compilation
> error, and in case we already know it, we should fix this error in
> advance.
> 
> For old gcc, we can add this?
> 
>  #pragma GCC diagnostic push
> +#if __GNUC__ >= 11 && __GNUC_MINOR__ >= 1
>  /* Ignore read(2) overflow and write(2) overread compile warnings */
>  #pragma GCC diagnostic ignored "-Wstringop-overread"
>  #pragma GCC diagnostic ignored "-Wstringop-overflow"
> +#endif
> 
> What do you think?

I think it looks great!  Looking forward to your v3 patch!


Thanks,
SJ

> 
> Good day!
> Rong Tao


  reply	other threads:[~2022-11-12 18:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 13:34 Rong Tao
2022-11-10 20:09 ` SeongJae Park
2022-11-11  2:37   ` Rong Tao
2022-11-11 17:38     ` SeongJae Park
2022-11-12  5:01       ` Rong Tao
2022-11-12 18:30         ` SeongJae Park [this message]
2022-11-13  0:38           ` [PATCH v3] " Rong Tao
2022-11-13 19:49             ` SeongJae Park

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=20221112183050.85200-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rongtao@cestc.cn \
    --cc=rtoax@foxmail.com \
    --cc=shuah@kernel.org \
    --cc=yuanchu@google.com \
    /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