[PATCH] fix #19444 - build failures with -O1 due to -Wmaybe-uninitialized
Mike Frysinger
vapier@gentoo.org
Wed Jan 13 17:50:00 GMT 2016
On 13 Jan 2016 10:02, Martin Sebor wrote:
> In his comments on the bug, Carlos suggests to fix these instances
> of false positives and to get -O1 to work. The attached patch
> does just that. In the patch, to minimize the impact of the
> (otherwise unnecessary) initialization, rather than initializing
> them for all the code paths, I reduced the scope of the local
> variables that are subject to the warning and added the redundant
> initialization only for the problem code paths. This led to more
> changes that would otherwise be required but resulted in code
> that's easier to follow.
any time code is changed to address warnings, especially "harmless" ones,
the first question is "has the compiled output changed". if gcc produces
worse code at -O2, then this is probably not the right direction.
> The patch also adds -Wno-error=maybe-uninitialized to the warning
> options when -O1 or lower is set in CFLAGS to prevent these false
> positives from causing build failures. This change renders the
> changes above strictly unnecessary. I include both since I think
> both are worthwhile but I can remove one or the other if others
> have a different preference.
i'm in favor of this myself. we clearly do not test -O1 as the normal
course of things, so it'll be perpetually broken.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160113/7ad16ea6/attachment.sig>
More information about the Libc-alpha
mailing list