Data race defect is false-positive reported with multitasking configuration

My program including multiple init task and cyclic tasks that access the same variable (Pseudocode code is as bewlow)
unit8 data[10];
void Init_task(void) {
unit8 i;
for (i =0; i <10; i++) {
data[i] = i;
}
}
void Cyclic_task(void) {
unit8 i;
unit8 temp;
for (i =0; i <10; i++) {
temp = data[i];
}
}
I have added Init_task into Tasks (-entry-points) and Cyclic_task into Cyclic tasks (-cyclic-tasks) in the Polyspace V2022a GUI multitasking manual setting.
However, Polyspace bug finder still report data race defect in variable data. Since the Init_task() is run once in the startup and exist then after that Cyclic_task() will be executed, I expected that there will be no data race detect. Did I missed anything in the configuration?

Answers (0)

Products

Release

R2022a

Asked:

Lan
on 12 Jan 2026

Edited:

Lan
on 12 Jan 2026

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!