I did: > 2026-07-25 Bruno Haible <[email protected]> > > tests: Avoid some runtime errors with Fil-C. > * tests/test-alignalloc.c (MAX_ALIGNMENT): New macro. Use it instead > of 16 MiB. > * tests/test-calloc-posix.c (main): Skip big allocations on Fil-C. > * tests/test-calloc-gnu.c (main): Likewise. > * tests/test-malloc-posix.c (main): Likewise. > * tests/test-malloc-gnu.c (main): Likewise. > * tests/test-realloc-posix.c (main): Likewise. > * tests/test-reallocarray.c (main): Likewise. > * tests/test-fprintf-posix2.c: Likewise. > * tests/test-printf-posix2.c: Likewise.
This patch fixes some more test failures. For three other test failures, I reported Fil-C bugs: https://github.com/pizlonator/fil-c/issues/285 https://github.com/pizlonator/fil-c/issues/286 https://github.com/pizlonator/fil-c/issues/287 2026-07-28 Bruno Haible <[email protected]> tests: Avoid some more runtime errors with Fil-C. * tests/test-c32ispunct.c (main): Skip a test case that fails on Fil-C. * tests/test-free.c (main): Avoid converting from a pointer to uintptr_t and back. * tests/test-explicit_bzero.c (test_heap): Skip this test on Fil-C. * tests/test-memset_explicit.c (test_heap): Likewise. * tests/test-sigsegv-catch-segv1.c: Skip the entire test on Fil-C, since it relies on converting an uintptr_t value to a pointer. * tests/test-sigsegv-catch-segv2.c: Likewise. diff --git a/tests/test-c32ispunct.c b/tests/test-c32ispunct.c index d7493d0589..64852bbba1 100644 --- a/tests/test-c32ispunct.c +++ b/tests/test-c32ispunct.c @@ -255,7 +255,7 @@ main (int argc, char *argv[]) is = for_character ("\360\235\204\200", 4); ASSERT (is != 0); #endif - #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__) + #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __FILC__) /* U+E003A TAG COLON */ is = for_character ("\363\240\200\272", 4); ASSERT (is == 0); diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c index 6abb85f180..f34670cb9e 100644 --- a/tests/test-explicit_bzero.c +++ b/tests/test-explicit_bzero.c @@ -61,11 +61,14 @@ test_static (void) /* =============== Verify operation on heap-allocated memory =============== */ /* Skip this part when an address sanitizer is in use, because it would report - a "heap use after free". */ + a "heap use after free". + Skip it also with Fil-C, because that environment does not support the + conversion of uintptr_t to a pointer or the re-use of a freed pointer. */ #ifndef __has_feature # define __has_feature(a) 0 #endif -#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) +#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) \ + || defined __FILC__ static void test_heap (void) @@ -141,7 +144,7 @@ test_heap (void) printf ("test_heap: address range is unmapped after free().\n"); } -#endif /* ! address sanitizer enabled */ +#endif /* ! (address sanitizer enabled || Fil-C) */ /* =============== Verify operation on stack-allocated memory =============== */ diff --git a/tests/test-free.c b/tests/test-free.c index 49b76bc543..7a3fa9a9aa 100644 --- a/tests/test-free.c +++ b/tests/test-free.c @@ -131,7 +131,7 @@ main () /* Do a large memory allocation. */ size_t big_size = 0x1000000; void *ptr = malloc (big_size - 0x100); - char *ptr_aligned = (char *) ((uintptr_t) ptr & ~(pagesize - 1)); + char *ptr_aligned = (char *) ptr - ((uintptr_t) ptr & (pagesize - 1)); /* This large memory allocation allocated a memory area from ptr_aligned to ptr_aligned + big_size. Enlarge this memory area by adding a page before and a page diff --git a/tests/test-memset_explicit.c b/tests/test-memset_explicit.c index 02cb7e01ef..d02431b4bb 100644 --- a/tests/test-memset_explicit.c +++ b/tests/test-memset_explicit.c @@ -87,11 +87,14 @@ test_static (void) /* =============== Verify operation on heap-allocated memory =============== */ /* Skip this part when an address sanitizer is in use, because it would report - a "heap use after free". */ + a "heap use after free". + Skip it also with Fil-C, because that environment does not support the + conversion of uintptr_t to a pointer or the re-use of a freed pointer. */ #ifndef __has_feature # define __has_feature(a) 0 #endif -#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) +#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) \ + || defined __FILC__ static void test_heap (void) @@ -167,7 +170,7 @@ test_heap (void) printf ("test_heap: address range is unmapped after free().\n"); } -#endif /* ! address sanitizer enabled */ +#endif /* ! (address sanitizer enabled || Fil-C) */ /* =============== Verify operation on stack-allocated memory =============== */ diff --git a/tests/test-sigsegv-catch-segv1.c b/tests/test-sigsegv-catch-segv1.c index 2d16478b8d..e433a607a5 100644 --- a/tests/test-sigsegv-catch-segv1.c +++ b/tests/test-sigsegv-catch-segv1.c @@ -24,7 +24,7 @@ #include <stdint.h> #include <stdio.h> -#if HAVE_SIGSEGV_RECOVERY +#if HAVE_SIGSEGV_RECOVERY && !defined __FILC__ # include "mmap-anon-util.h" # include <stdlib.h> diff --git a/tests/test-sigsegv-catch-segv2.c b/tests/test-sigsegv-catch-segv2.c index 97c069fb5d..e7f0482d77 100644 --- a/tests/test-sigsegv-catch-segv2.c +++ b/tests/test-sigsegv-catch-segv2.c @@ -24,7 +24,7 @@ #include <stdint.h> #include <stdio.h> -#if HAVE_SIGSEGV_RECOVERY +#if HAVE_SIGSEGV_RECOVERY && !defined __FILC__ # if defined _WIN32 && !defined __CYGWIN__ /* Windows doesn't have sigset_t. */
