Skip to content

Different outcome cli vs file input #12052

@pvdz

Description

@pvdz
  • Version:
    v6.10.1-pre
    (although this appears to affect multiple versions)

  • Platform:
    Linux fox 4.4.0-64-generic Update README.md #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64

Test case:

var a = 0;
var i = 5;
do {
  try {
  } finally {
    var NaN = --a;
  }
} while (NaN && --i > 0)
console.log(a);

Test output:

$ node -v
v6.10.1-pre
$ uname -a
Linux fox 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ cat s.js
var a = 0;
var i = 5;
do {
  try {
  } finally {
    var NaN = --a;
  }
} while (NaN && --i > 0)
console.log(a);

$ node s.js
-5
$ cat s.js | node
-1
$ 

From mishoo/UglifyJS#1695. I was fuzzing the minifier when I ran into this case. The output when ran from file is different as when ran when piping cli.

The code doesn't seem to do anything in particular that would cause this difference, although redefining NaN could be its own reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions