public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/114617] gm2 is unable to resolve const expression using relative operators ICE Date: Sat, 06 Apr 2024 22:46:15 +0000 [thread overview] Message-ID: <bug-114617-4-xEQvhM7fgO@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114617-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114617 --- Comment #4 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:4e3c8257304c55f2ebfb24bd6de3236bda0f054e commit r14-9823-g4e3c8257304c55f2ebfb24bd6de3236bda0f054e Author: Gaius Mulley <gaiusmod2@gmail.com> Date: Sat Apr 6 23:45:35 2024 +0100 PR modula2/114617 gm2 unable to resolve const expressions using relop ICE This patch allows cc1gm2 to resolve constant expressions which use relative operators. Previous to the patch the result of a relop was stored in a temporary variable set by an if then else quadruple sequence. This patch marks a const expression in the quadruples and then reduces this sequence of quadruples into a single assignment to an internal constant. gcc/m2/ChangeLog: PR modula2/114617 * gm2-compiler/M2GenGCC.mod (CodeStatememt): Add quad trace. (ResolveConstantExpressions): Add parameter p to FoldIfLess, FoldIfGre, FoldIfLessEqu, FoldIfGreEqu, FoldIfEqu, FoldIfNotEqu, FoldIfIn and FoldIfNotIn. (CodeInline): Add constExpr variable and pass it to GetQuadOtok. (CodeReturnValue): Ditto. (CodeParam): Ditto. (FoldStringLength): Ditto. (FoldStringConvertM2nul): Ditto. (FoldStringConvertCnul): Ditto. (DeclaredOperandsBecomes): Ditto. (TypeCheckBecomes): Ditto. (PerformFoldBecomes): Ditto. (CodeBecomes): Ditto. (CheckElementSetTypes): Ditto. (CodeBinarySet): Ditto. (PerformCodeIfLess): Ditto. (PerformCodeIfGre): Ditto. (PerformCodeIfLessEqu): Ditto. (PerformCodeIfGreEqu): Ditto. (PerformCodeIfEqu): Ditto. (PerformCodeIfNotEqu): Ditto. (IsValidExpressionRelOp): Ditto. (PerformCodeIfIn): Ditto. (PerformCodeIfNotIn): Ditto. (CodeXIndr): Ditto. (QuadCondition): New procedure function. (IsBooleanRelOpPattern): Ditto. (FoldBooleanRelopPattern): Ditto. (FoldIfGre): Check for boolean relop constant expression and add parameter p. (FoldIfLessEqu): Ditto. (FoldIfIn): Ditto. (FoldIfEqu): Ditto. (FoldIfNotIn): Ditto. (FoldIfGreEqu): New procedure. (FoldIfNotEqu): Ditto. * gm2-compiler/M2Optimize.mod (ReduceBranch): Add constExpr variable and pass it to GetQuadOtok. * gm2-compiler/M2Quads.def (IsBecomes): New procedure function. (IsDummy): Ditto. (IsQuadConstExpr): Ditto. (SetQuadConstExpr): Ditto. (GetQuadDest): New procedure. (GetQuadOp1): New procedure. (GetQuadOp2): New procedure. (GetQuadOp3): New procedure. (GetQuadOtok): New procedure. (GetQuadOTypetok): New procedure. (PutQuadOtok): New procedure. (IsInConstParameters): New procedure function. * gm2-compiler/M2Quads.mod (IsBecomes): New procedure function. (IsDummy): Ditto. (IsQuadConstExpr): Ditto. (SetQuadConstExpr): Ditto. (GetQuadDest): New procedure. (GetQuadOp1): New procedure. (GetQuadOp2): New procedure. (GetQuadOp3): New procedure. (GetQuadOtok): New procedure. (GetQuadOTypetok): New procedure. (PutQuadOtok): New procedure. (IsInConstParameters): New procedure function. (ConstStack): Remove to ... (ConstExprStack): ... this. (ConstParamStack): New variable and initialize. (QuadFrame): New field ConstExpr. (GetQuadOtok): Add parameter constExpr and assign. (PutQuadOtok): Add constExpr parameter and assign. (PutQuadOType): Ditto. (GetQuadOTypetok): Ditto. (EraseQuad): Assign ConstExpr to FALSE. (FoldSubrange): Set ConstExpr to FALSE in BecomesOp. (PushInConstParameters): New procedure. (PopInConstParameters): New procedure. (IsInConstParameters): New procedure function. * gm2-compiler/M2SymInit.mod (IssueConditional): Add constExpr boolean variable. (CheckReadBeforeInitQuad): Ditto. (trashParam): Ditto. * gm2-compiler/P3Build.bnf (ConstExpression): Call PushInConstExpression and PopInConstExpression. (ConstSetOrQualidentOrFunction): Call PushInConstParameters and PopInConstParameters. * gm2-compiler/PCBuild.bnf (ConstExpression): Call PushInConstExpression and PopInConstExpression. * gm2-compiler/PHBuild.bnf: Ditto * gm2-gcc/m2expr.cc (m2expr_BuildCondIfExpression): New function. * gm2-gcc/m2expr.def (BuildCondIfExpression): New prototype. * gm2-gcc/m2expr.h (m2expr_BuildCondIfExpression): New function. gcc/testsuite/ChangeLog: PR modula2/114617 * gm2/iso/const/pass/iso-const-pass.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
next prev parent reply other threads:[~2024-04-06 22:46 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-06 2:53 [Bug modula2/114617] New: " gaius at gcc dot gnu.org 2024-04-06 2:54 ` [Bug modula2/114617] " gaius at gcc dot gnu.org 2024-04-06 3:02 ` gaius at gcc dot gnu.org 2024-04-06 8:46 ` gaius at gcc dot gnu.org 2024-04-06 22:46 ` cvs-commit at gcc dot gnu.org [this message] 2024-04-06 22:52 ` gaius at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114617-4-xEQvhM7fgO@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).