public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bjorn at kernel dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/110634] New: Incorrect RISC-V assembly with -fno-omit-frame-pointer Date: Tue, 11 Jul 2023 19:43:07 +0000 [thread overview] Message-ID: <bug-110634-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110634 Bug ID: 110634 Summary: Incorrect RISC-V assembly with -fno-omit-frame-pointer Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bjorn at kernel dot org Target Milestone: --- Is see inconsistencies when comparing -fno-omit-frame-pointer GCC and clang builds. $ cat foo.c int foo(int a, int b) { return a + b; } $ clang-17 --target=riscv64-linux-gnu -O3 -fno-omit-frame-pointer -c foo.c -o foo.o && riscv64-linux-gnu-objdump -d foo.o foo.o: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <foo>: 0: 1141 add sp,sp,-16 2: e406 sd ra,8(sp) 4: e022 sd s0,0(sp) 6: 0800 add s0,sp,16 8: 9d2d addw a0,a0,a1 a: 60a2 ld ra,8(sp) c: 6402 ld s0,0(sp) e: 0141 add sp,sp,16 10: 8082 ret Where GCC yields: $ riscv64-linux-gnu-gcc -O3 -fno-omit-frame-pointer -c foo.c -o foo.o && riscv64-linux-gnu-objdump -d foo.o foo.o: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <foo>: 0: 1141 add sp,sp,-16 2: e422 sd s0,8(sp) 4: 0800 add s0,sp,16 6: 6422 ld s0,8(sp) 8: 9d2d addw a0,a0,a1 a: 0141 add sp,sp,16 c: 8082 ret I would expect GCC to store "ra" similar to clang, but the spec is a bit vague [1]. https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#frame-pointer-convention
next reply other threads:[~2023-07-11 19:43 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-11 19:43 bjorn at kernel dot org [this message] 2023-07-11 19:47 ` [Bug target/110634] " pinskia at gcc dot gnu.org 2023-07-11 19:50 ` bjorn at kernel dot org 2023-07-11 19:52 ` pinskia at gcc dot gnu.org 2023-07-11 20:07 ` schwab@linux-m68k.org 2023-07-19 17:57 ` cleger at rivosinc dot com
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-110634-4@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).