http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56231



             Bug #: 56231

           Summary: warning traces have bogus line information when using

                    LTO

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: major

          Priority: P3

         Component: middle-end

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: m...@use.net





>From bootstrapping GCC itself, one gets warnings that have bogus line entries,

like the ":61:" line below:

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:116:0,

                 from :61:

../../gcc-trunk/libbacktrace/elf.c: In function 'elf_add':

../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: 'ehdr_view.len' may be used

uninitialized in this function [-Werror=maybe-uninitialized]





On large LTO compilation units, the final link can include some of these kinds

of warnings that contain literally hundreds of ":0:" and ":N:" entries per

warning.



To reproduce the above issue, bootstrap trunk like so:

../gcc-trunk/configure --program-suffix=-4.8 --enable-languages=c,c++,lto

--prefix=/u/mhargett --with-build-config=bootstrap-lto --enable-lto

--with-fpmath=sse --disable-isl-version-check --disable-libmudflap

--disable-libssp --enable-gold=yes --disable-multilib --disable-nls

BOOT_CFLAGS="-O3 -floop-block -floop-interchange -floop-strip-mine

-march=nocona =mtune=core2" CFLAGS_FOR_BUILD="-O3 -floop-block

-floop-strip-mine -floop-interchange -march=nocona -mtune=core2"

CXXFLAGS_FOR_BUILD="-O3 -floop-block -floop-interchange -floop-strip-mine

-march=nocona -mtune=core2"



make



more complete output from the bootstrap that illustrates this bug:

/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/src/.libs

-B/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu

-I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include

-I/work/mhargett/gcc-trunk/libstdc++-v3/libsupc++

-L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs

-L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

  -g -O2 -O3 -march=nocona -mtune=core2 -floop-block -floop-interchange

-floop-strip-mine -flto=jobserver -frandom-seed=1 -DIN_GCC   -fno-exceptions

-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings

-Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long

-Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common 

-DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  gcov.o libcommon.a

../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a

../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -o gcov

/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/src/.libs

-B/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu

-I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include

-I/work/mhargett/gcc-trunk/libstdc++-v3/libsupc++

-L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs

-L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

  -g -O2 -O3 -march=nocona -mtune=core2 -floop-block -floop-interchange

-floop-strip-mine -flto=jobserver -frandom-seed=1 -DIN_GCC   -fno-exceptions

-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings

-Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long

-Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common 

-DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  gcov-dump.o \

        libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a

../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -o gcov-dump

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:116:0,

                 from :61:

../../gcc-trunk/libbacktrace/elf.c: In function 'elf_add':

../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: 'ehdr_view.len' may be used

uninitialized in this function [-Werror=maybe-uninitialized]

   if (munmap (const_cast.v, view->len) < 0)

              ^

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:119:0,

                 from :61:

../../gcc-trunk/libbacktrace/elf.c:476:25: note: 'ehdr_view.len' was declared

here

   struct backtrace_view ehdr_view;

                         ^

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:116:0,

                 from :61:

../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: 'ehdr_view.base' may be

used uninitialized in this function [-Werror=maybe-uninitialized]

   if (munmap (const_cast.v, view->len) < 0)

              ^

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:119:0,

                 from :61:

../../gcc-trunk/libbacktrace/elf.c:476:25: note: 'ehdr_view.base' was declared

here

   struct backtrace_view ehdr_view;

                         ^

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:119:0,

                 from :61:

../../gcc-trunk/libbacktrace/elf.c:516:10: error: 'ehdr_view.data' may be used

uninitialized in this function [-Werror=maybe-uninitialized]

   memcpy (&ehdr, ehdr_view.data, sizeof ehdr);

          ^

In file included from ../../gcc-trunk/libbacktrace/mmapio.c:119:0,

                 from :61:

../../gcc-trunk/libbacktrace/elf.c:476:25: note: 'ehdr_view.data' was declared

here

   struct backtrace_view ehdr_view;

                         ^

lto1: all warnings being treated as errors

make[4]: *** [/tmp/ccPsAbnW.ltrans2.ltrans.o] Error 1

lto-wrapper: make returned 2 exit status

/u/mhargett/x86_64-unknown-linux-gnu/bin/ld: lto-wrapper failed

collect2: error: ld returned 1 exit status

make[3]: *** [gcov-dump] Error 1

make[3]: *** Waiting for unfinished jobs....

In file included from ../../gcc-trunk/libiberty/cp-demangle.c:877:0,

                 from :73:

../../gcc-trunk/libbacktrace/elf.c: In function 'backtrace_initialize':

../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: 'ehdr_view.len' may be used

uninitialized in this function [-Werror=maybe-uninitialized]

   if (munmap (const_cast.v, view->len) < 0)

              ^

In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,

                 from :73:

../../gcc-trunk/libbacktrace/elf.c:476:25: note: 'ehdr_view.len' was declared

here

   struct backtrace_view ehdr_view;

                         ^

In file included from ../../gcc-trunk/libiberty/cp-demangle.c:877:0,

                 from :73:

../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: 'ehdr_view.base' may be

used uninitialized in this function [-Werror=maybe-uninitialized]

   if (munmap (const_cast.v, view->len) < 0)

              ^

In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,

                 from :73:

../../gcc-trunk/libbacktrace/elf.c:476:25: note: 'ehdr_view.base' was declared

here

   struct backtrace_view ehdr_view;

                         ^

In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,

                 from :73:

../../gcc-trunk/libbacktrace/elf.c:516:10: error: 'ehdr_view.data' may be used

uninitialized in this function [-Werror=maybe-uninitialized]

   memcpy (&ehdr, ehdr_view.data, sizeof ehdr);

          ^

lto1: all warnings being treated as errors

make[4]: *** [/tmp/ccQkv0KI.ltrans13.ltrans.o] Error 1

Reply via email to