[Bug middle-end/98583] missing -Wuninitialized reading from a second VLA in its own block

2021-05-13 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583

Martin Sebor  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Martin Sebor  ---
Fixed in GCC 12.

[Bug middle-end/98583] missing -Wuninitialized reading from a second VLA in its own block

2021-05-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:2efe245bb88bf4574e322ef7e6d2df83d9e13237

commit r12-783-g2efe245bb88bf4574e322ef7e6d2df83d9e13237
Author: Martin Sebor 
Date:   Thu May 13 16:05:50 2021 -0600

Avoid -Wuninitialized false negatives with sanitization and VLAs.

Resolves:
PR tree-optimization/93100 - gcc -fsanitize=address inhibits
-Wuninitialized
PR middle-end/98583 - missing -Wuninitialized reading from a second VLA in
its own block

gcc/ChangeLog:

PR tree-optimization/93100
PR middle-end/98583
* tree-ssa-uninit.c (check_defs): Exclude intrinsic functions that
don't modify referenced objects.

gcc/testsuite/ChangeLog:

PR tree-optimization/93100
PR middle-end/98583
* g++.dg/warn/uninit-pr93100.C: New test.
* gcc.dg/uninit-pr93100.c: New test.
* gcc.dg/uninit-pr98583.c: New test.

[Bug middle-end/98583] missing -Wuninitialized reading from a second VLA in its own block

2021-05-11 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch
   Target Milestone|--- |12.0
 Status|NEW |ASSIGNED
  Known to fail||10.3.0, 11.1.0, 12.0, 9.2.0
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570117.html

[Bug middle-end/98583] missing -Wuninitialized reading from a second VLA in its own block

2021-01-08 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583

Richard Biener  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-01-08
 Status|UNCONFIRMED |NEW

--- Comment #1 from Richard Biener  ---
The issue is that __builtin_stack_restore is considered a possible definition
by the alias machinery (it needs to be treated as barrier for code motion).
check_defs can probably skip __builtin_stack_restore unconditionally
(alternatively the uninit pass can stop walking at allocation sites but
it's run too early to not need its own tracking of which allocation an
object belongs to).

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 0800f596ab1..33a32eaaa37 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -216,6 +216,9 @@ check_defs (ao_ref *ref, tree vdef, void *data_)
return true;
   return false;
 }
+  /* End of VLA scope is not a kill.  */
+  if (gimple_call_builtin_p (def_stmt, BUILT_IN_STACK_RESTORE))
+return false;
   /* Found a may-def on this path.  */
   data->found_may_defs = true;
   return true;

fixes this bug (pre-approved if it tests OK).