https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82717
Bug ID: 82717 Summary: [RISCV] Default value of the -mabi option doesn't match documentation Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: asb at lowrisc dot org Target Milestone: --- The documentation for the -mabi command-line option for RISC-V states: """ @item -mabi=@var{ABI-string} @opindex mabi Specify integer and floating-point calling convention. This defaults to the natural calling convention: e.g.@ LP64 for RV64I, ILP32 for RV32I, LP64D for RV64G. """ By my reading, this indicates that -march=rv32imafd would imply -mabi=ilp32d as the "natural" calling convention. This is not the case. Note how the soft-float calling convention is used in the example below: $ cat t.c double callee(float a, double b, int c) { return a+b+c; } double caller(void) { callee(1.0, 2.0, 3); } $ ./riscv32-unknown-elf-gcc -march=rv32imafdc t.c -c -S -o - .file "t.c" .option nopic .text .align 1 .globl callee .type callee, @function callee: add sp,sp,-48 sw s0,44(sp) add s0,sp,48 sw a0,-20(s0) sw a1,-32(s0) sw a2,-28(s0) sw a3,-24(s0) flw fa5,-20(s0) fcvt.d.s fa4,fa5 fld fa5,-32(s0) fadd.d fa4,fa4,fa5 lw a5,-24(s0) fcvt.d.w fa5,a5 fadd.d fa5,fa4,fa5 fsd fa5,-40(s0) lw a0,-40(s0) lw a1,-36(s0) lw s0,44(sp) add sp,sp,48 jr ra .size callee, .-callee .align 1 .globl caller .type caller, @function caller: add sp,sp,-32 sw ra,28(sp) sw s0,24(sp) add s0,sp,32 lui a5,%hi(.LC0) addi a5,a5,%lo(.LC0) fld fa4,0(a5) lui a5,%hi(.LC1) flw fa5,%lo(.LC1)(a5) li a3,3 fsd fa4,-24(s0) lw a1,-24(s0) lw a2,-20(s0) fmv.x.s a0,fa5 call callee nop fsd fa5,-24(s0) lw a0,-24(s0) lw a1,-20(s0) lw ra,28(sp) lw s0,24(sp) add sp,sp,32 jr ra .size caller, .-caller .section .rodata .align 3 .LC0: .word 0 .word 1073741824 .align 2 .LC1: .word 1065353216 .ident "GCC: (GNU) 8.0.0 20171025 (experimental)" I would also note that the documentation could be improved by better detailing the accepted ABI strings and giving valid examples (ILP32 isn't accepted as it is uppercase).