[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

--- Comment #6 from Martin Liška  ---
> That looks like unpatched elfutils.  I know you mentioned[1] that you're
> using the latest elfutils but can you please confirm again?  Or maybe
> incorrect preprocessed file?
> 
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=29614#c2

Whoops, you are right. I've got 2 tested projects where only one contains the
latest elfutils snapshot.

[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

--- Comment #5 from Siddhesh Poyarekar  ---
(In reply to Siddhesh Poyarekar from comment #4)
> (In reply to Martin Liška from comment #2)
> > > I assume this is elfutils #29614?
> > 
> > Yes.
> > 
> > Please take a look at the original unreduced testcase I attached here.
> 
> That looks like unpatched elfutils.  I know you mentioned[1] that you're
> using the latest elfutils but can you please confirm again?  Or maybe
> incorrect preprocessed file?
> 
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=29614#c2

OK maybe that's irrelevant from the gcc perspective because this is basically
warning on unreachable code, which we know tends to happen sometimes.  The
comment is mainly for the elfutils issue you're facing.

[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

--- Comment #4 from Siddhesh Poyarekar  ---
(In reply to Martin Liška from comment #2)
> > I assume this is elfutils #29614?
> 
> Yes.
> 
> Please take a look at the original unreduced testcase I attached here.

That looks like unpatched elfutils.  I know you mentioned[1] that you're using
the latest elfutils but can you please confirm again?  Or maybe incorrect
preprocessed file?

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=29614#c2

[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

--- Comment #3 from Martin Sebor  ---
Just a quick note from what I see in GDB.  The warning is issued by the 2nd run
of the waccess pass (-fdump-tree-waccess2) for the following statement in bb 22
in pread():

  iftmp.21_88 = __pread_alias (_50, _82, _81, _79);

_81's range reported by range_query::range_of_expr (vr, exp, stmt) is [58,
ULONG_MAX], matching the range in the warning.

A partial output of debug_ranger() for the function is below.  I must be
reading it wrong because  I don't see what the range above is derived from.

=== BB 19 
Imports: recvd_78  _83  
Exports: _51  recvd_78  recvd.17_80  _83  _94  _116  _125  
_83 [irange] UNDEFINED
 [local count: 169058114]:
if (_83 == 18446744073709551615)
  goto ; [34.00%]
else
  goto ; [66.00%]

19->22  (T) _83 :   [irange] UNDEFINED
19->20  (F) _83 :   [irange] UNDEFINED

=== BB 20 
Imports: _81  _83  
Exports: _81  _83  _85  _86  _87  
 _85 : _81(I)  _83(I)  
 _86 : _81(I)  _83(I)  _85  
 _87 : _81(I)  _83(I)  _85  _86  
_81 [irange] long unsigned int VARYING
_83 [irange] long unsigned int VARYING
 [local count: 280636469]:
_85 = _81 <= _83;
_86 = (int) _85;
_87 = __builtin_constant_p (_86);
if (_87 != 0)
  goto ; [50.00%]
else
  goto ; [50.00%]

_86 : [irange] int [0, 1] NONZERO 0x1
_87 : [irange] int [0, 0] NONZERO 0x0
20->21  (T) _81 :   [irange] UNDEFINED
20->21  (T) _83 :   [irange] UNDEFINED
20->21  (T) _85 :   [irange] UNDEFINED
20->21  (T) _86 :   [irange] UNDEFINED
20->21  (T) _87 :   [irange] UNDEFINED
20->24  (F) _86 :   [irange] int [0, 1] NONZERO 0x1
20->24  (F) _87 :   [irange] int [0, 0] NONZERO 0x0

=== BB 21 
Imports: recvd_78  _81  _83  
Exports: _51  recvd_78  recvd.17_80  _81  _83  _94  _116  _125  
_81 [irange] UNDEFINED
_83 [irange] UNDEFINED
 [local count: 140318235]:
if (_81 <= _83)
  goto ; [50.00%]
else
  goto ; [50.00%]

21->22  (T) _81 :   [irange] UNDEFINED
21->22  (T) _83 :   [irange] UNDEFINED
21->23  (F) _81 :   [irange] UNDEFINED
21->23  (F) _83 :   [irange] UNDEFINED

=== BB 22 
 [local count: 127638877]:
iftmp.21_88 = __pread_alias (_50, _82, _81, _79);
goto ; [100.00%]

[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

--- Comment #2 from Martin Liška  ---
> I assume this is elfutils #29614?

Yes.

Please take a look at the original unreduced testcase I attached here.

[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

--- Comment #1 from Siddhesh Poyarekar  ---
recvd is uninitialized and it seems to be preventing optimization of the
fortify macro one way or for some reason.  I can take a look at why the
condition does not get folded away but a reproducer without undefined behaviour
may be more persuasive.  I assume this is elfutils #29614?

[Bug tree-optimization/107038] [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695

2022-09-26 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
   Target Milestone|--- |13.0