From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24083 invoked by alias); 24 May 2012 19:26:51 -0000 Received: (qmail 24070 invoked by uid 22791); 24 May 2012 19:26:50 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ,TW_CX,TW_DC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 May 2012 19:26:37 +0000 From: "gbburkhardt at verizon dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53480] New: warning "may be used uninitialized" issued with -m32 but not with -m64 Date: Thu, 24 May 2012 19:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gbburkhardt at verizon dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg02415.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53480 Bug #: 53480 Summary: warning "may be used uninitialized" issued with -m32 but not with -m64 Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: gbburkhardt@verizon.net For the following program, a warning is issued with "-m32", but not with "-m64". armis@armis-00:~$ gcc -c -O2 -g -Wall -m32 -std=3Dgnu99 tt.c tt.c: In function =E2=80=98sub=E2=80=99: tt.c:18:29: warning: =E2=80=98v0.minValue=E2=80=99 may be used uninitialize= d in this function [-Wuninitialized] tt.c:21:29: warning: =E2=80=98v0.maxValue=E2=80=99 may be used uninitialize= d in this function [-Wuninitialized] armis@armis-00:~$ gcc -c -O2 -g -Wall -m64 -std=3Dgnu99 tt.c armis@armis-00:~$ #include typedef struct { double minValue, maxValue; } Range; void getNewRange(Range*); void sub()=20 { Range v0, v1; for (int i=3D0; i < 2; i++) { getNewRange(&v1); if (i =3D=3D 0) { v0.minValue =3D v1.minValue; v0.maxValue =3D v1.minValue; } else { if (v0.minValue > v1.minValue) v0.minValue =3D v1.minValue; if (v0.maxValue < v1.maxValue) v0.maxValue =3D v1.maxValue; } } printf("min=3D%f, max=3D%f\n", v0.minValue, v0.maxValue);=20=20=20 } armis@armis-00:~$ gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=3Dfile:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=3Dc,c++,fortran,objc,obj-c++,go --prefix=3D/usr --program-suffix=3D-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --with-gxx-include-dir=3D/usr/include/c++/4.6 --libdir=3D/usr/lib --enable-nls --with-sysroot=3D/ --enable-clocale=3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=3Di686 --with-tune=3Dgener= ic --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linu= x-gnu --target=3Dx86_64-linux-gnu Thread model: posix gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)