Repository navigation
Pitfall: GCC 6.5 puts memory indirect operands on the wrong stack slot after a call - #59
Merged
Merged
Conversation
GCC-6.50-Dev on -m68080 addresses a pointer argument without a register as ([N,sp]) with the entry offset, also while a call's arguments are pushed. Found in libjpeg (ApolloOS R10); -fno-double-indirect avoids it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new toolchain pitfall,
toolchain/pitfalls/gcc-double-indirect-stack-slot.md.Since
double-indirect-fix.patchwas dropped (ApolloCrossDev PR #15, 2026-11-04), GCC-6.50-Dev emits memory indirect operands on-m68080. When a pointer argument gets no register, reload addresses it as([N,sp])with the stack offset of function entry. Between a call's argument pushes and the pop, that is another argument's slot:-m68020and-m68060don't use the mode.-fno-double-indirectgives correct code:move.l (76,sp),a0.Found during
The ApolloOS R10 port. MultiView crashed on every JPEG, because libjpeg's
sep_upsamplein jfif.library never advanced the scanline and bumpedcinfo->errinstead.A whole-build scan of 7662 C files found 23437 memory indirect operands, 2236 of them sp-based in 676 files. With
-fno-double-indirectthere are none, and the rebuilt tree shows the JPEG on the V4.Reported to ApolloCrossDev as issue WDrijver/ApolloCrossDev#27, with the reproduction.
Knowledge base files relied on
toolchain/compiler-variants.md(double-indirect-fix.patch history)core/pitfalls/double-memory-indirect.md(the mode is slow on the 080)toolchain/pitfalls/gcc-bbb-shift-wrong-code.md(format)Local checks:
check_frontmatter,check_linksandcheck_saga_addressespass.🤖 Generated with Claude Code