avoid -Waddress in vfprintf-internal.c

Martin Sebor msebor@gmail.com
Wed Sep 22 00:31:18 GMT 2021


Building Glibc with a GCC 12 enhanced to detect more instances
of comparing addresses to null that are guaranteed to evaluate
to a constanst triggers a large number of such instancesl.
The warnings, all isolated to the same file, are valid and
intended but the Glibc code is safe.  They show up because
the comparison is in a macro to which either null or a constant
address of an array element are alternately passed as an argument.

The attached patch avoids these warnings by introducing local
variables for the address being compared (an array element)
as well as for the null pointer.

Tested by building Glibc on x86_64, verifying the warnings
are gone, and by running the testsuite and checking for new
failures.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-28368.diff
Type: text/x-patch
Size: 6357 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20210921/ba844294/attachment-0001.bin>


More information about the Libc-alpha mailing list