commit 1ecf0ceacd8cfc6c1cdf0407fa3d4e75408a66bf
parent 5a7810a26c913cc58cc897e93e2de2f64b8d6a01
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Thu, 30 Apr 2026 06:53:28 -0700
tests/cc/: green host compiled cc suite
Diffstat:
2 files changed, 14 insertions(+), 27 deletions(-)
diff --git a/tests/cc/125-anon-union.c b/tests/cc/125-anon-union.c
@@ -17,11 +17,8 @@ struct S {
};
int main(int argc, char **argv) {
- struct S s;
- s.v = 1;
+ struct S s = { .v = 1, .b = 0, .c = 100, .trailing = 99 };
s.a = 7; /* into anon union 1 (offset 8) */
- s.c = 100; /* into anon union 2 (offset 16) */
- s.trailing = 99;
if (s.v != 1) return 1;
if (s.a != 7) return 2;
diff --git a/tests/cc/132-tentative-bss-sizing.c b/tests/cc/132-tentative-bss-sizing.c
@@ -12,9 +12,6 @@
* (so writing g_pp = X then reading g_int near it shows X
* bleeding through). */
-extern unsigned long strlen (const char *);
-extern long sys_write (long fd, long buf, long len);
-
char g_char; /* 1 byte */
short g_short; /* 2 bytes */
int g_int; /* 4 bytes */
@@ -24,27 +21,20 @@ char **g_pp; /* 8 bytes — the environ shape */
int g_arr[4]; /* 16 bytes */
char *g_parr[3]; /* 24 bytes */
-static long
-fail (const char *msg)
-{
- sys_write (2, (long) msg, (long) strlen (msg));
- return 1;
-}
-
int
main (void)
{
/* Tentative defs must zero-init. */
- if (g_char != 0) return fail ("g_char not zero\n");
- if (g_short != 0) return fail ("g_short not zero\n");
- if (g_int != 0) return fail ("g_int not zero\n");
- if (g_long != 0) return fail ("g_long not zero\n");
- if (g_p != 0) return fail ("g_p not zero\n");
- if (g_pp != 0) return fail ("g_pp not zero\n");
+ if (g_char != 0) return 1;
+ if (g_short != 0) return 2;
+ if (g_int != 0) return 3;
+ if (g_long != 0) return 4;
+ if (g_p != 0) return 5;
+ if (g_pp != 0) return 6;
if (g_arr[0] || g_arr[1] || g_arr[2] || g_arr[3])
- return fail ("g_arr not zero\n");
+ return 7;
if (g_parr[0] || g_parr[1] || g_parr[2])
- return fail ("g_parr not zero\n");
+ return 8;
/* Each slot must be addressable for its full sizeof(T).
* Write a sentinel through the address, read it back. If the
@@ -53,24 +43,24 @@ main (void)
long *pl = &g_long;
*pl = 0x1122334455667788L;
if (g_long != 0x1122334455667788L)
- return fail ("g_long roundtrip\n");
+ return 9;
g_pp = (char **) 0xdeadbeef00112233L;
if ((long) g_pp != (long) 0xdeadbeef00112233L)
- return fail ("g_pp roundtrip\n");
+ return 10;
/* Array element: write the last slot — only valid if the full
* 16-byte / 24-byte allocation actually exists. */
g_arr[3] = 42;
- if (g_arr[3] != 42) return fail ("g_arr[3] roundtrip\n");
+ if (g_arr[3] != 42) return 11;
g_parr[2] = (char *) 0x99;
- if ((long) g_parr[2] != 0x99) return fail ("g_parr[2] roundtrip\n");
+ if ((long) g_parr[2] != 0x99) return 12;
/* And no spill: writing g_pp must NOT change g_int next door.
* (Slot order in memory follows declaration order in the TU.) */
g_int = 0;
g_pp = (char **) 0xfffffffffffffffeL;
- if (g_int != 0) return fail ("g_pp store spilled into g_int\n");
+ if (g_int != 0) return 13;
return 0;
}