Re: [PATCH v3 4/4] testsuite/smokey/psostests: Fix compile error seen with gcc 16

Jan Kiszka <[email protected]> Mon, 20 Jul 2026 16:40:31 +0200
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On 17.07.26 09:45, Florian Bezdeka wrote:
> Fixes the following compile errors:
> 
> rn-1.c: In function ‘alloc_task’:
> rn-1.c:16:18: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=]
>    16 |         int ret, n;
>       |                  ^
> rn-1.c:15:22: error: variable ‘alloc_size’ set but not used [-Werror=unused-but-set-variable=]
>    15 |         u_long size, alloc_size = 0;
>       |
> 
> task-2.c: In function ‘backgroundTask’:
> task-2.c:19:42: error: variable ‘count’ set but not used [-Werror=unused-but-set-variable=]
>    19 |         unsigned int safety = 100000000, count = 0;
>       |                                          ^~~~~
> cc1: all warnings being treated as errors
> 
> The counting busy loop has been replaced by an interval based busy
> loop. While at it: Enable this test for CI. It was previously marked
> as broken. The counting busy loop was not enough to keep the task alive.
> 
> Signed-off-by: Florian Bezdeka <[email protected]>
> ---
>  testsuite/smokey/psostests/psostests.c | 4 +---
>  testsuite/smokey/psostests/rn-1.c      | 7 +++----
>  testsuite/smokey/psostests/task-2.c    | 5 ++---
>  3 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/testsuite/smokey/psostests/psostests.c b/testsuite/smokey/psostests/psostests.c
> index 289d563ac3595f0e2d21bc5f5746772fd51234b8..31347ba45ea430ac4b2e62be4c1e437519f2fb37 100644
> --- a/testsuite/smokey/psostests/psostests.c
> +++ b/testsuite/smokey/psostests/psostests.c
> @@ -15,9 +15,7 @@ static const char * const tests[] = {
>  	"psostests_sem1",
>  	"psostests_sem2",
>  	"psostests_task1",
> -	// 0"014.452| BUG in __traceobj_assert_failed(): [FGND] trace assertion failed:
> -	//		../../../../../../../../../workspace/sources/xenomai/testsuite/smokey/psostests/task-2.c:56 => "ret == 0"
> -	//"psostests_task2",
> +	"psostests_task2",
>  	"psostests_task3",
>  	"psostests_task4",
>  	"psostests_task5",
> diff --git a/testsuite/smokey/psostests/rn-1.c b/testsuite/smokey/psostests/rn-1.c
> index 5e82d1506ca029ae2bf812ccbfbf9c3a9ab9cc7e..d2e847375212c9746de3e550a5d10a8be4694de5 100644
> --- a/testsuite/smokey/psostests/rn-1.c
> +++ b/testsuite/smokey/psostests/rn-1.c
> @@ -12,15 +12,15 @@ static u_long tid, rnid;
>  
>  static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4)
>  {
> -	u_long size, alloc_size = 0;
> -	int ret, n;
> +	u_long size;
>  	void *buf;
> +	int ret;
>  
>  	traceobj_enter(&trobj);
>  
>  	srandom(0x11223344);
>  
> -	for (n = 0;; n++) {
> +	for (;;) {
>  		size = (random() % (sizeof(rn_mem) / 8)) + 4;
>  		ret = rn_getseg(rnid, size, RN_NOWAIT, 0, &buf);
>  		if (ret) {
> @@ -28,7 +28,6 @@ static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4)
>  			break;
>  		}
>  		memset(buf, 0xaa, size);
> -		alloc_size += size;
>  	}
>  
>  	traceobj_exit(&trobj);
> diff --git a/testsuite/smokey/psostests/task-2.c b/testsuite/smokey/psostests/task-2.c
> index d24c13465367c7c2a6975dd4cbb01eb75f8fd1ad..21497433f1a3584184406b172c367eacd5a8b127 100644
> --- a/testsuite/smokey/psostests/task-2.c
> +++ b/testsuite/smokey/psostests/task-2.c
> @@ -2,6 +2,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <copperplate/traceobj.h>
> +#include <copperplate/threadobj.h>
>  #include <psos/psos.h>
>  
>  static struct traceobj trobj;
> @@ -16,7 +17,6 @@ static u_long sem_id;
>  
>  static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4)
>  {
> -	unsigned int safety = 100000000, count = 0;
>  	int ret;
>  
>  	traceobj_enter(&trobj);
> @@ -28,8 +28,7 @@ static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4)
>  
>  	traceobj_mark(&trobj, 2);
>  
> -	while (--safety > 0)
> -		count++;
> +	threadobj_spin(2000000);
>  

Here you do the right thing.

>  	traceobj_mark(&trobj, 3);
>  
> 

But the patch description is confusing: It only talks about fixing
compiler errors, but the code is actually re-enabling psostests_task2,
isn't it?

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center