From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 918973858403; Fri, 2 Feb 2024 22:05:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 918973858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706911524; bh=a4YCMTBPvwZt8YQPCcxbqnEd/lBDCD6S/4Lw9o6dHuw=; h=From:To:Subject:Date:From; b=Vnvc7Me4khtC7g8gAJxcqxw22mRXm/GauZZ/UYw2IpCs8GCVO9BoLYwfSasb56ijU ppJ1I2TJveB23S1V2QGBqx+xkkxi84FDVkjJV/IqoGeFxi3mGkrbe+Qykl2NxS5z4/ nC/xmDF1jmKp+4q0Ch16NbIZVBLD/adFACoOodg4= From: "gaius at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/113730] New: Unexpected handling of mixed-precision integer arithmetic Date: Fri, 02 Feb 2024 22:05:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: modula2 X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gaius 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D113730 Bug ID: 113730 Summary: Unexpected handling of mixed-precision integer arithmetic 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: --- As reported on the gm2 mailing list the compiler incorrectly compiles mixed precision arithmetic when an expression uses a ZType constant. It would appear that the expression is widened to a ZType which is then compatible w= ith another fixed sized type. For example: VAR c32: CARDINAL32 ; c64: CARDINAL64 ; BEGIN c32 :=3D 1 ; c64 :=3D 2 ; c64 :=3D c64 + c32 ; (* Correctly: fails with incompatible expression.= *) c64 :=3D c64 * 2 + c32 ; (* Incorrectly passes! *)=