Sharing is incidental only if the task writes to the memory location before any read of the memory location anywhere in the dynamic extent of the task. This is easy to check when the task is a few lines of code in a single function. It is much harder when the task is hundreds or thousands of lines of code, and involves calls to many functions in many source files.
Sharing problems involving a task and a memory location are incidental if the memory location does not carry information into or out of the task. Therefore, if you replace all uses of the shared memory location in the task with uses of some non-shared memory location, you eliminate the sharing problem without changing the behavior of the program.