mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 15:44:18 +08:00
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
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:
parent
087cf2e579
commit
37e1c88d78
3
tccgen.c
3
tccgen.c
@ -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) {
|
||||
|
||||
23
tests/tests2/133_old_func.c
Normal file
23
tests/tests2/133_old_func.c
Normal 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;
|
||||
}
|
||||
|
||||
2
tests/tests2/133_old_func.expect
Normal file
2
tests/tests2/133_old_func.expect
Normal file
@ -0,0 +1,2 @@
|
||||
4 30
|
||||
4 30
|
||||
Loading…
Reference in New Issue
Block a user