aboutsummaryrefslogtreecommitdiff
path: root/tests/tcctest.c
diff options
context:
space:
mode:
authorjiang <30155751@qq.com>2014-04-30 15:26:45 +0800
committerjiang <30155751@qq.com>2014-04-30 15:26:45 +0800
commit5af0ea7fb8d6b2b2a2d3833caad5eda4b43ef595 (patch)
tree3d842579c3cd440a9dc246697da85554cd0270df /tests/tcctest.c
parent9ff288648b23537c205e4dad16002e2b9ca03203 (diff)
downloadtinycc-5af0ea7fb8d6b2b2a2d3833caad5eda4b43ef595.tar.gz
tinycc-5af0ea7fb8d6b2b2a2d3833caad5eda4b43ef595.tar.bz2
Fix va_arg bug, Fix type conversion bug, an increase of loc_stack () function is used to manage loc
Diffstat (limited to 'tests/tcctest.c')
-rw-r--r--tests/tcctest.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index cc8ffd8..ca2ad0b 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -1680,7 +1680,6 @@ void prefix ## fcast(type a)\
printf("ftof: %f %f %Lf\n", fa, da, la);\
ia = (int)a;\
llia = (long long)a;\
- a = (a >= 0) ? a : -a;\
ua = (unsigned int)a;\
llua = (unsigned long long)a;\
printf("ftoi: %d %u %lld %llu\n", ia, ua, llia, llua);\
@@ -1710,6 +1709,18 @@ void prefix ## call(void)\
printf("strto%s: %f\n", #prefix, (double)strto ## prefix("1.2", NULL));\
}\
\
+void prefix ## calc(type x, type y)\
+{\
+ x=x*x;y=y*y;\
+ printf("%d, %d\n", (int)x, (int)y);\
+ x=x-y;y=y-x;\
+ printf("%d, %d\n", (int)x, (int)y);\
+ x=x/y;y=y/x;\
+ printf("%d, %d\n", (int)x, (int)y);\
+ x=x+x;y=y+y;\
+ printf("%d, %d\n", (int)x, (int)y);\
+}\
+\
void prefix ## signed_zeros(void) \
{\
type x = 0.0, y = -0.0, n, p;\
@@ -1732,7 +1743,7 @@ void prefix ## signed_zeros(void) \
1.0 / x != 1.0 / p);\
else\
printf ("x != +y; this is wrong!\n");\
- p = -y;\
+ p = -y;\
if (x == p)\
printf ("Test 1.0 / x != 1.0 / -y returns %d (should be 0).\n",\
1.0 / x != 1.0 / p);\
@@ -1748,7 +1759,8 @@ void prefix ## test(void)\
prefix ## fcast(234.6);\
prefix ## fcast(-2334.6);\
prefix ## call();\
- prefix ## signed_zeros();\
+ prefix ## calc(1, 1.0000000000000001);\
+ prefix ## signed_zeros();\
}
FTEST(f, float, float, "%f")
@@ -2572,7 +2584,6 @@ int constant_p_var;
void builtin_test(void)
{
-#if GCC_MAJOR >= 3
COMPAT_TYPE(int, int);
COMPAT_TYPE(int, unsigned int);
COMPAT_TYPE(int, char);
@@ -2582,9 +2593,9 @@ void builtin_test(void)
COMPAT_TYPE(int *, void *);
COMPAT_TYPE(int *, const int *);
COMPAT_TYPE(char *, unsigned char *);
+ COMPAT_TYPE(char, unsigned char);
/* space is needed because tcc preprocessor introduces a space between each token */
- COMPAT_TYPE(char * *, void *);
-#endif
+ COMPAT_TYPE(char **, void *);
printf("res = %d\n", __builtin_constant_p(1));
printf("res = %d\n", __builtin_constant_p(1 + 2));
printf("res = %d\n", __builtin_constant_p(&constant_p_var));