https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113730
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 with
another fixed sized type.
For example:
VAR
c32: CARDINAL32 ;
c64: CARDINAL64 ;
BEGIN
c32 := 1 ;
c64 := 2 ;
c64 := c64 + c32 ; (* Correctly: fails with incompatible expression. *)
c64 := c64 * 2 + c32 ; (* Incorrectly passes! *)