Valgrind output

This is a discussion on Valgrind output within the C++ Programming forums, part of the General Programming Boards category; I am having a strange bug in my code that is causing a seg fault. I cant see any obvious ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    3

    Valgrind output

    I am having a strange bug in my code that is causing a seg fault. I cant see any obvious reason why this is. I ran valgrind on the program as follows
    valgrind --tool=memcheck --leak-check=yes programname

    The output I am getting is not very informative. I cant see anything wrong near the lines that it suggests. The output is as follows:

    Code:
    ==3907== Memcheck, a memory error detector for x86-linux.
    ==3907== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
    ==3907== Using valgrind-2.2.0, a program supervision framework for x86-linux.
    ==3907== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
    ==3907== For more details, rerun with: -v
    ==3907==
    ==3907== Invalid write of size 4
    ==3907==    at 0xAD00E1: std::string::string() (in /usr/lib/libstdc++.so.6.0.3)
    ==3907==    by 0x8082A29: clustalw::CommandLineParser::CommandLineParser(std::vector<std::string, std::allocator<std::string> >*, char, char) (CommandLineParser.cpp:89)
    ==3907==    by 0x804AF69: main (main.cpp:39)
    ==3907==  Address 0x1B92D984 is not stack'd, malloc'd or (recently) free'd
    
    number of seqs is: 3
    The maximum Alignment length is: 582
    No. of seqs = 3
    Sequences assumed to be PROTEIN
    Sequence 1: 1qf6aasjhhjhjhasss   291 aa
    Sequence 2: 1qf6b                291 aa
    Sequence 3: 1qf6c                291 aa
    number of seqs is: 3
    The maximum Alignment length is: 582
    No. of seqs in profile=3
    Total no. of seqs     =6
    Sequences assumed to be PROTEIN
    Sequence 4: 1zzsq                291 aa
    Sequence 5: 1zz6b                291 aa
    Sequence 6: 1zz6c                291 aa
    ==3907==
    ==3907== Invalid write of size 1
    ==3907==    at 0x8090E2C: clustalw::Clustal::profileAlign(std::string*, std::string*) (Clustal.cpp:389)
    ==3907==    by 0x8087B34: clustalw::CommandLineParser::parseParams(std::vector<std::string, std::allocator<std::string> >*, char) (CommandLineParser.cpp:854)
    ==3907==    by 0x8085446: clustalw::CommandLineParser::CommandLineParser(std::vector<std::string, std::allocator<std::string> >*, char, char) (CommandLineParser.cpp:276)
    ==3907==    by 0x804AF69: main (main.cpp:39)
    ==3907==  Address 0x1B92D98C is not stack'd, malloc'd or (recently) free'd
    ==3907==
    ==3907== Invalid read of size 1
    ==3907==    at 0x8090E40: clustalw::Clustal::profileAlign(std::string*, std::string*) (Clustal.cpp:392)
    ==3907==    by 0x8087B34: clustalw::CommandLineParser::parseParams(std::vector<std::string, std::allocator<std::string> >*, char) (CommandLineParser.cpp:854)
    ==3907==    by 0x8085446: clustalw::CommandLineParser::CommandLineParser(std::vector<std::string, std::allocator<std::string> >*, char, char) (CommandLineParser.cpp:276)
    ==3907==    by 0x804AF69: main (main.cpp:39)
    ==3907==  Address 0x1B92D98C is not stack'd, malloc'd or (recently) free'd
    ==3907==
    ==3907== Invalid read of size 1
    ==3907==    at 0x8091216: clustalw::Clustal::profileAlign(std::string*, std::string*) (Clustal.cpp:427)
    ==3907==    by 0x8087B34: clustalw::CommandLineParser::parseParams(std::vector<std::string, std::allocator<std::string> >*, char) (CommandLineParser.cpp:854)
    ==3907==    by 0x8085446: clustalw::CommandLineParser::CommandLineParser(std::vector<std::string, std::allocator<std::string> >*, char, char) (CommandLineParser.cpp:276)
    ==3907==    by 0x804AF69: main (main.cpp:39)
    ==3907==  Address 0x1B92D98C is not stack'd, malloc'd or (recently) free'd
    ==3907==
    ==3907== Conditional jump or move depends on uninitialised value(s)
    ==3907==    at 0x8098C10: std::_Bit_iterator std::__copy<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, std::random_access_iterator_tag) (stl_algobase.h:245)
    ==3907==    by 0x8098898: std::_Bit_iterator std::__copy_aux2<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __true_type) (stl_algobase.h:273)
    ==3907==    by 0x8097F63: std::_Bit_iterator std::__copy_ni2<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __false_type) (stl_algobase.h:308)
    ==3907==    by 0x8097825: std::_Bit_iterator std::__copy_ni1<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __false_type) (stl_algobase.h:327)
    ==3907==
    ==3907== Invalid read of size 4
    ==3907==    at 0x80962BB: std::_Bit_reference::operator char() const (stl_bvector.h:79)
    ==3907==    by 0x8098C44: std::_Bit_iterator std::__copy<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, std::random_access_iterator_tag) (stl_algobase.h:247)
    ==3907==    by 0x8098898: std::_Bit_iterator std::__copy_aux2<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __true_type) (stl_algobase.h:273)
    ==3907==    by 0x8097F63: std::_Bit_iterator std::__copy_ni2<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __false_type) (stl_algobase.h:308)
    ==3907==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
    ==3907==
    ==3907== Process terminating with default action of signal 11 (SIGSEGV)
    ==3907==  Access not within mapped region at address 0x0
    ==3907==    at 0x80962BB: std::_Bit_reference::operator char() const (stl_bvector.h:79)
    ==3907==    by 0x8098C44: std::_Bit_iterator std::__copy<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, std::random_access_iterator_tag) (stl_algobase.h:247)
    ==3907==    by 0x8098898: std::_Bit_iterator std::__copy_aux2<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __true_type) (stl_algobase.h:273)
    ==3907==    by 0x8097F63: std::_Bit_iterator std::__copy_ni2<std::_Bit_iterator, std::_Bit_iterator>(std::_Bit_iterator, std::_Bit_iterator, std::_Bit_iterator, __false_type) (stl_algobase.h:308)
    Can anyone suggest what this might be?
    Thanks
    Mark

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    Without seeing actual source code, there's not much chance of saying anything.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 02:08 PM
  2. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 02:29 PM
  3. Replies: 4
    Last Post: 11-30-2005, 03:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21