# configLIST\_VOLATILE required - Missing configASSERT in listREMOVE\_ITEM

**URL:** <https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400>\
**Category:** Kernel\
**Created:** [December 15, 2022, 6:24pm UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400 "2022-12-15T18:24:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![maharvey](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@maharvey](https://forums.freertos.org/u/maharvey)\
**Post date:** [December 15, 2022, 6:24pm UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/1 "2022-12-15T18:24:21Z")

</div>

Using the provided sample code for the PIC32 platform and FreeRTOS v202112.00. I ran into an issue in tasks.c when enabling the compiler optimizations (XC32 v4.00 compiler, -O2 optimization).

The exception happens in `xTaskResumeAll()` when the `listREMOVE_ITEM` macro tries to remove an item with a null pointer as the container. The macro creates a pointer pxList and de-references it without checking if it is NULL, causing an exception.

In my case, it seemed to be caused by an aggressive compiler and the fix was to add `#define configLIST_VOLATILE volatile` in FreeRTOSConfig.h

I think nevertheless the pointer should be checked for non-null in the macro to gracefully handle exceptions.

---

<div class="post-metadata">

**Author:** ![Shub](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@Shub](https://forums.freertos.org/u/Shub)\
**Post date:** [December 15, 2022, 6:47pm UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/2 "2022-12-15T18:47:02Z")

</div>

Hi,  
Thanks for posting the query.  
There are some similar posts in the following threads:

1. [Stuck in xTaskResumeAll() - Interrupt Priorities? Stack?](https://forums.freertos.org/t/stuck-in-xtaskresumeall-interrupt-priorities-stack/16397)
2. [Endless loop in 10.4.6 with -Os flag](https://forums.freertos.org/t/endless-loop-in-10-4-6-with-os-flag/14835)  
Please check if any of the suggested options help in your scenario.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [December 16, 2022, 5:00am UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/3 "2022-12-16T05:00:11Z")

</div>

As described in [this comment block](https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/include/list.h#L66), the solution you mentioned is right. Thank you for reporting it.

> [@maharvey](#):
>
> I think nevertheless the pointer should be checked for non-null in the macro to gracefully handle exceptions.

This list is not a general purpose list and meant for internal use only. Wherever we call remove item, it is ensured that the list is not empty. So I am _not_ sure that we need to add an extra NULL check here.

---

<div class="post-metadata">

**Author:** ![Pilot](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Pilot](https://forums.freertos.org/u/Pilot)\
**Post date:** [May 26, 2023, 9:16am UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/4 "2023-05-26T09:16:05Z")

</div>

Just ran into this issue with PIC32MZ using XC32 3.01 and -O3

Is the #define volatile still the suggested fix with the latest LTS FreeRTOS?

Thank you,  
Ben

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [May 26, 2023, 10:17am UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/5 "2023-05-26T10:17:32Z")

</div>

Yes, does that not work for you?

---

<div class="post-metadata">

**Author:** ![Pilot](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Pilot](https://forums.freertos.org/u/Pilot)\
**Post date:** [May 27, 2023, 8:47pm UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/6 "2023-05-27T20:47:34Z")

</div>

Limited testing suggests that it does solve the problem - I only asked because you said a null check should be added, which made me think you didn’t feel the volatile was the best solution.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [May 29, 2023, 4:56am UTC](https://forums.freertos.org/t/configlist-volatile-required-missing-configassert-in-listremove-item/16400/7 "2023-05-29T04:56:05Z")

</div>

Apologies. What I meant in my above response was not adding the check as we always ensure that list is not empty before calling the macro. I have updated my response above.
