DynamoRIO/drmemory

Floating point result differs after throwing an exception

Open

#2117 aperta il 31 ago 2018

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)C (289 fork)auto 404
Bug-AppFailOpSys-Windowshelp wanted

Metriche repository

Star
 (2727 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor