Skip to content

nixfmt modifies integers to signed 32 bits integers on 32 bit platforms #261

@symphorien

Description

@symphorien

Description

nixfmt formats 3000000000 into -1294967296 on armv7 (a 32 bit platform)

Steps to reproduce

$  echo '3000000000' | /nix/store/g5sxhbx8c0h585rnyacf3caa1k9pzq3n-nixfmt-unstable-2024-08-08/bin/nixfmt
-1294967296                                                                                                                                                                                                                                                                                                                                                                                         

3000000000 is a 32 bit unsigned integer with the first bit set: reinterpreted as a signed 32 bit integer it becomes -1294967296

Context:

32bit nix handles these numbers fine:

$  nix repl
Welcome to Nix 2.18.5. Type :? for help.

nix-repl> 3000000000
3000000000

nixfmt does not have this issue on x86_64 (and presumably on all 64bit platforms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorrectnessOutput parses differently after formatting

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions