Find a file
Gaius Mulley 40b91158c3 [modula2] Improve uninitialized variable analysis by combining basic blocks
This patch combines basic blocks for static analysis of uninitialized
variables providing that they are not the top of a loop, are not reached
by a conditional and are not reached after a procedure call.  It also
avoids checking array accesses for static analysis.  Finally the patch
adds switch modifiers to allow static analysis to include conditional
branches for subsequent basic block analysis.

gcc/ChangeLog:

	* doc/gm2.texi (-Wuninit-variable-checking=) New item.

gcc/m2/ChangeLog:

	* gm2-compiler/M2BasicBlock.def (InitBasicBlocksFromRange): New
	parameter ScopeSym.
	* gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): New
	parameter ScopeSym.
	(InitBasicBlocksFromRange): New	parameter ScopeSym.  Call
	ConvertQuads2BasicBlock with ScopeSym.
	(DisplayBasicBlocks): Uncomment.
	* gm2-compiler/M2Code.mod: Replace VariableAnalysis with
	ScopeBlockVariableAnalysis.
	(InitialDeclareAndOptiomize): Add parameter scope.
	(SecondDeclareAndOptimize): Add parameter scope.
	* gm2-compiler/M2GCCDeclare.mod (DeclareConstructor): Add scope
	parameter to DeclareTypesConstantsProceduresInRange.
	(DeclareTypesConstantsProceduresInRange): New parameter scope.
	Pass scope to DisplayQuadRange.  Reformatted.
	* gm2-compiler/M2GenGCC.def (ConvertQuadsToTree): New parameter
	scope.
	* gm2-compiler/M2GenGCC.mod (ConvertQuadsToTree): New parameter
	scope.
	* gm2-compiler/M2Optimize.mod (KnownReachable): New parameter
	scope.
	* gm2-compiler/M2Options.def (SetUninitVariableChecking): Add
	arg parameter.
	* gm2-compiler/M2Options.mod (SetUninitVariableChecking): Add
	arg parameter and set boolean UninitVariableChecking and
	UninitVariableConditionalChecking.
	(UninitVariableConditionalChecking): New boolean set to FALSE.
	* gm2-compiler/M2Quads.def (IsGoto): New procedure function.
	(DisplayQuadRange): Add scope parameter.
	(LoopAnalysis): Add scope parameter.
	* gm2-compiler/M2Quads.mod: Import PutVarArrayRef.
	(IsGoto): New procedure function.
	(LoopAnalysis): Add scope parameter and use MetaErrorT1 instead
	of WarnStringAt.
	(BuildStaticArray): Call PutVarArrayRef.
	(BuildDynamicArray): Call PutVarArrayRef.
	(DisplayQuadRange): Add scope parameter.
	(GetM2OperatorDesc): Add relational condition cases.
	* gm2-compiler/M2Scope.def (ScopeProcedure): Add parameter.
	* gm2-compiler/M2Scope.mod (DisplayScope): Pass scopeSym to
	DisplayQuadRange.
	(ForeachScopeBlockDo): Pass scopeSym to p.
	* gm2-compiler/M2SymInit.def (VariableAnalysis): Rename to ...
	(ScopeBlockVariableAnalysis): ... this.
	* gm2-compiler/M2SymInit.mod (ScopeBlockVariableAnalysis): Add
	scope parameter.
	(bbEntry): New pointer to record.
	(bbArray): New array.
	(bbFreeList): New variable.
	(errorList): New list.
	(IssueConditional): New procedure.
	(GenerateNoteFlow): New procedure.
	(IssueWarning): New procedure.
	(IsUniqueWarning): New procedure.
	(CheckDeferredRecordAccess): Re-implement.
	(CheckBinary): Add warning and lst parameters.
	(CheckUnary): Add warning and lst parameters.
	(CheckXIndr): Add warning and lst parameters.
	(CheckIndrX): Add warning and lst parameters.
	(CheckBecomes): Add warning and lst parameters.
	(CheckComparison): Add warning and lst parameters.
	(CheckReadBeforeInitQuad): Add warning and lst parameters to all
	Check procedures.  Add all case quadruple clauses.
	(FilterCheckReadBeforeInitQuad): Add warning and lst parameters.
	(CheckReadBeforeInitFirstBasicBlock): Add warning and lst parameters.
	(bbArrayKill): New procedure.
	(DumpBBEntry): New procedure.
	(DumpBBArray): New procedure.
	(DumpBBSequence): New procedure.
	(TestBBSequence): New procedure.
	(CreateBBPermultations): New procedure.
	(ScopeBlockVariableAnalysis): New procedure.
	(GetOp3): New procedure.
	(GenerateCFG): New procedure.
	(NewEntry): New procedure.
	(AppendEntry): New procedure.
	(init): Initialize bbFreeList and errorList.
	* gm2-compiler/SymbolTable.def (PutVarArrayRef): New procedure.
	(IsVarArrayRef): New procedure function.
	* gm2-compiler/SymbolTable.mod (SymVar): ArrayRef new field.
	(MakeVar): Set ArrayRef to FALSE.
	(PutVarArrayRef): New procedure.
	(IsVarArrayRef): New procedure function.
	* gm2-gcc/init.cc (_M2_M2SymInit_init): New prototype.
	(init_PerCompilationInit): Add call to _M2_M2SymInit_init.
	* gm2-gcc/m2options.h (M2Options_SetUninitVariableChecking):
	New definition.
	* gm2-lang.cc (gm2_langhook_handle_option): Add new case
	OPT_Wuninit_variable_checking_.
	* lang.opt: Wuninit-variable-checking= new entry.

