GCC 10 Inlining behavior breaks RT test 12-7 Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
mtrescott
Posts: 8
Joined: Sun Oct 11, 2020 4:57 am
Location: Michigan, USA
Has thanked: 1 time
Been thanked: 1 time

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby mtrescott » Wed Dec 16, 2020 4:55 am

Hi Giovanni, thanks for finding the bug, wish I could have been of more help but I didn't have time to learn what I'd need to know to investigate it myself.

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby Giovanni » Wed Dec 16, 2020 7:16 am

Hi,

Don't worry, I am just evaluating various ways to fix/workaround that problem.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby Giovanni » Thu Dec 17, 2020 3:40 pm

Hi,

Update, this has been reported as bug #1138.

I committed an initial fix on trunk and it appears to work correctly however:

1) The list (threads and virtual timers) handling in RT has been reorganized to avoid aliasing problems, this affected a lot of code in RT and OSLIB.
2) It has not yet been tested under all possible conditions, I know there are configuration options that do not compile correctly yet.
3) Quality procedures need to be performed again because the extensive changes.

On the other hand:

1) Lists-related code is more elegant now, the number for pointer casts has been reduced dramatically which is generally a good thing.
2) Gave me an opportunity to re-look at code not touched for many years.

I only tested on the STM32G4 but the test suite succeeds now. Please report any problem you may find.

After trunk is stable again the change will be back-ported on 19.x and 20.x (and it is a lot of work).

Giovanni

User avatar
FXCoder
Posts: 398
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 186 times
Been thanked: 133 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby FXCoder » Fri Dec 18, 2020 2:09 am

Hi Giovanni,
Moved the latest trunk into a project quickly this morning to do some checking.
Found the following...
#1 chvt.c casts for delta list manipulations

Code: Select all

Index: chvt.c
===================================================================
--- chvt.c   (revision 13960)
+++ chvt.c   (working copy)
@@ -380,10 +380,10 @@
       virtual_timer_t *vtp;
       vtfunc_t fn;
 
-      vtp = vtlp->dlist.next;
+      vtp = (virtual_timer_t *)vtlp->dlist.next;
       fn = vtp->func;
       vtp->func = NULL;
-      vtp->dlist.next->prev = (virtual_timer_t *)vtlp;
+      vtp->dlist.next->prev = (delta_list_t *)vtlp;
       vtlp->dlist.next = vtp->dlist.next;
       chSysUnlockFromISR();
       fn(vtp->par);



#2 Binary semaphore compile fails
This is likely one of the options that do not compile correctly that you referred to.
Didn't have time to dig into it.

Code: Select all

os/oslib/include/chbsem.h:92:4: warning: implicit declaration of function '_SEMAPHORE_DATA'; did you mean 'SEMAPHORE_DECL'? [-Wimplicit-function-declaration]
   92 |   {_SEMAPHORE_DATA(name.sem, ((taken) ? 0 : 1))}
      |    ^~~~~~~~~~~~~~~
 

--
Bob

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby Giovanni » Fri Dec 18, 2020 9:09 am

Hi Bob,

I meant exactly those kind of errors, things hidden by configuration switches, fixed.

Giovanni

User avatar
FXCoder
Posts: 398
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 186 times
Been thanked: 133 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby FXCoder » Fri Dec 18, 2020 12:05 pm

Hi,
Here is another...
Set CH_CFG_OPTIMIZE_SPEED FALSE
...to reveal a few more compile problems in chschd.c & chmtx.c (plus a type change in syscalls.c).
--
Bob

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby Giovanni » Sat Dec 19, 2020 10:27 am

Fixed thanks, committed more queues reorganization, there is no reason to hold back changes at this point.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: GCC 10 Inlining behavior breaks RT test 12-7

Postby Giovanni » Sun Dec 27, 2020 11:11 am

Hi,

Fixed as bug bug #1138 in trunk, 20.x and 19.x.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 138 guests