summaryrefslogtreecommitdiff
path: root/libmudflap/testsuite
diff options
context:
space:
mode:
authorgkm <gkm@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-02 22:24:50 +0000
committergkm <gkm@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-02 22:24:50 +0000
commit33296cfaf4f673fa5ca21a051673fa3532966a74 (patch)
treea1789ecd62d4476eaac6bade96f7be70f76b84ff /libmudflap/testsuite
parent0c9a1aea843b83de1838b89fca97462cee5af404 (diff)
downloadgcc-33296cfaf4f673fa5ca21a051673fa3532966a74.tar.gz
* mf-impl.h (uintptr_t): Get typedef via stdint.h or define explicitly.
* mf-runtime.h: New file, replaces mf-runtime.h.in. * configure.ac (AC_CONFIG_FILES): mf-runtime.h is no longer generated. * Makefile.in: Ditto. * testsuite/lib/libmudflap.exp: Add -I${srcdir}/.. to get mf-runtime.h * testsuite/libmudflap.c/pass32-frag.c: s/uintptr_t/__mf_uintptr_t/ * testsuite/libmudflap.c/fail36-frag.c: New test. * testsuite/libmudflap.c/fail37-frag.c: New test. * testsuite/libmudflap.c/fail38-frag.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92815 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libmudflap/testsuite')
-rw-r--r--libmudflap/testsuite/lib/libmudflap.exp2
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail36-frag.c23
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail37-frag.c22
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail38-frag.c29
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass32-frag.c2
5 files changed, 76 insertions, 2 deletions
diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp
index 8c604e1bc86..4b80716ebbf 100644
--- a/libmudflap/testsuite/lib/libmudflap.exp
+++ b/libmudflap/testsuite/lib/libmudflap.exp
@@ -83,7 +83,7 @@ proc libmudflap-init { language } {
set libs "-L${blddir}/.libs"
set cxxflags "-ggdb3 -DDEBUG_ASSERT"
- set includes "-I${srcdir} -I.."
+ set includes "-I${srcdir} -I${srcdir}/.. -I.."
if {$language == "c++"} {
if {[file exists $cxxflags_file]} then {
diff --git a/libmudflap/testsuite/libmudflap.c/fail36-frag.c b/libmudflap/testsuite/libmudflap.c/fail36-frag.c
new file mode 100644
index 00000000000..af6851c1d23
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail36-frag.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+
+struct k
+{
+ int p;
+ struct {
+ int m : 31;
+ } q;
+};
+
+int
+main ()
+{
+ volatile struct k *l = malloc (sizeof (int)); /* make it only big enough for k.p */
+ /* Confirm that we instrument this nested construct
+ BIT_FIELD_REF(COMPONENT_REF(INDIRECT_REF)). */
+ l->q.m = 5;
+ return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail37-frag.c b/libmudflap/testsuite/libmudflap.c/fail37-frag.c
new file mode 100644
index 00000000000..41ce4b91e05
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail37-frag.c
@@ -0,0 +1,22 @@
+typedef struct
+{
+ short f : 3;
+} small;
+
+struct
+{
+ int i;
+ small s[4];
+} x;
+
+main ()
+{
+ int i;
+ for (i = 0; i < 5; i++)
+ x.s[i].f = 0;
+ exit (0);
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.* x.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail38-frag.c b/libmudflap/testsuite/libmudflap.c/fail38-frag.c
new file mode 100644
index 00000000000..9667e213418
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail38-frag.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct a {
+ int x;
+ int y;
+ int z : 10;
+};
+
+struct b {
+ int x;
+ int y;
+};
+
+volatile struct b k;
+volatile struct a *p;
+
+p = (struct a*) &k;
+
+p->z = 'q';
+
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. k.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass32-frag.c b/libmudflap/testsuite/libmudflap.c/pass32-frag.c
index 83f121d4fa2..38468642328 100644
--- a/libmudflap/testsuite/libmudflap.c/pass32-frag.c
+++ b/libmudflap/testsuite/libmudflap.c/pass32-frag.c
@@ -13,6 +13,6 @@ int main ()
{
struct foo k;
char *n = get_z (& k);
-srand ((int)(uintptr_t) n); /* use the pointer value */
+srand ((int)(__mf_uintptr_)t n); /* use the pointer value */
return 0;
}