From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 641F9385AFA4; Fri, 28 Jul 2023 14:12:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 641F9385AFA4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690553526; bh=SpTnvwtj3roocI6v5MHMXE4di+JMb+zFN2B2sO7qiPg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n0j62mdDFl8FFP5HSBeK+9B4CBWrqkNbQZG4dqJZjySKBMys4qwpvsSCKKM8j3HE8 6dAd+Dx0dXFYsNJVK7E5tmOq+ZAftdjwxxQXIQAi8dDUYjHNKjLIsX9VbelNEn0EdO NdDhuCBnncANY/gQYQW2hArFycLEC/bM/2WvplVQ= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/110246] Using variables of type CHAR or BYTE as array index does not work Date: Fri, 28 Jul 2023 14:12:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: modula2 X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: gaius at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110246 --- Comment #2 from CVS Commits --- The releases/gcc-13 branch has been updated by Gaius Mulley : https://gcc.gnu.org/g:3e9aaa9bcb2fc64e64f4e8a2aa0f6f7395a21c52 commit r13-7622-g3e9aaa9bcb2fc64e64f4e8a2aa0f6f7395a21c52 Author: Gaius Mulley Date: Fri Jul 28 15:00:29 2023 +0100 PR modula2/109729 cannot use a CHAR type as a FOR loop iterator This patch introduces a new quadruple ArithAddOp which is used in the construction of FOR loop to ensure that when constant folding is applied it does not concatenate two constant char operands into a string constant. Overloading only occurs with constant operands. gcc/m2/ChangeLog: PR modula2/109729 PR modula2/110246 * gm2-compiler/M2GenGCC.mod (CodeStatement): Detect ArithAddOp and call CodeAddChecked. (ResolveConstantExpressions): Detect ArithAddOp and call FoldArithAdd. (FoldArithAdd): New procedure. (FoldAdd): Refactor to use FoldArithAdd. * gm2-compiler/M2Quads.def (QuadOperator): Add ArithAddOp. * gm2-compiler/M2Quads.mod: Remove commented imports. (QuadFrame): Changed comments to use GNU coding standards. (ArithPlusTok): New global variable. (BuildForToByDo): Use ArithPlusTok instead of PlusTok. (MakeOp): Detect ArithPlusTok and return ArithAddOp. (WriteQuad): Add ArithAddOp clause. (WriteOperator): Add ArithAddOp clause. (Init): Initialize ArithPlusTok. gcc/testsuite/ChangeLog: PR modula2/109729 * gm2/pim/run/pass/ForChar.mod: New test. (cherry picked from commit ac7c9954ece9a75c5e7c3b76a4800f2432002487) Signed-off-by: Gaius Mulley =