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*)) __MAYBE_REDIR(void, free, (void*))
#if defined __i386__ || defined __x86_64__ #if defined __i386__ || defined __x86_64__
__BOTH(void*, alloca, (__SIZE_TYPE__)) __BOTH(void*, alloca, (__SIZE_TYPE__))
void *alloca(__SIZE_TYPE__);
#else #else
__BUILTIN(void*, alloca, (__SIZE_TYPE__)) __BUILTIN(void*, alloca, (__SIZE_TYPE__))
#endif #endif

View File

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

View File

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

View File

@@ -68,9 +68,11 @@ nb_exe_failed="0"
old_pwd="`pwd`" old_pwd="`pwd`"
cd "$TESTSUITE_PATH" cd "$TESTSUITE_PATH"
skip_builtin="`grep "_builtin_" 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_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_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 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 " fp-cmp-4f.c fp-cmp-4l.c fp-cmp-8f.c fp-cmp-8l.c pr38016.c "
@@ -78,21 +80,27 @@ cd "$old_pwd"
for src in $TESTSUITE_PATH/compile/*.c ; do for src in $TESTSUITE_PATH/compile/*.c ; do
echo $TCC -o $RUNTIME_DIR/tst.o -c $src echo $TCC -o $RUNTIME_DIR/tst.o -c $src
$TCC -o $RUNTIME_DIR/tst.o -c $src >> tcc.fail 2>&1 if $TCC -o $RUNTIME_DIR/tst.o -c $src 2>&1 | grep 'cannot use local functions' >/dev/null 2>&1
if [ "$?" = "0" ] ; then then
result="PASS" result="SKIP"
nb_ok=$(( $nb_ok + 1 )) nb_skipped=$(( $nb_skipped + 1 ))
else else
base=`basename "$src"` $TCC -o $RUNTIME_DIR/tst.o -c $src >> tcc.fail 2>&1
skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_misc | grep -w $base`" if [ "$?" = "0" ] ; then
result="PASS"
if [ -n "$skip_me" ] nb_ok=$(( $nb_ok + 1 ))
then
result="SKIP"
nb_skipped=$(( $nb_skipped + 1 ))
else else
result="FAIL" base=`basename "$src"`
nb_failed=$(( $nb_failed + 1 )) skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_int128 $skip_misc $skip_vector | grep -w $base`"
if [ -n "$skip_me" ]
then
result="SKIP"
nb_skipped=$(( $nb_skipped + 1 ))
else
result="FAIL"
nb_failed=$(( $nb_failed + 1 ))
fi
fi fi
fi fi
echo "$result: $src" >> tcc.sum echo "$result: $src" >> tcc.sum
@@ -105,28 +113,33 @@ fi
for src in $TESTSUITE_PATH/execute/*.c $TESTSUITE_PATH/execute/ieee/*.c ; do for src in $TESTSUITE_PATH/execute/*.c $TESTSUITE_PATH/execute/ieee/*.c ; do
echo $TCC $src -o $RUNTIME_DIR/tst -lm echo $TCC $src -o $RUNTIME_DIR/tst -lm
$TCC $src -o $RUNTIME_DIR/tst -lm >> tcc.fail 2>&1 if $TCC $src -o $RUNTIME_DIR/tst -lm 2>&1 | grep 'cannot use local functions' >/dev/null 2>&1
if [ "$?" = "0" ] ; then then
result="PASS" result="SKIP"
if $RUNTIME_DIR/tst >> tcc.fail 2>&1 nb_skipped=$(( $nb_skipped + 1 ))
then
result="PASS"
nb_ok=$(( $nb_ok + 1 ))
else
result="FAILEXE"
nb_exe_failed=$(( $nb_exe_failed + 1 ))
fi
else else
base=`basename "$src"` $TCC $src -o $RUNTIME_DIR/tst -lm >> tcc.fail 2>&1
skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_misc | grep -w $base`" if [ "$?" = "0" ] ; then
if $RUNTIME_DIR/tst >> tcc.fail 2>&1
if [ -n "$skip_me" ] then
then result="PASS"
result="SKIP" nb_ok=$(( $nb_ok + 1 ))
nb_skipped=$(( $nb_skipped + 1 )) else
result="FAILEXE"
nb_exe_failed=$(( $nb_exe_failed + 1 ))
fi
else else
result="FAIL" base=`basename "$src"`
nb_failed=$(( $nb_failed + 1 )) skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_int128 $skip_misc $skip_vector | grep -w $base`"
if [ -n "$skip_me" ]
then
result="SKIP"
nb_skipped=$(( $nb_skipped + 1 ))
else
result="FAIL"
nb_failed=$(( $nb_failed + 1 ))
fi
fi fi
fi fi
echo "$result: $src" >> tcc.sum echo "$result: $src" >> tcc.sum

View File

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