diff --git a/arm64-gen.c b/arm64-gen.c index 5606271c..463541f1 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -1775,7 +1775,7 @@ ST_FUNC void gen_cvt_ftoi(int t) ST_FUNC void gen_cvt_ftof(int t) { - int f = vtop[0].type.t; + int f = vtop[0].type.t & VT_BTYPE; assert(t == VT_FLOAT || t == VT_DOUBLE || t == VT_LDOUBLE); assert(f == VT_FLOAT || f == VT_DOUBLE || f == VT_LDOUBLE); if (t == f) diff --git a/tests/tests2/22_floating_point.c b/tests/tests2/22_floating_point.c index e3491f5c..2eb062c3 100644 --- a/tests/tests2/22_floating_point.c +++ b/tests/tests2/22_floating_point.c @@ -1,6 +1,19 @@ #include #include +float fd; + +int +test() +{ + // was an internal tcc compiler error with arm64 backend until 2019-11-08 + if (fd < 5.5) { + return 1; + } else { + return 0; + } +} + int main() { // variables