From 6e0f130b0ef9c162289989db9d5906458e0e979e Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 12 Mar 1999 16:19:54 +0000 Subject: [PATCH] Minor testsuite fixes for targets with 16-bit ints and targets without I/O. * execute/970312-1.c, execute/980605-1.c (f): Change printf to sprintf. * execute/bf-sign-2.c (struct X): Add u15 field. (main): Add check for u15. Conditionalize u31 check depending on whether ints are <32 bits or >=32 bits. From-SVN: r25730 --- gcc/testsuite/gcc.c-torture/ChangeLog | 7 +++++++ gcc/testsuite/gcc.c-torture/execute/970312-1.c | 4 +++- gcc/testsuite/gcc.c-torture/execute/980605-1.c | 4 +++- gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c | 16 ++++++++++++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gcc.c-torture/ChangeLog b/gcc/testsuite/gcc.c-torture/ChangeLog index 72749bf4b5c..08bc7610b37 100644 --- a/gcc/testsuite/gcc.c-torture/ChangeLog +++ b/gcc/testsuite/gcc.c-torture/ChangeLog @@ -1,3 +1,10 @@ +Fri Mar 12 16:17:28 1999 Jim Wilson + + * execute/970312-1.c, execute/980605-1.c (f): Change printf to sprintf. + * execute/bf-sign-2.c (struct X): Add u15 field. + (main): Add check for u15. Conditionalize u31 check depending on + whether ints are <32 bits or >=32 bits. + 1999-03-01 Zack Weinberg * noncompile/noncompile.exp (951025-1.c): Accept an error diff --git a/gcc/testsuite/gcc.c-torture/execute/970312-1.c b/gcc/testsuite/gcc.c-torture/execute/970312-1.c index b303c4a8e60..6b78ee1ca60 100644 --- a/gcc/testsuite/gcc.c-torture/execute/970312-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/970312-1.c @@ -41,6 +41,8 @@ getval (void) return x++; } +char buf[10]; + void f () { @@ -59,7 +61,7 @@ f () k = f2 (17.0); - printf ("%d\n", a + b + c + d + e + f + g + h + i + j + k); + sprintf (buf, "%d\n", a + b + c + d + e + f + g + h + i + j + k); if (a + b + c + d + e + f + g + h + i + j + k != 227) abort (); } diff --git a/gcc/testsuite/gcc.c-torture/execute/980605-1.c b/gcc/testsuite/gcc.c-torture/execute/980605-1.c index 5ce89a28a76..2fc2691e535 100644 --- a/gcc/testsuite/gcc.c-torture/execute/980605-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/980605-1.c @@ -45,6 +45,8 @@ getval (void) return x++; } +char buf[10]; + void f () { @@ -64,7 +66,7 @@ f () k = f2 (17.0); - printf ("%d\n", a + b + c + d + e + f + g + h + i + j + k); + sprintf (buf, "%d\n", a + b + c + d + e + f + g + h + i + j + k); if (a + b + c + d + e + f + g + h + i + j + k != 227) abort (); } diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c b/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c index 479082217eb..365e061c839 100644 --- a/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c @@ -10,7 +10,7 @@ We test the behavior by subtracting two from the promoted value: this will result in a negitive value for signed types, a positive value for unsigned types. This test (of course) assumes that the compiler is correctly - implementing signed and unsigned arithmatic. + implementing signed and unsigned arithmetic. */ struct X { @@ -21,6 +21,7 @@ struct X { unsigned long int u32:32; unsigned long long ull3 :3; unsigned long long ull35:35; + unsigned u15:15; }; struct X x; @@ -36,9 +37,20 @@ main () if ((x.s32 - 2) >= 0) /* promoted value should be signed */ abort (); - if ((x.u31 - 2) >= 0) /* promoted value should be signed */ + if ((x.u15 - 2) >= 0) /* promoted value should be signed */ abort (); + if (sizeof (struct { unsigned long u32:32;}) <= sizeof (int)) + { + if ((x.u31 - 2) >= 0) /* promoted value should be signed */ + abort (); + } + else + { + if ((x.u31 - 2) < 0) /* promoted value should be UNsigned */ + abort (); + } + if ((x.u32 - 2) < 0) /* promoted value should be UNsigned */ abort (); -- 2.30.2