* [Bug c++/61971] array subscript is above array bounds [-Werror=array-bounds]
2014-07-31 1:07 [Bug c++/61971] New: array subscript is above array bounds [-Werror=array-bounds] kaijun at seed dot net.tw
@ 2014-07-31 1:12 ` kaijun at seed dot net.tw
2014-07-31 1:19 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kaijun at seed dot net.tw @ 2014-07-31 1:12 UTC (permalink / raw)
To: gcc-bugs
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;
}
~
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/61971] array subscript is above array bounds [-Werror=array-bounds]
2014-07-31 1:07 [Bug c++/61971] New: array subscript is above array bounds [-Werror=array-bounds] kaijun at seed dot net.tw
2014-07-31 1:12 ` [Bug c++/61971] " kaijun at seed dot net.tw
@ 2014-07-31 1:19 ` pinskia at gcc dot gnu.org
2014-11-13 1:12 ` kaijun at seed dot net.tw
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-31 1:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 61970 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/61971] array subscript is above array bounds [-Werror=array-bounds]
2014-07-31 1:07 [Bug c++/61971] New: array subscript is above array bounds [-Werror=array-bounds] kaijun at seed dot net.tw
2014-07-31 1:12 ` [Bug c++/61971] " kaijun at seed dot net.tw
2014-07-31 1:19 ` pinskia at gcc dot gnu.org
@ 2014-11-13 1:12 ` kaijun at seed dot net.tw
2014-12-08 18:27 ` ville.voutilainen at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kaijun at seed dot net.tw @ 2014-11-13 1:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971
--- Comment #3 from kaijun <kaijun at seed dot net.tw> ---
In Arch Linux & use [gcc 4.9.2]
The same problem happened again.
//This bug could be reproduced as following code on gcc 4.9.2
// g++ -Werror -Wall -O2 t.cpp -o t
class B {
public:
virtual ~B(){};
};
class A {
public:
B m1[1];
B m2[1];
B m3[1];
A(){};
};
int main() {
A v;
return 0;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/61971] array subscript is above array bounds [-Werror=array-bounds]
2014-07-31 1:07 [Bug c++/61971] New: array subscript is above array bounds [-Werror=array-bounds] kaijun at seed dot net.tw
` (2 preceding siblings ...)
2014-11-13 1:12 ` kaijun at seed dot net.tw
@ 2014-12-08 18:27 ` ville.voutilainen at gmail dot com
2015-03-24 16:27 ` [Bug c++/61971] [4.9 Regression] " paolo.carlini at oracle dot com
2015-03-24 16:34 ` paolo at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-08 18:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-08
CC| |ville.voutilainen at gmail dot com
Known to work| |4.8.2, 5.0
Ever confirmed|0 |1
Known to fail| |4.9.0, 4.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/61971] [4.9 Regression] array subscript is above array bounds [-Werror=array-bounds]
2014-07-31 1:07 [Bug c++/61971] New: array subscript is above array bounds [-Werror=array-bounds] kaijun at seed dot net.tw
` (3 preceding siblings ...)
2014-12-08 18:27 ` ville.voutilainen at gmail dot com
@ 2015-03-24 16:27 ` paolo.carlini at oracle dot com
2015-03-24 16:34 ` paolo at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-24 16:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Let's add the reduced testcase to trunk.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/61971] [4.9 Regression] array subscript is above array bounds [-Werror=array-bounds]
2014-07-31 1:07 [Bug c++/61971] New: array subscript is above array bounds [-Werror=array-bounds] kaijun at seed dot net.tw
` (4 preceding siblings ...)
2015-03-24 16:27 ` [Bug c++/61971] [4.9 Regression] " paolo.carlini at oracle dot com
@ 2015-03-24 16:34 ` paolo at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-03-24 16:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971
--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Mar 24 15:58:05 2015
New Revision: 221636
URL: https://gcc.gnu.org/viewcvs?rev=221636&root=gcc&view=rev
Log:
2015-03-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61971
* g++.dg/warn/Warray-bounds-7.C: New.
Added:
trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-7.C
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread