https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91970
Bug ID: 91970
Summary: arm: 64bit int to double conversion does not respect
rounding mode
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: nsz at gcc dot gnu.org
Target Milestone: ---
on arm-* with
#include <fenv.h>
#include <stdio.h>
int main()
{
long long x = (1LL << 60) - 1;
double y;
fesetround(FE_DOWNWARD);
__asm__ __volatile__ ("" : "+m" (x));
y = x;
__asm__ __volatile__ ("" : "+m" (y));
fesetround(FE_TONEAREST);
printf("%a\n", y);
}
i get
0x1p60
instead of
0x1.fffffffffffffp+59
i assume this is because the conversion is handled by __aeabi_l2d
(also known as __floatdidf in libgcc) which is not rounding mode
aware.
this affects hardfloat targets which otherwise support directed
rounding modes.