about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorZong Li <zong@andestech.com>2018-11-01 17:34:39 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-11-01 17:34:39 +0000
commitff48ea6787526d7e669af93ce2681b911d39675c (patch)
treee62f4b7c05f630df014ad5a2524535b990a804c1 /sysdeps
parenteac4405af00464a4268cfd13b25224901c193988 (diff)
downloadglibc-ff48ea6787526d7e669af93ce2681b911d39675c.tar.gz
glibc-ff48ea6787526d7e669af93ce2681b911d39675c.tar.xz
glibc-ff48ea6787526d7e669af93ce2681b911d39675c.zip
soft-fp: Use temporary variable in FP_FRAC_SUB_3/FP_FRAC_SUB_4
In FRAC_SUB_3(R, X, Y) and FRAC_SUB_4(R,, X, Y), it reference both
the X[N] and X[N] after R[N] have been set. If one of the X and Y is
the same address with R, the result of the calculation is wrong,
because the value of the original X and Y are overwritten.

In glibc, there are two places use FRAC_SUB and occurs the overlap.
The first is _FP_DIV_MEAT_N_loop in op-common.h, it uses the source
_FP_DIV_MEAT_N_loop_u as the destination. This macro only be used
when N is one(_FP_DIV_MEAT_1_loop) and then the _FP_FRAC_SUB_##wc
extend to _FP_FRAC_SUB_1 in this macro. so it also work because
_FP_FRAC_SUB_1 has no overlap problem in its implementation.
The second places is _FP_DIV_MEAT_4_udiv, the original value of X##_f[0]
is overwritten before the calculatation.

In FRAC_SUB_1 and FRAC_SUB_2, there don't refer the source after
destination have been set, so they have no problem.

After this modification, we can pass the soft floating testing of glibc
testsuites on RV32.

	* soft-fp/op-4.h (_FP_FRAC_SUB_3, _FP_FRAC_SUB_4): Use temporary
	variable to avoid overlap arguments.
Diffstat (limited to 'sysdeps')
0 files changed, 0 insertions, 0 deletions