Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add chen3feng/agent-skills --skill per-function-optimize-attribute-abi-mismatchgit clone --depth 1 https://github.com/chen3feng/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/chen3feng/agent-skills/per-function-optimize-attribute-abi-mismatch)<a href="https://agentmods.dev/skills/chen3feng/agent-skills/per-function-optimize-attribute-abi-mismatch"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/per-function-optimize-attribute-abi-mismatch/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/per-function-optimize-attribute-abi-mismatch"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/per-function-optimize-attribute-abi-mismatch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00041 | $0.01699 |
| Opus 5.5 | $0.00016 | $0.00680 |
| Sonnet 5.5 | $0.00008 | $0.00340 |
| Haiku 4.5 | $0.00004 | $0.00170 |
Grade A, and why
per-function-optimize-attribute-abi-mismatch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.
__attribute__((optimize("O0"))) silently breaks the ABI on GCC
When to use
You're trying to isolate a miscompile in a single helper function by
forcing it to lower optimization, using one of these forms inside a
translation unit that is otherwise built at -O2 or higher:
__attribute__((optimize("O0")))
static void Helper(uint8_t* Dst, const uint8_t* Src, int N) { ... }
or equivalently:
#pragma GCC push_options
#pragma GCC optimize("O0")
static void Helper(...) { ... }
#pragma GCC pop_options
and the program now crashes — usually SIGSEGV — on the first call
into Helper, before any of its body runs, even though the same code
worked at -O2.
Problem
GCC's per-function optimize attribute changes the optimization
level of the callee, but it does not re-align the ABI between
that callee and its -O2 caller. Concretely:
-O0GCC emits a full stack frame with a frame pointer, spills all arguments to memory, and does not use the x86-64 SysV red zone.-O2GCC elides the frame pointer, keeps arguments in registers, and may use the red zone.- The caller, built at
-O2, passes arguments and return address under-O2assumptions. The callee reads them under-O0assumptions. The mismatch shows up as reading0or garbage from a pointer argument, or a segfault on return (frame pointer mismatch).
Crucially, there is no compiler warning. The attribute silently produces a working-looking binary that crashes at runtime.
On Clang, __attribute__((optnone)) exists and is better-behaved
about this, but it's also more restrictive (disables all opts, not
just some) and is not a fix-by-dropping-level tool.
Solution
If you really need one function at a lower optimization level, pick one of these, in order of preference:
- Don't. If you reached for
optimize("O0")to diagnose a miscompile, see stop-chasing-the-optimizer-reduce-instead — reduce the repro and fix the real bug (usually UB) instead. - Isolate the function in its own TU, compiled at
-O1. MoveHelperintohelper.cppand add a per-file flag in the build system:
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 170 lines · 0 tokens per session scan A 4abeb8b6573e
per-function-optimize-attribute-abi-mismatch is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 41 tokens to every session and 1,699 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
per-function-optimize-attribute-abi-mismatch compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| per-function-optimize-attribute-abi-mismatchchen3feng/agent-skills | Skill | 5 | 6mo ago | Apache-2.0 | A | 41 | Claude Code, Codex |
| cpp-proJeffallan/claude-skills | Skill | 13k | today | MIT | A | 79 | Claude Code |
| memory-safety-patternsrmyndharis/antigravity-skills | Skill | 2.1k | 23d ago | MIT | A | 45 | Claude Code, Codex |
| memory-modelmohitmishra786/low-level-dev-skills | Skill | 304 | 10d ago | MIT | A | 113 | Claude Code, Codex |
| gccmohitmishra786/low-level-dev-skills | Skill | 304 | 10d ago | MIT | A | 85 | Claude Code, Codex |
| cuda-c-optimizationmindspore-ai/akg | Skill | 269 | yesterday | Apache-2.0 | A | 20 | Claude Code, Codex |
| cppcrazyguitar/cppcheatsheet | Skill | 297 | 6d ago | MIT | A | 0 | Claude Code |