lib/psos/task.c: fix build with gcc >= 12
PATCH v2 1/1 lib/psos/task.c: fix build with gcc >= 12
Fix the following build failure with gcc >= 12:
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;
| ^~~
Fixes:
- http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
---
Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS by ERR_OBJDEL
lib/psos/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/psos/task.c +2 -2
@@ -362,7 +362,7 @@ u_long t_start(u_long tid, {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);
@@ -426,7 +426,7 @@ u_long t_resume(u_long tid) {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);
Signature · 1 line
2.42.0
Quoted 42 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12:
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;
| ^~~Fixes:
- http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8aSigned-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/psos/task.c +1
-1@@ -362,7 +362,7 @@ u_long t_start(u_long tid, {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);
lib/psos/task.c u_long t_resume(u_long tid) · line 432
Quoted 8 lines
lib/psos/task.c +1
-1@@ -426,7 +426,7 @@ u_long t_resume(u_long tid) {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);
Not yet what I suggested - or does my proposal fail to resolve the warning?
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Hi Fabrice,
Quoted 2 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12:
I'm on gcc 13 here and didn't spot this problem (so far). Is it really gcc 12 that matters or some configure / compiler flag that makes the difference?
Quoted 15 lines
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;
| ^~~
Quoted 2 lines
Fixes:
- http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
The Fixes: tag I know from kernel development is different and normally points to git commits that introduced a regression. Not sure if we (should) follow this convention in Xenomai as well.
I like the reference to your problem, but maybe we should change the "syntax" a bit.
Btw: When following the URL I see Xenomai 3.0.10, that might explain why I did not see the problem yet. This information is important for Jan as well because this patch is then not targeting next but the stable branch.
If that "analysis" is right there must be a difference between next and the stable 3.0 branch that matters. Maybe we can get closer to next?
Best regards,
Florian
Quoted 33 lines
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/psos/task.c +2
-2@@ -362,7 +362,7 @@ u_long t_start(u_long tid, {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);@@ -426,7 +426,7 @@ u_long t_resume(u_long tid) {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);Signature · 1 line
2.42.0
Hi Jan, Florian,
Quoted 10 lines · Florian Bezdeka
Hi Fabrice,
Quoted 2 lines · Fabrice Fontaine
Fix the following build failure with gcc >= 12:
I'm on gcc 13 here and didn't spot this problem (so far). Is it really gcc 12 that matters or some configure / compiler flag that makes the difference?
Indeed, you're right the build failure is not only linked to gcc 12 but also to -Ofast.
There is no build failure if -Ofast is replaced by -Os.
I'll update the commit log in v3 (and also move ERR_OBJDEL to get_psos_task).
Quoted 19 lines
Quoted 16 lines
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;
| ^~~Quoted 2 lines
Fixes:
- http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Quoted 6 lines
The Fixes: tag I know from kernel development is different and normally points to git commits that introduced a regression. Not sure if we (should) follow this convention in Xenomai as well.
I like the reference to your problem, but maybe we should change the "syntax" a bit.
I'll replace "Fixes:" by a simple reference (i.e. [1])
Quoted 41 lines
Btw: When following the URL I see Xenomai 3.0.10, that might explain why I did not see the problem yet. This information is important for Jan as well because this patch is then not targeting next but the stable branch.
If that "analysis" is right there must be a difference between next and the stable 3.0 branch that matters. Maybe we can get closer to next?
Best regards,
FlorianQuoted 29 lines
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Jan Kiszka):
- Replace SUCCESS byERR_OBJDELlib/psos/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/psos/task.c +2
-2@@ -362,7 +362,7 @@ u_long t_start(u_long tid, {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;CANCEL_DEFER (svc);@@ -426,7 +426,7 @@ u_long t_resume(u_long tid) {struct psos_task *task;struct service svc; -int ret; +int ret =ERR_OBJDEL ;
Quoted 5 lines
Quoted 4 lines
lib/psos/task.c +0
-1CANCEL_DEFER (svc); --2.42.0
Best Regards,
Fabrice