[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-12-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

--- Comment #7 from Richard Biener  ---
Author: rguenth
Date: Fri Dec  8 14:45:30 2017
New Revision: 255512

URL: https://gcc.gnu.org/viewcvs?rev=255512=gcc=rev
Log:
2017-12-08  Richard Biener  

PR middle-end/81782
* tree-ssa-uninit.c (warn_uninitialized_vars): Properly
handle accesses outside of zero-sized vars.

* gcc.dg/uninit-pr81782.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/uninit-pr81782.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-uninit.c

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-12-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

--- Comment #6 from Richard Biener  ---
Ah.

(gdb) p ref
$1 = {ref = , 
  base = , offset = 0, size = 8, 
  max_size = 0, ref_alias_set = -1, base_alias_set = -1, volatile_p = false}

Testing patch.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-12-07 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #5 from Richard Biener  ---
I think this one should be WONTFIX.  OTOH it might be handled by

  /* Do not warn if the access is fully outside of the
 variable.  */
  if (DECL_P (base)
  && ref.size != -1
  && ref.max_size == ref.size
  && (ref.offset + ref.size <= 0
  || (ref.offset >= 0
  && DECL_SIZE (base)
  && TREE_CODE (DECL_SIZE (base)) == INTEGER_CST
  && compare_tree_int (DECL_SIZE (base),
   ref.offset) <= 0)))
continue;

which for whatever reason doesn't handle it?

Will have a look.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-09-01 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Manuel López-Ibáñez  changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #4 from Manuel López-Ibáñez  ---
(In reply to Jakub Jelinek from comment #3)
> This is only with -O0, when we do not optimize away the dead loop.
> 
> Perhaps at -O0 we could just punt if it is a conditional memory use (and we
> haven't e.g. found a CLOBBER guarded with the same condition), though it
> could mean we wouldn't also warn for many places where we should warn.

It seems an acceptable trade-off as long as we warn with higher optimization
levels. That general limitation already exists with -O0.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-09-01 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
This is only with -O0, when we do not optimize away the dead loop.

Perhaps at -O0 we could just punt if it is a conditional memory use (and we
haven't e.g. found a CLOBBER guarded with the same condition), though it could
mean we wouldn't also warn for many places where we should warn.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-08-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener  ---
The issue is that there is a maybe uninitialized use given we fail to optimize
the condition at -O0.  We're only warning for maybe-uninit uses before
optimization at -O0.

I don't see a good way out here but to enhance this by at least constant
propagating on the side.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

--- Comment #3 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #4 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

--- Comment #3 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #4 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-08-09 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Eric Gallager  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-09
 CC||egallager at gcc dot gnu.org
 Blocks||24639
 Ever confirmed|0   |1

--- Comment #2 from Eric Gallager  ---
Confirmed that GCC warns here


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

[Bug middle-end/81782] [7/8 Regression] Yet another -Wmaybe-uninitialized false positive with empty array

2017-08-09 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81782

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |7.2
Summary|Yet another |[7/8 Regression] Yet
   |-Wmaybe-uninitialized false |another
   |positive with empty array   |-Wmaybe-uninitialized false
   ||positive with empty array

--- Comment #1 from Marek Polacek  ---
Started with
commit 4d2b9d1e3c794a05c00708035519290e920768e8
Author: rguenth 
Date:   Thu Mar 2 13:42:05 2017 +

2017-03-02  Richard Biener  

PR tree-optimization/79345
PR c++/42000
* tree-ssa-alias.c (walk_aliased_vdefs_1): Take a limit
param and abort the walk, returning -1 if it is hit.
(walk_aliased_vdefs): Take a limit param and pass it on.
* tree-ssa-alias.h (walk_aliased_vdefs): Add a limit param,
defaulting to 0 and return a signed int.
* tree-ssa-uninit.c (struct check_defs_data): New struct.
(check_defs): New helper.
(warn_uninitialized_vars): Use walk_aliased_vdefs to warn
about uninitialized memory.

* fixed-value.c (fixed_from_string): Use ulow/uhigh to avoid
bogus uninitialized warning.
(fixed_convert_from_real): Likewise.

* g++.dg/warn/Wuninitialized-7.C: New testcase.
* c-c++-common/ubsan/bounds-2.c: Add -Wno-uninitialized.
* gcc.dg/uninit-pr19430-2.c: Add expected warning.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245840
138bc75d-0d04-0410-961f-82ee72b054a4