diff options
Diffstat (limited to 'src/cmd/8l/pass.c')
-rw-r--r-- | src/cmd/8l/pass.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cmd/8l/pass.c b/src/cmd/8l/pass.c index 294926f29..28589b66a 100644 --- a/src/cmd/8l/pass.c +++ b/src/cmd/8l/pass.c @@ -614,14 +614,17 @@ dostkoff(void) diag("unbalanced PUSH/POP"); if(autoffset) { - q = p; + p->as = AADJSP; + p->from.type = D_CONST; + p->from.offset = -autoffset; + p->spadj = -autoffset; p = appendp(p); p->as = ARET; - - q->as = AADJSP; - q->from.type = D_CONST; - q->from.offset = -autoffset; - p->spadj = -autoffset; + // If there are instructions following + // this ARET, they come from a branch + // with the same stackframe, so undo + // the cleanup. + p->spadj = +autoffset; } } } |