Skip to content

[BUG] Compilation fails with -Wall -Werror -Wextra -O3 when using arm gcc 11.1 and up #858

@RyanHanson-Deere

Description

@RyanHanson-Deere

Describe the bug
tasks.c is failing to build when using arm gcc 11.2 (The compiler distributed with Xilinx) and the options -Wall -Werror -Wextra -O3

Here is the error I get:

In file included from /workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/task.h:37,                                                                            
                 from /workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:40:                                                                           
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c: In function 'xTaskGetHandle':                                                                      
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/list.h:289:64: error: array subscript 'ListItem_t {aka struct xLIST_ITEM}[0]' is partly outside array bounds
 of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]                                                                                                                                              
  289 |             ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                       \                                                                                                    
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~                                                                                                                             
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:2412:13: note: in expansion of macro 'listGET_OWNER_OF_NEXT_ENTRY'                                  
 2412 |             listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too.  Alignment is known to be fine as the type of the
 pointer stored and retrieved is the same. */                                                                                                                                                               
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                             
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:362:35: note: while referencing 'xSuspendedTaskList'                                                
  362 |     PRIVILEGED_DATA static List_t xSuspendedTaskList; /*< Tasks that are currently suspended. */                                                                                                    
      |                                   ^~~~~~~~~~~~~~~~~~                                                                                                                                                
In file included from /workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/task.h:37,                                                                            
                 from /workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:40:                                                                           
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/list.h:289:64: error: array subscript 'ListItem_t {aka struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]                                                                                                                                              
  289 |             ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                       \                                                                                                    
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~                                                                                                                            
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:2416:17: note: in expansion of macro 'listGET_OWNER_OF_NEXT_ENTRY'                                  
 2416 |                 listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too.  Alignment is known to be fine as the type of 
the pointer stored and retrieved is the same. */                                                                                                                                                            
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                         
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:362:35: note: while referencing 'xSuspendedTaskList'                                                
  362 |     PRIVILEGED_DATA static List_t xSuspendedTaskList; /*< Tasks that are currently suspended. */                                                                                                    
      |                                   ^~~~~~~~~~~~~~~~~~                                                                                                                                                
In file included from /workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/task.h:37,                                                                            
                 from /workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:40:                                                                           
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/list.h:289:64: error: array subscript 'ListItem_t {aka struct xLIST_ITEM}[0]' is partly outside array bound$ of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]                                                                                                                                              
  289 |             ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                       \                                                                                                    
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~                                                                                                                             
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:2412:13: note: in expansion of macro 'listGET_OWNER_OF_NEXT_ENTRY'                                  
 2412 |             listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too.  Alignment is known to be fine as the type of th$ pointer stored and retrieved is the same. */                                                                                                                                                               
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                             
/workspace/VanillaR5Alt/R5Common/bsp/r5_0.bsp/psu_cortexr5_0/libsrc/freertos10_xilinx_v1_11/src/tasks.c:355:35: note: while referencing 'xTasksWaitingTermination'                                          
  355 |     PRIVILEGED_DATA static List_t xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */                                                                   
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~                                                                 

Target

  • Development board: Xilinx Ultrascale
  • Instruction Set Architecture: ARM
  • IDE and version: VIM/CMake
  • Toolchain and version: armr5-none-eabi-gcc

Host

  • Host OS: Linux
  • Version: Ubuntu 18.04.6 LTS

To Reproduce

Expected behavior

tasks.c compiles

Additional context

I am mostly sure this is a compiler bug. But just in case it isn't I wanted to post it here.

The only other concern that I have is that listGET_OWNER_OF_NEXT_ENTRY is accessing the element after xListEnd and maybe that is bad. I don't know if xListEnd->pxNext gets set to the first element of the list or is kept pointing back to xListEnd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions