Allow C solutions to modify string inputs

Merged
TS
1d ago
+71-0

Correct C solutions that overwrite string arguments crashed because the generated inputs pointed at string literals. Declare scalar string arguments as writable character arrays, leaving other argument types unchanged.

Add compiled C regression tests for Backwards Caption Repair and Scrambled Label Match. The first edits and returns its input; the second sorts both input strings. Both tests compare every result against the existing judge fixtures.

Validation:

  • On Windows, with Node.js 24.21.0 and GCC/G++ 16.2.0, node --test tests/browser/compiler-explorer.test.js: 70 passed, 0 failed, 9 skipped because Java is unavailable. Both new C tests ran without skips.
  • Ran the two new tests with the original generator loaded from HEAD: both failed with access violation 0xC0000005. Both pass with the fix.
  • Compiler Explorer, Clang 19.1.0 with -O2 -std=c17: both original harnesses crashed with SIGSEGV; both fixed harnesses passed 6/6 cases.
  • Prettier 3.9.10 and ESLint 10.13.0 passed for both changed files. git diff --check passed.
  • Compared generated harnesses across the problem bank: only scalar-string declarations changed for 26 C problems. The remaining 117 C harnesses and all 151 C++ and 151 Java harnesses were identical.

Attempted the full project gate on Windows; it exited with code 1. The run reported missing Cargo, skipped checks due to unavailable tools, and additional test failures that have not all been investigated.

Close #477