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


Strange compiler warning

Posted by ksoldavin on March 25, 2014

I am getting a compiler warning that I have not seen before and I'm not sure if I should be concerned. I am running version 7.6 on a STM32F4 using CodeSourcery Lite 2013.11-24 tool chain. This is the warning I am seeing:

tasks.c:2526:56: warning: multiple accesses to volatile structure member because of packed attribute [-fstrict-volatile-bitfields]

I see this warning in three different places in the tasks.c source code. The code runs fine but I always try to track down all compiler warnings. The compiler flag that is causing the warning is "-fpack-struct" which I need for other parts of my code.

Any thoughts? Thank you Keith

Strange compiler warning

Posted by rtel on March 25, 2014

It is warning you that, because you have packed the structures, it is taking three memory accesses to read a single member out of a structure - and because that member is marked as volatile the compiler rightly is cautioning you that the member's value might change between the first and third access.

It is probably not a real issue, please post the three line numbers that generate the warning from the link below and I will let you know:



Strange compiler warning

Posted by ksoldavin on March 26, 2014

Thanks for the prompt help. I am seeing the warnings on line numbers: 2526 pxTaskStatusArray[ uxTask ].xTaskNumber = pxNextTCB->uxTCBNumber; 2532 pxTaskStatusArray[ uxTask ].uxBasePriority = pxNextTCB->uxBasePriority; 2542 pxTaskStatusArray[ uxTask ].ulRunTimeCounter = pxNextTCB->ulRunTimeCounter;

Strange compiler warning

Posted by rtel on March 26, 2014

These fall inside a helper function, rather than in the actual kernel code. The function is only ever called with the scheduler suspended so there is no chance of the data changing during the volatile access - so nothing to worry about. You may find that some of the volatiles inside that function are only actually declared volatile because some compilers will generate warning messages if they are not.


Strange compiler warning

Posted by ksoldavin on March 26, 2014

Wonderful! Thank you for all your help.

[ 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