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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [bitfld-2.c] - Rev 298

Compare with Previous | Blame | View Log

/* Copyright (C) 2002 Free Software Foundation, Inc.
 
   Tests we warn about overly-large assignments to bitfields.
 
   Source: Neil Booth, 28 Jan 2002.
*/
 
struct bf
{
  unsigned int a: 2;
  int b: 2;
};
 
struct bf p = {4, 0};		/* { dg-warning "truncated" "" } */
struct bf q = {0, 2};		/* { dg-warning "overflow" "" } */
struct bf r = {3, -2};		/* { dg-bogus "(truncated|overflow)" } */
 
void foo ()
{
  p.a = 4, p.b = 0;		/* { dg-warning "truncated" "" } */
  q.a = 0, q.b = 2;		/* { dg-warning "overflow" "" } */
  r.a = 3, r.b = -2;		/* { dg-bogus "(truncated|overflow)" } */
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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