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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c99-bool-3.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for _Bool bit-fields.  They have the semantics of _Bool, at
2
   least for now (DR#335 Spring 2007 discussion).  */
3
/* Origin: Joseph Myers <joseph@codesourcery.com> */
4
/* { dg-do run } */
5
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6
struct foo
7
{
8
  _Bool a : 1;
9
} sf;
10
 
11
extern void abort (void);
12
extern void exit (int);
13
 
14
int
15
main (void)
16
{
17
  int i;
18
  for (i = 0; i < sizeof (struct foo); i++)
19
    *((unsigned char *)&sf + i) = (unsigned char) -1;
20
  sf.a = 2;
21
  if (sf.a != 1)
22
    abort ();
23
  sf.a = 0;
24
  if (sf.a != 0)
25
    abort ();
26
  sf.a = 0.2;
27
  if (sf.a != 1)
28
    abort ();
29
  sf.a = &sf;
30
  if (sf.a != 1)
31
    abort ();
32
  exit (0);
33
}

powered by: WebSVN 2.1.0

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