Skip to content

Incorrect constant folding of word equality #341

Description

@JohnReppy

Version

110.99.7.1 (Latest)

Operating System

  • Any
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

No response

Processor

  • Any
  • Arm (using Rosetta)
  • PowerPC
  • Sparc
  • x86 (32-bit)
  • x86-64 (64-bit)
  • Other

System Component

Core system

Severity

Minor

Description

The constant folding of word equality produces incorrect results when one of the arguments is a negative integer wrapped by the Word.fromInt function. Note that constant folding other comparison operators works correctly.

This issue was extracted from the Issue #340 report.

Transcript

Standard ML of New Jersey [Version 110.99.7.1; 64-bit; January 17, 2025]
- Word.fromInt ~1 = 0wx7fffffffffffffff;
val it = false : bool
- Word.fromInt ~1;
val it = 0wx7FFFFFFFFFFFFFFF : word
- it = 0wx7fffffffffffffff;
val it = true : bool

Expected Behavior

Since Word.fromInt ~1 is 0wx7FFFFFFFFFFFFFFF, a result of true is expected.

Steps to Reproduce

See above.

Additional Information

No response

Email address

jhr@cs.uchicago.edu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompilerproblem with compilerfixed-in-110.99.8Issues fixed in the 110.99.8 release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions