Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong SBC asm in stm8 #7

Open
sogrom opened this issue Mar 25, 2024 · 0 comments
Open

Wrong SBC asm in stm8 #7

sogrom opened this issue Mar 25, 2024 · 0 comments

Comments

@sogrom
Copy link

sogrom commented Mar 25, 2024

Current version 3.9.0 generates wrong asm for stm8.
getting errors:

 obj/main.asm:715: Error: stm8: call to md_operand
 obj/main.asm:715: Error: bad expression

Please see fix below:

diff --git a/src/stm8/gen.c b/src/stm8/gen.c
index 0d89633..1536392 100644
--- a/src/stm8/gen.c
+++ b/src/stm8/gen.c
@@ -2860,7 +2860,7 @@ genSub (const iCode *ic, asmop *result_aop, asmop *left_aop, asmop *right_aop)
                 emit3_o (started ? A_SBC : A_SUB, ASMOP_A, 0, right_aop, i);
               else
                 {
-                  emit2 (started ? "sbc" : "sub", "a, (#%d, sp)", right_offset);
+                  emit2 (started ? "sbc" : "sub", "a, (%d, sp)", right_offset);
                   cost (2, 1);
                 }
 

this was fixed in new version here:

swegener/sdcc@02c36c6

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

No branches or pull requests

1 participant