gcc/testsuite/ChangeLog:

	* gm2/switches/uninit-variable-checking/cascade/fail/cascadedif.mod: New test.
	* gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp:
	New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-07-11 15:28:42 +01:00
c++tools Daily bump. 2023-06-23 00:16:38 +00:00
config Daily bump. 2022-11-15 08:32:29 +00:00
contrib Daily bump. 2023-07-08 00:16:53 +00:00
fixincludes Daily bump. 2023-06-16 00:17:18 +00:00
gcc [modula2] Improve uninitialized variable analysis by combining basic blocks 2023-07-11 15:28:42 +01:00
gnattools Daily bump. 2023-04-26 00:17:46 +00:00
gotools Daily bump. 2022-08-31 00:16:45 +00:00
include Daily bump. 2023-06-13 00:17:29 +00:00
INSTALL
intl Daily bump. 2023-06-16 00:17:18 +00:00
libada Update copyright years. 2023-01-16 11:52:17 +01:00
libatomic Daily bump. 2023-06-11 00:17:37 +00:00
libbacktrace Daily bump. 2023-03-29 00:17:01 +00:00
libcc1 Daily bump. 2023-05-19 00:17:43 +00:00
libcody Daily bump. 2023-06-16 00:17:18 +00:00
libcpp Daily bump. 2023-07-07 00:17:17 +00:00
libdecnumber Daily bump. 2023-06-16 00:17:18 +00:00
libffi Daily bump. 2023-05-07 00:16:40 +00:00
libgcc libgcc: Fix -Wint-conversion warning in find_fde_tail 2023-07-11 06:19:39 +02:00
libgfortran Daily bump. 2023-06-12 00:16:56 +00:00
libgm2 Daily bump. 2023-06-03 00:16:48 +00:00
libgo compiler, libgo: support bootstrapping gc compiler 2023-06-23 16:17:11 -07:00
libgomp libgomp: Update OpenMP memory allocation doc, fix omp_high_bw_mem_space 2023-07-11 16:11:35 +02:00
libiberty Daily bump. 2023-06-16 00:17:18 +00:00
libitm Daily bump. 2023-06-03 00:16:48 +00:00
libobjc Daily bump. 2023-05-23 00:17:11 +00:00
libphobos Daily bump. 2023-07-11 00:16:56 +00:00
libquadmath Daily bump. 2023-03-03 00:16:38 +00:00
libsanitizer Daily bump. 2023-05-01 00:16:44 +00:00
libssp Update copyright years. 2023-01-16 11:52:17 +01:00
libstdc++-v3 Daily bump. 2023-07-07 00:17:17 +00:00
libvtv Update copyright years. 2023-01-16 11:52:17 +01:00
lto-plugin Daily bump. 2023-07-01 00:18:32 +00:00
maintainer-scripts Daily bump. 2023-07-08 00:16:53 +00:00
zlib Daily bump. 2023-06-17 00:17:17 +00:00
.dir-locals.el
.gitattributes
.gitignore .gitignore: do not ignore config.h 2022-07-19 17:07:04 +03:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-07-08 00:16:53 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure configure, Darwin: Ensure overrides to host-pie are passed to gcc configure. 2023-06-25 10:16:39 +01:00
configure.ac configure, Darwin: Ensure overrides to host-pie are passed to gcc configure. 2023-06-25 10:16:39 +01:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 Generic configury support for shared libs on VxWorks 2022-10-11 07:31:07 +00:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS MAINTAINERS file: Added myself to Write After Approval and DCO 2023-06-30 16:04:48 +05:30
Makefile.def configure, Darwin: Ensure overrides to host-pie are passed to gcc configure. 2023-06-25 10:16:39 +01:00
Makefile.in Collect both user and kernel events for autofdo tests and autoprofiledbootstrap 2023-07-07 13:06:28 -07:00
Makefile.tpl Collect both user and kernel events for autofdo tests and autoprofiledbootstrap 2023-07-07 13:06:28 -07:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

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.