]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/bitfld-2.c
replace ISL with isl
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / bitfld-2.c
CommitLineData
8469e54e
NB
1/* 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
8struct bf
9{
10 unsigned int a: 2;
11 int b: 2;
12};
13
bc15d0ef
JM
14struct bf p = {4, 0}; /* { dg-warning "truncated" "" } */
15struct bf q = {0, 2}; /* { dg-warning "overflow" "" } */
8469e54e
NB
16struct bf r = {3, -2}; /* { dg-bogus "(truncated|overflow)" } */
17
18void foo ()
19{
bc15d0ef
JM
20 p.a = 4, p.b = 0; /* { dg-warning "truncated" "" } */
21 q.a = 0, q.b = 2; /* { dg-warning "overflow" "" } */
8469e54e
NB
22 r.a = 3, r.b = -2; /* { dg-bogus "(truncated|overflow)" } */
23}