[RTEMS Project] #4662: Fix GCC 12 warnings

RTEMS trac trac at rtems.org
Mon Jun 20 01:19:56 UTC 2022


#4662: Fix GCC 12 warnings
-------------------------+---------------------
 Reporter:  Chris Johns  |       Owner:  (none)
     Type:  defect       |      Status:  new
 Priority:  normal       |   Milestone:  6.1
Component:  tool/gcc     |     Version:  6
 Severity:  blocker      |  Resolution:
 Keywords:               |  Blocked By:
 Blocking:               |
-------------------------+---------------------

Comment (by Chris Johns):

 The warning in comment:4 looks similar to:
 {{{
 [3173/4451] Compiling testsuites/psxtests/psxkey07/init.c
 ../../../testsuites/psxtests/psxkey07/init.c: In function 'Test_Thread':
 ../../../testsuites/psxtests/psxkey07/init.c:59:8: warning: 'value_p' may
 be used uninitialized [-Wmaybe-uninitialized]
    59 |   sc = pthread_setspecific( Key, value_p );
       |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from ../../../testsuites/psxtests/psxkey07/init.c:34:
 /opt/work/rtems/6/arm-rtems6/include/pthread.h:309:9: note: by argument 2
 of type 'const void *' to 'pthread_setspecific' declared here
   309 | int     pthread_setspecific (pthread_key_t __key, const void
 *__value);
       |         ^~~~~~~~~~~~~~~~~~~
 }}}
 The code is also similar to the comment:4 test case:
 {{{
   int *value_p, *value_p2;

   value_p = malloc( sizeof( int ) );
   rtems_test_assert(value_p != NULL);
 }}}
 Note, I added the `NULL` assert. Is this a false trigger for gcc 12 or
 something related to the `malloc` decl?

--
Ticket URL: <http://devel.rtems.org/ticket/4662#comment:5>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list