Skip to content

Commit 1dec31d

Browse files
committed
Fix GCC sanitizer guard in stress test
1 parent e2e7371 commit 1dec31d

2 files changed

Lines changed: 49 additions & 4 deletions

File tree

.agents/sow/done/SOW-0013-20260603-codacy-metrics-investigation.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Status: completed
66

7-
Sub-state: coverage workflow implemented and locally validated; maintainability hotspot remediation is tracked in `SOW-0014`.
7+
Sub-state: coverage workflow implemented; remote C build regression repaired locally and queued for remote revalidation after push.
88

99
## Requirements
1010

@@ -431,6 +431,47 @@ enabled; real hotspot remediation is tracked separately.
431431

432432
- `SOW-0014`: source complexity and duplication hotspot remediation.
433433

434-
## Regression Log
434+
## Regression - 2026-06-03
435435

436-
None yet.
436+
What broke:
437+
438+
- GitHub Actions run `26877754854`, job `79269490556`, failed in the new
439+
`Codacy Coverage` workflow before upload.
440+
- Failure occurred during `Generate coverage reports` while building
441+
`tests/fixtures/c/test_stress.c`.
442+
- Remote evidence: GCC 13 on Ubuntu 24.04 rejected the sanitizer guard at
443+
`tests/fixtures/c/test_stress.c:840` with `missing binary operator before
444+
token "("`.
445+
446+
Why previous validation missed it:
447+
448+
- Local validation used a newer GCC that accepted the existing guard.
449+
- The broken expression mixed `defined(__has_feature)` with direct
450+
`__has_feature(...)` calls in the same preprocessor expression; GCC 13 still
451+
parsed the function-like expression even when the macro was absent.
452+
453+
Repair plan:
454+
455+
- Define a local `__has_feature(feature)` compatibility macro as `0` when the
456+
compiler does not provide it.
457+
- Simplify the sanitizer guard to call `__has_feature(...)` directly after the
458+
compatibility macro is defined.
459+
- Re-run local C build/tests and final CI workflow checks.
460+
461+
Validation:
462+
463+
- Targeted local validation passed:
464+
- configured coverage build with `cmake -S . -B build-codacy-coverage
465+
-DCMAKE_BUILD_TYPE=Debug -DNETIPC_COVERAGE=ON -DCMAKE_C_COMPILER=gcc`.
466+
- built `test_stress` with `cmake --build build-codacy-coverage --target
467+
test_stress`.
468+
- ran `build-codacy-coverage/bin/test_stress`; result was 32 passed, 0
469+
failed.
470+
- Remote GitHub Actions validation will be checked after the repair commit is
471+
pushed.
472+
473+
Artifact updates:
474+
475+
- SOW lifecycle: reopened from `done/` to `current/` for this regression.
476+
- Specs/docs/skills: no protocol/API/operator behavior changes expected from
477+
this test portability fix.

tests/fixtures/c/test_stress.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <unistd.h>
3232
#include <dirent.h>
3333

34+
#ifndef __has_feature
35+
#define __has_feature(feature) 0
36+
#endif
37+
3438
/* ------------------------------------------------------------------ */
3539
/* Test infrastructure */
3640
/* ------------------------------------------------------------------ */
@@ -837,7 +841,7 @@ static void test_long_running_stability(void)
837841
* (ASAN shadow memory, TSAN metadata), so use a larger tolerance. */
838842
long vmrss_growth = vmrss_end - vmrss_start;
839843
#if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__) || \
840-
(defined(__has_feature) && (__has_feature(address_sanitizer) || __has_feature(thread_sanitizer)))
844+
__has_feature(address_sanitizer) || __has_feature(thread_sanitizer)
841845
check("memory stable (< 256MB growth, sanitizer)", vmrss_growth < 262144);
842846
#else
843847
check("memory stable (< 4MB growth)", vmrss_growth < 4096);

0 commit comments

Comments
 (0)