This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++: inlining problems with current CVS


Hi,

in the current CVS version (112499) of gcc under i686-pc-linux-gnu configured with --enable-shared,
the inlining of functions seems to fail badly. The following example generates a flood of
warnings when compiled with "gcc -c -O2 -Winline", while gcc-2.95.2 does not produce any
warnings at all:

#include <vector>

int main() {
  using namespace std;
  vector <int> a;
}


~/tmp>/afs/mpa/data/martin/egcscvs/bin/g++ -v -Winline -O2 -c test.cxx
Reading specs from /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 19991124 (experimental)
 /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=96 -D__cplusplus -D__ELF__ -Dunix -D__i386__
-Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -D__OPTIMIZE__ -Winline -Acpu(i386) -Amachine(i386) -Di386 -D__i386
-D__i386__ -D__tune_pentiumpro__ test.cxx /tmp/ccJHYcZS.ii
GNU CPP version 2.96 19991124 (experimental) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3
 /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../i686-pc-linux-gnu/include
 /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/include
End of omitted list.
 /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/cc1plus /tmp/ccJHYcZS.ii -quiet -dumpbase test.cc -O2 -Winline -version -o /tmp/ccGLdKnO.s
GNU C++ version 2.96 19991124 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.96 19991124 (experimental).
In file included from /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/vector:30,
                 from test.cxx:1:
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h: In function `const _Tp &min (const _Tp &, const _Tp &) [with _Tp =
size_t]':
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:442:   instantiated from here
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:91: warning: function with static variable cannot be inline
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h: In function `bool lexicographical_compare (const unsigned char *,
const unsigned char *, const unsigned char *, const unsigned char *)':
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:91: warning: can't inline call to `const _Tp &min (const _Tp &,
const _Tp &) [with _Tp = size_t]'
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:442: warning: called from here
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h: In function `const _Tp &min (const _Tp &, const _Tp &) [with _Tp =
ptrdiff_t]':
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:490:   instantiated from here
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:91: warning: function with static variable cannot be inline
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h: In function `int __lexicographical_compare_3way (const unsigned
char *, const unsigned char *, const unsigned char *, const unsigned char *)':
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:91: warning: can't inline call to `const _Tp &min (const _Tp &,
const _Tp &) [with _Tp = ptrdiff_t]'
/afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/../../../../include/g++-3/stl_algobase.h:490: warning: called from here
[...]

Can anyone shed some light on this?

Thanks,
  Martin

test.ii.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]