GNU bug report logs -
#55895
[PATCH] maint: Fix ptr_align signature to silence -Wmaybe-uninitialized
Previous Next
Reported by: Anders Kaseorg <andersk <at> mit.edu>
Date: Fri, 10 Jun 2022 22:31:02 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 55895 <at> debbugs.gnu.org (full text, mbox):
On 6/10/22 15:24, Anders Kaseorg wrote:
> ptr_align is always called with a pointer to uninitialized memory, so
> it does not make sense for that pointer to be const.
I don't see why not. ptr_align does not modify the referenced storage so
"void const *" is appropriate. If we changed the type to "void *" we'd
unnecessarily limit ptr_align's applicability.
> This change avoids -Wmaybe-uninitialized warnings from GCC 11.
I can't reproduce the problem with the latest coreutils commit
93e099e4c3b659b2e329f655fbdc73fdf594a66e on Savannah master on Ubuntu
22.04 LTS x86-64, I don't get warnings with either gcc (Ubuntu
11.2.0-19ubuntu1) 11.2.0 or with gcc-12 (Ubuntu 12-20220319-1ubuntu1)
12.0.1 20220319 (experimental) [master r12-7719-g8ca61ad148f]. I also
don't see a problem on Fedora 36 x86-64 with gcc (GCC) 12.1.1 20220507
(Red Hat 12.1.1-1)
. In all cases I configured and built with "./configure
--enable-gcc-warnings; make".
Perhaps the problem (whatever it was) has already been fixed in
coreutils. If not, I guess that the issue has something to do with the
particular platform and options you configured with. If it's an older
compiler like GCC 11.3.0 I wouldn't worry too much about it, as older
GCCs are notorious for false alarms and not worth the trouble of pacifying.
Most likely the warnings are false positives (though I haven't checked
this).
This bug report was last modified 2 years and 342 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.