mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 18:56:10 +00:00
fxtract.c. Also, gets rid of some of the warnings that -Wextra finds in Massif. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9237
21 lines
549 B
C
21 lines
549 B
C
|
|
#include <stdlib.h>
|
|
|
|
int main(void)
|
|
{
|
|
// When I had n-u --> u, this gave a false positive... can happen because
|
|
// p+up can give n if you are (un)lucky, because the result is close enough
|
|
// to zero.
|
|
int u[20];
|
|
int* p = malloc(sizeof(int) * 100);
|
|
int* n;
|
|
int* x;
|
|
|
|
p[0] = 0; // ok
|
|
n = (int*)((long)p + (long)u); // result is n, because near zero!
|
|
x = (int*)((long)n - (long)u); // x == p
|
|
x[0] = 0; // ok, originally caused false pos.
|
|
|
|
return 0;
|
|
}
|