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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [abi/] [bitfield1.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run }
2
// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" }
3
 
4
// Copyright (C) 2001 Free Software Foundation, Inc.
5
// Contributed by Nathan Sidwell 15 Dec 2001 
6
 
7
typedef int Int;
8
typedef signed int SInt;
9
typedef unsigned int UInt;
10
 
11
struct A
12
{
13
  SInt bitS : 1;        // signed
14
  UInt bitU : 1;        // unsigned
15
  Int bit : 1;          // signedness by -f{signed,unsigned}-bitfields
16
};
17
 
18
int main ()
19
{
20
  A a;
21
 
22
  a.bitS = 1; // { dg-warning "overflow" }
23
  a.bitU = 1;
24
  a.bit = 1;
25
 
26
  if (a.bitS != -1)
27
    return 1;
28
  if (a.bitU != 1)
29
    return 2;
30
  if (a.bit != 1)
31
    return 3;
32
 
33
  return 0;
34
}

powered by: WebSVN 2.1.0

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