mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-27 06:04:12 +08:00
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:
parent
a30036b2fd
commit
306ae32b68
@ -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
|
||||
|
23
libmudflap/testsuite/libmudflap.c/fail35-frag.c
Normal file
23
libmudflap/testsuite/libmudflap.c/fail35-frag.c
Normal 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 *-*-* } } */
|
@ -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 ()
|
||||
{
|
||||
|
41
libmudflap/testsuite/libmudflap.c/pass53-frag.c
Normal file
41
libmudflap/testsuite/libmudflap.c/pass53-frag.c
Normal 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;
|
||||
}
|
33
libmudflap/testsuite/libmudflap.c/pass54-frag.c
Normal file
33
libmudflap/testsuite/libmudflap.c/pass54-frag.c
Normal 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");
|
||||
}
|
Loading…
Reference in New Issue
Block a user