https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114379

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Denilson Sá Maia from comment #0)
>       for (auto &queue : queues) {
>               auto actionQueue =
>                       std::dynamic_pointer_cast<ActionQueue>(queue);

The compiler can't prove that actionQueue is not null here.
If it is null, then actionQueue would dereference a null pointer, and so would
try to do an atomic store on an object at address zero. That's what the warning
is saying.

>               actionQueue->Stop();

You can fix this either by checking for null:

                if (actionQueue) actionQueue->Stop();

or by telling the compiler it can't be null:

                if (!actionQueue)
                    __builtin_unreachable(); // or C++23 std::unreachable()
                actionQueue->Stop();

Reply via email to