emscripten-core / emscripten-core/emscripten
wrong code at -Os
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
```
[551] % emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.42 (6ede0b8fc1c979bb206148804bfb48b472ccc3da)
clang version 17.0.0 (https://github.com/llvm/llvm-project f3b64887de61020c09404bfee97b2fadd30df10a)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /local/home/suz/suz-local/software/emsdk/upstream/bin
[552] %
[552] % emcc -O1 small.c -o small.js
[553] % node small.js; echo $?
0
[554] % emcc -Os small.c -o small.js
[555] % node small.js; echo $?
1
[556] % cat small.c
int a, b, d;
unsigned c, h, i;
unsigned long long f;
long long q;
int main() {
int e = 0, g = 1;
h = e;
k:
if (q) {
l:
q = i;
goto m;
}
if (q < d)
goto r;
h = -1;
f = -2;
b = f;
for (; a < 2; a++) {
if (h < i)
return 1;
int n = ~b;
m:
c = h;
int o = h & q || b;
if (!o)
goto l;
i = n;
h = q;
if (!g)
goto k;
if (q)
goto p;
r:
if (c > f)
continue;
h = c;
if (0)
p:
g = 0;
}
return 0;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.