Convert float to double for old function code.
Some checks are pending
build and test / test-x86_64-linux (push) Waiting to run
build and test / test-x86_64-osx (push) Waiting to run
build and test / test-aarch64-osx (push) Waiting to run
build and test / test-x86_64-win32 (push) Waiting to run
build and test / test-i386-win32 (push) Waiting to run
build and test / test-armv7-linux (push) Waiting to run
build and test / test-aarch64-linux (push) Waiting to run
build and test / test-riscv64-linux (push) Waiting to run

This commit is contained in:
herman ten brugge 2025-08-10 22:02:44 +02:00
parent 087cf2e579
commit 37e1c88d78
3 changed files with 28 additions and 0 deletions

View File

@ -8693,6 +8693,9 @@ static int decl(int l)
if (sym->type.t != VT_VOID)
tcc_error("redefinition of parameter '%s'",
get_tok_str(v, NULL));
if (func_vt.ref->f.func_type == FUNC_OLD &&
type.t == VT_FLOAT)
type.t = VT_DOUBLE;
convert_parameter_type(&type);
sym->type = type;
} else if (type.t & VT_TYPEDEF) {

View File

@ -0,0 +1,23 @@
int printf(const char *s, ...);
float fx(x)
float x;
{
return 2.0 * x;
}
int
main(void)
{
float fy();
printf("%g %g\n", fx(2.0), fy(10.0));
printf("%g %g\n", fx(2.0f), fy(10.0f));
}
float fy(x)
float x;
{
return 3.0 * x;
}

View File

@ -0,0 +1,2 @@
4 30
4 30