Commit 6e0f130b by Jim Wilson Committed by Jim Wilson

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
parent d24de7d1
Fri Mar 12 16:17:28 1999 Jim Wilson <wilson@cygnus.com>
* 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 <zack@rabi.columbia.edu> 1999-03-01 Zack Weinberg <zack@rabi.columbia.edu>
* noncompile/noncompile.exp (951025-1.c): Accept an error * noncompile/noncompile.exp (951025-1.c): Accept an error
......
...@@ -41,6 +41,8 @@ getval (void) ...@@ -41,6 +41,8 @@ getval (void)
return x++; return x++;
} }
char buf[10];
void void
f () f ()
{ {
...@@ -59,7 +61,7 @@ f () ...@@ -59,7 +61,7 @@ f ()
k = f2 (17.0); 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) if (a + b + c + d + e + f + g + h + i + j + k != 227)
abort (); abort ();
} }
......
...@@ -45,6 +45,8 @@ getval (void) ...@@ -45,6 +45,8 @@ getval (void)
return x++; return x++;
} }
char buf[10];
void void
f () f ()
{ {
...@@ -64,7 +66,7 @@ f () ...@@ -64,7 +66,7 @@ f ()
k = f2 (17.0); 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) if (a + b + c + d + e + f + g + h + i + j + k != 227)
abort (); abort ();
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
We test the behavior by subtracting two from the promoted value: this will 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 result in a negitive value for signed types, a positive value for unsigned
types. This test (of course) assumes that the compiler is correctly types. This test (of course) assumes that the compiler is correctly
implementing signed and unsigned arithmatic. implementing signed and unsigned arithmetic.
*/ */
struct X { struct X {
...@@ -21,6 +21,7 @@ struct X { ...@@ -21,6 +21,7 @@ struct X {
unsigned long int u32:32; unsigned long int u32:32;
unsigned long long ull3 :3; unsigned long long ull3 :3;
unsigned long long ull35:35; unsigned long long ull35:35;
unsigned u15:15;
}; };
struct X x; struct X x;
...@@ -36,9 +37,20 @@ main () ...@@ -36,9 +37,20 @@ main ()
if ((x.s32 - 2) >= 0) /* promoted value should be signed */ if ((x.s32 - 2) >= 0) /* promoted value should be signed */
abort (); abort ();
if ((x.u31 - 2) >= 0) /* promoted value should be signed */ if ((x.u15 - 2) >= 0) /* promoted value should be signed */
abort (); 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 */ if ((x.u32 - 2) < 0) /* promoted value should be UNsigned */
abort (); abort ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment