mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 15:44:18 +08:00
Small updates
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
Allow 'make speedtest' in tests directory Fix compiler warning tccpp.c
This commit is contained in:
parent
3c18df610d
commit
34eed88a70
@ -1,6 +1,6 @@
|
|||||||
#include <tcclib.h>
|
#include <tcclib.h>
|
||||||
|
|
||||||
int fib(n)
|
int fib(int n)
|
||||||
{
|
{
|
||||||
if (n <= 2)
|
if (n <= 2)
|
||||||
return 1;
|
return 1;
|
||||||
@ -18,6 +18,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
n = atoi(argv[1]);
|
n = atoi(argv[1]);
|
||||||
printf("fib(%d) = %d\n", n, fib(n, 2));
|
printf("fib(%d) = %d\n", n, fib(n));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
3
tccpp.c
3
tccpp.c
@ -2575,13 +2575,14 @@ static void parse_number(const char *p)
|
|||||||
if (t >= b)
|
if (t >= b)
|
||||||
tcc_error("invalid digit");
|
tcc_error("invalid digit");
|
||||||
n = n * b + t;
|
n = n * b + t;
|
||||||
if (!ov)
|
if (!ov) {
|
||||||
/* detect overflow */
|
/* detect overflow */
|
||||||
if (n1 >= 0x1000000000000000ULL && n / b != n1)
|
if (n1 >= 0x1000000000000000ULL && n / b != n1)
|
||||||
ov = 1;
|
ov = 1;
|
||||||
else
|
else
|
||||||
n1 = n;
|
n1 = n;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#ifdef TCC_CUT_ON_INTEGER_LITERAL_OVERFLOW
|
#ifdef TCC_CUT_ON_INTEGER_LITERAL_OVERFLOW
|
||||||
/* On integer literal overflow use the most significant digits before
|
/* On integer literal overflow use the most significant digits before
|
||||||
the overflow happened. Effectively this cuts the 0x1000000000000000
|
the overflow happened. Effectively this cuts the 0x1000000000000000
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user