public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug math/30998] New: fesetexceptflag clears too many floating-point exception flags on alpha @ 2023-10-24 18:19 bruno at clisp dot org 2023-10-24 18:20 ` [Bug math/30998] " bruno at clisp dot org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: bruno at clisp dot org @ 2023-10-24 18:19 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=30998 Bug ID: 30998 Summary: fesetexceptflag clears too many floating-point exception flags on alpha Product: glibc Version: 2.36 Status: UNCONFIRMED Severity: normal Priority: P2 Component: math Assignee: unassigned at sourceware dot org Reporter: bruno at clisp dot org Target Milestone: --- Created attachment 15196 --> https://sourceware.org/bugzilla/attachment.cgi?id=15196&action=edit test case foo.c On Linux/alpha, the function fesetexceptflag() clears some exception flags that are outside the EXCEPTS argument. This violates ISO C 23 § 7.6.4.5, which says: "The fesetexceptflag function attempts to set the floating-point status flags indicated by the argument excepts to the states stored in the object pointed to by flagp." How to reproduce: Compile and run the attached program. $ gcc -Wall foo.c -lm $ ./a.out Expected: It terminates with exit code 0. Actual: a.out: foo.c:58: main: Assertion `fetestexcept (FE_DIVBYZERO) == FE_DIVBYZERO' failed. Aborted When you compare the program's lines 49 and 58, you see that the invocation fesetexceptflag (&saved_flags_2, FE_OVERFLOW) not only modified the FE_OVERFLOW flag bit, but also cleared the FE_DIVBYZERO flag bit. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug math/30998] fesetexceptflag clears too many floating-point exception flags on alpha 2023-10-24 18:19 [Bug math/30998] New: fesetexceptflag clears too many floating-point exception flags on alpha bruno at clisp dot org @ 2023-10-24 18:20 ` bruno at clisp dot org 2023-10-24 18:20 ` bruno at clisp dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: bruno at clisp dot org @ 2023-10-24 18:20 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=30998 Bruno Haible <bruno at clisp dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Host| |alpha-linux-gnu -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug math/30998] fesetexceptflag clears too many floating-point exception flags on alpha 2023-10-24 18:19 [Bug math/30998] New: fesetexceptflag clears too many floating-point exception flags on alpha bruno at clisp dot org 2023-10-24 18:20 ` [Bug math/30998] " bruno at clisp dot org @ 2023-10-24 18:20 ` bruno at clisp dot org 2023-10-24 18:24 ` bruno at clisp dot org 2023-12-19 18:39 ` adhemerval.zanella at linaro dot org 3 siblings, 0 replies; 5+ messages in thread From: bruno at clisp dot org @ 2023-10-24 18:20 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=30998 --- Comment #1 from Bruno Haible <bruno at clisp dot org> --- Seen on Debian 12.0/alpha. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug math/30998] fesetexceptflag clears too many floating-point exception flags on alpha 2023-10-24 18:19 [Bug math/30998] New: fesetexceptflag clears too many floating-point exception flags on alpha bruno at clisp dot org 2023-10-24 18:20 ` [Bug math/30998] " bruno at clisp dot org 2023-10-24 18:20 ` bruno at clisp dot org @ 2023-10-24 18:24 ` bruno at clisp dot org 2023-12-19 18:39 ` adhemerval.zanella at linaro dot org 3 siblings, 0 replies; 5+ messages in thread From: bruno at clisp dot org @ 2023-10-24 18:24 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=30998 --- Comment #2 from Bruno Haible <bruno at clisp dot org> --- Created attachment 15197 --> https://sourceware.org/bugzilla/attachment.cgi?id=15197&action=edit proposed fix Find attached a proposed fix. The bug is obviously in glibc/sysdeps/alpha/fpu/fsetexcptflg.c . The line tmp = (tmp & ~SWCR_STATUS_MASK) | (*flagp & excepts & SWCR_STATUS_MASK); needs to be changed to tmp = (tmp & ~(excepts & SWCR_STATUS_MASK)) | (*flagp & excepts & SWCR_STATUS_MASK); A optimized expression (produces one less instruction when compiled by "alpha-linux-gnu-gcc -O2") is: tmp ^= (tmp ^ *flagp) & excepts & SWCR_STATUS_MASK; -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug math/30998] fesetexceptflag clears too many floating-point exception flags on alpha 2023-10-24 18:19 [Bug math/30998] New: fesetexceptflag clears too many floating-point exception flags on alpha bruno at clisp dot org ` (2 preceding siblings ...) 2023-10-24 18:24 ` bruno at clisp dot org @ 2023-12-19 18:39 ` adhemerval.zanella at linaro dot org 3 siblings, 0 replies; 5+ messages in thread From: adhemerval.zanella at linaro dot org @ 2023-12-19 18:39 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=30998 Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.39 CC| |adhemerval.zanella at linaro dot o | |rg Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> --- Fixed on 2.39 (80a40a9e14d9a01e3f70c5b37ecd1da83033b6de). -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-19 18:39 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-10-24 18:19 [Bug math/30998] New: fesetexceptflag clears too many floating-point exception flags on alpha bruno at clisp dot org 2023-10-24 18:20 ` [Bug math/30998] " bruno at clisp dot org 2023-10-24 18:20 ` bruno at clisp dot org 2023-10-24 18:24 ` bruno at clisp dot org 2023-12-19 18:39 ` adhemerval.zanella at linaro dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).