diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 13:23:04 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 13:23:04 +0000 |
| commit | eaad9c34403f05372c1544d7ef522c847dfea0ba (patch) | |
| tree | 4cd2dbaadecbfafe7855ad8ae03c046a8947697d /tests/i/extern-c-variadic/notes.md | |
| parent | 628270661843c4d61a2b5bc656daeb3099850e64 (diff) | |
test(extern): check variadic promotions with va_arg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/i/extern-c-variadic/notes.md')
| -rw-r--r-- | tests/i/extern-c-variadic/notes.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/i/extern-c-variadic/notes.md b/tests/i/extern-c-variadic/notes.md new file mode 100644 index 0000000..4820ecd --- /dev/null +++ b/tests/i/extern-c-variadic/notes.md @@ -0,0 +1,7 @@ +# extern-c-variadic + +Human review: pending. Expected output was independently traced by AI, not captured from cpsc. + +Basis: compiler extension (EXTERN "C", INCLUDE_OBJ of a user object); C11 6.5.2.2p6-7 default argument promotions and 7.16.1.1 va_arg. + +Trace: the harness compiles `lib.c` with the host C compiler. sum_ints reads 5 arguments with va_arg(ap, int), so each must arrive promoted to int: unsigned char 200 gives 200, short -7 gives -7, unsigned short 65535 gives 65535 (int is wider than short), _Bool TRUE gives 1 and char 'A' gives 65. 200 - 7 + 65535 + 1 + 65 = 65794. sum_doubles reads 2 arguments with va_arg(ap, double): float 1.5 is promoted to double 1.5, and double 2.25 is passed unchanged. 1.5 + 2.25 = 3.75, printed like other C doubles as `3.750000`. |
