From 57b907ca172cd7048d61de5e19564c18588e3a27 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Fri, 1 Mar 2024 14:01:35 +0100 Subject: [PATCH] cl/tests: make the code compile with gcc-14.x This commit fixes the following errors: ``` In file included from cl/tests/data/vk-0100.c:1: cl/../include/predator-builtins/verifier-builtins.h: In function '__VERIFIER_error': cl/../include/predator-builtins/verifier-builtins.h:119:5: error: implicit declaration of function 'abort' [-Wimplicit-function-declaration] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:1:1: note: include '' or provide a declaration of 'abort' +++ |+#include 1 | /* cl/../include/predator-builtins/verifier-builtins.h:119:5: warning: incompatible implicit declaration of built-in function 'abort' [-Wbuiltin-declaration-mismatch] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:119:5: note: include '' or provide a declaration of 'abort' cl_build/tests/libchk_var_killer.so: warning: some errors already detected, additional passes will be skipped In file included from cl/tests/data/vk-0101.c:1: cl/../include/predator-builtins/verifier-builtins.h: In function '__VERIFIER_error': cl/../include/predator-builtins/verifier-builtins.h:119:5: error: implicit declaration of function 'abort' [-Wimplicit-function-declaration] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:1:1: note: include '' or provide a declaration of 'abort' +++ |+#include 1 | /* cl/../include/predator-builtins/verifier-builtins.h:119:5: warning: incompatible implicit declaration of built-in function 'abort' [-Wbuiltin-declaration-mismatch] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:119:5: note: include '' or provide a declaration of 'abort' cl_build/tests/libchk_var_killer.so: warning: some errors already detected, additional passes will be skipped cl/tests/data/pt-0850.c: In function 'main': cl/tests/data/pt-0850.c:16:10: error: assignment to 'int *' from incompatible pointer type 'int **' [-Wincompatible-pointer-types] 16 | ptrB = &ptrC; | ^ cl_build/tests/libchk_pt.so: warning: some errors already detected, additional passes will be skipped cl/tests/data/pt-0950.c: In function 'test': cl/tests/data/pt-0950.c:13:8: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 13 | *p = &i; | ^ cl/tests/data/pt-0950.c: In function 'main': cl/tests/data/pt-0950.c:21:7: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 21 | i = &j; | ^ cl_build/tests/libchk_pt.so: warning: some errors already detected, additional passes will be skipped In file included from cl/tests/data/pt-1203.c:3: cl/../include/predator-builtins/verifier-builtins.h: In function '__VERIFIER_error': cl/../include/predator-builtins/verifier-builtins.h:119:5: error: implicit declaration of function 'abort' [-Wimplicit-function-declaration] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:1:1: note: include '' or provide a declaration of 'abort' +++ |+#include 1 | /* cl/../include/predator-builtins/verifier-builtins.h:119:5: warning: incompatible implicit declaration of built-in function 'abort' [-Wbuiltin-declaration-mismatch] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:119:5: note: include '' or provide a declaration of 'abort' cl_build/tests/libchk_pt.so: warning: some errors already detected, additional passes will be skipped In file included from cl/tests/data/pt-1300.c:2: cl/../include/predator-builtins/verifier-builtins.h: In function '__VERIFIER_error': cl/../include/predator-builtins/verifier-builtins.h:119:5: error: implicit declaration of function 'abort' [-Wimplicit-function-declaration] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:1:1: note: include '' or provide a declaration of 'abort' +++ |+#include 1 | /* cl/../include/predator-builtins/verifier-builtins.h:119:5: warning: incompatible implicit declaration of built-in function 'abort' [-Wbuiltin-declaration-mismatch] 119 | abort(); | ^~~~~ cl/../include/predator-builtins/verifier-builtins.h:119:5: note: include '' or provide a declaration of 'abort' cl_build/tests/libchk_pt.so: warning: some errors already detected, additional passes will be skipped cl/tests/data/pt-0850.c: In function 'main': cl/tests/data/pt-0850.c:16:10: error: assignment to 'int *' from incompatible pointer type 'int **' [-Wincompatible-pointer-types] 16 | ptrB = &ptrC; | ^ cl_build/tests/libchk_pt.so: warning: some errors already detected, additional passes will be skipped cl/tests/data/pt-0950.c: In function 'test': cl/tests/data/pt-0950.c:13:8: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 13 | *p = &i; | ^ cl/tests/data/pt-0950.c: In function 'main': cl/tests/data/pt-0950.c:21:7: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 21 | i = &j; | ^ cl_build/tests/libchk_pt.so: warning: some errors already detected, additional passes will be skipped ``` Related: https://github.com/kdudka/predator/pull/92 Related: https://github.com/kdudka/predator/pull/93 --- cl/tests/data/pt-0850.c | 2 +- cl/tests/data/pt-0950.c | 4 ++-- include/predator-builtins/verifier-builtins.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cl/tests/data/pt-0850.c b/cl/tests/data/pt-0850.c index a0c935ff0..4149fa2f2 100644 --- a/cl/tests/data/pt-0850.c +++ b/cl/tests/data/pt-0850.c @@ -13,5 +13,5 @@ int *ptrA, *ptrB, *ptrC; int main() { ptrA = ptrB; - ptrB = &ptrC; + ptrB = (void *) &ptrC; } diff --git a/cl/tests/data/pt-0950.c b/cl/tests/data/pt-0950.c index 77ed7ba69..9f031d4e8 100644 --- a/cl/tests/data/pt-0950.c +++ b/cl/tests/data/pt-0950.c @@ -10,7 +10,7 @@ int test(int *p) // Note that we are accessing local variable! This is just for points-to // test purposes. - *p = &i; + *p = (long) &i; } @@ -18,7 +18,7 @@ int main(int argc, char **argv) { int i, j; - i = &j; + i = (long) &j; // ___cl_pt_points_glob_y(i, j); diff --git a/include/predator-builtins/verifier-builtins.h b/include/predator-builtins/verifier-builtins.h index 7276f31e1..f420e2ca1 100644 --- a/include/predator-builtins/verifier-builtins.h +++ b/include/predator-builtins/verifier-builtins.h @@ -68,6 +68,8 @@ void __VERIFIER_error() __attribute__ ((__noreturn__)); * sl.h:62:25: error: ‘int __VERIFIER_nondet_int()’ defined but not used */ +# include // for abort(); + static /* inline */ void ___sl_break(const char *msg) { (void) msg;