Forum: Mikrocontroller und Digitale Elektronik freertos: Compilerwarnung


von matze (Gast)


Angehängte Dateien:

Lesenswert?

Ich hab auf einen Mikrocontroller das Echtzeitbetriebssystem freertos 
portiert. Beim übersetzen erscheint folgende Fehlermeldung:

Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 652
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 658
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 713
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 719
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 1578
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 1578
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 1579
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 1634
Warning: undefined behavior: the order of volatile accesses is undefined 
in this statement C:\Entwicklung\freertos\tasks.c 1639

Was bedeutet eigentlich genau diese Warnung? Was könnte ich tun, damit 
diese Warnung nicht wieder erscheinen tut?

von ... .. (docean) Benutzerseite


Lesenswert?

brr leider hat die Codeansicht keine Zeilennumern...

Kannst du nochmal Ausschnitte mit dem entsprechenden Stelle posten in 
[.c][./c] (ohne .) ?

von matze (Gast)


Lesenswert?

Line 652:
1
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );

Line 658:
1
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );

Line 713:
1
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );

Line 719:
1
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );

Line 1578 und 1579:
1
taskFIRST_CHECK_FOR_STACK_OVERFLOW();
2
taskSECOND_CHECK_FOR_STACK_OVERFLOW();

Line 1634:
1
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );

Line 1639:
1
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );

von Εrnst B. (ernst)


Lesenswert?

Sowohl pxOverflowDelayedTaskList als auch pxCurrentTCB sind volatile?

Die Warnung besagt, dass die Reihenfolge, in welcher auf die 
Volatile-Variablen zugegriffen wird, so nicht definiert ist. Der 
Compiler ist frei sich seine "Lieblingsreihenfolge" auszuwählen.

Da volatile-Variablen für Memory-Mapped IO, IO-Ports, etc verwendet 
werden, kann das ein Problem sein.

Wenn es kein Problem ist, dann trägt vermutlich eine oder beide 
Variablen das Volatile zu unrecht.

von (prx) A. K. (prx)


Lesenswert?

Stecken hinter den Variablen oder Funktionen irgendwelche Makros?

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.