public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/104475] [12 Regression] Wstringop-overflow + atomics incorrect warning on dynamic object
Date: Thu, 03 Mar 2022 16:09:00 +0000	[thread overview]
Message-ID: <bug-104475-4-3oh0sv4f54@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104475-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Aldy Hernandez from comment #3)
> This isn't the threader but VRP/ranger.
> 
> What happens is that the threader isolates the path, making it easier for
> VRP to see the equivalence, and then CCP4 folds the constant into the
> problematic call.  This is from the .ccp4 pass:
> 
> Folding statement: __atomic_or_fetch_4 (pretmp_29, 64, 0);
> Folded into: __atomic_or_fetch_4 (184B, 64, 0);
> 
> In VRP2 the ranger is folding:
> 
> Folding statement: pretmp_29 = &MEM[(struct __atomic_base *)_1 + 184B]._M_i;
> Folded into: pretmp_29 = 184B;
> 
> The ranger is determining that _1 is 0 because it has determined that since
> _2 is 0 on the 2->3 edge, so is _1, as m_mutex is the first field of _1:
> 
> =========== BB 2 ============
> Imports: _1  
> Exports: _1  _2  
>          _2 : _1(I)  
>     <bb 2> [local count: 1073741824]:
>     _1 = this_10(D)->d;
>     _2 = &_1->m_mutex;
>     MEM[(struct __as_base  &)&lock] ={v} {CLOBBER};
>     if (_2 != 0B)
>       goto <bb 5>; [90.00%]
>     else
>       goto <bb 3>; [10.00%]
> 
> 2->5  (T) _1 : 	struct QFutureInterfaceBasePrivate * [1B, +INF]
> 2->5  (T) _2 : 	struct QMutex * [1B, +INF]
> 2->3  (F) _1 : 	struct QFutureInterfaceBasePrivate * [0B, 0B]
> 2->3  (F) _2 : 	struct QMutex * [0B, 0B]
> 
> Andrew, how/where is that we relate _1 and _2 here?  I can't seem to find it.
> 
> My gut feeling is that special casing anything in the ranger for this is
> wrong.


Its via op1_range for OP_ADDR:  
--param=ranger-debug=tracegori shows:

2120    GORI  outgoing_edge for _1 on edge 2->3
2121    GORI    compute op 1 (_2) at if (_2 != 0B)
        GORI      LHS =bool [0, 0]
        GORI      Computes _2 = struct QMutex * [0B, 0B] intersect Known range
: struct QMutex * VARYING
        GORI    TRUE : (2121) produces  (_2) struct QMutex * [0B, 0B]
2122    GORI    compute op 1 (_1) at _2 = &_1->m_mutex;
        GORI      LHS =struct QMutex * [0B, 0B]
        GORI      Computes _1 = struct QFutureInterfaceBasePrivate * [0B, 0B]
intersect Known range : struct QFutureInterfaceBasePrivate * VARYING
        GORI    TRUE : (2122) produces  (_1) struct QFutureInterfaceBasePrivate
* [0B, 0B]
        GORI  TRUE : (2120) outgoing_edge (_1) struct
QFutureInterfaceBasePrivate * [0B, 0B]

so with _2 == 0, the 2122 trace element is solving for _1 in
    _2 = &_1->m_mutex
[0,0] = &_1->m_mutex

is  it possible for _1 to be anything other than 0 in this case?  If so we need
to adjust range-ops

  parent reply	other threads:[~2022-03-03 16:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 19:37 [Bug c++/104475] New: " thiago at kde dot org
2022-02-09 20:14 ` [Bug tree-optimization/104475] [12 Regression] " pinskia at gcc dot gnu.org
2022-02-09 23:48 ` msebor at gcc dot gnu.org
2022-02-16 14:56 ` jakub at gcc dot gnu.org
2022-03-03 14:00 ` aldyh at gcc dot gnu.org
2022-03-03 16:09 ` amacleod at redhat dot com [this message]
2022-03-03 17:55 ` amacleod at redhat dot com
2022-03-04 14:47 ` amacleod at redhat dot com
2022-03-09 13:13 ` rguenth at gcc dot gnu.org
2022-03-12  9:39 ` aldyh at gcc dot gnu.org
2022-03-23 12:47 ` rguenth at gcc dot gnu.org
2022-03-23 17:23 ` aldyh at gcc dot gnu.org
2022-05-06  8:32 ` [Bug tree-optimization/104475] [12/13 " jakub at gcc dot gnu.org
2022-07-26 12:59 ` rguenth at gcc dot gnu.org
2022-12-05 15:50 ` rguenth at gcc dot gnu.org
2022-12-05 16:36 ` thiago at kde dot org
2022-12-06  8:17 ` rguenth at gcc dot gnu.org
2022-12-06  9:11 ` rguenth at gcc dot gnu.org
2022-12-06 10:22 ` cvs-commit at gcc dot gnu.org
2022-12-06 10:26 ` rguenth at gcc dot gnu.org
2022-12-06 18:03 ` thiago at kde dot org
2022-12-07  9:46 ` rguenth at gcc dot gnu.org
2022-12-07  9:48 ` rguenth at gcc dot gnu.org
2022-12-07  9:49 ` rguenth at gcc dot gnu.org
2022-12-07  9:54 ` rguenth at gcc dot gnu.org
2022-12-07 11:25 ` rguenth at gcc dot gnu.org
2023-01-17 17:37 ` jason at gcc dot gnu.org
2023-05-08 12:23 ` [Bug tree-optimization/104475] [12/13/14 " rguenth at gcc dot gnu.org
2023-09-18  9:19 ` aph at gcc dot gnu.org
2023-09-18 10:04 ` rguenth 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-104475-4-3oh0sv4f54@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).