This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/42182] memory errors using valarrays
- From: "christian dot bruel at st dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Nov 2009 11:35:20 -0000
- Subject: [Bug libstdc++/42182] memory errors using valarrays
- References: <bug-42182-9958@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from christian dot bruel at st dot com 2009-11-26 11:35 -------
Created an attachment (id=19154)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19154&action=view)
computed assignment test case
compiled with g++ -O0
gnx2439$ valgrind ./a.out==1599== Memcheck, a memory error detector
==1599== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==1599== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==1599== Command: ./a.out
==1599==
==1599== Invalid read of size 1
==1599== at 0x8048A0B: void
std::_Array_augmented___plus<int>(std::_Array<int>, std::_Array<bool>,
std::_Array<int>, unsigned int) (in /home/bruel/tmp/a.out)
==1599== by 0x80488D4: std::mask_array<int>::operator+=(std::valarray<int>
const&) const (in /home/bruel/tmp/a.out)
==1599== by 0x80485E9: main (in /home/bruel/tmp/a.out)
==1599== Address 0x4129061 is 0 bytes after a block of size 1 alloc'd
==1599== at 0x40061CC: operator new(unsigned int) (vg_replace_malloc.c:214)
==1599== by 0x804867E: std::__valarray_get_memory(unsigned int) (in
/home/bruel/tmp/a.out)
==1599== by 0x8048920: bool* restrict
std::__valarray_get_storage<bool>(unsigned int) (in /home/bruel/tmp/a.out)
==1599== by 0x8048728: std::valarray<bool>::valarray(bool const&, unsigned
int) (in /home/bruel/tmp/a.out)
==1599== by 0x804857B: main (in /home/bruel/tmp/a.out)
==1599==
==1599== Invalid read of size 4
==1599== at 0x8048A18: void
std::_Array_augmented___plus<int>(std::_Array<int>, std::_Array<bool>,
std::_Array<int>, unsigned int) (in /home/bruel/tmp/a.out)
==1599== by 0x80488D4: std::mask_array<int>::operator+=(std::valarray<int>
const&) const (in /home/bruel/tmp/a.out)
==1599== by 0x80485E9: main (in /home/bruel/tmp/a.out)
==1599== Address 0x4129108 is not stack'd, malloc'd or (recently) free'd
==1599==
==1599== Invalid write of size 4
==1599== at 0x8048A24: void
std::_Array_augmented___plus<int>(std::_Array<int>, std::_Array<bool>,
std::_Array<int>, unsigned int) (in /home/bruel/tmp/a.out)
==1599== by 0x80488D4: std::mask_array<int>::operator+=(std::valarray<int>
const&) const (in /home/bruel/tmp/a.out)
==1599== by 0x80485E9: main (in /home/bruel/tmp/a.out)
==1599== Address 0x4129108 is not stack'd, malloc'd or (recently) free'd
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42182