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



             Bug #: 55413

           Summary: [LTO] hashtable.h:1648 '__bbegin_bkt' may be used

                    uninitialized in this function

                    [-Werror=maybe-uninitialized]

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: minor

          Priority: P3

         Component: libstdc++

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

        ReportedBy: david.abdurachma...@gmail.com





Hi,



I have enabled -Werror=maybe-uninitialized and normal builds works fine. LTO

builds crashed with error coming from hashtable.h. According to he code,

__bbegin_bkt is not explicitly initialized to anything.



1637       std::size_t __bbegin_bkt;

<snip>

1648     __new_buckets[__bbegin_bkt] = __p;                                     

1649         __bbegin_bkt = __bkt;



Similar issues MIGHT be on the next (in file) template.



1678       std::size_t __bbegin_bkt;

<snip>

1724         __new_buckets[__bbegin_bkt] = __p;

1725       __bbegin_bkt = __bkt;



This is a minor issue, but comments would be welcomed. Is LTO + diagnostics

issue or STL issue? Is the a way to silence them from user-code side? (I tried

GCC diagnostics pragma w/o results).



Attaching *.ii.



## GCC VERSION ##



Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../configure

--prefix=/build/davidlt/build-BOOTSTRAP_slc5_amd64_gcc472/b/tmp/BUILDROOT/3526ecf0ad2656770a1b0f9f5e8d92a9/opt/cmssw/slc5_amd64_gcc472/external/gcc/4.7.2

--disable-multilib --disable-nls --enable-languages=c,c++,fortran

--enable-gold=yes --enable-lto

--with-gmp=/build/davidlt/build-BOOTSTRAP_slc5_amd64_gcc472/b/tmp/BUILDROOT/3526ecf0ad2656770a1b0f9f5e8d92a9/opt/cmssw/slc5_amd64_gcc472/external/gcc/4.7.2

--with-mpfr=/build/davidlt/build-BOOTSTRAP_slc5_amd64_gcc472/b/tmp/BUILDROOT/3526ecf0ad2656770a1b0f9f5e8d92a9/opt/cmssw/slc5_amd64_gcc472/external/gcc/4.7.2

--with-mpc=/build/davidlt/build-BOOTSTRAP_slc5_amd64_gcc472/b/tmp/BUILDROOT/3526ecf0ad2656770a1b0f9f5e8d92a9/opt/cmssw/slc5_amd64_gcc472/external/gcc/4.7.2

--with-ppl=/build/davidlt/build-BOOTSTRAP_slc5_amd64_gcc472/b/tmp/BUILDROOT/3526ecf0ad2656770a1b0f9f5e8d92a9/opt/cmssw/slc5_amd64_gcc472/external/gcc/4.7.2

--with-cloog=/build/davidlt/build-BOOTSTRAP_slc5_amd64_gcc472/b/tmp/BUILDROOT/3526ecf0ad2656770a1b0f9f5e8d92a9/opt/cmssw/slc5_amd64_gcc472/external/gcc/4.7.2

--enable-cloog-backend=isl --enable-shared CC='gcc -fPIC' CXX='c++ -fPIC'

CPP=cpp CXXCPP='c++ -E'

Thread model: posix

gcc version 4.7.2 (GCC)



## FULL ERROR ##



In file included from

/afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/stl_algobase.h:1026:0,

                 from :97:

test.cc: In function 'main':

/afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/hashtable.h:1648:3:

error: '__bbegin_bkt' may be used uninitialized in this function

[-Werror=maybe-uninitialized]

In file included from

/afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/stl_algobase.h:1017:0,

                 from :97:

/afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/hashtable.h:1637:19:

note: '__bbegin_bkt' was declared here

lto1: some warnings being treated as errors

lto-wrapper: /afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/c++

returned 1 exit status

/afs/cern.ch/cms/slc5_amd64_gcc472/external/gcc/4.7.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../x86_64-unknown-linux-gnu/bin/ld:

fatal error: lto-wrapper failed

collect2: error: ld returned 1 exit status



## TESTCASE ##



#include <unordered_map>

struct S {  int id;  S(): id(0) {} };

int main(void) {

  std::unordered_map<unsigned int, S> tmap;

  S & res = tmap[0];

  return 0;

}



## COMPILE LINE ##



c++ -v -save-temps -c -DGNU_GCC -D_GNU_SOURCE -O2 -pedantic -pthread -pipe

-Wno-vla -Werror=overflow -Wstrict-overflow -std=c++0x -msse3 -ftree-vectorize

-Wno-strict-overflow -Werror=array-bounds -Werror=format-contains-nul

-Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param

vect-max-version-for-alias-checks=50 -felide-constructors -fmessage-length=0

-ftemplate-depth-300 -Wall -Wno-non-template-friend -Wno-long-long

-Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type

-Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format

-Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor

-Werror=maybe-uninitialized -Werror=strict-aliasing -Werror=narrowing

-Werror=uninitialized -Werror=unused-but-set-variable -Werror=reorder

-fdiagnostics-show-option -flto -fno-fat-lto-objects -fPIC -MMD test.cc -o

test.o



## LINK LINE ##



c++ -O2 -pedantic -pthread -pipe -Wno-vla -Werror=overflow -Wstrict-overflow

-std=c++0x -msse3 -ftree-vectorize -Wno-strict-overflow -Werror=array-bounds

-Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden

-fno-math-errno --param vect-max-version-for-alias-checks=50

-felide-constructors -fmessage-length=0 -ftemplate-depth-300 -Wall

-Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses

-Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value

-Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings

-Werror=delete-non-virtual-dtor -Werror=maybe-uninitialized

-Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized

-Werror=unused-but-set-variable -Werror=reorder -fdiagnostics-show-option -flto

-fno-fat-lto-objects -shared -shared -Wl,-E -Wl,-z,defs test.o -o test.so

-Wl,-E -Wl,--hash-style=gnu

Reply via email to