Build error using thread statistics Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
andypiper
Posts: 65
Joined: Sat Oct 24, 2020 5:21 pm
Has thanked: 5 times
Been thanked: 4 times

Build error using thread statistics  Topic is solved

Postby andypiper » Sun Aug 08, 2021 8:34 pm

Seeing this in the newest ChibiOS release:

../../modules/ChibiOS/os/rt/include/chschd.h: In function 'void ch_sch_prio_insert(ch_queue_t*, ch_queue_t*)':
../../modules/ChibiOS/os/rt/include/chschd.h:509:26: error: cast from 'ch_queue_t* {aka ch_queue*}' to 'thread_t* {aka ch_thread*}' increases required alignment of target type [-Werror=cast-align]
(((thread_t *)cp)->hdr.pqueue.prio >= ((thread_t *)tp)->hdr.pqueue.prio));

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Build error using thread statistics

Postby Giovanni » Mon Aug 09, 2021 7:46 am

Hi,

Moving in bug reports.

Giovanni

andypiper
Posts: 65
Joined: Sat Oct 24, 2020 5:21 pm
Has thanked: 5 times
Been thanked: 4 times

Re: Build error using thread statistics

Postby andypiper » Fri Aug 13, 2021 5:24 pm

Giovanni wrote:Hi,

Moving in bug reports.

Giovanni


Any idea how to fix? I can just turn off the warning but don't know if that is safe or not.

Andy

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Build error using thread statistics

Postby Giovanni » Fri Aug 13, 2021 6:18 pm

I haven't looked into it yet. Try to put an intermediate cast to void* in there.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Build error using thread statistics

Postby Giovanni » Sun Aug 15, 2021 8:41 am

Hi,

I examined several occurrences of this error, there are several of those, but the code is safe as is.

-Werror=cast-align is not a default option, why are you using it? are you using some peculiar setup?

Note that none of the tested compilers complains about it: GCC, LLVM, Keil, IAR.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Build error using thread statistics

Postby Giovanni » Sun Aug 15, 2021 11:54 am

Hi,

Update, I modified things to be compatible with "-Wcast-align=strict". I think you are compiling the code using the C++ compiler (correct?), this is why you are seeing the warnings.

I fixed all casts to (thread_t *), post here if you find more instances of the problem. Cleaning things up is always a good thing.

Giovanni

andypiper
Posts: 65
Joined: Sat Oct 24, 2020 5:21 pm
Has thanked: 5 times
Been thanked: 4 times

Re: Build error using thread statistics

Postby andypiper » Mon Aug 16, 2021 1:50 pm

Giovanni wrote:Hi,

Update, I modified things to be compatible with "-Wcast-align=strict". I think you are compiling the code using the C++ compiler (correct?), this is why you are seeing the warnings.

I fixed all casts to (thread_t *), post here if you find more instances of the problem. Cleaning things up is always a good thing.

Giovanni


Yes, C++ compiler - great thanks!


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 8 guests