lwp: Ignore dangling-pointer warning in process.c 57/14957/9
authorCheyenne Wills <cwills@sinenomine.net>
Tue, 7 Jun 2022 17:14:55 +0000 (11:14 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 25 Jun 2022 23:19:26 +0000 (19:19 -0400)
commit748ae0fc25c51316d741afd9b9dfd479ffdf3250
tree63dae0b83d7f5739f80e234f04b0573978915a92
parent1d1a20c33258a9285a16e85a55df9c0fbf4a3ac2
lwp: Ignore dangling-pointer warning in process.c

In lwp/process.c the address of a stack variable is saved as part of
creating a new context.  GCC-12 is flagging the statement with a
diagnostic:

  ./process.c:46:24: error: storing the address of local variable
      ‘stackvar’ in ‘*savearea.topstack’ [-Werror=dangling-pointer=]
   46 |     savearea->topstack = (char *)&stackvar;
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

In this particular case, the code is meaning to save the address of the
stack in preparation of setting up a new context, which requires knowing
the address the current stack.

The diagnostic is changed from a warning to an error when configured
with --enable-checking.

Set the env variable CFLAGS_NODANGLING_POINTER to
'-Wno-dangling-pointer' if the compiler supports the option and update
the src/lwp/Makefile.in to use the flag when compiling process.c

Change-Id: Ibec956b505c0edad9b74d63b9bb7805f6f0cba01
Reviewed-on: https://gerrit.openafs.org/14957
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
CODING
src/cf/osconf.m4
src/lwp/Makefile.in