[Bug middle-end/108016] RISC-V:Bad codegen in scalar code comparing to LLVM

vincenzo.romano at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Sep 10 12:19:48 GMT 2025


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

--- Comment #14 from Vincenzo Romano <vincenzo.romano at gmail dot com> ---
For sure, with current RV64 trunk version, this code

    typedef struct {
      unsigned long one;
      unsigned long two;
    } twin;

    twin function(twin t) { return (twin){0, 0}; }



still generates useless stack resizing:

    function:
      addi sp,sp,-32
      li a0,0
      li a1,0
      addi sp,sp,32
      jr ra

Instead, clang-trunc does it right.

https://godbolt.org/z/KdjfzE9rx


More information about the Gcc-bugs mailing list