public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: "sunil.k.pandey" <skpandey@sc.intel.com>
Cc: gcc-patches@gcc.gnu.org, richard.earnshaw@arm.com, msebor@gcc.gnu.org
Subject: Re: [r12-3899 Regression] FAIL: gcc.dg/strlenopt-13.c scan-tree-dump-times strlen1 "memcpy \\(" 7 on Linux/x86_64
Date: Tue, 28 Sep 2021 09:20:59 +0200 (CEST)	[thread overview]
Message-ID: <721qso41-r16o-88nq-2o81-oqq0648p5382@fhfr.qr> (raw)
In-Reply-To: <20210927182833.05F062864721@gskx-2.sc.intel.com>

On Mon, 27 Sep 2021, sunil.k.pandey wrote:

> On Linux/x86_64,
> 
> d06dc8a2c73735e9496f434787ba4c93ceee5eea is the first bad commit
> commit d06dc8a2c73735e9496f434787ba4c93ceee5eea
> Author: Richard Biener <rguenther@suse.de>
> Date:   Mon Sep 27 13:36:12 2021 +0200
> 
>     middle-end/102450 - avoid type_for_size for non-existing modes
> 
> caused
> 
> FAIL: gcc.dg/out-of-bounds-1.c  (test for warnings, line 12)
> FAIL: gcc.dg/pr78408-1.c scan-tree-dump-times fab1 "after previous" 17
> FAIL: gcc.dg/strlenopt-13.c scan-tree-dump-times strlen1 "memcpy \\(" 7

After the change the new memcpy inlining limit using MOVE_MAX * MOVE_RATIO
comes into play and ends up using an OImode move which previously was
disregarded as there's no __int256 standard type in the frontend
(but now we build such type anyway after verifying the mode exists and
it has move support).

For example gcc.dg/out-of-bounds-1.c which looks like

void ProjectOverlay(const float localTextureAxis[2], char *lump)
{
   const void *d = &localTextureAxis;
   int size = sizeof(float)*8 ;
   __builtin_memcpy( &lump[ 0 ], d, size );  /* { dg-warning "reading" } 
*/
}

gets turned into

        movq    %rdi, -8(%rsp)
        vmovdqu64       -8(%rsp), %ymm31
        vmovdqu64       %ymm31, (%rsi)

which I guess is good but then the diagnostic is no longer emitted
because -Wstringop-overread only applies to the builtin.  Usually
we avoid the folding in such a case but

              /* Detect out-of-bounds accesses without issuing warnings.
                 Avoid folding out-of-bounds copies but to avoid false
                 positives for unreachable code defer warning until after
                 DCE has worked its magic.
                 -Wrestrict is still diagnosed.  */
              if (int warning = check_bounds_or_overlap (as_a <gcall 
*>(stmt),
                                                         dest, src, len, 
len,
                                                         false, false))
                if (warning != OPT_Wrestrict)
                  return false;

does not seem to trigger here.  Changing the testcase to

void ProjectOverlay(const float localTextureAxis[2], char *lump)
{
   const void *d = &localTextureAxis;
   int size = sizeof(float)*4 ;
   __builtin_memcpy( &lump[ 0 ], d, size );  /* { dg-warning "reading" } 
*/
}

also fails to warn.

Richard.

  reply	other threads:[~2021-09-28  7:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 18:28 sunil.k.pandey
2021-09-28  7:20 ` Richard Biener [this message]
2021-09-28 15:06   ` Martin Sebor

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=721qso41-r16o-88nq-2o81-oqq0648p5382@fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=msebor@gcc.gnu.org \
    --cc=richard.earnshaw@arm.com \
    --cc=skpandey@sc.intel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).