fail35-,pass53-,pass54-frag.c: New tests.

2004-10-28  Frank Ch. Eigler  <fche@redhat.com>

	* testsuite/libmudflap.c/fail35-,pass53-,pass54-frag.c: New tests.
	* testsuite/libmudflap.c/pass35-frag.c: Correct embedded warning
	message.

From-SVN: r89783
This commit is contained in:
Frank Ch. Eigler 2004-10-28 21:21:59 +00:00 committed by Frank Ch. Eigler
parent a30036b2fd
commit 306ae32b68
5 changed files with 104 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-10-28 Frank Ch. Eigler <fche@redhat.com>
* testsuite/libmudflap.c/fail35-,pass53-,pass54-frag.c: New tests.
* testsuite/libmudflap.c/pass35-frag.c: Correct embedded warning
message.
2004-10-25 Eric Botcazou <ebotcazou@libertysurf.fr>
PR other/18138

View File

@ -0,0 +1,23 @@
#include <stdlib.h>
struct k
{
int p;
struct {
int m;
} 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
COMPONENT_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 *-*-* } } */

View File

@ -3,7 +3,7 @@
#include <string.h>
extern char end []; /* Any old symbol we're sure will be defined. */
/* { dg-warning "cannot track unknown size extern 'end'" "cannot track unknown size extern" { target *-*-* } 0 } */
/* { dg-warning "cannot track unknown size extern" "cannot track unknown size extern" { target *-*-* } 0 } */
int main ()
{

View File

@ -0,0 +1,41 @@
int foo1 ()
{
union { int l; char c[sizeof (int)]; } k1;
char *m;
k1.l = 0;
/* This test variant triggers ADDR_EXPR of k explicitly in order to
ensure it's registered with the runtime. */
m = k1.c;
k1.c [sizeof (int)-1] = m[sizeof (int)-2];
}
int foo2 ()
{
union { int l; char c[sizeof (int)]; } k2;
k2.l = 0;
/* Since this access is known-in-range, k need not be registered
with the runtime, but then this access better not be instrumented
either. */
k2.c [sizeof (int)-1] ++;
return k2.l;
}
int foo3idx = sizeof (int)-1;
int foo3 ()
{
union { int l; char c[sizeof (int)]; } k3;
k3.l = 0;
/* NB this test uses foo3idx, an extern variable, to defeat mudflap
known-in-range-index optimizations. */
k3.c [foo3idx] ++;
return k3.l;
}
int main ()
{
foo1 ();
foo2 ();
foo3 ();
return 0;
}

View File

@ -0,0 +1,33 @@
struct k
{
struct {
int b;
int c;
} a;
};
static struct k l;
static struct k m;
void foo ()
{
/* This should not be instrumented. */
l.a.b = 5;
}
void bar ()
{
/* This should not be instrumented. */
m.a.b = 5;
}
int main ()
{
/* Force TREE_ADDRESSABLE on "l" only. */
volatile int *k = & l.a.c;
*k = 8;
__mf_set_options ("-mode-violate");
foo ();
bar ();
__mf_set_options ("-mode-check");
}