mirror of
https://github.com/cc65/cc65.git
synced 2025-01-25 11:30:06 +00:00
Testcase for #1662.
This commit is contained in:
parent
6beb090193
commit
6dbafda53f
@ -26,8 +26,10 @@
|
|||||||
|
|
||||||
static unsigned char failures = 0;
|
static unsigned char failures = 0;
|
||||||
|
|
||||||
|
typedef unsigned int field_type;
|
||||||
|
|
||||||
static struct four_bits {
|
static struct four_bits {
|
||||||
unsigned int x : 4;
|
field_type x : 4;
|
||||||
} fb = {1};
|
} fb = {1};
|
||||||
|
|
||||||
static void test_four_bits(void)
|
static void test_four_bits(void)
|
||||||
@ -57,8 +59,8 @@ static void test_four_bits(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static struct four_bits_with_int {
|
static struct four_bits_with_int {
|
||||||
unsigned int x : 4;
|
field_type x : 4;
|
||||||
unsigned int y;
|
field_type y;
|
||||||
} fbi = {1, 2};
|
} fbi = {1, 2};
|
||||||
|
|
||||||
static void test_four_bits_with_int(void)
|
static void test_four_bits_with_int(void)
|
||||||
@ -95,8 +97,8 @@ static void test_four_bits_with_int(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct overlap {
|
static struct overlap {
|
||||||
unsigned int x : 10;
|
field_type x : 10;
|
||||||
unsigned int y : 10;
|
field_type y : 10;
|
||||||
} o = {11, 22};
|
} o = {11, 22};
|
||||||
|
|
||||||
/* Tests that bit-fields can share allocation units. */
|
/* Tests that bit-fields can share allocation units. */
|
||||||
@ -133,9 +135,9 @@ static void test_overlap(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct overlap_with_int {
|
static struct overlap_with_int {
|
||||||
unsigned int x : 10;
|
field_type x : 10;
|
||||||
unsigned int y : 10;
|
field_type y : 10;
|
||||||
unsigned int z;
|
field_type z;
|
||||||
} oi = {111, 222, 333};
|
} oi = {111, 222, 333};
|
||||||
|
|
||||||
static void test_overlap_with_int(void)
|
static void test_overlap_with_int(void)
|
||||||
@ -183,8 +185,8 @@ static void test_overlap_with_int(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct full_width {
|
static struct full_width {
|
||||||
unsigned int x : 8;
|
field_type x : 8;
|
||||||
unsigned int y : 16;
|
field_type y : 16;
|
||||||
} fw = {255, 17};
|
} fw = {255, 17};
|
||||||
|
|
||||||
static void test_full_width(void)
|
static void test_full_width(void)
|
||||||
@ -220,13 +222,13 @@ static void test_full_width(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct aligned_end {
|
static struct aligned_end {
|
||||||
unsigned int : 2;
|
field_type : 2;
|
||||||
unsigned int x : 6;
|
field_type x : 6;
|
||||||
unsigned int : 3;
|
field_type : 3;
|
||||||
unsigned int y : 13;
|
field_type y : 13;
|
||||||
/* z crosses a byte boundary, but fits in a byte when shifted. */
|
/* z crosses a byte boundary, but fits in a byte when shifted. */
|
||||||
unsigned int : 6;
|
field_type : 6;
|
||||||
unsigned int z : 7;
|
field_type z : 7;
|
||||||
} ae = {63, 17, 100};
|
} ae = {63, 17, 100};
|
||||||
|
|
||||||
static void test_aligned_end(void)
|
static void test_aligned_end(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user