The gcc "torture"/regression test-suite is available at
https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gcc.c-torture/execute.
I did a quick evaluation with cproc:
---
~/src/rpj-qbe-test/gcc.c-torture$ cat run.sh
#!/bin/bash
GCC_TORTURE_DIR=~/src/gcc/gcc/testsuite/gcc.c-torture/execute
BIN_DIR=./bin-rpj
rm -rf $BIN_DIR
mkdir $BIN_DIR
for f in ${GCC_TORTURE_DIR}/*.c; do
b=$(basename $f)
e=${BIN_DIR}/${b}.exe
echo $f $b $e
if cproc $f -o $e; then
if ${e}; then
echo SUCCESS $f
else
echo FAIL $f
fi
else
echo COMPFAIL $f
fi
done
---
~/src/rpj-qbe-test/gcc.c-torture$ time ./run.sh > results.txt 2> results.err
real 1m23.084s
user 1m2.381s
sys 0m22.600s
---
~/src/rpj-qbe-test/gcc.c-torture$ grep COMPFAIL results.txt | wc -l
845
~/src/rpj-qbe-test/gcc.c-torture$ grep SUCCESS results.txt | wc -l
798
~/src/rpj-qbe-test/gcc.c-torture$ grep -w FAIL results.txt | wc -l
15
---
Execution failures:
---
~/src/rpj-qbe-test/gcc.c-torture$ grep -w FAIL results.txt
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20021127-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20031003-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050316-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050316-2.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050316-3.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050604-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20221006-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/970217-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/bitfld-3.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/eeprof-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr34971.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/simd-4.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/simd-6.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/va-arg-11.c
---
Compilation failures - this is not as bad as it seems due to many
_builtin_foo and non-C99 code errors:
---
~/src/rpj-qbe-test/gcc.c-torture$ cat results.err | grep "error:" |
sed 's/.*error[:] //' | sort | uniq -c | sort -nr
246 undeclared identifier: __builtin_abort
96 expected declaration or function definition
47 no type in parameter declaration
43 undeclared identifier: asm
30 volatile store is not yet supported
23 GNU attribute 'aligned' is not supported here
17 undeclared identifier: __builtin_memcpy
16 undeclared identifier: __builtin_memset
16 expected primary expression
14 function definition not allowed
13 va_arg with non-scalar type is not yet supported
13 expected '(' or identifier
12 GNU attribute 'packed' is not supported here
11 either array or index must be pointer type
10 _Complex is not yet supported
9 undeclared identifier: __builtin_printf
8 undeclared identifier: __builtin_strlen
8 undeclared identifier: __builtin_strcmp
8 undeclared identifier: __builtin_memcmp
7 undeclared identifier: __builtin_mul_overflow
7 no type in struct member declaration
6 undeclared identifier: __builtin_prefetch
6 too many arguments for function call
5 unexpected ';' at top-level
5 undeclared identifier: __label__
5 undeclared identifier: __builtin_add_overflow
4 undeclared identifier: __builtin_return_address
4 expected ')' to close function declarator, saw identifier 'p'
4 bit-field 'a' in packed struct is not supported
3 undeclared identifier: __builtin_strcpy
3 undeclared identifier: __builtin_sprintf
3 undeclared identifier: __builtin_mul_overflow_p
3 undeclared identifier: __builtin_malloc
3 undeclared identifier: __builtin_longjmp
3 undeclared identifier: __builtin_ffs
3 pointer operand to '+' must be to complete object type
3 inline assembly is not yet supported
3 expected ')' to end attribute specifier, saw 'const'
2 undeclared identifier: __complex__
2 undeclared identifier: __builtin_trap
2 undeclared identifier: __builtin_shuffle
2 undeclared identifier: __builtin_abs
2 struct member 'i' has variably modified type
2 struct member 'b' has variably modified type
2 pointer operands to '!=' operator are to incompatible types
2 multiple types in declaration specifiers
2 expected ',' or ';' after declarator, saw identifier 'u128'
2 expected ',' or ';' after declarator, saw identifier 'p'
2 declaration has no type specifier
2 bit-field 'i' in packed struct is not supported
2 bit-field 'g' in packed struct is not supported
2 base types of pointer assignment must be compatible or void
2 array of unknown size has empty initializer
1 undeclared identifier: __FUNCTION__
1 undeclared identifier: foo
1 undeclared identifier: f
1 undeclared identifier: exit
1 undeclared identifier: d
1 undeclared identifier: __complex
1 undeclared identifier: c
1 undeclared identifier: __builtin_sub_overflow
1 undeclared identifier: __builtin_strncpy
1 undeclared identifier: __builtin_strchr
1 undeclared identifier: __builtin_snprintf
1 undeclared identifier: __builtin_signbit
1 undeclared identifier: __builtin_isinff
1 undeclared identifier: __builtin_frame_address
1 undeclared identifier: __builtin_exit
1 undeclared identifier: __builtin_ctz
1 undeclared identifier: __builtin_copysign
1 undeclared identifier: __builtin_classify_type
1 undeclared identifier: __builtin_choose_expr
1 undeclared identifier: __builtin_bswap64
1 undeclared identifier: __builtin_bswap32
1 undeclared identifier: __builtin_bswap16
1 undeclared identifier: __builtin_apply
1 undeclared identifier: b
1 undeclared identifier: alloca
1 undeclared identifier: abort
1 struct member 'x' has variably modified type
1 struct member 'w' has variably modified type
1 struct member 'c' has variably modified type
1 struct member 'a' contains flexible array member
1 string literal contains invalid UTF-8
1 invalid operands to conditional operator
1 external declaration must not contain 'register'
1 expected ')' to close function declarator, saw identifier 'x'
1 expected ')' to close function declarator, saw identifier '__dest'
1 expected '}' to close enum specifier, saw 'false'
1 expected ',' or ';' after declarator, saw identifier 'x'
1 expected ',' or ';' after declarator, saw identifier 'V'
1 expected ',' or ';' after declarator, saw '__attribute__'
1 expected ':' after case expression, saw '...'
1 cast type must be scalar
1 bit-field 's' in packed struct is not supported
1 alignof operator applied to incomplete type
On Wed, Sep 4, 2024 at 8:31 AM Roland Paterson-Jones <rolandpj@gmail.com> wrote:
>
> The gcc "torture"/regression test-suite is available at
> https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gcc.c-torture/execute.
>
> I did a quick evaluation with cproc:
FWIW I had a bit more success with some hackery of some __builtin_foo:
---
~/src/rpj-qbe-test/gcc.c-torture$ cat run.sh
#!/bin/bash
GCC_TORTURE_DIR=~/src/gcc/gcc/testsuite/gcc.c-torture/execute
SRC_DIR=./src-rpj
BIN_DIR=./bin-rpj
rm -rf $SRC_DIR
mkdir $SRC_DIR
rm -rf $BIN_DIR
mkdir $BIN_DIR
for f in ${GCC_TORTURE_DIR}/*.c; do
b=$(basename $f)
c=${SRC_DIR}/${b}
if grep -w -q __builtin_abort $f; then
echo "#include <stdlib.h>" > $c
echo "#define __builtin_abort abort" >> $c
fi
if grep -w -q __builtin_memcpy $f; then
echo "#include <string.h>" >> $c
echo "#define __builtin_memcpy memcpy" >> $c
fi
if grep -w -q __builtin_memset $f; then
echo "#include <string.h>" >> $c
echo "#define __builtin_memset memset" >> $c
fi
if grep -w -q __builtin_memcmp $f; then
echo "#include <string.h>" >> $c
echo "#define __builtin_memcmp memcmp" >> $c
fi
if grep -w -q __builtin_printf $f; then
echo "#include <stdio.h>" >> $c
echo "#define __builtin_printf printf" >> $c
fi
if grep -w -q __builtin_strlen $f; then
echo "#include <string.h>" >> $c
echo "#define __builtin_strlen strlen" >> $c
fi
if grep -w -q __builtin_strcmp $f; then
echo "#include <string.h>" >> $c
echo "#define __builtin_strcmp strcmp" >> $c
fi
if grep -w -q __builtin_strcpy $f; then
echo "#include <string.h>" >> $c
echo "#define __builtin_strcpy strcpy" >> $c
fi
if grep -w -q __builtin_malloc $f; then
echo "#include <stdlib.h>" > $c
echo "#define __builtin_malloc malloc" >> $c
fi
if grep -w -q __builtin_sprintf $f; then
echo "#include <stdio.h>" >> $c
echo "#define __builtin_sprintf sprintf" >> $c
fi
if grep -w -q __builtin_exit $f; then
echo "#include <stdlib.h>" > $c
echo "#define __builtin_exit exit" >> $c
fi
cat $f >> $c
e=${BIN_DIR}/${b}.exe
echo $f $b $e
if cproc $c -o $e; then
if ${e}; then
echo SUCCESS $f
else
echo FAIL $f
fi
else
echo COMPFAIL $f
fi
done
---
~/src/rpj-qbe-test/gcc.c-torture$ echo -n "COMPFAIL "; grep COMPFAIL
results.txt | wc -l; echo -n "SUCCESS "; grep SUCCESS results.txt | wc
-l; echo -n "FAIL "; grep -w FAIL results.txt | wc -l
COMPFAIL 546
SUCCESS 1091
FAIL 21
~/src/rpj-qbe-test/gcc.c-torture$ cat results.err | grep "error:" |
sed 's/.*error[:] //' | sort | uniq -c | sort -nr
96 expected declaration or function definition
56 undeclared identifier: asm
47 no type in parameter declaration
33 volatile store is not yet supported
17 expected primary expression
16 GNU attribute 'aligned' is not supported here
15 function definition not allowed
14 va_arg with non-scalar type is not yet supported
11 GNU attribute 'packed' is not supported here
11 expected '(' or identifier
11 either array or index must be pointer type
10 _Complex is not yet supported
7 undeclared identifier: __builtin_mul_overflow
7 no type in struct member declaration
6 undeclared identifier: __builtin_prefetch
6 too many arguments for function call
5 unexpected ';' at top-level
5 undeclared identifier: __label__
5 undeclared identifier: __builtin_add_overflow
4 undeclared identifier: __builtin_return_address
3 undeclared identifier: __builtin_longjmp
3 undeclared identifier: __builtin_ffs
3 pointer operand to '+' must be to complete object type
3 inline assembly is not yet supported
3 gcc_tmpnam.h: No such file or directory
3 expected ')' to end attribute specifier, saw 'const'
3 expected ')' to close function declarator, saw identifier 'p'
2 undeclared identifier: __complex__
2 undeclared identifier: __builtin_trap
2 undeclared identifier: __builtin_strlen
2 undeclared identifier: __builtin_shuffle
2 undeclared identifier: __builtin_bswap32
2 undeclared identifier: __builtin_abs
2 struct member 'i' has variably modified type
2 struct member 'b' has variably modified type
2 pointer operands to '!=' operator are to incompatible types
2 multiple types in declaration specifiers
2 expected ',' or ';' after declarator, saw identifier 'u128'
2 expected ',' or ';' after declarator, saw identifier 'p'
2 declaration has no type specifier
2 bit-field 'i' in packed struct is not supported
2 bit-field 'g' in packed struct is not supported
2 base types of pointer assignment must be compatible or void
2 array of unknown size has empty initializer
1 undeclared identifier: __FUNCTION__
1 undeclared identifier: foo
1 undeclared identifier: f
1 undeclared identifier: exit
1 undeclared identifier: d
1 undeclared identifier: __complex
1 undeclared identifier: c
1 undeclared identifier: __builtin_sub_overflow
1 undeclared identifier: __builtin_strncpy
1 undeclared identifier: __builtin_strcpy
1 undeclared identifier: __builtin_strcmp
1 undeclared identifier: __builtin_strchr
1 undeclared identifier: __builtin_snprintf
1 undeclared identifier: __builtin_signbit
1 undeclared identifier: __builtin_mul_overflow_p
1 undeclared identifier: __builtin_isinff
1 undeclared identifier: __builtin_frame_address
1 undeclared identifier: __builtin_ctz
1 undeclared identifier: __builtin_copysign
1 undeclared identifier: __builtin_classify_type
1 undeclared identifier: __builtin_choose_expr
1 undeclared identifier: __builtin_bswap64
1 undeclared identifier: __builtin_bswap16
1 undeclared identifier: __builtin_apply
1 undeclared identifier: __builtin_abort
1 undeclared identifier: b
1 undeclared identifier: alloca
1 undeclared identifier: abort
1 undeclared identifier: a
1 struct member 'x' has variably modified type
1 struct member 'w' has variably modified type
1 struct member 'c' has variably modified type
1 struct member 'a' has variably modified type
1 struct member 'a' contains flexible array member
1 string literal contains invalid UTF-8
1 invalid operands to conditional operator
1 ../../gcc.dg/tree-ssa/pr30314.c: No such file or directory
1 ../../gcc.dg/tree-ssa/pr109986.c: No such file or directory
1 ../../gcc.dg/tree-ssa/pr109938.c: No such file or directory
1 ../../gcc.dg/tree-ssa/pr105777.c: No such file or directory
1 ../../gcc.dg/pr98304-1.c: No such file or directory
1 function 'strcmp' redeclared with different linkage
1 external declaration must not contain 'register'
1 expected ')' to close function declarator, saw identifier 'x'
1 expected ')' to close function declarator, saw identifier '__dest'
1 expected '}' to close enum specifier, saw 'false'
1 expected ',' or ';' after declarator, saw identifier 'x'
1 expected ',' or ';' after declarator, saw identifier 'V'
1 expected ',' or ';' after declarator, saw '__attribute__'
1 expected ':' after case expression, saw '...'
1 cast type must be scalar
1 bit-field 's' in packed struct is not supported
1 alignof operator applied to incomplete type
~/src/rpj-qbe-test/gcc.c-torture$ grep -w FAIL results.txt
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20021127-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20031003-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050316-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050316-2.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050316-3.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20050604-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/20221006-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/970217-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/bitfld-3.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/eeprof-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr34971.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr43629.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr58943.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr77767.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/pr92618.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/scal-to-vec1.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/scal-to-vec2.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/scal-to-vec3.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/simd-4.c
FAIL /home/rolandpj/src/gcc/gcc/testsuite/gcc.c-torture/execute/simd-6.c
---
Of these, bitfld-3.c looks interesting?