leaningtech / cheerp-meta

Cheerp - a C/C++ compiler for Web applications - compiles to WebAssembly and JavaScript
https://labs.leaningtech.com/cheerp
Other
1.02k stars 50 forks source link

Crash at LinearMemoryHelper #130

Closed zyz9740 closed 1 year ago

zyz9740 commented 1 year ago

crash_CheerpWasmWriter.zip

This case crash at LinearMemoryHelper, but it can't be linked by clang as well.

But I think may indicate some hidden bugs so I share it with you. If you think it is meaningless, you can just close this issue.

carlopi commented 1 year ago

Hi, this particular case could be handled better (as in having a more controlled failure mode), but should still result in a compilation error.

/opt/cheerp/bin/clang random.c -cheerp-strict-linking=error

will point you to the missing definitions, like:

error: symbol not defined d
error: symbol not defined f
LLVM ERROR: Strict linking enabled and undefined symbols found
// Plus still actual crash

Other command line option is -cheerp-strict-linking=warning that would only emit those as warning.

The reasoning behind being more lax with undefined symbols is that as long as they can be compiled away, it might still be of use to have them fail as late as possible.

I think in this particular case we, the development team, are aware of the problem, and won't be fixed in the short term, so I am inclined to simply close this issue.

zyz9740 commented 1 year ago

Thanks again for quick respond !