This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix maybe-uninitialized error on powerpc
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Matheus Castanho <msc at linux dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 9 Jan 2020 18:48:24 +0000
- Subject: Re: [PATCH] Fix maybe-uninitialized error on powerpc
- Ironport-sdr: uvcSSnet3RYiwFL15RxsHVflklOm4TwrneqFa5vQvVZVmEN2cQ9MQz5u7sSKOFYlMr8PGMFRQa VyQuiZ9464W1UuvoQbYX4jHlP/vymlBiQU0nzlDruO0WSNaJwfUmJBmyD3dnde5d2nnIkkg1v+ jGvT1Ct3QhKDAKWhX2laeD6gP8HLLMnb7C9qFEhzEtWf/RpdXM9aMn4JZdOQoCBYba4g25oR8X x4MYqx2tBEdXjJ/W7VZdt7BsGMJlD1ZgnjgEHxz4HfTCcbV/auzGIr+R5FSCY0kTSUS8qUexXV MQI=
- Ironport-sdr: ev1O5/vdfXLdrUP42L4i1AEUnh0OPQo3+r0KY30GjkBFqXXgTrlAmCEXpi77w6gdKOraNie6xG XNSZ3b1CAR8HO2ZhUsBBXQD3mroz8Yh80Je2/PbKLhUeozXZdzaPvn1GLIdbqhtfwgjVIj/21T E4DSfIZlchHXTNUnbuDe5ui4o9itngBHe5GjqXzjNifty15utMcWK+55NkXMHdGc4SV3HhyRHQ myVcsBO2rCW8Fhe84viFkbsJm+UdTrHG2JOLMrGTY1jsAL52gDEeHjx9uCCIaWodkGI9v7y8gj LSQ=
- References: <20200109182705.5309-1-msc@linux.ibm.com>
On Thu, 9 Jan 2020, Matheus Castanho wrote:
> The build has been failing on powerpc64le-linux-gnu with GCC 10
> due to a maybe-uninitialized error:
>
> ../sysdeps/ieee754/dbl-64/mpa.c:875:6: error: ‘w.e’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> 875 | EY -= EX;
> | ^~
>
> This commits adds proper initialization to avoid it.
glibc practice is not to add such initializations just to avoid warnings,
if the warnings are false positives (rather, DIAG_* macros with
appropriate comments, or __builtin_unreachable, are used instead).
I think what's going on here is that __dbl_mp may not set the exponent of
a returned 0 value, but in fact a returned 0 value is impossible in the
case where GCC is reporting uninitialized data. If you agree with that
analysis, does putting
if (t == 0)
__builtin_unreachable ();
(with a comment justifying *why* t cannot be 0), just before the __dbl_mp
call in __inv, help with the warning?
--
Joseph S. Myers
joseph@codesourcery.com