On 02/02/2023 10:26, Amit Daniel Kachhap wrote:
Gcc toolchain generates the below warning in clone.c,
freestanding.h:44:9: warning: ‘tls’ may be used uninitialized in this function [-Wmaybe-uninitialized] 44 | __syscall(sys_no, __cap(arg1), __cap(arg2), __cap(arg3), __cap(arg4), __cap(arg5), __cap(arg6)) | ^~~~~~~~~ clone.c:392:15: note: ‘tls’ was declared here 392 | void *tls;
It's quite surprising that GCC can't figure out that it is never used initialised given how simple the conditionals are, I experimented a bit with it and it seems to depend on the code in between the conditionals. In any case I can get upstream GCC 13 to give the same warning for similar code so that's not an issue with Morello GCC as such, happy with the patch.
Kevin
Fix the above warning by initializing the pointer.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
tools/testing/selftests/arm64/morello/clone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/arm64/morello/clone.c b/tools/testing/selftests/arm64/morello/clone.c index f261d0fd88f3..9c55225d34c5 100644 --- a/tools/testing/selftests/arm64/morello/clone.c +++ b/tools/testing/selftests/arm64/morello/clone.c @@ -409,7 +409,7 @@ void run_clone3(struct clone3_fixture *data) siginfo_t wait_si; int result; pid_t pid;
- void *tls;
- void *tls = NULL;
args->pidfd = (uintcap_t)&pidfd; args->parent_tid = (uintcap_t)&parent_tid;