Compilation timeout
Closed this issue · 4 comments
I find a strange situation when compiling a C program with both infinite loop and printf . Code is as follows:
#include <stdio.h>
int a = 1;
int main() {
printf("%d",a);
for (;;) {}
return 0;
}
# It works well
gcc random.c
# CPU 100% in opt process, also in O3
/opt/cheerp/bin/clang -target cheerp-wasm random.c -O3 -o random_cheerp.js
GCC compiles it well. But when using cheerp, I wait for a long time but it is still compiling. "top" shows that it is stuck in opt process. I think it may relate to some infinite loop optimization ? Note that printf and an infinite loop must both occur.
Can you reproduce this ?
I can't reproduce, as in with most update version of Cheerp this seems to work as expected.
This is potentially connected to a fix that was added a few months back to fix this sort of situation: leaningtech/cheerp-compiler@1db4772, which version of the compiler are you using? Can you give it another try with the nightly packages?
I excuted /opt/cheerp/bin/clang -v and I got this:
Cheerp 1658127505-1~focal clang version 15.0.0
Target: cheerp-leaningtech-webbrowser-wasm
Thread model: posix
InstalledDir: /opt/cheerp/./bin
What's the meaning of "1658127505-1~focal" ? I don't know how to get the version number like "2.7"
As to the result of nightly version, I will update my cheerp and come soon.
I think that refers to the identifier of the build, as in here: https://launchpad.net/~leaningtech-dev/+archive/ubuntu/cheerp-nightly-ppa/+packages.
So probably you are actually already using nightly's PPA, and should be just a matter of running apt upgrade
Just checked again, this is fixed in the current nightly version of Cheerp, thanks.