OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [bitfld-2.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2002 Free Software Foundation, Inc.
2
 
3
   Tests we warn about overly-large assignments to bitfields.
4
 
5
   Source: Neil Booth, 28 Jan 2002.
6
*/
7
 
8
struct bf
9
{
10
  unsigned int a: 2;
11
  int b: 2;
12
};
13
 
14
struct bf p = {4, 0};            /* { dg-warning "truncated" "" } */
15
struct bf q = {0, 2};            /* { dg-warning "overflow" "" } */
16
struct bf r = {3, -2};          /* { dg-bogus "(truncated|overflow)" } */
17
 
18
void foo ()
19
{
20
  p.a = 4, p.b = 0;              /* { dg-warning "truncated" "" } */
21
  q.a = 0, q.b = 2;              /* { dg-warning "overflow" "" } */
22
  r.a = 3, r.b = -2;            /* { dg-bogus "(truncated|overflow)" } */
23
}

powered by: WebSVN 2.1.0

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