This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/30416] New: SIGSEGV in valarray::cshift(n) on empty array
- From: "sebor at roguewave dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jan 2007 21:47:30 -0000
- Subject: [Bug libstdc++/30416] New: SIGSEGV in valarray::cshift(n) on empty array
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
AFAIK, the program below should have well-defined behavior but it abends with
gcc 4.1.0 on Solaris 9.
$ cat t.cpp && g++ -g t.cpp -static && gdb ./a.out
#include <valarray>
int main ()
{
const std::valarray<int> a;
a.cshift (1);
}
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.9"...
(gdb) run
Starting program: a.out
Program received signal SIGSEGV, Segmentation fault.
0x00024db8 in memcpy ()
(gdb) where
#0 0x00024db8 in memcpy ()
#1 0x00010368 in std::_Array_copy_ctor<int, true>::_S_do_it (__b=0x0,
__e=0x4, __o=0xffbffb94)
at
/usr/local/gcc-4.1.0/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../../include/c++/4.1.0/bits/valarray_array.h:165
#2 0x00010398 in std::__valarray_copy_construct<int> (__b=0x0, __e=0x4,
__o=0xffbffb94)
at
/usr/local/gcc-4.1.0/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../../include/c++/4.1.0/bits/valarray_array.h:174
#3 0x0001057c in std::valarray<int>::cshift (this=0xffbffc20, __n=1)
at
/usr/local/gcc-4.1.0/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../../include/c++/4.1.0/valarray:821
#4 0x00010288 in main () at /nfs/b20/sebor/tmp/t.cpp:8
--
Summary: SIGSEGV in valarray::cshift(n) on empty array
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sebor at roguewave dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30416