Skip to content

Pitfall: &tag1 as a tag list breaks when GCC inlines or clones a variadic function - #91

Merged
WDrijver merged 1 commit into
mainfrom
pitfall/gcc-variadic-taglist-address
Nov 25, 2026
Merged

WDrijver merged 1 commit into
mainfrom
pitfall/gcc-variadic-taglist-address

Conversation

@WDrijver

Copy link
Copy Markdown
Contributor

New toolchain pitfall toolchain/pitfalls/gcc-variadic-taglist-address.md.

The classic Amiga helper f(Tag tag1, ...) that passes (struct TagItem *)&tag1 to a ...A() function breaks with GCC-6.50-Dev: a static (or same-file) helper is inlined and the variadic tags are never pushed, and a helper called with a constant first argument is cloned (.constprop) without it. Fix: copy the tags with va_arg (or AROS_SLOWSTACKTAGS); noinline, noclone together also work.

Evidence: a reproduction compiled with GCC-6.50-Dev at -O1/-O2/-Os/-O3 (objdump), and ApolloOS R10's IControl under AROS Zune on a V4 (Core 12856), where ChunkyImage got no attributes and the window did not open (fixed in ApolloOS-Port b5fd0c5c).

check_frontmatter.py and check_links.py pass.

🤖 Generated with Claude Code

…adic function

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver
WDrijver requested a review from TuKo1982 as a code owner November 25, 2026 09:48
@WDrijver
WDrijver merged commit 6b3261e into main Nov 25, 2026
2 checks passed
@WDrijver
WDrijver deleted the pitfall/gcc-variadic-taglist-address branch November 25, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant