-
Notifications
You must be signed in to change notification settings - Fork 0
GCC Compatibility
Derek Snider edited this page May 19, 2026
·
2 revisions
madc aims for broad compatibility with real-world C code. The primary benchmark is the GCC torture test suite — a collection of 1685 C programs designed to stress-test compilers.
~80% parity — 1327 of 1685 torture tests pass (as of v0.17.0+).
This means most standard C constructs compile and run correctly in madc, including:
- Structs, unions, enums, typedefs
- Pointers, pointer arithmetic, multi-level indirection
- Fixed-size arrays, multi-dimensional arrays
- Function pointers, indirect calls
- Variadic functions (
va_list,va_arg) - K&R-style function definitions
- Cast chains, integer promotions
- Bitwise operations, shifts
- Comma operator, compound assignment
-
goto, labels - Preprocessor conditionals, macros
- Standard C control flow — if, for, while, switch, goto
- Struct layout — C ABI-compatible alignment, packing, nested structs
-
Pointer semantics — address-of, dereference, pointer subscript,
->chains - Standard library calls — printf, sprintf, strlen, memcpy, etc. via dlsym fallback
-
Preprocessor —
#define,#ifdef,#if/#elif/#else,#pragma pack
These C features are not yet fully supported:
- Struct pass-by-value for function arguments (~8 remaining failures)
-
__builtin_return_addressand similar GCC builtins -
__real__/__imag__— fuller complex number support - VLA members in local anonymous structs
- 32-bit arithmetic wrapping in widening cast contexts
-
-0.0preservation in floating-point operations -
Triple dereference (
***p) -
Inline assembly (
asm)
When debugging JIT vs compiled parity, madc uses GCC as the reference compiler:
- Reduce the failing case to the closest valid GCC analogue
- Inspect GCC's emitted code shape
- Prefer fixes that move madc toward GCC's lowering shape
When madc intentionally diverges from GCC (e.g., 64-bit default int), the divergence is documented.
- C23 Features — modern C standard coverage
- Embedded Headers — built-in standard headers
- ← Back to Home