----- Ursprüngliche Mail -----
> Von: "Jan Kiszka" <jan.kis...@siemens.com>
> An: "richard" <rich...@nod.at>, "xenomai" <xenomai@xenomai.org>
> Gesendet: Donnerstag, 14. April 2022 13:18:59
> Betreff: Re: [PATCH v2 0/9] Revive alchemy, pSOS and VxWorks tests

> On 13.04.22 23:58, Richard Weinberger via Xenomai wrote:
>> This patch series is a first attempt to integrate the currently abandoned
>> alchemy, pSOS and VxWorks tests into Xenomai's test suite.
>> Since each test assumes running as own process a test driver is needed
>> which executes each tests separately.
>> The driver makes use of the smokey framework.
>> 
>> Test results on a x86 VM (5.15.19, Xenomai master as of today):
>> - Alchemy:
>>   test2 fails:
>>      [8] at task-2.c:71
>>      [1] at task-2.c:24
>>      [9] at task-2.c:79
>>      [4] at task-2.c:43
>>      [10] at task-2.c:87
>>      [5] at task-2.c:48
>>      [11] at task-2.c:92
>>      [2] at task-2.c:29
>>      [6] at task-2.c:52
>>         0"022.972| BUG in __traceobj_check_abort(): [FGND] wrong return 
>> status:
>>                    task-2.c:55 => EINVAL (want OK)

task-2 seems suffers from modern gcc, changes to safety and count are dead 
stores.

This makes the test pass here:

diff --git a/testsuite/alchemytests/task-2.c b/testsuite/alchemytests/task-2.c
index e751ddd34..9d5281c75 100644
--- a/testsuite/alchemytests/task-2.c
+++ b/testsuite/alchemytests/task-2.c
@@ -28,8 +28,10 @@ static void background_task(void *arg)
 
        traceobj_mark(&trobj, 2);
 
-       while (--safety > 0)
+       while (--safety > 0) {
+               compiler_barrier();
                count++;
+       }
 
        traceobj_exit(&trobj);
 }

...same does marking both variables as volatile.

Thanks,
//richard

Reply via email to