public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jskumari at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/100799] Stackoverflow in optimized code on PPC Date: Mon, 17 Oct 2022 09:42:10 +0000 [thread overview] Message-ID: <bug-100799-4-mSpl45rfjl@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100799-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100799 --- Comment #18 from Surya Kumari Jangala <jskumari at gcc dot gnu.org> --- I git cloned and built flexiblas to see what is the frame size and what is the assembly code generated for the flexiblas C wrapper routine for dgebal. The important assembly code snippets for dgebal.c : // r23-r31 are saved in the callee frame std r23,-72(r1) std r24,-64(r1) ... ... std r31,-8(r1) // allocate the stack frame stdu r1,-112(r1) // save the parameter registers r3-r10 into r23-r30 mr r30,r3 ... mr r23,r10 // some of the param regs are used as temps ld r3,0(r31) lwz r11,16(r3) // populate the param registers appropriately mr r3,r30 ... mr r10,r23 // make the call to the fortran dgebal routine bctrl // restore r1 addi r1,r1,112 // restore r23-r31 ld r23,-72(r1) ... ld r31,-8(r1) // return blr As we can see, the frame size allocated is only 112 out of which 32 is for things like LR, TOC etc. and 72 is needed to save r23-r31. So clearly, the wrapper routine is not allocating any parameter save area in it's frame. Now, the dgebal fortran routine writes into the caller's frame thereby corrupting a callee save register (one of r23-r31). So when control returns back from the wrapper routine to the fortran routine dgeev, we see a corrupted value.
next prev parent reply other threads:[~2022-10-17 9:42 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-27 11:20 [Bug fortran/100799] New: " alexander.grund@tu-dresden.de 2021-05-28 16:42 ` [Bug target/100799] " alexander.grund@tu-dresden.de 2021-06-01 19:08 ` bergner at gcc dot gnu.org 2021-06-01 21:09 ` segher at gcc dot gnu.org 2021-06-02 0:31 ` amodra at gmail dot com 2021-10-05 22:45 ` bergner at gcc dot gnu.org 2022-01-09 11:13 ` kenneth.hoste at ugent dot be 2022-07-08 10:53 ` alexander.grund@tu-dresden.de 2022-07-08 16:38 ` bergner at gcc dot gnu.org 2022-07-14 20:10 ` bergner at gcc dot gnu.org 2022-07-20 11:45 ` alexander.grund@tu-dresden.de 2022-07-20 14:14 ` alexander.grund@tu-dresden.de 2022-07-20 17:42 ` segher at gcc dot gnu.org 2022-07-20 17:59 ` segher at gcc dot gnu.org 2022-09-13 19:29 ` segher at gcc dot gnu.org 2022-09-19 5:46 ` jskumari at gcc dot gnu.org 2022-09-20 22:45 ` segher at gcc dot gnu.org 2022-10-17 8:17 ` jskumari at gcc dot gnu.org 2022-10-17 9:42 ` jskumari at gcc dot gnu.org [this message] 2022-10-17 17:10 ` jskumari at gcc dot gnu.org 2022-10-31 3:00 ` linkw at gcc dot gnu.org 2022-11-09 16:43 ` jskumari at gcc dot gnu.org 2023-06-19 20:25 ` bergner at gcc dot gnu.org 2024-02-21 7:38 ` jakub at gcc dot gnu.org 2024-02-22 2:51 ` bergner at gcc dot gnu.org 2024-02-22 14:44 ` bergner at gcc dot gnu.org 2024-02-22 14:59 ` jakub at gcc dot gnu.org 2024-02-25 0:39 ` bergner at gcc dot gnu.org 2024-02-26 9:58 ` jakub at gcc dot gnu.org 2024-02-27 0:45 ` bergner at gcc dot gnu.org 2024-02-27 7:26 ` jakub at gcc dot gnu.org 2024-02-27 15:30 ` bergner at gcc dot gnu.org 2024-03-01 15:25 ` bergner at gcc dot gnu.org 2024-03-22 7:44 ` aagarwa at gcc dot gnu.org 2024-03-22 7:45 ` aagarwa at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100799-4-mSpl45rfjl@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).