OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libmudflap/] [testsuite/] [libmudflap.c/] [pass23-frag.c] - Blame information for rev 776

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 738 jeremybenn
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
int main ()
5
{
6
struct foo {
7
  int part1: 8;
8
  int nothing : 1;
9
  int part2 : 5;
10
  int lots_more_nothing : 3;
11
  int some_padding; /* for 64-bit hosts */
12
  float some_more_nothing;
13
  double yet_more_nothing;
14
};
15
 
16
#define offsetof(TYPE, MEMBER)  ((size_t) &((TYPE *) 0)->MEMBER)
17
 
18
struct foo* q = (struct foo *) malloc (offsetof (struct foo, some_more_nothing));
19
q->nothing = 1; /* touch q */
20
/* The RHS of the following expression is meant to trigger a
21
   fold-const.c mapping the expression to a BIT_FIELD_REF.  It glues
22
   together the accesses to the two non-neighbouring bitfields into a
23
   single bigger boolean test. */
24
q->lots_more_nothing = (q->part1 == 13 && q->part2 == 7);
25
free (q);
26
 
27
 
28
return 0;
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.