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++/4015: Strange "statement with no effect" warning (gcc 3.0 regression)



>Number:         4015
>Category:       c++
>Synopsis:       Strange "statement with no effect" warning (gcc 3.0 regression)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 13 08:46:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Peter Schmid
>Release:        3.0.1 20010810 (prerelease)
>Organization:
TU Darmstadt
>Environment:
System: Linux kiste 2.4.6 #6 Wed Jul 11 02:21:23 CEST 2001 i686 unknown
Architecture: i686
SuSE 7.1
glibc 2.2
linux 2.4.6
GNU ld version 2.11.90.0.23
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-shared --enable-threads=posix --enable-languages=c,c++,f77,objc --disable-nls --enable-clocale=gnu
>Description:
While compiling the following code t.C gcc 3.0.1 emits a "statement
with no effect" warning. I believe this message is bogus. gcc 3.0
compiles this code without a warning. 
>How-To-Repeat:
Source code t.C

template <class _Tp>
class allocator {};

template <class _Value, class _Tp, class _MaybeReboundAlloc>
class _STLP_alloc_proxy : public _MaybeReboundAlloc {
private:
  typedef _MaybeReboundAlloc _Base;
  typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
public:
  _Value _M_data;
  inline _Self& operator = (const _Self& __x) { _M_data = __x._M_data; return *this; } 
  inline _Self& operator = (const _Base& __x) { ((_Base&)*this) = __x; return *this; } 
  
};

template class _STLP_alloc_proxy<void**, void*, allocator<void*> >;

Compiling t.C
g++  -v -c -W -Wall t.C -save-temps
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/specs
Configured with: ../gcc/configure --enable-shared --enable-threads=posix --enable-languages=c,c++,f77,objc --disable-nls --enable-clocale=gnu
Thread model: posix
gcc version 3.0.1 20010810 (prerelease)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/cpp0 -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=1 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -W -Wall -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ t.C t.ii
GNU CPP version 3.0.1 20010810 (prerelease) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/i686-pc-linux-gnu
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/cc1plus -fpreprocessed t.ii -quiet -dumpbase t.C -W -Wall -version -o t.s
GNU CPP version 3.0.1 20010810 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.1 20010810 (prerelease) (i686-pc-linux-gnu)
	compiled by GNU C version 3.0.1 20010810 (prerelease).
t.C: In member function `_STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc>& 
   _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc>::operator=(const 
   _MaybeReboundAlloc&) [with _Value = void**, _Tp = void*, _MaybeReboundAlloc 
   = allocator<void*>]':
t.C:16:   instantiated from here
t.C:12: warning: statement with no effect
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/../../../../i686-pc-linux-gnu/bin/as -V -Qy -o t.o t.s
GNU assembler version 2.11.90.0.23 (i686-pc-linux-gnu) using BFD version 2.11.90.0.23

Preprocessor source file t.ii
# 1 "t.C"
template <class _Tp>
class allocator {};

template <class _Value, class _Tp, class _MaybeReboundAlloc>
class _STLP_alloc_proxy : public _MaybeReboundAlloc {
private:
  typedef _MaybeReboundAlloc _Base;
  typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
public:
  _Value _M_data;
  inline _Self& operator = (const _Self& __x) { _M_data = __x._M_data; return *this; }
  inline _Self& operator = (const _Base& __x) { ((_Base&)*this) = __x; return *this; }

};

template class _STLP_alloc_proxy<void**, void*, allocator<void*> >;

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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