]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/112893 detect procedure address incompatible with cardinal in iso
authorGaius Mulley <gaiusmod2@gmail.com>
Thu, 7 Dec 2023 13:10:49 +0000 (13:10 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Thu, 7 Dec 2023 13:10:49 +0000 (13:10 +0000)
commitf8c8aebc597611b8d37edce165a891d00e23a9c1
tree095ac9e84fa1beb397633e9e3720662dea308258
parentabded9bf3e1ebc1789d47ac2c445f5b613981a0e
PR modula2/112893 detect procedure address incompatible with cardinal in iso

In ISO m2 the type cardinal is assignment incompatible with address (but
it is allowed in PIM).  The patch also extends the type checker to include
procedures (which appear as having GetType () = address).  At some point
this should be be improved to use a pointer to proc type.  Perhaps in
the next stage1.
For now this will catch procedures being passed as actual parameters into
a formal cardinal parameter in ISO m2 (for example).

gcc/m2/ChangeLog:

PR modula2/112893
* gm2-compiler/M2Base.mod (Ass): Extend array to include proc row
and column.  Allow PIM to assign cardinal variables to address
variables.
(Expr): Ditto.
(Comp): Ditto.
* gm2-compiler/M2Check.mod (getSType): New procedure function.
Replace all occurances of GetSType with getSType.
* gm2-compiler/M2GenGCC.mod (CodeParam): Rewrite format specifier
error message.
* gm2-compiler/M2Quads.mod (CheckProcTypeAndProcedure): Add tokno
parameter.
* gm2-compiler/M2Range.def (InitTypesParameterCheck): Add tokno
parameter.
(InitParameterRangeCheck): Add tokno parameter.
Remove EXPORT QUALIFIED list.
(InitParameterRangeCheck): Add tokno parameter.
* gm2-compiler/M2Range.mod (InitTypesParameterCheck): Add tokno
parameter and pass tokno to PutRangeParam.
(InitParameterRangeCheck): Add tokno parameter and pass tokno to
PutRangeParam.
(PutRangeParam): Add tokno parameter and assign to tokenNo.
(FoldTypeParam): Rewrite format string.

gcc/testsuite/ChangeLog:

PR modula2/112893
* gm2/iso/fail/proccard.mod: New test.
* gm2/pim/pass/proccard.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/M2Base.mod
gcc/m2/gm2-compiler/M2Check.mod
gcc/m2/gm2-compiler/M2GenGCC.mod
gcc/m2/gm2-compiler/M2Quads.mod
gcc/m2/gm2-compiler/M2Range.def
gcc/m2/gm2-compiler/M2Range.mod
gcc/testsuite/gm2/iso/fail/proccard.mod [new file with mode: 0644]
gcc/testsuite/gm2/pim/pass/proccard.mod [new file with mode: 0644]