[Bug tree-optimization/104475] [12 Regression] Wstringop-overflow + atomics incorrect warning on dynamic object

aldyh at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 3 14:00:53 GMT 2022


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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
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.


More information about the Gcc-bugs mailing list