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

            Bug ID: 87391
           Summary: [RISCV] -march=rv32i -mabi=ilp32e is erroneously
                    accepted
           Product: gcc
           Version: 9.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 current ABI docs state that the RV32E calling convention (-mabi=ilp32e) may
only be used with the RV32E ISA (-march=rv32e). GCC does not produce an error
for -march=rv32i -mabi=ilp32e, but it seems that it does ignore the ABI
argument and use the ilp32e ABI anyway. I would expect GCC to produce an error
instead.

$ cat foo.c 
int foo(int a, int b, int c, int d, int e, int f, int g);

int bar() {
  return foo(1, 2, 3, 4, 5, 6, 7);
}

$ ./riscv32-unknown-elf-gcc -march=rv32i -mabi=ilp32 foo.c -S -o -
        .file   "foo.c"
        .option nopic
        .text
        .align  2
        .globl  bar
        .type   bar, @function
bar:
        addi    sp,sp,-16
        sw      ra,12(sp)
        sw      s0,8(sp)
        addi    s0,sp,16
        li      a6,7
        li      a5,6
        li      a4,5
        li      a3,4
        li      a2,3
        li      a1,2
        li      a0,1
        call    foo
        mv      a5,a0
        mv      a0,a5
        lw      ra,12(sp)
        lw      s0,8(sp)
        addi    sp,sp,16
        jr      ra
        .size   bar, .-bar
        .ident  "GCC: (GNU) 9.0.0 20180922 (experimental)"

Reply via email to