[BUG] MISRA C 2012 Rule 9.3 violation in SMP configuration: xYieldPendings is partially initialized

Aperta
#1,491 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@20000419 ci sta già lavorando.

Dal 22/9/2026.

  • #1493 di @qualcuno — chiusa senza merge
  • #1498 di @20000419 — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
c

Direzione di ricerca

The array is declared in tasks.c near line 510 as xYieldPendings[ configNUMBER_OF_CORES ] = { pdFALSE }. Before editing, read open PR #1498 and closed PR #1493 to see what was tried and whether the work is already covered. Done means the initializer is changed to { 0 } or MISRA.md gets a documented deviation, as the issue proposes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Describe the bug
In the SMP configuration (configNUMBER_OF_CORES > 1), tasks.c:510 declares:

    PRIVILEGED_DATA STATIC volatile BaseType_t xYieldPendings[ configNUMBER_OF_CORES ] = { pdFALSE };

The array has configNUMBER_OF_CORES elements, but the initializer list has a single
element, so the remaining elements are only implicitly zero-initialized. This is a violation of MISRA C:2012 Rule 9.3 (Required): "Arrays shall not be partially initialized".
PR #973 fixed the same pattern for the same rule in portable/Common/mpu_wrappers_v2.c (= { NULL } → = { 0 }). pdFALSE is ( ( BaseType_t ) 0 ) (include/projdefs.h:52), so this is the same class.

Expected behavior
No Rule 9.3 violation. Proposed change (no behavior change, keeps all cores
zero-initialized).

PRIVILEGED_DATA STATIC volatile BaseType_t xYieldPendings[ configNUMBER_OF_CORES ] = { 0 };

Alternatively, add a documented deviation in MISRA.md if the implicit zero-initialization is intentional and preferred as-is.

Lingua principale
C
Stelle
4.6k
Fork
1.6k
Merge medio
2g 22h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FreeRTOS/FreeRTOS-Kernel

Tutte le issue di FreeRTOS/FreeRTOS-Kernel

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.