DynamoRIO / DynamoRIO/drmemory

Floating point result differs after throwing an exception

Open
#2,117 2 comments 0 reactions 0 assignees View on GitHub
Bug-AppFail help wanted OpSys-Windows
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

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:
```C
#include

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.