public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109402] New: v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction
@ 2023-04-04 11:44 t-hoshino@pony-e.jp
  2023-04-04 18:53 ` [Bug target/109402] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: t-hoshino@pony-e.jp @ 2023-04-04 11:44 UTC (permalink / raw)
  To: gcc-bugs

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-hoshino@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-hoshino@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/109402] v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction
  2023-04-04 11:44 [Bug target/109402] New: v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction t-hoshino@pony-e.jp
@ 2023-04-04 18:53 ` pinskia at gcc dot gnu.org
  2023-04-06 15:38 ` mikpelinux at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-04 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
r0-44780-g8376061dbecc aka
https://inbox.sourceware.org/gcc-patches/m3wuqam1t4.fsf@north-pole.nickc.cambridge.redhat.com/

It has been broken for almost 21 years even.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/109402] v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction
  2023-04-04 11:44 [Bug target/109402] New: v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction t-hoshino@pony-e.jp
  2023-04-04 18:53 ` [Bug target/109402] " pinskia at gcc dot gnu.org
@ 2023-04-06 15:38 ` mikpelinux at gmail dot com
  2023-04-08 14:26 ` cvs-commit at gcc dot gnu.org
  2023-04-08 14:29 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikpelinux at gmail dot com @ 2023-04-06 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Please send patches to gcc-patches for review.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/109402] v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction
  2023-04-04 11:44 [Bug target/109402] New: v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction t-hoshino@pony-e.jp
  2023-04-04 18:53 ` [Bug target/109402] " pinskia at gcc dot gnu.org
  2023-04-06 15:38 ` mikpelinux at gmail dot com
@ 2023-04-08 14:26 ` cvs-commit at gcc dot gnu.org
  2023-04-08 14:29 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-08 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

https://gcc.gnu.org/g:79fb2de020c499bd01708e1418965a11166b7d5b

commit r13-7123-g79fb2de020c499bd01708e1418965a11166b7d5b
Author: Tetsuma Hoshino <t-hoshino@pony-e.jp>
Date:   Sat Apr 8 08:19:53 2023 -0600

    PR target/109402: v850 (not v850e) variant of __muldi3() moves sp in
reversed direction [PR109402]

    muldi3 will deallocate stack space after the call to __save_r26_r31,
    then re-allocate the space a short while later.  If an interrupt
    occurs in that window, it can clobber items on the stack.

            PR target/109402

    libgcc/
            * config/v850/lib1funcs.S (___muldi3): Remove unnecessary
            stack manipulations.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/109402] v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction
  2023-04-04 11:44 [Bug target/109402] New: v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction t-hoshino@pony-e.jp
                   ` (2 preceding siblings ...)
  2023-04-08 14:26 ` cvs-commit at gcc dot gnu.org
@ 2023-04-08 14:29 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: law at gcc dot gnu.org @ 2023-04-08 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Fixed on the trunk.  Not planning to backport given gcc-13 is due out soon and
v850 isn't a primary target.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-08 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 11:44 [Bug target/109402] New: v850: non-v850e version of __muldi3() in /libgcc/config/v850/lib1funcs.S operates sp in reversed direction t-hoshino@pony-e.jp
2023-04-04 18:53 ` [Bug target/109402] " pinskia at gcc dot gnu.org
2023-04-06 15:38 ` mikpelinux at gmail dot com
2023-04-08 14:26 ` cvs-commit at gcc dot gnu.org
2023-04-08 14:29 ` law at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).