From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19980 invoked by alias); 18 Dec 2012 17:27:23 -0000 Received: (qmail 19355 invoked by uid 48); 18 Dec 2012 17:26:56 -0000 From: "matt at use dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors Date: Tue, 18 Dec 2012 17:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matt at use 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: In-Reply-To: References: 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-12/txt/msg01798.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D50148 --- Comment #6 from Matt Hargett 2012-12-18 17:26:54 = UTC --- Applying the supplied patch reveals another issue underneath, which is a fa= lse positive: /work/mhargett/gcc-trunk-obj/./prev-gcc/xg++ -B/work/mhargett/gcc-trunk-obj/./prev-gcc/ -B/u/mhargett/x86_64-unknown-linux-gnu/bin/ -nostdinc++ -B/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/s= rc/.libs -B/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/l= ibsupc++/.libs -I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/i= nclude/x86_64-unknown-linux-gnu -I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/i= nclude -I/work/mhargett/gcc-trunk/libstdc++-v3/libsupc++ -L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/s= rc/.libs -L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/l= ibsupc++/.libs -g -O2 -O3 -march=3Dnocona -mtune=3Dcore2 -floop-block -floop-interchange -floop-strip-mine -flto=3Djobserver -frandom-seed=3D1 -DIN_GCC -fno-excep= tions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-stri= ngs -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common=20 -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o gengtype \ gengtype.o gengtype-lex.o gengtype-parse.o gengtype-state.o version= .o errors.o libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a libcomm= on.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a=20 In file included from ../../gcc-trunk/libiberty/cp-demangle.c:876:0, from :51: ../../gcc-trunk/libbacktrace/elf.c: In function =E2=80=98elf_add=E2=80=99: ../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: =E2=80=98ehdr_view.len= =E2=80=99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] if (munmap (const_cast.v, view->len) < 0) ^ In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0, from :51: ../../gcc-trunk/libbacktrace/elf.c:476:25: note: =E2=80=98ehdr_view.len=E2= =80=99 was declared here struct backtrace_view ehdr_view; ^ In file included from ../../gcc-trunk/libiberty/cp-demangle.c:876:0, from :51: ../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: =E2=80=98ehdr_view.base= =E2=80=99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] if (munmap (const_cast.v, view->len) < 0) ^ In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0, from :51: ../../gcc-trunk/libbacktrace/elf.c:476:25: note: =E2=80=98ehdr_view.base=E2= =80=99 was declared here struct backtrace_view ehdr_view; ^ In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0, from :51: ../../gcc-trunk/libbacktrace/elf.c:516:10: error: =E2=80=98ehdr_view.data= =E2=80=99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] memcpy (&ehdr, ehdr_view.data, sizeof ehdr); ^ In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0, from :51: ../../gcc-trunk/libbacktrace/elf.c:476:25: note: =E2=80=98ehdr_view.data=E2= =80=99 was declared here struct backtrace_view ehdr_view; ^ lto1: all warnings being treated as errors make[4]: *** [/tmp/ccQGEpYR.ltrans15.ltrans.o] Error 1 in libbacktrace/elf.c, elf_add() calls backtrace_get_view(..., &ehdr_view). ehdr_view isn't initialized. backtrace_get_view() will return 1 and leave edhr_view uninitialized, but the potential uninitialized use of ehdr_view is guarded in get_elf() with a 'goto fail'. Therefore, the uninitialized ehdr_= view would never get to backtrace_release_view(). Let me know if I should file a separate bug for this.