Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

FreeRTOS V8.2.0 compile warning in queue.c

Posted by wlauer on March 10, 2015

Just got around to upgrading to V8.2.0 Using Atmel Studio 6.2.1563 which uses ARM GCCNative4.8.1443

I get the following warning when compiling: Warning 1 cast increases required alignment of target type [-Wcast-align] ...srcASFthirdpartyfreertosfreertos-8.2.0sourcequeue.c 343 16

Can't figure it out. Any ideas?

Thanks in advance, Bill


FreeRTOS V8.2.0 compile warning in queue.c

Posted by rtel on March 10, 2015

Interestingly I've never seen that warning. Projects created in Atmel Studio do, by default, have a very 'elaborate' set of warnings turned on individually. I normally just -Wall -Wextra.

It is a genuine warning non-the-less:

pxNewQueue = ( Queue_t * ) pcAllocatedBuffer;

pcAllocatedBuffer is a char*, with no alignment requirement. pxNewQueue is a Queue_t * with a 4 byte alignment requirement. Hence it is warning you that the alignment might not be correct after the assignment.

However, what the compiler does not know is that pcAllocatedBuffer is guaranteed to have 8-bit alignment as it was dynamically allocated. Therefore, it is a valid warning, but it is warning you about something that cannot possibly happen.

Regards.


FreeRTOS V8.2.0 compile warning in queue.c

Posted by wlauer on March 10, 2015

"However, what the compiler does not know is that pcAllocatedBuffer is guaranteed to have 8-bit alignment as it was dynamically allocated. Therefore, it is a valid warning, but it is warning you about something that cannot possibly happen"

I'm assuming you meant 8 byte alignment.


FreeRTOS V8.2.0 compile warning in queue.c

Posted by rtel on March 10, 2015

I'm assuming you meant 8 byte alignment.

yes :o)


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS