[Bug tree-optimization/103089] -Wmaybe-uninitialized -O2 false positive

2021-11-04 Thread xantares09 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103089

xantares09 at hotmail dot com changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from xantares09 at hotmail dot com ---
my bad, thanks for the reply

[Bug tree-optimization/103089] -Wmaybe-uninitialized -O2 false positive

2021-11-04 Thread xantares09 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103089

--- Comment #2 from xantares09 at hotmail dot com ---
indeed, I assumed both were positive, I guess there's no bug then

[Bug c/103089] New: -Wmaybe-uninitialized -O2 false positive

2021-11-04 Thread xantares09 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103089

Bug ID: 103089
   Summary: -Wmaybe-uninitialized -O2 false positive
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xantares09 at hotmail dot com
  Target Milestone: ---

Created attachment 51736
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51736=edit
minimal reproducer

on this example gcc 11.2, 11.1 gives a false positive for -Wmaybe-uninitialized
(at O2 only)


$ gcc -c -O2 -Wmaybe-uninitialized ks.c
ks.c: In function ‘DurbinMatrix’:
ks.c:21:18: warning: ‘*H_67 + _146’ may be used uninitialized
[-Wmaybe-uninitialized]
   21 |   H[(m - 1) * m] += (2 * h - 1 > 0 ? pow (2 * h - 1, (double) m) : 0);
  |  ^~
ks.c:21:18: warning: ‘*H_67 + _146’ may be used uninitialized
[-Wmaybe-uninitialized]


we can see the whole H array is initialized because H[i * m + j] covers the
whole (0, m*m( range:

H = (double *) malloc ((m * m) * sizeof (double));
  for (i = 0; i < m; i++)
for (j = 0; j < m; j++)
  if (i - j + 1 < 0)
H[i * m + j] = 0;
  else
H[i * m + j] = 1;