This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/21035] New: longjmp() resets FPU exception mask


https://sourceware.org/bugzilla/show_bug.cgi?id=21035

            Bug ID: 21035
           Summary: longjmp() resets FPU exception mask
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: nyh at math dot technion.ac.il
  Target Milestone: ---

Created attachment 9745
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9745&action=edit
Code demonstrating this problem (C++)

I wrote a small test for feenablexcept() which enables an FPU exception (e.g.,
FE_DIVBYZERO), makes it happen (dividing 1.0 by 0.0), catches the exception,
and longjmp()s to return from the test. See code below.

However, it turns out that longjmp(), very unexpectedly, resets the exception
mask back to zero! So after an feenableexcept() we'll get one exception and
longjmp, but a second division by zero will no longer generate a signal.

Code demonstrating this problem attached.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]