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

--- Comment #2 from Alex Bradbury <asb at lowrisc dot org> ---
Better example demonstrating the problem exists for returns too:

$ cat foo.c 
struct float_struct { float v; };
struct char_struct { char v; };

struct float_struct callee(float, char);

float caller(struct float_struct fs, struct char_struct cs) {
  return callee(fs.v, cs.v).v;
}

$ ./riscv32-unknown-elf-gcc -march=rv64i -mabi=lp64 -S -o - foo.c -O2
        .file   "foo.c"
        .option nopic
        .text
        .align  2
        .globl  caller
        .type   caller, @function
caller:
        addi    sp,sp,-16
        andi    a1,a1,0xff
        sd      ra,8(sp)
        call    callee
        ld      ra,8(sp)
        addi    sp,sp,16
        jr      ra
        .size   caller, .-caller
        .ident  "GCC: (GNU) 9.0.0 20180922 (experimental)"

Reply via email to