Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPEC2006]### Assertion failure ../../../../osprey/ir_tools/whirl2llvm.cxx:2051: ### Handle_arg_diff_ty: Parameter number is wrong, expected 0 got 2 #34

Open
zqb-all opened this issue Oct 28, 2023 · 1 comment

Comments

@zqb-all
Copy link

zqb-all commented Oct 28, 2023

spec2k6 456.hmmer build fail.
one of the errors can be reproduce by the following code:

static  int		(*qcmp)();		/* the comparison routine */

void specqsort(compar)
	int	(*compar)();
{
	qcmp = compar;
	(*qcmp)(1, 2);
}

cmd:

xcalcc -c a.c

error:

2023-10-28 10:57:41,190 - xcalcc - ERROR - !!! Log: (null) :Translating specqsort(0)

!!! DevWarn: specqsort :Stmt2llvm: ingore PRAGMA stmt now

### Assertion failure ../../../../osprey/ir_tools/whirl2llvm.cxx:2051:
### Handle_arg_diff_ty: Parameter number is wrong, expected 0 got 2.
### For a.O in specqsort (xcalcc:583)
@zqb-all
Copy link
Author

zqb-all commented Oct 28, 2023

$riscv64-unknown-linux-gnu-gcc -S a.c
$ cat a.s
	.file	"a.c"
	.option nopic
	.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
	.attribute unaligned_access, 0
	.attribute stack_align, 16
	.text
	.local	qcmp
	.comm	qcmp,8,8
	.align	1
	.globl	specqsort
	.type	specqsort, @function
specqsort:
	addi	sp,sp,-32
	sd	ra,24(sp)
	sd	s0,16(sp)
	addi	s0,sp,32
	sd	a0,-24(s0)
	lui	a5,%hi(qcmp)
	ld	a4,-24(s0)
	sd	a4,%lo(qcmp)(a5)
	lui	a5,%hi(qcmp)
	ld	a5,%lo(qcmp)(a5)
	li	a1,2
	li	a0,1
	jalr	a5
	nop
	ld	ra,24(sp)
	ld	s0,16(sp)
	addi	sp,sp,32
	jr	ra
	.size	specqsort, .-specqsort
	.ident	"GCC: (g) 12.3.1 20230609"
	.section	.note.GNU-stack,"",@progbits

zengdage added a commit to zengdage/open64 that referenced this issue Jan 4, 2024
The icall or vfcall should support unproto type function.

1. The w2ll will crash if compile the code like that:
```
static  int             (*qcmp)();

void specqsort(base, n, size, compar)
    char    *base;
    int     n;
    int     size;
    int     (*compar)();
{
    char *min;
    while ((*qcmp)(min) > 0){}
}

```

2. Error Log:
```
Assertion failure ../../../../osprey/ir_tools/whirl2llvm.cxx:2056:
Handle_arg_diff_ty: Parameter number is wrong, expected 0 got 1.

Assertion failure ../../../../osprey/ir_tools/whirl2llvm.cxx:1985:
CastToTargetType: can't handle other src-type now

```

Signed-off-by: Zhijin Zeng <zhijin.zeng@spacemit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant