NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-amd64/57949: fetestexcept disables all floating-point exception traps as a side effect
>Number: 57949
>Category: port-amd64
>Synopsis: fetestexcept disables all floating-point exception traps as a side effect
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 19 21:25:00 +0000 2024
>Originator: Taylor R Campbell
>Release: current, 10, 9, 8, 7, 6
>Organization:
The NetBSD Exception
>Environment:
amd64
>Description:
fetestexcept uses fnstenv, which has the side effect of masking all x87 floating-point exception traps.
There's no need to use this; it should just use fnstcw (and stmxcsr).
>How-To-Repeat:
unsigned enabled0, raised, enabled1;
feclearexcept(FE_ALL_EXCEPT);
fedisableexcept(FE_ALL_EXCEPT);
feenableexcept(FE_ALL_EXCEPT);
enabled0 = fegetexcept();
raised = fetestexcept(FE_ALL_EXCEPT);
enabled1 = fegetexcept();
printf("enabled0: 0x%x\n", enabled0);
printf("raised: 0x%x\n", raised);
printf("enabled1: 0x%x\n", enabled1);
Expected enabled0 and enabled1 to both be 0x3d, but instead enabled0 is 0x3d and enabled1 is 0.
>Fix:
Yes, please!
Home |
Main Index |
Thread Index |
Old Index