test237
auto test237 =
q{--- test237
// Bug #27. be.emit_mc_amd64(257): ICE: Assertion failure: reg size mismatch 2 != 3
f64 to_f64(u8* s) {
f64 a = 0.0;
i32 c;
i32 e = 0;
c = *s++; // This expression will give use the "illegal hardware instruction" issue if I un-comment it
while (c != '\0' && is_digit(c)) {
a = a * 10.0 + (c - '0');
}
if (c == '.') {
c = *s++; // However, the same expression doesn't give the error here
while (c != '\0' && is_digit(c)) {
a = a * 10.0 + (c - '0');
e = e - 1;
c = *s++; // And here too!
}
}
if (c == 'e' || c == 'E') {
i32 sign = 1;
i32 i = 0;
c = *s++;
if (c == '+') c = *s++;
else if (c == '-') {
c = *s++;
sign = -1;
}
while (is_digit(c)) {
i = i * 10 + (c - '0');
c = *s++;
}
e += i*sign;
}
while (e > 0) {
a *= 10.0;
e--;
}
while (e < 0) {
a *= 0.1;
e++;
}
return a;
}
bool is_digit(i32 c) {
return c >= '0' && c <= '9';
}
};
tests passing
functionsvariables