[Bug c++/40658] New: spurious warning "array subscript is below array bounds"

gcc at axel-naumann dot de gcc-bugzilla@gcc.gnu.org
Mon Jul 6 09:22:00 GMT 2009

Compiling the following code snippet with "g++ -m32 -S -Wall -O2 t.cc" on a
64bit machine issues a warning

t.cc: In static member function 'static void
NewDelFunctionsT<T>::deleteArray_T(void*) [with T = EcalTPGLut]':
t.cc:12: warning: array subscript is below array bounds

This does not happen with 4.4.

class EcalTPGLut {
   ~EcalTPGLut() ;

  unsigned int lut_[1024];

template <class T>
struct NewDelFunctionsT {
   static void
   deleteArray_T(void* p) { delete[] (T*) p; }

typedef void (*DelArrFunc_t)(void*);

DelArrFunc_t method_newdel_98() {
   return NewDelFunctionsT< ::EcalTPGLut >::deleteArray_T;

           Summary: spurious warning "array subscript is below array bounds"
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at axel-naumann dot de
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: -m32


More information about the Gcc-bugs mailing list