https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109402

            Bug ID: 109402
           Summary: v850: non-v850e version of __muldi3() in
                    /libgcc/config/v850/lib1funcs.S operates sp in
                    reversed direction
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: t-hosh...@pony-e.jp
  Target Milestone: ---

I have no idea to show a reproduce way in shortly.
Because a problem happens with inter-procedure such as interrupt service
routines which use storage in stack.

Where I talk about is:
in a commit 8b1204d7, /libgcc/config/v850/lib1funcs.S L2214, L2259.

There are stack-pointer operations.
I think these operations: shrink before, glowth after --- may reversed way.
There is one more consideration; this version of __muldi3() does not use
local storage in stack. So the problem will be resolved simply to remove
sp-operations.

In my environment, the next patch works well.

---

>From 1258506e0192fb0b9e5ce9e99fe88752ba7a5644 Tue, 4 Apr 2023 20:31:48 +0900
From: Hoshino Tetsuma <t-hosh...@pony-e.jp>
Date: Tue, 4 Apr 2023 19:25:03 +0900
Subject: [PATCH] remove improper stack-pointer operation

diff --git a/libgcc/config/v850/lib1funcs.S b/libgcc/config/v850/lib1funcs.S
index 00dd61d..99e79bf 100644
--- a/libgcc/config/v850/lib1funcs.S
+++ b/libgcc/config/v850/lib1funcs.S
@@ -2211,7 +2211,6 @@
 ___muldi3:
 #ifdef __v850__
         jarl  __save_r26_r31, r10
-        addi  16,  sp, sp
         mov   r6,  r28
         shr   15,  r28
         movea lo(32767), r0, r14
@@ -2256,7 +2255,6 @@
         mulh  r12, r6
         mov   r28,  r17
         mulh  r10, r17
-        add   -16, sp
         mov   r28,  r12
         mulh  r8,  r12
         add   r17, r18

Reply via email to