Skip to content

minifier: incorrect minification in try_fold_left_child_op #7944

@Boshen

Description

@Boshen

((x - 1) & 1); -> x & 1;
((y >> 3) & 7); -> y & 3;

Reference:

https://github.com/google/closure-compiler/blob/ffa350b86aa68a8b3cf3b9e294c92f6b9f0831a3/src/com/google/javascript/jscomp/PeepholeFoldConstants.java#L1036

This was caught by monitor-oxc with luck .. took me a bit of time to track down.

https://github.com/oxc-project/monitor-oxc/actions/runs/12355173391/job/34478272871

/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/[email protected]/node_modules/brotli/build/encode.js:35
		if (!(a instanceof y)) throw a;
		                       ^

Error: [ReadHuffmanCode] invalid num_codes or space
    at ReadHuffmanCode (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/[email protected]/node_modules/brotli/dec/decode.js:2[21](https://github.com/oxc-project/monitor-oxc/actions/runs/12355173391/job/34478272871#step:8:22):48)
    at BrotliDecompress (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/[email protected]/node_modules/brotli/dec/decode.js:417:104)
    at BrotliDecompressBuffer (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/[email protected]/node_modules/brotli/dec/decode.js:351:2)
    at Object.b.readBinary (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/[email protected]/node_modules/brotli/build/encode.js:4:9)
    at Object.<anonymous> (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/[email protected]/node_modules/brotli/build/encode.js:27329:13)

The bigger problem for me is how to systemically detect these kind of regressions 😭

Metadata

Metadata

Assignees

Labels

C-bugCategory - Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions