summaryrefslogtreecommitdiff
path: root/libmudflap/testsuite/libmudflap.c/fail16-frag.c
blob: 6ac6187e2ad4919df1680f7bbc236625ed4edd05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void *p;
int main ()
{
struct base {
  int basic;
}; 

struct derived { 
  struct base common;
  char extra;
};

struct base *bp;

bp = (struct base *) malloc (sizeof (struct base));;
p = bp;
bp->basic = 10;
((struct derived *)bp)->extra = 'x';
return 0;
}
/* { dg-output "mudflap violation 1.*" } */
/* { dg-output "Nearby object 1.*" } */
/* { dg-output "mudflap object.*.malloc region.*" } */
/* { dg-do run { xfail *-*-* } } */