Message ID | 20160117175903.GQ3017@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On 01/17/2016 10:59 AM, Jakub Jelinek wrote: > Hi! > > During profiledbootstrap, I'm seeing: > ../../gcc/system.h: In function 'void autopref_multipass_init(const rtx_insn*, int)': > ../../gcc/system.h:367:29: warning: 'max_offset' may be used uninitialized in this function [-Wmaybe-uninitialized] > #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) > ^ > ../../gcc/haifa-sched.c:5603:11: note: 'max_offset' was declared here > int max_offset; > ^~~~~~~~~~ > and similarly for min_offset. The warning is a false positive just because > the compiler can't know that a PARALLEL should never have zero XVECLEN (pat, 0). > prev_base which is also set during the first iteration and thus not set > if n_elems is 0 already have an initializer for this reason. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2016-01-17 Jakub Jelinek <jakub@redhat.com> > > * haifa-sched.c (autopref_multipass_init): Work around > -Wmaybe-uninitialized warning. OK. I was carrying a similar patch locally. The difference is I used INT_MAX for min_offset and INT_MIN for max_offset, just for extra safety. Jeff
--- gcc/haifa-sched.c.jj 2016-01-04 14:55:52.000000000 +0100 +++ gcc/haifa-sched.c 2016-01-16 11:30:04.782594233 +0100 @@ -5599,8 +5599,8 @@ autopref_multipass_init (const rtx_insn int i = 0; rtx prev_base = NULL_RTX; - int min_offset; - int max_offset; + int min_offset = 0; + int max_offset = 0; for (i = 0; i < n_elems; i++) {