https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67929
Bug ID: 67929 Summary: [4.9/5/6 Regression][arm] Wrong code for FP mult-by-power-of-2 + int conversion Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ktkachov at gcc dot gnu.org Target Milestone: --- Target: arm* Testcase: int foo (float a) { return a * 4.9f; } int main (void) { if (foo (10.0f) != 49) __builtin_abort (); return 0; } Compiled with -Ofast -mfpu=vfpv3 -mfloat-abi=hard -mcpu=cortex-a15 -fno-inline aborts. The problem is foo (10.0f) returns 40. This is because the combine_vcvtf2i triggers where its predicate should have rejected 4.9f The vfp3_const_double_for_bits function in arm.c is too liberal and accepts any FP constant that, when truncated, evaluates to a power of 2 FP constant.