Made Addrcheck distinguish between invalid reads and invalid writes (previously
was just saying "invalid memory access").
Added a regression test for this, for memcheck and addrcheck. Also made
Addrcheck use Memcheck's fprw regtest. Was able to remove the not-very-useful
'true' test for Addrcheck now that it has a couple of real tests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1815 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/tests/badrw.c b/memcheck/tests/badrw.c
new file mode 100644
index 0000000..b72f393
--- /dev/null
+++ b/memcheck/tests/badrw.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+
+int main(void)
+{
+ void* x = malloc(10);
+
+ int* x4 = x-4;
+ short int* x2 = x-4;
+ char* x1 = x-1;
+
+ // Invalid reads and writes of sizes 4, 2, 1
+ int y4 = *x4; *x4 = y4;
+ short int y2 = *x2; *x2 = y2;
+ char y1 = *x1; *x1 = y1;
+
+ return 0;
+}