lib/psos/task.c: fix build with gcc >= 12 and -Ofast
PATCH v3 1/1 lib/psos/task.c: fix build with gcc >= 12 and -Ofast
Fix the following build failure with gcc >= 12 and -Ofast (found by buildroot autobuilders on xenomai 3.0.10 [1]):
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~
[1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
---
Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
- Move ERR_OBJDEL to get_psos_task
- Update commit message to mention -Ofast and xenomai 3.0.10
Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS by ERR_OBJDEL
lib/psos/task.c | 1 + 1 file changed, 1 insertion(+)
lib/psos/task.c +1 -0
@@ -99,6 +99,7 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)struct psos_task *get_psos_task (u_long tid,int *err_r) { + *err_r =ERR_OBJDEL ;struct psos_task *task =find_psos_task (tid, err_r);/*
Signature · 1 line
2.42.0
Jan Kiszka
AppliedQuoted 37 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12 and -Ofast (found by buildroot autobuilders on xenomai 3.0.10 [1]):
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~[1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
- MoveERR_OBJDELtoget_psos_task
- Update commit message to mention -Ofast and xenomai 3.0.10Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 1 + 1 file changed, 1 insertion(+)lib/psos/task.c +0
-0
lib/psos/task.c static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r) · line 105
Quoted 7 lines
lib/psos/task.c +1
-0@@ -99,6 +99,7 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)struct psos_task *get_psos_task (u_long tid,int *err_r) { + *err_r =ERR_OBJDEL ;struct psos_task *task =find_psos_task (tid, err_r);/*
Thanks, applied.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 39 lines · Jan Kiszka
Quoted 38 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12 and -Ofast (found by buildroot autobuilders on xenomai 3.0.10 [1]):
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~[1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
- MoveERR_OBJDELtoget_psos_task
- Update commit message to mention -Ofast and xenomai 3.0.10Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 1 + 1 file changed, 1 insertion(+)lib/psos/task.c +0
-0@@ -99,6 +99,7 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)
Quoted 8 lines
lib/psos/task.c static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r) · line 105
Quoted 6 lines
lib/psos/task.c +1
-0struct psos_task *get_psos_task (u_long tid,int *err_r) { + *err_r =ERR_OBJDEL ;struct psos_task *task =find_psos_task (tid, err_r);/* Thanks, applied.
Hm... err_r can never be NULL?
Quoted 2 lines
Jan
Quoted 45 lines · Florian Bezdeka
Quoted 44 lines · Jan Kiszka
Quoted 43 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12 and -Ofast (found by buildroot autobuilders on xenomai 3.0.10 [1]):
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~[1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
- MoveERR_OBJDELtoget_psos_task
- Update commit message to mention -Ofast and xenomai 3.0.10Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 1 + 1 file changed, 1 insertion(+)lib/psos/task.c +1
-0@@ -99,6 +99,7 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)struct psos_task *get_psos_task (u_long tid,int *err_r) { + *err_r =ERR_OBJDEL ;struct psos_task *task =find_psos_task (tid, err_r);
Quoted 6 lines
Quoted 3 lines
lib/psos/task.c static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r) · line 105
Quoted 1 line
lib/psos/task.c +0
-0/* Thanks, applied.
Hm...
err_rcan never be NULL?
This function already assumed that err_r is always non-NULL before this change.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 50 lines · Jan Kiszka
Quoted 49 lines · Florian Bezdeka
Quoted 47 lines · Jan Kiszka
Quoted 37 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12 and -Ofast (found by buildroot autobuilders on xenomai 3.0.10 [1]):
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~[1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
- MoveERR_OBJDELtoget_psos_task
- Update commit message to mention -Ofast and xenomai 3.0.10Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 1 + 1 file changed, 1 insertion(+)lib/psos/task.c +0
-0lib/psos/task.c static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r) · line 105
Quoted 7 lines
lib/psos/task.c +1
-0@@ -99,6 +99,7 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)struct psos_task *get_psos_task (u_long tid,int *err_r) { + *err_r =ERR_OBJDEL ;struct psos_task *task =find_psos_task (tid, err_r);/* Thanks, applied.
Quoted 5 lines
Quoted 2 lines
Hm...
err_rcan never be NULL?This function already assumed that
err_ris always non-NULL before this change.
This patch makes the smokey testsuite fail, psostests reports:
2023-12-07T10:59:27 [1] at task-4.c:22 2023-12-07T10:59:27 0\"011.394| BUG in __traceobj_assert_failed(): [TASK] trace assertion failed: 2023-12-07T10:59:27 task-4.c:36 => \"ret == 0 && regval == 0xdeadbeef\" 2023-12-07T10:59:27 test psostests_task4 failed: 256
ret is now 5 (ERR_OBJDEL) instead of the expected 0 (SUCCESS).
Quoted 6 lines
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 57 lines · Florian Bezdeka
Quoted 50 lines · Jan Kiszka
Quoted 49 lines · Florian Bezdeka
Quoted 47 lines · Jan Kiszka
Quoted 37 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12 and -Ofast (found by buildroot autobuilders on xenomai 3.0.10 [1]):
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~[1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
- MoveERR_OBJDELtoget_psos_task
- Update commit message to mention -Ofast and xenomai 3.0.10Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 1 + 1 file changed, 1 insertion(+)lib/psos/task.c +0
-0lib/psos/task.c static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r) · line 105
Quoted 7 lines
lib/psos/task.c +1
-0@@ -99,6 +99,7 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)struct psos_task *get_psos_task (u_long tid,int *err_r) { + *err_r =ERR_OBJDEL ;struct psos_task *task =find_psos_task (tid, err_r);/* Thanks, applied.
Quoted 5 lines
Quoted 2 lines
Hm...
err_rcan never be NULL?This function already assumed that
err_ris always non-NULL before this change.
Quoted 9 lines
This patch makes the smokey testsuite fail, psostests reports:
2023-12-07T10:59:27 [1] at task-4.c:22 2023-12-07T10:59:27 0\"011.394| BUG in __traceobj_assert_failed(): [TASK] trace assertion failed: 2023-12-07T10:59:27 task-4.c:36 => \"ret == 0 && regval == 0xdeadbeef\" 2023-12-07T10:59:27 test psostests_task4 failed: 256ret is now 5 (
ERR_OBJDEL) instead of the expected 0 (SUCCESS).
Had a closer look again. All users of get_psos_task_or_self() should initialize the second parameter. Most of them do, but not all.
I can take this one...
Quoted 6 lines
Quoted 6 lines
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center