+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>
* noncompile/noncompile.exp (951025-1.c): Accept an error
return x++;
}
+char buf[10];
+
void
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 ();
}
return x++;
}
+char buf[10];
+
void
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 ();
}
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 {
unsigned long int u32:32;
unsigned long long ull3 :3;
unsigned long long ull35:35;
+ unsigned u15:15;
};
struct X x;
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 ();