[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-03-14
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

--- Comment #2 from Gaius Mulley  ---
Created attachment 57694
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57694&action=edit
Proposed fix

Here is a proposed fix.  The fixes were mainly made in M2Check.mod with a few
checking calls made in M2GenGCC.mod.  This patch fixes # and = comparisons a
later patch will include the remaining four comparison tests.

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

--- Comment #3 from GCC Commits  ---
The master branch has been updated by Gaius Mulley :

https://gcc.gnu.org/g:b7f70cfdb6f7ab369ecca14a99a0064d2a11ddd2

commit r14-9463-gb7f70cfdb6f7ab369ecca14a99a0064d2a11ddd2
Author: Gaius Mulley 
Date:   Thu Mar 14 11:23:42 2024 +

PR modula2/114333 set type comparison against a cardinal should cause an
error

The type checker M2Check.mod needs extending to detect if a set, array or
record is in either operand at the end of the cascaded test list.

gcc/m2/ChangeLog:

PR modula2/114333
* gm2-compiler/M2Check.mod (checkUnbounded): New procedure
function.
(checkArrayTypeEquivalence): Extend checking to cover unbounded
arrays, arrays and constants.
(IsTyped): Simplified the expression and corrected a test for
IsConstructor.
(checkTypeKindViolation): New procedure function.
(doCheckPair): Call checkTypeKindViolation.
* gm2-compiler/M2GenGCC.mod (CodeStatement): Remove parameters
to CodeEqu and CodeNotEqu.
(PerformCodeIfEqu): New procedure.
(CodeIfEqu): Rewrite.
(PerformCodeIfNotEqu): New procedure.
(CodeIfNotEqu): Rewrite.
* gm2-compiler/M2Quads.mod (BuildRelOpFromBoolean): Correct
comment.

gcc/testsuite/ChangeLog:

PR modula2/114333
* gm2/cse/pass/testcse54.mod: New test.
* gm2/iso/run/pass/array9.mod: New test.
* gm2/iso/run/pass/strcons3.mod: New test.
* gm2/iso/run/pass/strcons4.mod: New test.
* gm2/pim/fail/badset1.mod: New test.
* gm2/pim/fail/badset2.mod: New test.
* gm2/pim/fail/badset3.mod: New test.
* gm2/pim/fail/badset4.mod: New test.

Signed-off-by: Gaius Mulley 

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

--- Comment #5 from GCC Commits  ---
The master branch has been updated by Gaius Mulley :

https://gcc.gnu.org/g:7aeedff6a426cc05024af0bc92116d676a5ba42b

commit r14-9475-g7aeedff6a426cc05024af0bc92116d676a5ba42b
Author: Gaius Mulley 
Date:   Thu Mar 14 15:34:36 2024 +

PR modula2/114333 set type comparison against cardinal should cause error
addendum

This patch applies the new stricter type checking procedure function to
the remaining 6 comparisons: less, greater, lessequ, greequ, ifin and
ifnotin.

gcc/m2/ChangeLog:

PR modula2/114333
* gm2-compiler/M2GenGCC.mod (CodeStatement): Remove op1, op2 and
op3 parameters to CodeIfLess, CodeIfLessEqu, CodeIfGreEqu,
CodeIfGre,
CodeIfIn, CodeIfNotIn.
(CodeIfLess): Rewrite.
(PerformCodeIfLess): New procedure.
(CodeIfLess): Rewrite.
(PerformCodeIfLess): New procedure.
(CodeIfLessEqu): Rewrite.
(PerformCodeIfLessEqu): New procedure.
(CodeIfGreEqu): Rewrite.
(PerformCodeIfGreEqu): New procedure.
(CodeIfGre): Rewrite.
(PerformCodeIfGre): New procedure.
(CodeIfIn): Rewrite.
(PerformCodeIfIn): New procedure.
(CodeIfNotIn): Rewrite.
(PerformCodeIfNotIn): New procedure.

gcc/testsuite/ChangeLog:

PR modula2/114333
* gm2/pim/fail/badset5.mod: New test.
* gm2/pim/fail/badset6.mod: New test.

Signed-off-by: Gaius Mulley