Bug 110209

Summary: --show-emwarns vs default fixup and floating point exception flags
Product: [Developer tools] valgrind Reporter: John Reiser <jreiser>
Component: memcheckAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: pjfloyd
Priority: NOR    
Version First Reported In: 3.0.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description John Reiser 2005-08-05 06:25:07 UTC
Memcheck does not give an emulation warning when it does not set or honor the
IEEE 754 floating point exception flags, even when --show-emwarns is in effect.
 The surprise for the user is that the answers are different but there is no
warning, even though the user asked for the best possible information from memcheck.

All of the "Fail:" lines below appear before the first "Emulation warning".

$ valgrind3 --show-emwarns=yes glibc-2.3.90-5/math/test-fenv
==27809== Memcheck, a memory error detector.
==27809== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==27809== Using LibVEX rev 1313, a library for dynamic binary translation.
==27809== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==27809== Using valgrind-3.0.0, a dynamic binary instrumentation framework.
==27809== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==27809== For more details, rerun with: -v
==27809==
Test: Initially all exceptions should be cleared
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Rounding direction should be initalized to nearest
  Pass: Rounding mode is TONEAREST.
Test: feclearexcept (FE_ALL_EXCEPT) clears all exceptions
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: feraiseexcept (FE_ALL_EXCEPT) raises all exceptions
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_DIVBYZERO: set flag, with rest not set
  Fail: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_DIVBYZERO: clear flag, rest also unset
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_DIVBYZERO: set flag, with rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_DIVBYZERO: clear flag, leave rest set
  Pass: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INVALID: set flag, with rest not set
  Pass: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INVALID: clear flag, rest also unset
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INVALID: set flag, with rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INVALID: clear flag, leave rest set
  Fail: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INEXACT: set flag, with rest not set
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INEXACT: clear flag, rest also unset
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INEXACT: set flag, with rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_INEXACT: clear flag, leave rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Pass: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_UNDERFLOW: set flag, with rest not set
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Fail: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_UNDERFLOW: clear flag, rest also unset
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_UNDERFLOW: set flag, with rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_UNDERFLOW: clear flag, leave rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Pass: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_OVERFLOW: set flag, with rest not set
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_OVERFLOW: clear flag, rest also unset
  Pass: Exception "DIVBYZERO" is not set
  Pass: Exception "INVALID" is not set
  Pass: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
Test: Set/Clear FE_OVERFLOW: set flag, with rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Fail: Exception "OVERFLOW" is not set
Test: Set/Clear FE_OVERFLOW: clear flag, leave rest set
  Fail: Exception "DIVBYZERO" is not set
  Fail: Exception "INVALID" is not set
  Fail: Exception "INEXACT" is not set
  Fail: Exception "UNDERFLOW" is not set
  Pass: Exception "OVERFLOW" is not set
==27809== Emulation warning: unsupported action:
==27809==   Unmasking x87 FP exceptions
==27809==    at 0x372D2AF8: fesetenv@@GLIBC_2.2 (fesetenv.c:79)
==27809==    by 0x8048AEA: feenv_nomask_test (test-fenv.c:241)
==27809==    by 0x80493AF: main (test-fenv.c:608)
     ...
Comment 1 Tom Hughes 2005-08-10 15:44:28 UTC
Julian - you wrote in 3_0_BUGSTATUS that you would like a test case for this. The math/test-fenv.c file in the glibc source is the code in question and I can reproduce it with that code.