emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Fix library_browser.js use of assertions with ASSERTIONS=0

Open ifiddynine opened this issue 2 years ago • 6 comments

ifiddynine avatar Jan 22 '24 15:01 ifiddynine

BTW is there any way we could automatically drop asserts through the compiler if ASSERTIONS=0? I've come across this a few times now, seems error prone the way it's done atm.

ifiddynine avatar Jan 22 '24 15:01 ifiddynine

Yes we have thought about perhaps removing these using tools/acorn-optimizer.mjs... is that what you meant by "automatically drop asserts through the compiler". I'm not sure how easy it would be, but it should be possible, and it would make the input code easier to read for sure.

sbc100 avatar Jan 22 '24 17:01 sbc100

I'm curious why non of our existing tests are hitting this error. Do we not run any browser tests with assertions disabled?

Oh, this is only an issue in STRICT mode I believe and maybe we don't run browser tests in STRICT mode yet.

Can I ask how you ran into this bug? Are you using STRICT mode? Or MINIMAL_RUNTIME perhaps?

sbc100 avatar Jan 22 '24 18:01 sbc100

I'm curious why non of our existing tests are hitting this error. Do we not run any browser tests with assertions disabled?

Oh, this is only an issue in STRICT mode I believe and maybe we don't run browser tests in STRICT mode yet.

Can I ask how you ran into this bug? Are you using STRICT mode? Or MINIMAL_RUNTIME perhaps?

Yup we run STRICT, but not MINIMAL_RUNTIME

ifiddynine avatar Jan 22 '24 19:01 ifiddynine

Could you perhaps add a -sSTRICT to one or more of the browser tests and verify that they then fail without this change? (Perhaps test_html5_core?)

sbc100 avatar Jan 22 '24 19:01 sbc100

Have these issues already been fixed or should we still try to land this change?

sbc100 avatar Apr 26 '24 06:04 sbc100