[Bug 587220] New: incorrect "may be used uninitialized" warning
http://bugzilla.novell.com/show_bug.cgi?id=587220 http://bugzilla.novell.com/show_bug.cgi?id=587220#c0 Summary: incorrect "may be used uninitialized" warning Classification: openSUSE Product: openSUSE 11.3 Version: Factory Platform: PowerPC-64 OS/Version: openSUSE 11.3 Status: NEW Severity: Normal Priority: P5 - None Component: Development AssignedTo: pth@novell.com ReportedBy: jeffm@novell.com QAContact: qa@suse.de Found By: Development Blocker: --- Created an attachment (id=347713) --> (http://bugzilla.novell.com/attachment.cgi?id=347713) Flags used to call gcc Building arch/powerpc/kvm/book3s.c from the 2.6.34-rc1 kernel results in a build failure due to the use of -Werror and an incorrect "may be used uninitialized" warning. cc1: warnings being treated as errors /usr/src/packages/BUILD/kernel-default-2.6.34/linux-2.6.33/arch/powerpc/kvm/book3s.c: In function '__kvmppc_vcpu_run': /usr/src/packages/BUILD/kernel-default-2.6.34/linux-2.6.33/arch/powerpc/kvm/book3s.c:1102:23: error: 'ext_bkp.vrsave' may be used uninitialized in this function The chunk in question is the following: struct thread_struct ext_bkp; bool save_vec = current->thread.used_vr; [...] #ifdef CONFIG_ALTIVEC /* Save Altivec state in stack */ if (save_vec) { if (current->thread.regs->msr & MSR_VEC) giveup_altivec(current); memcpy(ext_bkp.vr, current->thread.vr, sizeof(ext_bkp.vr)); ext_bkp.vscr = current->thread.vscr; ext_bkp.vrsave = current->thread.vrsave; } ext_bkp.used_vr = current->thread.used_vr; #endif [...] #ifdef CONFIG_ALTIVEC /* Restore Altivec state from stack */ if (save_vec && current->thread.used_vr) { memcpy(current->thread.vr, ext_bkp.vr, sizeof(ext_bkp.vr)); current->thread.vscr = ext_bkp.vscr; current->thread.vrsave= ext_bkp.vrsave; } current->thread.used_vr = ext_bkp.used_vr; #endif save_vec is set once at the top of the function and is not changed. ext_bkp.vrsave is set within the save_vec if statement and read within the next one, and not at all outside of either. I'll attach the .c, the .i, and the gcc build options. gcc version 4.5.0 20100302 (experimental) [trunk revision 157166] (SUSE Linux) -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=587220 http://bugzilla.novell.com/show_bug.cgi?id=587220#c1 --- Comment #1 from Jeff Mahoney <jeffm@novell.com> 2010-03-10 20:43:12 UTC --- Created an attachment (id=347714) --> (http://bugzilla.novell.com/attachment.cgi?id=347714) book3s.c -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=587220 http://bugzilla.novell.com/show_bug.cgi?id=587220#c2 --- Comment #2 from Jeff Mahoney <jeffm@novell.com> 2010-03-10 20:43:39 UTC --- Created an attachment (id=347715) --> (http://bugzilla.novell.com/attachment.cgi?id=347715) book3s.i -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=587220 http://bugzilla.novell.com/show_bug.cgi?id=587220#c4 Richard Guenther <rguenther@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX --- Comment #4 from Richard Guenther <rguenther@novell.com> 2010-03-18 15:36:16 UTC --- struct thread_struct ext_bkp; bool save_vec = current->thread.used_vr; [...] #ifdef CONFIG_ALTIVEC /* Save Altivec state in stack */ if (save_vec) { if (current->thread.regs->msr & MSR_VEC) giveup_altivec(current); memcpy(ext_bkp.vr, current->thread.vr, sizeof(ext_bkp.vr)); ext_bkp.vscr = current->thread.vscr; ext_bkp.vrsave = current->thread.vrsave; } ext_bkp.used_vr = current->thread.used_vr; #endif [...] #ifdef CONFIG_ALTIVEC /* Restore Altivec state from stack */ if (save_vec && current->thread.used_vr) { memcpy(current->thread.vr, ext_bkp.vr, sizeof(ext_bkp.vr)); current->thread.vscr = ext_bkp.vscr; current->thread.vrsave= ext_bkp.vrsave; } ext_bkp.vrsave is set under save_vec and used under save_vec && current->thread.used_vr. GCC isn't smart enough to cover this false positive (if indeed it is one). So GCC says _may_ be used uninitialized. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com