Update gcctestsuite

I updated the tests/gcctestsuite.sh a bit.
before:
  3329 test(s) ok.
  210 test(s) skipped.
  168 test(s) failed.
  28 test(s) exe failed.
after:
  3331 test(s) ok.
  299 test(s) skipped.
  79 test(s) failed.
  26 test(s) exe failed.

I found some small problems:
include/tccdefs.h: Add alloca definition for i386 and x86_64
lib/alloca.S/lib/alloca-bt.S: align i386 alloca to 16 bytes.
			      i386_gen.c vla code and gcc do the same.
x86_64-gen.c: fix typo in comment
This commit is contained in:
herman ten brugge
2025-08-03 10:35:58 +02:00
parent 80bef6162a
commit 6694391b74
5 changed files with 57 additions and 41 deletions

View File

@@ -310,6 +310,7 @@
__MAYBE_REDIR(void, free, (void*))
#if defined __i386__ || defined __x86_64__
__BOTH(void*, alloca, (__SIZE_TYPE__))
void *alloca(__SIZE_TYPE__);
#else
__BUILTIN(void*, alloca, (__SIZE_TYPE__))
#endif

View File

@@ -15,8 +15,9 @@ _(__bound_alloca):
pop %edx
pop %eax
mov %eax, %ecx
add $3+1,%eax
and $-4,%eax
add $15+1,%eax
and $-16,%eax
sub $4,%eax
jz p6
#ifdef _WIN32

View File

@@ -16,8 +16,9 @@ _(__alloca):
push %ebp
mov %esp,%ebp
mov 8(%ebp),%eax
add $3,%eax
and $-4,%eax
add $15,%eax
and $-16,%eax
sub $4,%eax
#ifdef _WIN32
jmp .+16 #p2
p1:

View File

@@ -68,9 +68,11 @@ nb_exe_failed="0"
old_pwd="`pwd`"
cd "$TESTSUITE_PATH"
skip_builtin="`grep "_builtin_" compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
skip_ieee="`grep "_builtin_" execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f3 | sort -u `"
skip_complex="`grep -i "_Complex" compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
skip_builtin="`grep '_builtin_' compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
skip_ieee="`grep '_builtin_' execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f3 | sort -u `"
skip_complex="`grep -i '_Complex' compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
skip_int128="`grep -Eiw '__int128_t|__uint128_t' compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
skip_vector="`grep -Eiw 'vector|vector_size|__vector_size__' compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
skip_misc="20000120-2.c mipscop-1.c mipscop-2.c mipscop-3.c mipscop-4.c
fp-cmp-4f.c fp-cmp-4l.c fp-cmp-8f.c fp-cmp-8l.c pr38016.c "
@@ -78,13 +80,18 @@ cd "$old_pwd"
for src in $TESTSUITE_PATH/compile/*.c ; do
echo $TCC -o $RUNTIME_DIR/tst.o -c $src
if $TCC -o $RUNTIME_DIR/tst.o -c $src 2>&1 | grep 'cannot use local functions' >/dev/null 2>&1
then
result="SKIP"
nb_skipped=$(( $nb_skipped + 1 ))
else
$TCC -o $RUNTIME_DIR/tst.o -c $src >> tcc.fail 2>&1
if [ "$?" = "0" ] ; then
result="PASS"
nb_ok=$(( $nb_ok + 1 ))
else
base=`basename "$src"`
skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_misc | grep -w $base`"
skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_int128 $skip_misc $skip_vector | grep -w $base`"
if [ -n "$skip_me" ]
then
@@ -95,6 +102,7 @@ for src in $TESTSUITE_PATH/compile/*.c ; do
nb_failed=$(( $nb_failed + 1 ))
fi
fi
fi
echo "$result: $src" >> tcc.sum
done
@@ -105,9 +113,13 @@ fi
for src in $TESTSUITE_PATH/execute/*.c $TESTSUITE_PATH/execute/ieee/*.c ; do
echo $TCC $src -o $RUNTIME_DIR/tst -lm
if $TCC $src -o $RUNTIME_DIR/tst -lm 2>&1 | grep 'cannot use local functions' >/dev/null 2>&1
then
result="SKIP"
nb_skipped=$(( $nb_skipped + 1 ))
else
$TCC $src -o $RUNTIME_DIR/tst -lm >> tcc.fail 2>&1
if [ "$?" = "0" ] ; then
result="PASS"
if $RUNTIME_DIR/tst >> tcc.fail 2>&1
then
result="PASS"
@@ -118,7 +130,7 @@ for src in $TESTSUITE_PATH/execute/*.c $TESTSUITE_PATH/execute/ieee/*.c ; do
fi
else
base=`basename "$src"`
skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_misc | grep -w $base`"
skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_int128 $skip_misc $skip_vector | grep -w $base`"
if [ -n "$skip_me" ]
then
@@ -129,6 +141,7 @@ for src in $TESTSUITE_PATH/execute/*.c $TESTSUITE_PATH/execute/ieee/*.c ; do
nb_failed=$(( $nb_failed + 1 ))
fi
fi
fi
echo "$result: $src" >> tcc.sum
done

View File

@@ -1503,7 +1503,7 @@ void gfunc_prolog(Sym *func_sym)
gen_le32(seen_stack_size);
/* movq %r11, -0x10(%rbp) */
o(0xf05d894c);
/* leaq $-192(%rbp), %r11 */
/* leaq $-200(%rbp), %r11 */
o(0x9d8d4c);
gen_le32(-176 - 24);
/* movq %r11, -0x8(%rbp) */