https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971

--- Comment #1 from kaijun <kaijun at seed dot net.tw> ---
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --disable-libgcj
--with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) 

========================================================================
$ make -f Makefile2 
make -f mytest2.mak all

g++ -c -pipe -D_LITTLE_ENDIAN_BYTE_ORDER_ -DLINUX -D_NOT_SOLARIS8
-DSYSTEM_TYPE=10 -ansi -Wno-deprecated -m64 -DUSE_MSG -DDEBUG_SQLITE -DLINUX
-DRMM_UNIX -DRUM_UNIX -DRMM_UNIX -DOS_LINUX -D_THREAD_SAFE -D_REENTRANT -Werror
-W -Wall -Wpointer-arith -Wcast-align -Wshadow -Wno-long-long
-Wstrict-aliasing=0 -Wformat=2 -Wno-deprecated -g -O2 -I/opt/IBM/llm/include -o
obj/mytest2.o mytest2.cpp
mytest2.cpp: In member function 'void std::vector<_Tp,
_Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with
_Tp = ProdBook; _Alloc = std::allocator<ProdBook>; std::vector<_Tp,
_Alloc>::iterator = __gnu_cxx::__normal_iterator<ProdBook*,
std::vector<ProdBook> >; typename std::_Vector_base<_Tp, _Alloc>::pointer =
ProdBook*]':
mytest2.cpp:32:7: error: array subscript is above array bounds
[-Werror=array-bounds]
 class ProdBook {
       ^
mytest2.cpp:32:7: error: array subscript is above array bounds
[-Werror=array-bounds]
cc1plus: all warnings being treated as errors
make[1]: *** [obj/mytest2.o] Error 1

make: *** [all] Error 2
=========================================================================
//mytest2.cpp

#include <map>
#include <vector>
#include <string>
#include <string.h>
#include <list>


class CPriceLst;
class DPriceLst;
class DDPriceLst;
class ProdBook;

class PriceLst {
public:
    virtual ~PriceLst();
};


class DPriceLst : public PriceLst
{
public:
};

class DDPriceLst : public DPriceLst
{
public:
};


class ProdBook {
public:
    PriceLst    m_bs_pr[2];
    DPriceLst   m_bs_d_pr[2];  // derived order lst
    DDPriceLst  m_bs_dd_pr[2]; // 2nd derived lst

    ProdBook();
};


class OrderBook {
public:
    std::vector<ProdBook> m_prod;
};



int main() {
        void *ptr=NULL;
        ProdBook prod;

        ((OrderBook*)ptr)->m_prod.push_back(prod);

        return 0;
}
~

Reply via email to