Gaius Mulley a2f60c1ff5 PR modula2/118978 ICE when attempting to pass an incompatible parameter
This bugfix is for a an ICE which occurs if an incompatible parameter
is passed to a procedure.  In particular if a REAL constant actual
parameter is passed to INTEGER formal parameter then M2Range is invoked
to check the type and then M2Range is called to check the value range.

The value range check causes an ICE.  The bug fix introduces range
dependencies on type checks.  If the type check fails an
error message is generated and any future range check cancelled.
These range and type checks are tightly coupled when generating
parameter quad intermediate code.

gcc/m2/ChangeLog:

	PR modula2/118978
	* gm2-compiler/M2Check.mod (checkConstMeta): Add check for
	typed constants.
	* gm2-compiler/M2Quads.mod (BoolFrame): New field RangeDep.
	(CheckProcedureParameters): Call PutRangeDep to associate the
	range dependency with the parameter on the quad stack.
	Pass ParamCheckId to CheckParameter.
	(CheckProcTypeAndProcedure): Add ParamCheckId parameter.
	Pass ParamCheckId to BuildRange.
	(CheckParameter): New parameter ParamCheckId.
	Pass ParamCheckId to CheckProcTypeAndProcedure.
	(CheckParameterOrdinals): Add extra range dep parameter to the
	call of InitParameterRangeCheck.
	(ConvertBooleanToVariable): Initialize RangeDep field.
	(PushBacktok): Ditto.
	(OperandRangeDep): New procedure.
	(PutRangeDep): Ditto.
	* gm2-compiler/M2Range.def (InitTypesParameterCheck): Add new
	parameter depRangeId.
	(InitParameterRangeCheck): Add new parameter parentRangeId.
	(FoldRangeCheck): Add new parameter range.
	* gm2-compiler/M2Range.mod (InitTypesParameterCheck): Add new
	parameter depRangeId.
	(InitParameterRangeCheck): Add new parameter parentRangeId.
	(FoldRangeCheck): Add new parameter range and rewrite.
	(FoldRangeCheckLower): New procedure.
	(Range): New field cancelled.
	New field dependantid.
	(PutRangeParam): Initialize dependantid.
	(PutRangeParamAssign): Ditto.
	(CheckCancelled): New procedure.
	(Cancel): Ditto.
	(IsCancelled): New procedure function.
	(FoldTypeParam): Add depRangeId parameter.
	(WriteRangeCheck): Add dependent debugging.

gcc/testsuite/ChangeLog:

	PR modula2/118978
	* gm2/pim/fail/badparamtype.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-02-22 16:47:21 +00:00
2025-02-12 00:17:11 +00:00
2025-02-11 00:17:27 +00:00
2025-02-15 00:18:03 +00:00
2025-02-19 00:18:02 +00:00
2025-02-22 00:17:38 +00:00
2025-02-12 00:17:11 +00:00
2025-02-12 00:17:11 +00:00
2025-02-21 00:17:36 +00:00
2025-02-20 00:18:17 +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%