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?

回答 (0 件)

製品

リリース

R2022a

質問済み:

Lan
2026 年 1 月 12 日

編集済み:

Lan
2026 年 1 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by