[rtems commit] testsuite: Fix gcc 12 warnings

Chris Johns chrisj at rtems.org
Tue Jun 21 00:16:56 UTC 2022


Module:    rtems
Branch:    master
Commit:    6b2c5b5da1a0394c9ffa81fc55e73920be9f6bff
Changeset: http://git.rtems.org/rtems/commit/?id=6b2c5b5da1a0394c9ffa81fc55e73920be9f6bff

Author:    Chris Johns <chrisj at rtems.org>
Date:      Mon Jun 20 12:04:43 2022 +1000

testsuite: Fix gcc 12 warnings

---

 testsuites/libtests/POSIX/readv.c                                 | 2 +-
 testsuites/libtests/POSIX/sigismember.c                           | 2 +-
 testsuites/libtests/POSIX/sigprocmask.c                           | 3 ++-
 testsuites/libtests/POSIX/writev.c                                | 2 +-
 testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c                 | 2 +-
 testsuites/psxtests/psxhdrs/fcntl/openat.c                        | 4 ++--
 testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c                 | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c   | 4 ++--
 .../psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c       | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c  | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c       | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c       | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c   | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c   | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c  | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c           | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c      | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_create.c              | 2 +-
 .../psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c       | 4 ++--
 testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c          | 2 +-
 testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c     | 2 +-
 .../psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c   | 2 +-
 .../psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c      | 4 ++--
 .../psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c       | 4 ++--
 testsuites/psxtests/psxhdrs/sys/select/pselect.c                  | 4 ++--
 testsuites/psxtests/psxhdrs/sys/socket/bind.c                     | 2 +-
 testsuites/psxtests/psxhdrs/sys/socket/connect.c                  | 6 +++---
 testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c               | 2 +-
 testsuites/psxtests/psxhdrs/sys/socket/send.c                     | 2 +-
 testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c                  | 2 +-
 testsuites/psxtests/psxhdrs/sys/socket/sendto.c                   | 4 ++--
 testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c               | 2 +-
 testsuites/psxtests/psxhdrs/sys/stat/futimens.c                   | 4 ++--
 testsuites/psxtests/psxhdrs/sys/stat/utimensat.c                  | 4 ++--
 testsuites/psxtests/psxhdrs/sys/time/utimes.c                     | 8 ++++----
 testsuites/psxtests/psxhdrs/termios/cfgetispeed.c                 | 4 ++--
 testsuites/psxtests/psxhdrs/termios/cfgetospeed.c                 | 4 ++--
 testsuites/psxtests/psxhdrs/termios/cfsetispeed.c                 | 4 ++--
 testsuites/psxtests/psxhdrs/termios/cfsetospeed.c                 | 4 ++--
 testsuites/psxtests/psxhdrs/termios/tcgetattr.c                   | 4 ++--
 testsuites/psxtests/psxhdrs/termios/tcsetattr.c                   | 4 ++--
 testsuites/psxtests/psxhdrs/time/asctime.c                        | 2 +-
 testsuites/psxtests/psxhdrs/time/asctime_r.c                      | 2 +-
 testsuites/psxtests/psxhdrs/time/clock_settime.c                  | 2 +-
 testsuites/psxtests/psxhdrs/time/ctime.c                          | 2 +-
 testsuites/psxtests/psxhdrs/time/ctime_r.c                        | 2 +-
 testsuites/psxtests/psxhdrs/time/gmtime.c                         | 2 +-
 testsuites/psxtests/psxhdrs/time/gmtime_r.c                       | 2 +-
 testsuites/psxtests/psxhdrs/time/localtime.c                      | 2 +-
 testsuites/psxtests/psxhdrs/time/localtime_r.c                    | 2 +-
 testsuites/psxtests/psxhdrs/time/strftime.c                       | 2 +-
 testsuites/psxtests/psxhdrs/unistd/setgroups.c                    | 2 +-
 testsuites/psxtests/psxhdrs/utime/utime.c                         | 2 +-
 testsuites/psxtests/psxhdrs/wchar/mbsinit.c                       | 4 ++--
 testsuites/psxtests/psxkey07/init.c                               | 3 ++-
 testsuites/psxtests/psxkey08/init.c                               | 2 +-
 testsuites/psxtests/psxmsgq01/init.c                              | 2 +-
 testsuites/sptests/sp68/init.c                                    | 2 +-
 testsuites/sptests/spfatal32/init.c                               | 5 +++++
 62 files changed, 96 insertions(+), 89 deletions(-)

