Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minifier: invalid handling of exponentiate with NaN exponent #8942

Closed
hyp3rflow opened this issue May 10, 2024 · 1 comment · Fixed by #8947
Closed

minifier: invalid handling of exponentiate with NaN exponent #8942

hyp3rflow opened this issue May 10, 2024 · 1 comment · Fixed by #8947
Assignees
Labels

Comments

@hyp3rflow
Copy link
Sponsor Contributor

Describe the bug

I thought that #8924 occurs only in undefined exponent, however same result happens with NaN exponent.

Input code

"use strict";
const k = (() => {
  let x = 1;
  x **= undefined / x;
  return x;
})();

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es2022",
    "loose": false,
    "minify": {
      "compress": {
        "arguments": false,
        "arrows": true,
        "booleans": true,
        "booleans_as_integers": false,
        "collapse_vars": true,
        "comparisons": true,
        "computed_props": true,
        "conditionals": true,
        "dead_code": true,
        "directives": true,
        "drop_console": false,
        "drop_debugger": true,
        "evaluate": true,
        "expression": false,
        "hoist_funs": false,
        "hoist_props": true,
        "hoist_vars": false,
        "if_return": true,
        "join_vars": true,
        "keep_classnames": false,
        "keep_fargs": true,
        "keep_fnames": false,
        "keep_infinity": false,
        "loops": true,
        "negate_iife": true,
        "properties": true,
        "reduce_funcs": false,
        "reduce_vars": false,
        "side_effects": true,
        "switches": true,
        "typeofs": true,
        "unsafe": false,
        "unsafe_arrows": false,
        "unsafe_comps": false,
        "unsafe_Function": false,
        "unsafe_math": false,
        "unsafe_symbols": false,
        "unsafe_methods": false,
        "unsafe_proto": false,
        "unsafe_regexp": false,
        "unsafe_undefined": false,
        "unused": true,
        "const_to_let": true,
        "pristine_globals": true
      },
      "mangle": {
        "toplevel": false,
        "keep_classnames": false,
        "keep_fnames": false,
        "keep_private_props": false,
        "ie8": false,
        "safari10": false
      }
    }
  },
  "module": {
    "type": "commonjs"
  },
  "minify": false,
  "isModule": false
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.5.5&code=H4sIAAAAAAAAAxXIQQqAIBBG4b2n%2BHE1uonWYpfRCaSYQEcQorunu%2Fc%2B2xujaS1JbTDpkaa4EEHkEA%2B8BrhZMSbtYc6A9xFdMp9FOGPDWFxZe5XVnyMXfkvq7g1WAAAA&config=H4sIAAAAAAAAA41VwW7bMAy99ysCn3focir2AbvtGwTFohxlsmiIlJugyL%2BPVuw0bWhjlyDm0yNF8pH6eNntmhO1za%2Fdh%2FyVj8Fmgnz%2FFgtdEtuzWBpoe0ttDgM3Pxb0RBPkbSSopusNadjmDriyaP%2B638%2BMJiISLIzZ1ocU%2FOUxZov9kIHowSZWcVl6SExf%2BTOW8X0COJdH%2BwExgk0biLFkQmLoIGuOW4zRDgRmtFnxMt3U5kCohZjAwuDMkHFQ8eQCB0wS8xl1YJ1p0YEChQwthxE0msQSWiJJT8mnwg4Opetqn7%2BxYbSxWFZiwrm2RG6reD1iIDa%2BJK2EN3ClBjdwLu53ZvAmA5ecnnknDGmlJ38BpALREiXbg%2Ba3nvCipzW232SG5EWyfFFw0beWZYJOimpC8Eplp8pA5qB1M4MrLUyVbbXrzPBK%2BSg4MOC9aEVxTe%2BB26MWlC8DoFcA6a%2F1mqpugLlP4Qo%2BDcQG%2FFuyZF1g84ne8nEdpUt%2FwLgRoAc%2Bots4IK1gXIezbInzsI6X5ECkAU49UqgCz0tABoDRxLovn7Qh4yEeTRfx8Lkm5gPX%2Bx7uberqvD%2FsS8YhwghxTcb%2FMSKbqNxtnFS9TPbT9MKbJkorgxd%2Bvn55NiSVl%2BW3JtX06MpDQlWT03MiEuoxnaj5PLk8H%2FdITaA%2FC%2F0W4%2FoPf3j7aeoGAAA%3D

SWC Info output

No response

Expected behavior

k should be NaN

Actual behavior

k is 1

Version

1.5.5

Additional context

No response

@kdy1 kdy1 self-assigned this May 12, 2024
kdy1 added a commit that referenced this issue May 13, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Jun 12, 2024

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants