diff --git a/gcc/testsuite/gcc.dg/field-merge-1.c b/gcc/testsuite/gcc.dg/field-merge-1.c index 4405d40ee79d8773dc6c65d98aa20ef786297254..4e7f6ae9332a89b79a8d2567bb0a114a8724902a 100644 --- a/gcc/testsuite/gcc.dg/field-merge-1.c +++ b/gcc/testsuite/gcc.dg/field-merge-1.c @@ -25,8 +25,8 @@ struct TB { unsigned char s; } __attribute__ ((packed, aligned (4), scalar_storage_order ("big-endian"))); -#define vc 0xaa -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vi (unsigned int)0x12345678 struct TL vL = { vc, vi, vc, vi, vc, vi, vc }; struct TB vB = { vc, vi, vc, vi, vc, vi, vc }; diff --git a/gcc/testsuite/gcc.dg/field-merge-11.c b/gcc/testsuite/gcc.dg/field-merge-11.c index fe627cddd7fdf4825307e1cca2e88bb56d90f4a6..9e606e3bef16ade9bb6f4be5f7c125f3247b4cb4 100644 --- a/gcc/testsuite/gcc.dg/field-merge-11.c +++ b/gcc/testsuite/gcc.dg/field-merge-11.c @@ -10,7 +10,11 @@ struct s { int c; } __attribute__ ((aligned (4))); -struct s p = { 42, (short)(0xef1 - 0x1000), 0x12345678 }; +struct s p = { + (short)(unsigned short)42, + (short)(unsigned short)(0xef1 - 0x1000), + (int)(unsigned int)0x12345678 +}; void f (void) { if (0 @@ -19,9 +23,9 @@ void f (void) { || (int)(signed char)p.b != (int)(signed char)(0xef1 - 0x1000) || (unsigned)(unsigned char)p.b != (unsigned)(unsigned char)(0xef1 - 0x1000) || (unsigned)p.b != (unsigned short)(0xef1 - 0x1000) - || (int)(short)p.b != (int)(0xef1 - 0x1000) + || (int)(short)p.b != (int)(short)(unsigned short)(0xef1 - 0x1000) || (long)(unsigned char)(p.c >> 8) != (long)(unsigned char)0x123456 - || p.c != 0x12345678 + || p.c != (int)(unsigned int)0x12345678 ) __builtin_abort (); } diff --git a/gcc/testsuite/gcc.dg/field-merge-17.c b/gcc/testsuite/gcc.dg/field-merge-17.c index a42658ac5c51660f1f3c2131d73fb9c8c8df6b32..35ead954060610bb87d9d906cf51352901a61b8c 100644 --- a/gcc/testsuite/gcc.dg/field-merge-17.c +++ b/gcc/testsuite/gcc.dg/field-merge-17.c @@ -3,6 +3,8 @@ /* Check that we can optimize misaligned double-words. */ +#include <stddef.h> + struct s { short a; long long b; @@ -33,7 +35,7 @@ int main () { if (fp () > 0) __builtin_abort (); unsigned char *pc = (unsigned char *)&p; - for (int i = 0; i < sizeof (p); i++) + for (int i = 0; i < offsetof (struct s, e) + sizeof (p.e); i++) { pc[i] = 1; if (fp () < 0) diff --git a/gcc/testsuite/gcc.dg/field-merge-3.c b/gcc/testsuite/gcc.dg/field-merge-3.c index a9fe404fa426133b7737c54a2a7d835af7f67f81..e9af4915ad8c1f102f784d100943fc5a237be6f4 100644 --- a/gcc/testsuite/gcc.dg/field-merge-3.c +++ b/gcc/testsuite/gcc.dg/field-merge-3.c @@ -15,8 +15,8 @@ struct T2 { unsigned int z; } __attribute__((__aligned__(8))); -#define vc 0xaa -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vi (unsigned int)0x12345678 struct T1 v1 = { { vc + !BIG_ENDIAN_P, vc + BIG_ENDIAN_P }, vc, vi }; struct T2 v2 = { (vc << 8) | (vc - 1), vc, vi }; diff --git a/gcc/testsuite/gcc.dg/field-merge-4.c b/gcc/testsuite/gcc.dg/field-merge-4.c index c629069e52b2c81a7e7591b87794b2d4a61d2dae..7c63123a282d3023f1a70a5feebb98be01ddb0b3 100644 --- a/gcc/testsuite/gcc.dg/field-merge-4.c +++ b/gcc/testsuite/gcc.dg/field-merge-4.c @@ -18,9 +18,9 @@ struct T2 { unsigned int z; } __attribute__((__packed__, __aligned__(4))); -#define vc 0xaa -#define vs 0xccdd -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vs (unsigned short)0xccdd +#define vi (unsigned int)0x12345678 struct T1 v1 = { -1, vc, 1, vs, vi }; struct T2 v2 = { -1, 0, vc, 1, vs, vi }; diff --git a/gcc/testsuite/gcc.dg/field-merge-5.c b/gcc/testsuite/gcc.dg/field-merge-5.c index 1580b14bcc935aa17f1fd37f231183c0b525a2f6..1b5d1a8cb16e93b4b83a089f911b48f73012ab02 100644 --- a/gcc/testsuite/gcc.dg/field-merge-5.c +++ b/gcc/testsuite/gcc.dg/field-merge-5.c @@ -18,9 +18,9 @@ struct T2 { unsigned int z; } __attribute__((__packed__, __aligned__(8))); -#define vc 0xaa -#define vs 0xccdd -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vs (unsigned short)0xccdd +#define vi (unsigned int)0x12345678 struct T1 v1 = { -1, vc, 1, vs, vi }; struct T2 v2 = { -1, 0, vc, 1, vs, vi };