This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix sysdeps/ieee754/dbl-64/mpa.c for -Wuninitialized [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 28 May 2015 15:54:03 +0000
- Subject: Re: Fix sysdeps/ieee754/dbl-64/mpa.c for -Wuninitialized [committed]
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1505212306390 dot 24623 at digraph dot polyomino dot org dot uk> <5561361C dot 5020700 at redhat dot com>
On Sat, 23 May 2015, Carlos O'Donell wrote:
> On 05/21/2015 07:07 PM, Joseph Myers wrote:
> > If you remove the "override CFLAGS += -Wno-uninitialized" in
> > math/Makefile, one of the errors you get is:
> >
> > ../sysdeps/ieee754/dbl-64/mpa.c: In function '__mp_dbl.part.0':
> > ../sysdeps/ieee754/dbl-64/mpa.c:183:5: error: 'c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > c *= X[0];
> >
> > The problem is that the p < 5 case initializes c if p is 1, 2, 3 or 4
> > but not otherwise, and in fact p is positive for all calls to this
> > function so the uninitialized case can't actually occur. This patch
> > replaces the "if (p == 4)" last case with a comment so the compiler
> > can see that all paths do initialize c.
>
> Just out of curiosity, did this result in better generated code?
I didn't review the generated code.
--
Joseph S. Myers
joseph@codesourcery.com