Skip to content
Snippets Groups Projects
Commit c1667b1e authored by Gaius Mulley's avatar Gaius Mulley
Browse files

PR modula2/114055 improve error message when checking the BY constant


The fix marks a constant created during the default BY clause of the
FOR loop as internal.  The type checker will always return true if
checking against an internal const.

gcc/m2/ChangeLog:

	PR modula2/114055
	* gm2-compiler/M2Check.mod (Import): IsConstLitInternal and
	IsConstLit.
	(isInternal): New procedure function.
	(doCheck): Test for isInternal in either operand and early
	return true.
	* gm2-compiler/M2Quads.mod (PushOne): Rewrite with extra
	parameter internal.
	(BuildPseudoBy): Add TRUE parameter to PushOne call.
	(BuildIncProcedure): Add FALSE parameter to PushOne call.
	(BuildDecProcedure): Add FALSE parameter to PushOne call.
	* gm2-compiler/M2Range.mod (ForLoopBeginTypeCompatible):
	Uncomment code and tidy up error string.
	* gm2-compiler/SymbolTable.def (PutConstLitInternal):
	New procedure.
	(IsConstLitInternal): New procedure function.
	* gm2-compiler/SymbolTable.mod (PutConstLitInternal):
	New procedure.
	(IsConstLitInternal): New procedure function.
	(SymConstLit): New field IsInternal.
	(CreateConstLit): Initialize IsInternal to FALSE.

gcc/testsuite/ChangeLog:

	PR modula2/114055
	* gm2/pim/fail/forloopby.mod: New test.
	* gm2/pim/pass/forloopby2.mod: New test.

Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
parent 92c40297
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment