This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53242] New: Invalid write in push_back
- From: "rsfalcon7 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 05 May 2012 00:27:30 +0000
- Subject: [Bug c/53242] New: Invalid write in push_back
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53242
Bug #: 53242
Summary: Invalid write in push_back
Classification: Unclassified
Product: gcc
Version: 4.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rsfalcon7@gmail.com
I had this feedback from valgrind:
user@compute-611-2 ~/sorting $ g++ --version
g++ (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
user@compute-611-2 ~/sorting $ valgrind --tool=memcheck ./radix
==668== Memcheck, a memory error detector
==668== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==668== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==668== Command: ./radix
==668==
Generating randon 10 numbers... DONE
Sorting all numbers... ==668== Invalid write of size 4
==668== at 0x401731: __gnu_cxx::new_allocator<unsigned
int>::construct(unsigned int*, unsigned int const&) (new_allocator.h:105)
==668== by 0x4014CF: std::vector<unsigned int, std::allocator<unsigned int>
>::push_back(unsigned int const&) (stl_vector.h:737)
==668== by 0x400FB2: radix(unsigned int*) (radix.seq.cpp:45)
==668== by 0x4012F4: main (radix.seq.cpp:91)
==668== Address 0x9 is not stack'd, malloc'd or (recently) free'd
==668==
==668==
==668== Process terminating with default action of signal 11 (SIGSEGV)
==668== Access not within mapped region at address 0x9
==668== at 0x401731: __gnu_cxx::new_allocator<unsigned
int>::construct(unsigned int*, unsigned int const&) (new_allocator.h:105)
==668== by 0x4014CF: std::vector<unsigned int, std::allocator<unsigned int>
>::push_back(unsigned int const&) (stl_vector.h:737)
==668== by 0x400FB2: radix(unsigned int*) (radix.seq.cpp:45)
==668== by 0x4012F4: main (radix.seq.cpp:91)
==668== If you believe this happened as a result of a stack
==668== overflow in your program's main thread (unlikely but
==668== possible), you can try to increase the size of the
==668== main thread stack using the --main-stacksize= flag.
==668== The main thread stack size used in this run was 10485760.
==668==
==668== HEAP SUMMARY:
==668== in use at exit: 0 bytes in 0 blocks
==668== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==668==
==668== All heap blocks were freed -- no leaks are possible
==668==
==668== For counts of detected and suppressed errors, rerun with: -v
==668== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 6 from 6)
Segmentation fault (core dumped)
user@compute-611-2 ~/sorting $
This version of code is hosted in: https://github.com/RSFalcon7/Radix-Sort/ on
commit "push_back error".