Skip to content

Minifier does not finish for a large arguments index #12108

Description

@magic-akari

Describe the bug

On main (5bf27fd72e), SWC does not complete minification for the input below when arguments compression is enabled and keep_fargs is false. No minified output is produced.

Input code

(function (zero, one) {
    console.log(
        arguments[20],
        arguments["20"],
        arguments[4294967295],
        arguments["4294967295"],
    );
})("zero", "one");

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript"
    },
    "target": "es2024",
    "minify": {
      "compress": {
        "arguments": true,
        "defaults": true,
        "keep_fargs": false,
        "passes": 2
      },
      "mangle": false,
    },
  },
  "isModule": true
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.15.47&code=H4sIAAAAAAAAA9NIK81LLsnMz1PQqEotytdRyM9L1VSo5lIAguT8vOL8nFS9nPx0DbAACCQWpZfmpuaVFEcbGcTqYBFWMjJQwiphYmRpYmlmbmRpil0fQh6mX9Oaq1ZTQwnkMCUdBSWg05Q0rQH86XHAsgAAAA%3D%3D&config=H4sIAAAAAAAAA22NwQrCMAyG73uKkfMOMjz5Dj6DhC4d1bYrTQuOsXdfWqdO8BKS78ufLE3bwp0VXNpFWhkCRqb4mYXw7BM%2BhQAph6yiCQmqXLtXJmEcKdUN7k%2F9GXbujDd6Pt5SkwuRmA9MqMSzI58KTjFT91UDacz2n3kQhZuWaHEaLR9lQGYqot%2FZ%2Bpbg0I%2BWfjPV1gKGr9OQ60J52KwbscEmiCMBAAA%3D

SWC Info output

N/A

Expected behavior

Minification completes and produces output equivalent to:

!function(zero, one) {
    console.log(arguments[20], arguments[20], arguments[4294967295], arguments[4294967295]);
}("zero", "one");

When executed, the output is:

undefined undefined undefined undefined

Actual behavior

On main, the minification process does not complete and produces no minified output. Depending on the environment, the process may be terminated before producing output.

Version

N/A

Additional context


This is message for readers, not the author of ths issue.

Please read no +1 before lefting a comment, or your comment will be deleted and you will be blocked.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions