]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
[PowerPC64] Fix multiple issues in fpsetmask().
authorBrandon Bergren <bdragon@FreeBSD.org>
Mon, 1 Mar 2021 02:35:53 +0000 (20:35 -0600)
committerBrandon Bergren <bdragon@FreeBSD.org>
Mon, 8 Mar 2021 19:00:55 +0000 (13:00 -0600)
commit015a37124b91043b7f052352a2ba9f19b5d8b5a7
treeb15a6f527aed2c4df5f955bd7dadd77fe01db413
parent1a4b9c2827dc74867ceed85febf89f3924605c43
[PowerPC64] Fix multiple issues in fpsetmask().

Building R exposed a problem in fpsetmask() whereby we were not properly
clamping the provided mask to the valid range.

R initilizes the mask by calling fpsetmask(~0) on FreeBSD. Since we
recently enabled precise exceptions, this was causing an immediate
SIGFPE because we were attempting to set invalid bits in the fpscr.

Properly limit the range of bits that can be set via fpsetmask().

While here, use the correct fp_except_t type instead of fp_rnd_t.

Reported by: pkubaj (in IRC)
Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit dd95b39235dd81c890aa3cce02a5bb7f91f23803)
(cherry picked from commit a79735386c46298274d71577ab6b4dd00be261cc)
lib/libc/powerpc64/gen/fpsetmask.c