Skip to content

Commit

Permalink
library-check: fixup missing __builtin_ffs check
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Nov 17, 2024
1 parent e8d3409 commit 8a708ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/ansi-c/library/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ long double __builtin_huge_vall(void)
#pragma CPROVER check pop
}

/* FUNCTION: __builtin_ffs */

//int __builtin_ffs(float f)
//{
// return simplify_exprt::simplify_ffs(f);
//}

/* FUNCTION: _dsign */

int _dsign(double d)
Expand Down
9 changes: 5 additions & 4 deletions src/ansi-c/library_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for f in "$@"; do
[ "${ec}" -eq 0 ] || exit "${ec}"
done

# Make sure all internal library functions have tests exercising them:
echo Make sure all internal library functions have tests exercising them
grep '^/\* FUNCTION:' ../*/library/* | cut -f3 -d" " | sort -u > __functions

# Some functions are not expected to have tests:
Expand Down Expand Up @@ -81,7 +81,7 @@ perl -p -i -e 's/^__vfprintf_chk\n//' __functions # vfprintf-01/__vfprintf_chk.d

# Some functions are covered by tests in other folders:
perl -p -i -e 's/^__spawned_thread\n//' __functions # any pthread_create tests
perl -p -i -e 's/^__builtin_ffsl?l?\n//' __functions # cbmc/__builtin_ffs-01
#perl -p -i -e 's/^__builtin_ffsl?l?\n//' __functions # cbmc/__builtin_ffs-01
perl -p -i -e 's/^__builtin_[su]addl?l?_overflow\n//' __functions # cbmc/gcc_builtin_add_overflow
perl -p -i -e 's/^__builtin_[su]mull?l?_overflow\n//' __functions # cbmc/gcc_builtin_mul_overflow
perl -p -i -e 's/^__builtin_[su]subl?l?_overflow\n//' __functions # cbmc/gcc_builtin_sub_overflow
Expand All @@ -101,13 +101,14 @@ perl -p -i -e 's/^_mm_setr_epi(16|32)\n//' __functions # cbmc/SIMD1
perl -p -i -e 's/^_mm_setr_pi16\n//' __functions # cbmc/SIMD1
perl -p -i -e 's/^_mm_subs_ep[iu]16\n//' __functions # cbmc/SIMD1

ls ../../regression/cbmc-library/ | grep -- - | cut -f1 -d- | sort -u > __tests
ls ../../regression/cbmc-library/ | grep -- -0 | cut -f1 -d- | sort -u > __tests
diff -u __tests __functions
ec="${?}"
rm __functions __tests
if [ $ec != 0 ]; then
echo "Tests and library functions don't match."
echo "Lines prefixed with - are tests not matching any library function."
echo "Lines prefixed with + are functions lacking a test."
else
rm __functions __tests
fi
exit "${ec}"

0 comments on commit 8a708ef

Please sign in to comment.