-
Notifications
You must be signed in to change notification settings - Fork 0
GCC Compatibility
madc aims for broad compatibility with real-world C code. The primary
benchmark is the GCC torture test suite (gcc.c-torture/execute) — 1685 C
programs designed to stress-test compilers — run under --std=c17.
1614 of 1685 pass — with zero standard-C failures outstanding.
- 1614 pass (95.8% of the full suite; 99.4% of the 1624 in-scope tests)
- 10 fail — every one a GNU extension, not standard C (see below)
-
61 formally skipped — gcc-internal constructs and undefined-behavior
probes, classified test-by-test in the repo
(
docs/parity/failset-classification.md, signed-off skip manifest)
Standard C works: every torture failure classified as standard C89–C17 has been fixed. That includes historically hard cases:
- K&R old-style definitions and implicit
int - VLAs — including VLA parameters with runtime bounds (
char a[2][N]) evaluated at function entry, and VLAsizeof - Native
_Complexarithmetic (__real__/__imag__included) - Struct/union pass-by-value and return (SysV ABI, mixed-class varargs)
- Bitfields with SysV shared-window packing
- Computed goto (labels-as-values), case ranges, statement expressions
- Setjmp/longjmp,
alloca, zero-length arrays, flexible array members -
-0.0preservation and long-double semantics
| Cluster | Tests |
|---|---|
SIMD vectors wider than 16 bytes (vector_size) |
simd-1, simd-2, pr23135, pr92904, pr46309 |
__attribute__((aligned)) > 16 / misalignment probing |
20010904-1, 20010904-2, misalign |
| Empty-union-by-value ABI corner (union + bitfields) | pr23324 |
__sync_add_and_fetch atomic builtin |
pr122000 |
These are roadmap items (≤16-byte SIMD already works — it's in the MIR fork), not standard-compliance bugs.
Tests that exercise gcc-internal contracts rather than the C language:
inline assembly, __builtin_apply / __builtin_return_address-style frame
introspection, deliberately corrupted jmp_bufs, UB probes where madc's
behavior is as defensible as gcc's, and the VLA-in-struct extension (which
clang also refuses to support). Each skip carries a written reason in the
manifest and can be run anyway with --include-manifest-skips.
madc treats both gcc and clang as canon. For any codegen, type-system, or runtime question:
- Reduce the failing case to a minimal C reducer
- Compile it with
gcc -S -fverbose-asm -O0(andclang -S -O0) and study what the reference compilers actually do - Fix madc at the deepest layer that moves it toward that shape
Two additional oracles keep the backend honest: the emitted-C oracle
(--emit=c11 output compiled by gcc must behave identically to madc's JIT)
and clang as a scope filter (a GNU extension clang rejects is not something
madc is required to support).
When the madc dialect intentionally diverges from C (e.g. 64-bit default
integers outside --std=c* modes), the divergence is documented and gated
behind the --std= switch — under --std=c89…c23, madc behaves like a
standard C compiler.
- C23 Features — modern C standard coverage
- C++ Support — the C++ surface
- Embedded Headers — built-in standard headers
- ← Back to Home