diff --git a/testsuites/libtests/POSIX/readv.c b/testsuites/libtests/POSIX/readv.c
index a980e9468c..6b0bf63f94 100644
--- a/testsuites/libtests/POSIX/readv.c
+++ b/testsuites/libtests/POSIX/readv.c
@@ -14,7 +14,7 @@
 
 int main(void)
 {
-  struct iovec iov;
+  struct iovec iov = { 0 };
   int count = 4;
   ssize_t ret;
 
diff --git a/testsuites/libtests/POSIX/sigismember.c b/testsuites/libtests/POSIX/sigismember.c
index ed980b70f0..f4c7d37cb2 100644
--- a/testsuites/libtests/POSIX/sigismember.c
+++ b/testsuites/libtests/POSIX/sigismember.c
@@ -14,7 +14,7 @@
 
 int main(void)
 {
-  sigset_t set;
+  sigset_t set = { 0 };
   int status;
   status = sigismember(&set, 21);
 
diff --git a/testsuites/libtests/POSIX/sigprocmask.c b/testsuites/libtests/POSIX/sigprocmask.c
index ba634e4660..25de0c28c7 100644
--- a/testsuites/libtests/POSIX/sigprocmask.c
+++ b/testsuites/libtests/POSIX/sigprocmask.c
@@ -15,7 +15,8 @@
 int main(void)
 {
   int rc;
-  sigset_t set1, set2;
+  sigset_t set1 = { 0 };
+  sigset_t set2 = { 0 };
 
   rc = sigprocmask(SIG_BLOCK, &set1, &set2);
   (void) rc;
diff --git a/testsuites/libtests/POSIX/writev.c b/testsuites/libtests/POSIX/writev.c
index 853b8a8ced..5b5068db65 100644
--- a/testsuites/libtests/POSIX/writev.c
+++ b/testsuites/libtests/POSIX/writev.c
@@ -14,7 +14,7 @@
 
 int main(void)
 {
-  struct iovec iov;
+  struct iovec iov = { 0 };
   int count = 4;
   ssize_t ret;
 
diff --git a/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
index c3e3828b0b..5b64b565cc 100644
--- a/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
+++ b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
@@ -32,7 +32,7 @@ int test(void);
 int test(void)
 {
   int af = 0;
-  struct in_addr addr;
+  struct in_addr addr = { 0 };
   char *dst = "string";
 
   const char *ret = inet_ntop(af, &addr, dst, sizeof(dst));
diff --git a/testsuites/psxtests/psxhdrs/fcntl/openat.c b/testsuites/psxtests/psxhdrs/fcntl/openat.c
index 927d56774b..1c15cd0867 100644
--- a/testsuites/psxtests/psxhdrs/fcntl/openat.c
+++ b/testsuites/psxtests/psxhdrs/fcntl/openat.c
@@ -5,7 +5,7 @@
 
 /*
  * SPDX-License-Identifier: BSD-2-Clause
- * 
+ *
  * Copyright (C) 2018, Zenon
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ int test(void);
 
 int test(void){
   int i0, i1;
-  char c;
+  char c = '\0';
 
   i0 = 0;
   i1 = 0;
diff --git a/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c b/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c
index 07d734334b..cd2a271c37 100644
--- a/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c
+++ b/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c
@@ -43,7 +43,7 @@
  int test( void )
  {
    struct hostent *host;
-   struct in_addr ipv4addr;
+   struct in_addr ipv4addr = { 0 };
 
    host = gethostbyaddr( &ipv4addr, sizeof(ipv4addr), AF_INET );
 
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c
index 9bac990cd3..e2341a582d 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attribute;
-  int             state;
+  pthread_attr_t  attribute = { 0 };
+  int             state = 0;
   int             result;
 
   result = pthread_attr_getdetachstate( &attribute, &state );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c
index 6542efdf13..5a816d2115 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attribute;
-  size_t          size;
+  pthread_attr_t  attribute = { 0 };
+  size_t          size = 0;
   int             result;
 
   result = pthread_attr_getguardsize( &attribute, &size );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c
index a76172908b..86a4547164 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attr;
-  int             inheritsched;
+  pthread_attr_t  attr = { 0 };
+  int             inheritsched = 0;
   int             result;
 
   result = pthread_attr_getinheritsched( &attr, &inheritsched );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c
index cc2dcb0198..743e2c4d21 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t      attr;
-  struct sched_param  param;
+  pthread_attr_t      attr = { 0 };
+  struct sched_param  param = { 0 };
   int                 result;
 
   result = pthread_attr_getschedparam( &attr, &param );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c
index a341eeb337..60595d1a7a 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attr;
-  int             policy;
+  pthread_attr_t  attr = { 0 };
+  int             policy = 0;
   int             result;
 
   result = pthread_attr_getschedpolicy( &attr, &policy );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c
index 7023c29fce..7b97a7859c 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attr;
-  int             contentionscope;
+  pthread_attr_t  attr = { 0 };
+  int             contentionscope = 0;
   int             result;
 
   result = pthread_attr_getscope( &attr, &contentionscope );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c
index 177b775baf..f2d8a76362 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c
@@ -47,7 +47,7 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attribute;
+  pthread_attr_t  attribute = { 0 };
   void           *stackaddr;
   size_t          stacksize;
   int             result;
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c
index 4e7c17f40a..ed718c76d9 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c
@@ -47,7 +47,7 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attribute;
+  pthread_attr_t  attribute = { 0 };
   void           *stackaddr;
   int             result;
 
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c
index d9f8c4f718..ff9237a8eb 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c
@@ -46,8 +46,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t  attribute;
-  size_t          size;
+  pthread_attr_t  attribute = { 0 };
+  size_t          size = 0;
   int             result;
 
   result = pthread_attr_getstacksize( &attribute, &size );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c
index 70f001fc67..643ccde907 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c
@@ -42,8 +42,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_attr_t      attr;
-  struct sched_param  param;
+  pthread_attr_t      attr = { 0 };
+  struct sched_param  param = { 0 };
   int                 result;
 
   result = pthread_attr_setschedparam( &attr, &param );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c
index 86f74d7cff..b7e2e2ad34 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c
@@ -43,7 +43,7 @@ int test( void );
 int test( void )
 {
   pthread_cond_t     cond = PTHREAD_COND_INITIALIZER;
-  pthread_condattr_t attribute;
+  pthread_condattr_t attribute = { 0 };
   int result;
 
   result = pthread_cond_init( &cond, &attribute );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c
index 1c38af0067..72427266c1 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c
@@ -44,7 +44,7 @@ int test( void )
 {
   pthread_cond_t  cond  = PTHREAD_COND_INITIALIZER;
   pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-  struct timespec abstime;
+  struct timespec abstime = { 0 };
   int result;
 
   result = pthread_cond_timedwait( &cond, &mutex, &abstime );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c b/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c
index b37f1c00b9..21af201c65 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c
@@ -45,7 +45,7 @@ int test( void );
 
 int test( void )
 {
-  pthread_condattr_t attribute;
+  pthread_condattr_t attribute = { 0 };
   int                pshared;
   int                result;
 
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_create.c b/testsuites/psxtests/psxhdrs/pthread/pthread_create.c
index bde6105933..de4f6b0bec 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_create.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_create.c
@@ -53,7 +53,7 @@ void *test_task(
 int test( void )
 {
   pthread_t       thread;
-  pthread_attr_t  attribute;
+  pthread_attr_t  attribute = { 0 };
   void           *arg = NULL;
   int             result;
 
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c
index 4f652283df..65b44fa779 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c
@@ -45,8 +45,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_mutex_t mutex;
-  int             prioceiling;
+  pthread_mutex_t mutex = { 0 };
+  int             prioceiling = 0;
   int             result;
 
   result = pthread_mutex_getprioceiling( &mutex, &prioceiling );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c
index 085d6f9835..1b42dbc0f3 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c
@@ -43,7 +43,7 @@ int test( void );
 int test( void )
 {
   pthread_mutex_t     mutex = PTHREAD_MUTEX_INITIALIZER;
-  pthread_mutexattr_t attribute;
+  pthread_mutexattr_t attribute = { 0 };
   int result;
 
   result = pthread_mutex_init( &mutex, &attribute );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c
index c402d17a57..02f864493d 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c
@@ -46,7 +46,7 @@ int test( void );
 int test( void )
 {
   pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-  struct timespec timeout;
+  struct timespec timeout = { 0 };
   int result;
 
   result = pthread_mutex_timedlock( &mutex, &timeout );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c
index a53535881c..675ef02d38 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c
@@ -45,7 +45,7 @@ int test( void );
 
 int test( void )
 {
-  pthread_mutexattr_t attribute;
+  pthread_mutexattr_t attribute = { 0 };
   int                 prioceiling = 0;
   int                 result;
 
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c
index 99cd093b17..da16c786b0 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c
@@ -45,8 +45,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_mutexattr_t attribute;
-  int                 protocol;
+  pthread_mutexattr_t attribute = { 0 };
+  int                 protocol = 0;
   int                 result;
 
   result = pthread_mutexattr_getprotocol( &attribute, &protocol );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c
index 3735b76b41..d8e8eaabeb 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c
@@ -45,8 +45,8 @@ int test( void );
 
 int test( void )
 {
-  pthread_mutexattr_t attribute;
-  int                 pshared;
+  pthread_mutexattr_t attribute = { 0 };
+  int                 pshared = 0;
   int                 result;
 
   result = pthread_mutexattr_getpshared( &attribute, &pshared );
diff --git a/testsuites/psxtests/psxhdrs/sys/select/pselect.c b/testsuites/psxtests/psxhdrs/sys/select/pselect.c
index d35a0d0921..ad96dda686 100644
--- a/testsuites/psxtests/psxhdrs/sys/select/pselect.c
+++ b/testsuites/psxtests/psxhdrs/sys/select/pselect.c
@@ -45,8 +45,8 @@ int test( void )
   fd_set readfds;
   fd_set writefds;
   fd_set errorfds;
-  struct timespec timeout;
-  sigset_t sigmask;
+  struct timespec timeout = { 0 };
+  sigset_t sigmask = { 0 };
 
   return_value = pselect(nfds, &readfds, &writefds, &errorfds, &timeout, &sigmask);
   return return_value;
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/bind.c b/testsuites/psxtests/psxhdrs/sys/socket/bind.c
index 3da39b31ff..2fa19f2c26 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/bind.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/bind.c
@@ -44,7 +44,7 @@ int test(void);
 int test(void)
 {
   int              sockfd = 4;
-  struct  sockaddr addr;
+  struct  sockaddr addr = { 0 };
   socklen_t        addrlen = sizeof(addr);
 
   return bind(sockfd, &addr, addrlen);
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/connect.c b/testsuites/psxtests/psxhdrs/sys/socket/connect.c
index 1b8f5b9001..afb560ff52 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/connect.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/connect.c
@@ -43,9 +43,9 @@ int test(void);
 
 int test(void)
 {
-  int              sockfd = 4;
-  struct  sockaddr addr;
-  socklen_t        addrlen = sizeof(addr);
+  int             sockfd = 4;
+  struct sockaddr addr = { 0 };
+  socklen_t       addrlen = sizeof(addr);
 
   return connect(sockfd, &addr, addrlen);
 }
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c b/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
index 0ecf27dda5..e0cd442441 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
@@ -48,7 +48,7 @@ int test(void)
   int              optname = 67;
   int              value;
   void            *optval = &value;
-  socklen_t        optlen;
+  socklen_t        optlen = { 0 };
 
   return getsockopt(sockfd, level, optname, optval, &optlen);
 }
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/send.c b/testsuites/psxtests/psxhdrs/sys/socket/send.c
index b93a87f482..de2ad3ba5a 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/send.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/send.c
@@ -44,7 +44,7 @@ ssize_t test(void);
 ssize_t test(void)
 {
   int     sockfd = 4;
-  int     buffer;
+  int     buffer = 0;
   void   *buf = &buffer;
   size_t  len = sizeof(buffer);
   int     flags = 7;
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c b/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
index 3205271572..a14b8ff8d4 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
@@ -44,7 +44,7 @@ ssize_t test(void);
 ssize_t test(void)
 {
   int           sockfd = 4;
-  struct msghdr msg;
+  struct msghdr msg = { 0 };
   int           flags = 7;
 
 
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/sendto.c b/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
index 298d17f4ec..5050f1a0a5 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
@@ -44,11 +44,11 @@ ssize_t test(void);
 ssize_t test(void)
 {
   int              sockfd = 4;
-  int              buffer;
+  int              buffer = 0;
   const void      *buf = &buffer;
   size_t           len = sizeof(buffer);
   int              flags = 7;
-  struct  sockaddr dest_addr;
+  struct  sockaddr dest_addr = { 0 };
   socklen_t        addrlen = sizeof(dest_addr);
 
   return sendto(sockfd, buf, len, flags, &dest_addr, addrlen);
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c b/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
index d373add6de..e4d21d3837 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
@@ -46,7 +46,7 @@ int test(void)
   int              sockfd = 4;
   int              level = SOL_SOCKET;
   int              optname = 67;
-  int              value;
+  int              value = 0;
   void            *optval = &value;
   socklen_t        optlen = sizeof(value);
 
diff --git a/testsuites/psxtests/psxhdrs/sys/stat/futimens.c b/testsuites/psxtests/psxhdrs/sys/stat/futimens.c
index 75fa0ce0e6..9892352b71 100644
--- a/testsuites/psxtests/psxhdrs/sys/stat/futimens.c
+++ b/testsuites/psxtests/psxhdrs/sys/stat/futimens.c
@@ -42,9 +42,9 @@ int test( void )
 {
 	int return_value;
 	int fd = 1;
-	struct timespec times[2];
+	struct timespec times[2] = { 0 };
 
 
 	return_value = futimens(fd, times);
 	return (return_value != -1);
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c b/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c
index c8c0767ce3..b74cc1a44b 100644
--- a/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c
+++ b/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c
@@ -44,9 +44,9 @@ int test( void )
 	int return_value;
 	int fd = 1;
 	char *path = "/";
-	struct timespec times[2];
+	struct timespec times[2] = { 0 };
 	int flag = AT_SYMLINK_NOFOLLOW;
 
 	return_value = utimensat(fd, path, times, flag);
 	return (return_value != -1);
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/time/utimes.c b/testsuites/psxtests/psxhdrs/sys/time/utimes.c
index ae69eb5ded..bebc7a77b4 100644
--- a/testsuites/psxtests/psxhdrs/sys/time/utimes.c
+++ b/testsuites/psxtests/psxhdrs/sys/time/utimes.c
@@ -5,7 +5,7 @@
 
 /*
  * SPDX-License-Identifier: BSD-2-Clause
- * 
+ *
  * Copyright (C) 2018, Zenon
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,8 @@ int test(void);
 int test(void)
 {
   int callback;
-  struct timeval tv;
-  
-  callback = utimes(NULL, &tv);
+  struct timeval tv[2] = { 0 };
+
+  callback = utimes(NULL, &tv[0]);
   return (callback == -1);
 }
diff --git a/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c b/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c
index e98a28179e..0c8d304a71 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c
@@ -40,11 +40,11 @@ int test( void );
 
 int test( void )
 {
-  struct termios term;
+  struct termios term = { 0 };
   speed_t rate;
 
   rate = cfgetispeed(&term);
 
   (void) rate;
   return 0;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c b/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c
index b326a78378..4d2e23ed50 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c
@@ -40,11 +40,11 @@ int test( void );
 
 int test( void )
 {
-  struct termios term;
+  struct termios term = { 0 };
   speed_t rate;
 
   rate = cfgetospeed(&term);
 
   (void) rate;
   return 0;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c b/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c
index b73dbffce1..0f8ddfff57 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c
@@ -41,10 +41,10 @@ int test( void );
 int test( void )
 {
   int result;
-  struct termios term;
+  struct termios term = { 0 };
   speed_t speed = B0;
 
   result = cfsetispeed(&term, speed);
 
   return result;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c b/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c
index 8377fc6e26..8d5404c954 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c
@@ -41,10 +41,10 @@ int test( void );
 int test( void )
 {
   int result;
-  struct termios term;
+  struct termios term = { 0 };
   speed_t speed = B0;
 
   result = cfsetospeed(&term, speed);
 
   return result;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/tcgetattr.c b/testsuites/psxtests/psxhdrs/termios/tcgetattr.c
index d00336b214..843b7c8281 100644
--- a/testsuites/psxtests/psxhdrs/termios/tcgetattr.c
+++ b/testsuites/psxtests/psxhdrs/termios/tcgetattr.c
@@ -42,9 +42,9 @@ int test( void )
 {
   int result;
   int fildes = 0;
-  struct termios term;
+  struct termios term = { 0 };
 
   result = tcgetattr(fildes, &term);
 
   return result;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/tcsetattr.c b/testsuites/psxtests/psxhdrs/termios/tcsetattr.c
index e2bd6980a9..da0e0ea62d 100644
--- a/testsuites/psxtests/psxhdrs/termios/tcsetattr.c
+++ b/testsuites/psxtests/psxhdrs/termios/tcsetattr.c
@@ -43,9 +43,9 @@ int test( void )
   int result;
   int fildes = 0;
   int optional_actions = 0;
-  struct termios term;
+  struct termios term = { 0 };
 
   result = tcsetattr(fildes, optional_actions, &term);
 
   return result;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/time/asctime.c b/testsuites/psxtests/psxhdrs/time/asctime.c
index c02a543d6b..400dbf5258 100644
--- a/testsuites/psxtests/psxhdrs/time/asctime.c
+++ b/testsuites/psxtests/psxhdrs/time/asctime.c
@@ -42,7 +42,7 @@ int test( void );
 int test( void )
 {
   char      *buffer;
-  struct tm  timestruct;
+  struct tm  timestruct = { 0 };
 
   buffer = asctime( &timestruct );
 
diff --git a/testsuites/psxtests/psxhdrs/time/asctime_r.c b/testsuites/psxtests/psxhdrs/time/asctime_r.c
index 231ea14dfb..c0a22b7d6b 100644
--- a/testsuites/psxtests/psxhdrs/time/asctime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/asctime_r.c
@@ -42,7 +42,7 @@ int test( void );
 int test( void )
 {
   char      *buffer_pointer;
-  struct tm  timestruct;
+  struct tm  timestruct = { 0 };
   char       buffer[ 80 ];
 
   buffer_pointer = asctime_r( &timestruct, buffer );
diff --git a/testsuites/psxtests/psxhdrs/time/clock_settime.c b/testsuites/psxtests/psxhdrs/time/clock_settime.c
index 8a4d88c37f..8584e1c61f 100644
--- a/testsuites/psxtests/psxhdrs/time/clock_settime.c
+++ b/testsuites/psxtests/psxhdrs/time/clock_settime.c
@@ -46,7 +46,7 @@ int test( void );
 int test( void )
 {
   clockid_t        clock_id = 0;
-  struct timespec  tp;
+  struct timespec  tp = { 0 };
   int              result;
 
   result = clock_settime( clock_id, &tp );
diff --git a/testsuites/psxtests/psxhdrs/time/ctime.c b/testsuites/psxtests/psxhdrs/time/ctime.c
index f778e726a9..67dddf21ca 100644
--- a/testsuites/psxtests/psxhdrs/time/ctime.c
+++ b/testsuites/psxtests/psxhdrs/time/ctime.c
@@ -42,7 +42,7 @@ int test( void );
 int test( void )
 {
   char     *buffer;
-  time_t    time;
+  time_t    time = { 0 };
 
   buffer = ctime( &time );
 
diff --git a/testsuites/psxtests/psxhdrs/time/ctime_r.c b/testsuites/psxtests/psxhdrs/time/ctime_r.c
index b973a504ae..30f1285d0a 100644
--- a/testsuites/psxtests/psxhdrs/time/ctime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/ctime_r.c
@@ -43,7 +43,7 @@ int test( void )
 {
   char     *buffer_pointer;
   char      buffer[ 80 ];
-  time_t    time;
+  time_t    time = { 0 };
 
   buffer_pointer = ctime_r( &time, buffer );
 
diff --git a/testsuites/psxtests/psxhdrs/time/gmtime.c b/testsuites/psxtests/psxhdrs/time/gmtime.c
index 7118162c84..d7c08726ad 100644
--- a/testsuites/psxtests/psxhdrs/time/gmtime.c
+++ b/testsuites/psxtests/psxhdrs/time/gmtime.c
@@ -41,7 +41,7 @@ int test( void );
 
 int test( void )
 {
-  time_t     time;
+  time_t     time = { 0 };
   struct tm *timestruct;
 
   timestruct = gmtime( &time );
diff --git a/testsuites/psxtests/psxhdrs/time/gmtime_r.c b/testsuites/psxtests/psxhdrs/time/gmtime_r.c
index 58f6a3212a..128e5107e0 100644
--- a/testsuites/psxtests/psxhdrs/time/gmtime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/gmtime_r.c
@@ -41,7 +41,7 @@ int test( void );
 
 int test( void )
 {
-  time_t     time;
+  time_t     time = { 0 };
   struct tm *timestruct_pointer;
   struct tm  timestruct;
 
diff --git a/testsuites/psxtests/psxhdrs/time/localtime.c b/testsuites/psxtests/psxhdrs/time/localtime.c
index 674d8e43c2..7f1b4e481d 100644
--- a/testsuites/psxtests/psxhdrs/time/localtime.c
+++ b/testsuites/psxtests/psxhdrs/time/localtime.c
@@ -41,7 +41,7 @@ int test( void );
 
 int test( void )
 {
-  time_t     time;
+  time_t     time = { 0 };
   struct tm *timestruct;
 
   timestruct = localtime( &time );
diff --git a/testsuites/psxtests/psxhdrs/time/localtime_r.c b/testsuites/psxtests/psxhdrs/time/localtime_r.c
index be85af36c5..10338db9fe 100644
--- a/testsuites/psxtests/psxhdrs/time/localtime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/localtime_r.c
@@ -41,7 +41,7 @@ int test( void );
 
 int test( void )
 {
-  time_t     time;
+  time_t     time = { 0 };
   struct tm *timestruct_pointer;
   struct tm  timestruct;
 
diff --git a/testsuites/psxtests/psxhdrs/time/strftime.c b/testsuites/psxtests/psxhdrs/time/strftime.c
index ee27e7b8d4..6b75cdac1e 100644
--- a/testsuites/psxtests/psxhdrs/time/strftime.c
+++ b/testsuites/psxtests/psxhdrs/time/strftime.c
@@ -44,7 +44,7 @@ int test( void )
   size_t    length;
   size_t    max_length;
   char      buffer[ 80 ];
-  struct tm timestruct;
+  struct tm timestruct = { 0 };
 
   max_length = sizeof( buffer );
 
diff --git a/testsuites/psxtests/psxhdrs/unistd/setgroups.c b/testsuites/psxtests/psxhdrs/unistd/setgroups.c
index b40547a5e8..a29cb05978 100644
--- a/testsuites/psxtests/psxhdrs/unistd/setgroups.c
+++ b/testsuites/psxtests/psxhdrs/unistd/setgroups.c
@@ -42,7 +42,7 @@ int test( void );
 
 int test( void )
 {
-  gid_t grouplist[ 20 ];
+  gid_t grouplist[ 20 ] = { 0 } ;
   int   gidsetsize;
   int   result;
 
diff --git a/testsuites/psxtests/psxhdrs/utime/utime.c b/testsuites/psxtests/psxhdrs/utime/utime.c
index 6236a84637..db619baecc 100644
--- a/testsuites/psxtests/psxhdrs/utime/utime.c
+++ b/testsuites/psxtests/psxhdrs/utime/utime.c
@@ -43,7 +43,7 @@ int test( void );
 int test( void )
 {
   int result;
-  const struct utimbuf buff;
+  const struct utimbuf buff = { 0 };
   const char *path = "/tmp/myfile";
 
   result = utime(path, &buff);
diff --git a/testsuites/psxtests/psxhdrs/wchar/mbsinit.c b/testsuites/psxtests/psxhdrs/wchar/mbsinit.c
index 21a39ee2ce..5432520f86 100644
--- a/testsuites/psxtests/psxhdrs/wchar/mbsinit.c
+++ b/testsuites/psxtests/psxhdrs/wchar/mbsinit.c
@@ -5,7 +5,7 @@
 
 /*
  * SPDX-License-Identifier: BSD-2-Clause
- * 
+ *
  * Copyright (C) 2018, Zenon
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ int test(void);
 
 int test(void)
 {
-  const mbstate_t state;
+  const mbstate_t state = { 0 };
 
   return mbsinit(&state);
 }
diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c
index d9696a0e28..593df739db 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -55,6 +55,7 @@ rtems_task Test_Thread(rtems_task_argument argument)
   int *value_p, *value_p2;
 
   value_p = malloc( sizeof( int ) );
+  rtems_test_assert(value_p != NULL);
   sc = pthread_setspecific( Key, value_p );
   rtems_test_assert( !sc );
 
@@ -119,7 +120,7 @@ rtems_task Init(rtems_task_argument argument)
     pthread_mutex_lock( &mutex1 );
 
     rc = rtems_task_create(
-      rtems_build_name( 'T', 'E', 'S', 'T' ), 
+      rtems_build_name( 'T', 'E', 'S', 'T' ),
       1,
       RTEMS_MINIMUM_STACK_SIZE,
       RTEMS_DEFAULT_MODES,
diff --git a/testsuites/psxtests/psxkey08/init.c b/testsuites/psxtests/psxkey08/init.c
index 2bd00bc53d..ed0b6e8554 100644
--- a/testsuites/psxtests/psxkey08/init.c
+++ b/testsuites/psxtests/psxkey08/init.c
@@ -51,7 +51,7 @@ static rtems_name name1, name2;
 
 static rtems_task test_task(rtems_task_argument arg)
 {
-  rtems_status_code sc;
+  rtems_status_code sc = 0;
   const void *value_p;
   const void *value_p2;
 
diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c
index 3c77beb038..c6b3d92464 100644
--- a/testsuites/psxtests/psxmsgq01/init.c
+++ b/testsuites/psxtests/psxmsgq01/init.c
@@ -1133,7 +1133,7 @@ void verify_with_threads(void)
 
 void validate_mq_setattr(void)
 {
-  struct mq_attr  attr;
+  struct mq_attr  attr = { 0 };
   struct mq_attr  save_attr[ NUMBER_OF_TEST_QUEUES ];
   int             status;
   int            i;
diff --git a/testsuites/sptests/sp68/init.c b/testsuites/sptests/sp68/init.c
index 5443dfbb5e..8e0bd1c8c8 100644
--- a/testsuites/sptests/sp68/init.c
+++ b/testsuites/sptests/sp68/init.c
@@ -166,7 +166,7 @@ static void obtain_callback(rtems_id timer_id, void *arg)
 static void release_callback(rtems_id timer_id, void *arg)
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
-  char buf [1];
+  char buf [1] = { 0 };
   size_t size = sizeof(buf);
   uint32_t released = 0;
 
diff --git a/testsuites/sptests/spfatal32/init.c b/testsuites/sptests/spfatal32/init.c
index 78dcfeb669..1a1e0bee79 100644
--- a/testsuites/sptests/spfatal32/init.c
+++ b/testsuites/sptests/spfatal32/init.c
@@ -39,6 +39,11 @@
 #define FATAL_ERROR_EXPECTED_SOURCE RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE
 #define FATAL_ERROR_EXPECTED_ERROR  1
 
+/*
+ * Disable for the specific test case.
+ */
+#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
+
 static void force_error(void)
 {
   uintptr_t invalid = 1;



More information about the vc mailing list