From 33296cfaf4f673fa5ca21a051673fa3532966a74 Mon Sep 17 00:00:00 2001 From: gkm Date: Sun, 2 Jan 2005 22:24:50 +0000 Subject: * 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 --- libmudflap/testsuite/lib/libmudflap.exp | 2 +- libmudflap/testsuite/libmudflap.c/fail36-frag.c | 23 ++++++++++++++++++++ libmudflap/testsuite/libmudflap.c/fail37-frag.c | 22 +++++++++++++++++++ libmudflap/testsuite/libmudflap.c/fail38-frag.c | 29 +++++++++++++++++++++++++ libmudflap/testsuite/libmudflap.c/pass32-frag.c | 2 +- 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 libmudflap/testsuite/libmudflap.c/fail36-frag.c create mode 100644 libmudflap/testsuite/libmudflap.c/fail37-frag.c create mode 100644 libmudflap/testsuite/libmudflap.c/fail38-frag.c (limited to 'libmudflap/testsuite') 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 + +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 +#include +#include +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; } -- cgit v1.2.1