public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106931] [12/13 Regression] -Wstringop-overflow false positive  -O3 -fno-tree-vectorize with loop unrolling since r12-3300-gece28da924ddda8b
Date: Tue, 13 Sep 2022 20:09:22 +0000	[thread overview]
Message-ID: <bug-106931-4-wbnGLKJxJu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106931-4@http.gcc.gnu.org/bugzilla/>

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression]          |[12/13 Regression]
                   |-Wstringop-overflow false   |-Wstringop-overflow false
                   |positive  -O3               |positive  -O3
                   |-fno-tree-vectorize since   |-fno-tree-vectorize with
                   |r12-3300-gece28da924ddda8b  |loop unrolling since
                   |                            |r12-3300-gece28da924ddda8b

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The false positive is issued for the store to A[i_90] in BB 10 by the strlen
pass, where i_90's range is [8, 8].

  <bb 10> [local count: 712060]:
  _35 = (sizetype) i_90;
  _36 = B.1_83 + _35;
  _37 = *_36;
  A[i_90] = _37;    << -Wstringop-overflow
  _20 = _93 + 9;
  i_39 = (int) _20;
  goto <bb 12>; [100.00%]

Changing i's type to unsigned avoids the warning.  The IL looks very close but
i_90's range in BB 10 is VR_UNDEFINED instead.

The following is debug_ranger() output for BBs 9 and 10 in the original test
case.

=========== BB 9 ============
Imports: _93  
Exports: _8  i_90  _93  
         _8 : _93(I)  
         _86 : i_82(I)  
         _87 : i_82(I)  B.1_83(I)  _86  
         i_90 : _8  _93(I)  
i_82    [irange] int [7, 7] NONZERO 0x7
_93     [irange] unsigned int [0, 0] NONZERO 0x0
Relational : (_8 > _93)
    <bb 9> [local count: 801058]:
    _86 = (sizetype) i_82;
    _87 = B.1_83 + _86;
    _88 = *_87;
    A[i_82] = _88;
    _8 = _93 + 8;
    i_90 = (int) _8;
    if (i_90 != 8)
      goto <bb 10>; [88.89%]
    else
      goto <bb 12>; [11.11%]

_8 : [irange] unsigned int [8, 8] NONZERO 0x8
_86 : [irange] sizetype [7, 7] NONZERO 0x7
_87 : [irange] char * [1, +INF]
i_90 : [irange] int [8, 8] NONZERO 0x8
9->10  (T) _8 :         [irange] UNDEFINED
9->10  (T) i_90 :       [irange] UNDEFINED
9->10  (T) _93 :        [irange] UNDEFINED
9->12  (F) _8 :         [irange] unsigned int [8, 8] NONZERO 0x8
9->12  (F) i_90 :       [irange] int [8, 8] NONZERO 0x8
9->12  (F) _93 :        [irange] unsigned int [0, 0] NONZERO 0x0

=========== BB 10 ============
_93     [irange] UNDEFINED
    <bb 10> [local count: 712060]:
    _35 = (sizetype) i_90;
    _36 = B.1_83 + _35;
    _37 = *_36;
    A[i_90] = _37;
    _20 = _93 + 9;
    i_39 = (int) _20;
    goto <bb 12>; [100.00%]

whereas for the unsigned case:

=========== BB 10 ============
_85     [irange] UNDEFINED
i_90    [irange] UNDEFINED

  parent reply	other threads:[~2022-09-13 20:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 18:34 [Bug tree-optimization/106931] New: -Wstringop-overflow false positive kasper93 at gmail dot com
2022-09-13 18:38 ` [Bug tree-optimization/106931] [12/13 Regression] -Wstringop-overflow false positive -O3 -fno-tree-vectorize pinskia at gcc dot gnu.org
2022-09-13 19:21 ` [Bug tree-optimization/106931] [12/13 Regression] -Wstringop-overflow false positive -O3 -fno-tree-vectorize since r12-3300-gece28da924ddda8b marxin at gcc dot gnu.org
2022-09-13 20:09 ` msebor at gcc dot gnu.org [this message]
2022-10-18  8:46 ` [Bug tree-optimization/106931] [12/13 Regression] -Wstringop-overflow false positive -O3 -fno-tree-vectorize with loop unrolling " rguenth at gcc dot gnu.org
2023-05-08 12:25 ` [Bug tree-optimization/106931] [12/13/14 " rguenth at gcc dot gnu.org
2024-03-15  0:45 ` [Bug tree-optimization/106931] [12 " law 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-106931-4-wbnGLKJxJu@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).