Quality RTOS & Embedded Software

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




Loading

Warnings in tasks.c 5.4.1 IAR

Posted by Geoff Kruse on July 28, 2009
I receive the following warnings in tasks.c in freertos 5.4.1 in IAR arm 5.20 for cortex-m3:

Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 611
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 617
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 672
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 678
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 1551
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 1593
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 1598
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement freeRTOS\tasks.c 1970

While these warnings seem to have no ill effects, our internal coding standard prohibits having any warnings in our code. Any thoughts on the proper way to resolve these warnings?

RE: Warnings in tasks.c 5.4.1 IAR

Posted by Richard on July 29, 2009
The warning is quite correct, but as far as I recall from inspection, also quite benign. It comes from trying to support lots of different compilers, all of which generate warnings in different and sometimes contradictory ways.

You could try casting away the volatile from one or other side of the statement.

I will take a look at the code lines again to see what can be done. In the provided demos I think you will find the warning is just switched off.

Regards.

RE: Warnings in tasks.c 5.4.1 IAR

Posted by RachelAdamec on February 2, 2011
I ended up satisfying this warning by forcing the order in which these variables were accessed:

xList xlXList;
xListItem xliXListItem;
...
if( xTimeToWake < xTickCount )
{
/* Wake time has overflowed. Place this item in the
overflow list. */
xlXList = *((xList *) pxOverflowDelayedTaskList);
xliXListItem = *((xListItem *) &( pxCurrentTCB->xGenericListItem ));
vListInsert( &xlXList, &xliXListItem);
}
else
{
/* The wake time has not overflowed, so we can use the
current block list. */
xlXList = *((xList *) pxDelayedTaskList);
xliXListItem = *((xListItem *) &( pxCurrentTCB->xGenericListItem ));
vListInsert( &xlXList, &xliXListItem);
}

wouldn't this be 'better' than just turning off the warning?


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists