public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/114333] New: set type comparison against a cardinal should cause an error
@ 2024-03-14 8:39 gaius at gcc dot gnu.org
2024-03-14 8:57 ` [Bug modula2/114333] " gaius at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-14 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333
Bug ID: 114333
Summary: set type comparison against a cardinal should cause an
error
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: modula2
Assignee: gaius at gcc dot gnu.org
Reporter: gaius at gcc dot gnu.org
Target Milestone: ---
gm2 incorrectly allows set types to be compared to ZTyped constants. For
example the following code should generate an error at the IF expression.
MODULE badset2 ;
FROM libc IMPORT printf ;
PROCEDURE init ;
VAR
s: SET OF [1..2] ;
BEGIN
IF s = 10
THEN
printf ("failure\n")
END
END init ;
BEGIN
init
END badset2.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/114333] set type comparison against a cardinal should cause an error
2024-03-14 8:39 [Bug modula2/114333] New: set type comparison against a cardinal should cause an error gaius at gcc dot gnu.org
@ 2024-03-14 8:57 ` gaius at gcc dot gnu.org
2024-03-14 9:03 ` gaius at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-14 8:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-03-14
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/114333] set type comparison against a cardinal should cause an error
2024-03-14 8:39 [Bug modula2/114333] New: set type comparison against a cardinal should cause an error gaius at gcc dot gnu.org
2024-03-14 8:57 ` [Bug modula2/114333] " gaius at gcc dot gnu.org
@ 2024-03-14 9:03 ` gaius at gcc dot gnu.org
2024-03-14 11:24 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-14 9:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333
--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/114333] set type comparison against a cardinal should cause an error
2024-03-14 8:39 [Bug modula2/114333] New: set type comparison against a cardinal should cause an error gaius at gcc dot gnu.org
2024-03-14 8:57 ` [Bug modula2/114333] " gaius at gcc dot gnu.org
2024-03-14 9:03 ` gaius at gcc dot gnu.org
@ 2024-03-14 11:24 ` cvs-commit at gcc dot gnu.org
2024-03-14 11:25 ` gaius at gcc dot gnu.org
2024-03-14 15:35 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-14 11:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:b7f70cfdb6f7ab369ecca14a99a0064d2a11ddd2
commit r14-9463-gb7f70cfdb6f7ab369ecca14a99a0064d2a11ddd2
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Thu Mar 14 11:23:42 2024 +0000
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 <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/114333] set type comparison against a cardinal should cause an error
2024-03-14 8:39 [Bug modula2/114333] New: set type comparison against a cardinal should cause an error gaius at gcc dot gnu.org
` (2 preceding siblings ...)
2024-03-14 11:24 ` cvs-commit at gcc dot gnu.org
@ 2024-03-14 11:25 ` gaius at gcc dot gnu.org
2024-03-14 15:35 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-14 11:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now the patch has been applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/114333] set type comparison against a cardinal should cause an error
2024-03-14 8:39 [Bug modula2/114333] New: set type comparison against a cardinal should cause an error gaius at gcc dot gnu.org
` (3 preceding siblings ...)
2024-03-14 11:25 ` gaius at gcc dot gnu.org
@ 2024-03-14 15:35 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-14 15:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:7aeedff6a426cc05024af0bc92116d676a5ba42b
commit r14-9475-g7aeedff6a426cc05024af0bc92116d676a5ba42b
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Thu Mar 14 15:34:36 2024 +0000
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 <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-14 15:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 8:39 [Bug modula2/114333] New: set type comparison against a cardinal should cause an error gaius at gcc dot gnu.org
2024-03-14 8:57 ` [Bug modula2/114333] " gaius at gcc dot gnu.org
2024-03-14 9:03 ` gaius at gcc dot gnu.org
2024-03-14 11:24 ` cvs-commit at gcc dot gnu.org
2024-03-14 11:25 ` gaius at gcc dot gnu.org
2024-03-14 15:35 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).