David Malcolm 9b4eee5fd1 analyzer: stop -ftrivial-auto-var-init from suppressing uninit warnings [PR104270]
GCC 12 has gained two features for dealing with uninitialized variables:

(a) a new -Wanalyzer-use-of-uninitialized-value warning within -fanalyzer
for interprocedural path-sensitive detection of ununit uses, and

(b) a new -ftrivial-auto-var-init option for mitigating some uses of
uninit variables

It turns out that using (b) was thwarting (a), as it led to -fanalyzer
seeing calls to IFN_DEFERRED_INIT, which -fanalyzer wasn't
special-casing, thus treating it as initializing the variables in
question, and thus silencing -Wanalyzer-use-of-uninitialized-value on
them.

invoke.texi says:

"GCC still considers an automatic variable that doesn't have an explicit
initializer as uninitialized, @option{-Wuninitialized} will still report
warning messages on such automatic variables."

and thus -Wanalyzer-use-of-uninitialized-value ought to as well.

This patch adds special-case handling to -fanalyzer for
IFN_DEFERRED_INIT,  so that -fanalyzer will warn on uninit uses of
variables that are mitigated by -ftrivial-auto-var-init.

gcc/analyzer/ChangeLog:
	PR analyzer/104270
	* region-model.cc (region_model::on_call_pre): Handle
	IFN_DEFERRED_INIT.

gcc/testsuite/ChangeLog:
	PR analyzer/104270
	* gcc.dg/analyzer/uninit-trivial-auto-var-init-pattern.c: New
	test.
	* gcc.dg/analyzer/uninit-trivial-auto-var-init-uninitialized.c:
	New test.
	* gcc.dg/analyzer/uninit-trivial-auto-var-init-zero.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-02-02 09:51:07 -05:00
2022-02-01 00:16:29 +00:00
2022-02-01 00:16:29 +00:00
2022-02-02 00:17:16 +00:00
2022-01-26 00:16:38 +00:00
2022-01-27 00:16:29 +00:00
2022-02-02 00:17:16 +00:00
2022-02-01 00:16:29 +00:00
2022-02-01 00:16:29 +00:00
2022-01-12 00:16:39 +00:00
2022-02-01 00:16:29 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%