DynamoRIO/drmemory

Floating point result differs after throwing an exception

Open

#2,117 opened on Aug 31, 2018

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C (289 forks)auto 404
Bug-AppFailOpSys-Windowshelp wanted

Repository metrics

Stars
 (2,727 stars)
PR merge metrics
 (PR metrics pending)

Description

The following little program (compiled with VS2008) shows, that the result of floating point calculation differs after throwing an exception running under drmemory version 1.11.*, with version 1.8.0 the result is ok:

#include <iostream>

int main()
{
   short sRc    = 2;
   double dTest = 0.0175;
   printf("result before exception: %19.17f\n",1./(1.+dTest));
   try
   {
      if (sRc!=0)
         throw std::invalid_argument("Test");
   }
   catch (std::invalid_argument &)
   {
      printf("result after  exception: %19.17f\n",1./(1.+dTest));
      return 0;
   }
}
>C:\old\DrMemory\bin\drmemory.exe   -batch -- buctr
~~Dr.M~~ Dr. Memory version 1.11.17622
~~Dr.M~~ Running "buctr"
result before exception: 0.98280098280098271
result after  exception: 0.98280098280098283
~~Dr.M~~
~~Dr.M~~ NO ERRORS FOUND:
~~Dr.M~~       0 unique,     0 total unaddressable access(es)
~~Dr.M~~       0 unique,     0 total uninitialized access(es)
~~Dr.M~~       0 unique,     0 total invalid heap argument(s)
~~Dr.M~~       0 unique,     0 total GDI usage error(s)
~~Dr.M~~       0 unique,     0 total handle leak(s)
~~Dr.M~~       0 unique,     0 total warning(s)
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of leak(s)
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of possible leak(s)
~~Dr.M~~ ERRORS IGNORED:
~~Dr.M~~       2 unique,     2 total,   4110 byte(s) of still-reachable allocation(s)
~~Dr.M~~          (re-run with "-show_reachable" for details)
~~Dr.M~~ Details: C:\old\DrMemory\drmemory\logs\DrMemory-buctr.exe.16964.000\results.txt

>C:\old\DrMemory\bin\drmemory.exe   -batch -- buctr.exe
~~Dr.M~~ Dr. Memory version 1.8.0
~~Dr.M~~ Running "h:\nix\buctr.exe"
result before exception: 0.98280098280098271
result after  exception: 0.98280098280098271
~~Dr.M~~
~~Dr.M~~ NO ERRORS FOUND:
~~Dr.M~~       0 unique,     0 total unaddressable access(es)
~~Dr.M~~       0 unique,     0 total uninitialized access(es)
~~Dr.M~~       0 unique,     0 total invalid heap argument(s)
~~Dr.M~~       0 unique,     0 total GDI usage error(s)
~~Dr.M~~       0 unique,     0 total handle leak(s)
~~Dr.M~~       0 unique,     0 total warning(s)
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of leak(s)
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of possible leak(s)
~~Dr.M~~ ERRORS IGNORED:
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of still-reachable allocation(s)
~~Dr.M~~          (re-run with "-show_reachable" for details)
~~Dr.M~~ Details: C:\old\DrMemory\drmemory\logs\DrMemory-buctr.exe.7032.015\results.txt

Contributor guide