Menu

#188 Failed assertion about sizeof(StaticQueue_t)

v1.0 (example)
closed-fixed
nobody
None
3
2019-02-21
2019-02-20
No

This assertion fails:
configASSERT( xSize == sizeof( Queue_t ) );
in function xQueueGenericCreateStatic(), in "queue.c"
when this macro is set to 1:
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

The problem is that the opaque data structures in "FreeRTOS.h" are different from the real ones in "list.h"

This is the current source code (in "FreeRTOS.h"):

struct xSTATIC_LIST_ITEM
{
    TickType_t xDummy1;
    void *pvDummy2[ 4 ];
};
typedef struct xSTATIC_LIST_ITEM StaticListItem_t;

/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
struct xSTATIC_MINI_LIST_ITEM
{
    TickType_t xDummy1;
    void *pvDummy2[ 2 ];
};
typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;

/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
typedef struct xSTATIC_LIST
{
    UBaseType_t uxDummy1;
    void *pvDummy2;
    StaticMiniListItem_t xDummy3;
} StaticList_t;

And this is the fix I could implement:

struct xSTATIC_LIST_ITEM
{
#if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
    TickType_t xDummy0;
#endif
    TickType_t xDummy1;
    void *pvDummy2[ 4 ];
#if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
    TickType_t xDummy3;
#endif
};
typedef struct xSTATIC_LIST_ITEM StaticListItem_t;

/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
struct xSTATIC_MINI_LIST_ITEM
{
#if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
    TickType_t xDummy0;
#endif
    TickType_t xDummy1;
    void *pvDummy2[ 2 ];
};
typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;

/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
typedef struct xSTATIC_LIST
{
#if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
    TickType_t xDummy0;
#endif
    UBaseType_t uxDummy1;
    void *pvDummy2;
    StaticMiniListItem_t xDummy3;
#if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
    TickType_t xDummy4;
#endif
} StaticList_t;

Related

Bugs: #188

Discussion

  • Richard Barry

    Richard Barry - 2019-02-20
    • status: open --> pending
     
    • Stefano Zanotti

      Stefano Zanotti - 2019-02-21

      Well, both the data integrity checks and the assertions are meant for
      debugging, so it was weird not to have them coexist nicely.
      Thanks for fixing it.
      The latest code from SVN works fine.

      As a side note, about the new code: in "StackMacros.h" you could use

      pragma message("xyz") for MSVC, for the warning about the renaming of the

      file.

      On Wed, Feb 20, 2019 at 7:27 PM Richard Barry rtel@users.sourceforge.net
      wrote:

      • status: open --> pending
      • Comment:

      Thanks for taking the time to report - we were aware of this (from
      previous reports) but had opted 'not to fix' as the data integrity checks
      are really for debug rather than production. However as several folks have
      asked about this now it seems approprate to update. Can you please try the
      latest code from SVN (specifically the list.h file) and report back if it
      has fixed your issue (which it should have done, as we have tried with
      various different combinations - but want to make sure).


      Status: pending
      Group: v1.0 (example)
      Created: Wed Feb 20, 2019 04:05 PM UTC by Stefano Zanotti
      Last Updated: Wed Feb 20, 2019 04:05 PM UTC
      Owner: nobody

      This assertion fails:
      configASSERT( xSize == sizeof( Queue_t ) );
      in function xQueueGenericCreateStatic(), in "queue.c"
      when this macro is set to 1:
      configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

      The problem is that the opaque data structures in "FreeRTOS.h" are
      different from the real ones in "list.h"

      This is the current source code (in "FreeRTOS.h"):

      struct xSTATIC_LIST_ITEM
      {
      TickType_t xDummy1;
      void *pvDummy2[ 4 ];
      };
      typedef struct xSTATIC_LIST_ITEM StaticListItem_t;

      / See the comments above the struct xSTATIC_LIST_ITEM definition. /
      struct xSTATIC_MINI_LIST_ITEM
      {
      TickType_t xDummy1;
      void *pvDummy2[ 2 ];
      };
      typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;

      / See the comments above the struct xSTATIC_LIST_ITEM definition. /
      typedef struct xSTATIC_LIST
      {
      UBaseType_t uxDummy1;
      void *pvDummy2;
      StaticMiniListItem_t xDummy3;
      } StaticList_t;

      And this is the fix I could implement:

      struct xSTATIC_LIST_ITEM
      {

      if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

      TickType_t xDummy0;
      

      endif

      TickType_t xDummy1;
      void *pvDummy2[ 4 ];
      

      if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

      TickType_t xDummy3;
      

      endif

      };
      typedef struct xSTATIC_LIST_ITEM StaticListItem_t;

      / See the comments above the struct xSTATIC_LIST_ITEM definition. /
      struct xSTATIC_MINI_LIST_ITEM
      {

      if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

      TickType_t xDummy0;
      

      endif

      TickType_t xDummy1;
      void *pvDummy2[ 2 ];
      

      };
      typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;

      / See the comments above the struct xSTATIC_LIST_ITEM definition. /
      typedef struct xSTATIC_LIST
      {

      if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

      TickType_t xDummy0;
      

      endif

      UBaseType_t uxDummy1;
      void *pvDummy2;
      StaticMiniListItem_t xDummy3;
      

      if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

      TickType_t xDummy4;
      

      endif

      } StaticList_t;


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/freertos/bugs/188/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #188

  • Richard Barry

    Richard Barry - 2019-02-20

    Thanks for taking the time to report - we were aware of this (from previous reports) but had opted 'not to fix' as the data integrity checks are really for debug rather than production. However as several folks have asked about this now it seems approprate to update. Can you please try the latest code from SVN (specifically the list.h file) and report back if it has fixed your issue (which it should have done, as we have tried with various different combinations - but want to make sure).

     
  • Richard Barry

    Richard Barry - 2019-02-21
    • status: pending --> closed-fixed
     
  • Richard Barry

    Richard Barry - 2019-02-21

    Thanks for taking the time to report - we were aware of this (from previous reports) but had opted 'not to fix' as the data integrity checks are really for debug rather than production. However as several folks have asked about this now it seems approprate to update. Can you please try the latest code from SVN (specifically the list.h file) and report back if it has fixed your issue (which it should have done, as we have tried with various different combinations - but want to make sure).

     

Log in to post a comment.

MongoDB Logo MongoDB