Re: [sigc] Incorrect memory read in libsigc++-2.0.3 when compiled without optimization
- From: Martin Schulze <martin-ml hippogriff de>
- To: Andris Pavenis <pavenis latnet lv>
- Cc: libsigc-list gnome org
- Subject: Re: [sigc] Incorrect memory read in libsigc++-2.0.3 when compiled without optimization
- Date: Wed, 2 Jun 2004 19:14:20 +0200
Am 02.06.2004 09:38:34 schrieb(en) Andris Pavenis:
Noticed incorrect memory read in included example when it was
compiled
without optimizations (-O0). It's most likely a bug in GCC, as
it doesn't appear with -O1 or -O2. Tested under Linux.
I have libsigc++-2.0.3, gcc-3.3.3, valgrind-2.1.1
I will investigate. Thanks for the pointer!
(Ah, debian sarge rocks on my notebook since yesterday :-))
Regards,
Martin
Andris
#include <string>
#include <iostream>
#include <sigc++/sigc++.h>
struct Foo
{
bool f1 (std::string s, bool x)
{
std::cout << x << " : " << s << std::endl;
}
};
int main (int argc, const char * argv[])
{
Foo foo;
sigc::slot<void,bool,std::string> slot_1;
slot_1 = sigc::group(
sigc::hide_return(sigc::mem_fun(foo, &Foo::f1)),
sigc::_2,
sigc::_1);
slot_1 (false, argv[0]);
return 0;
}
CXX = g++
CXXFLAGS = -O0 -g $(shell pkg-config --cflags sigc++-2.0)
LDFLAGS = $(shell pkg-config --libs sigc++-2.0)
all: prog
valgrind --tool=memcheck ./foo *
prog: foo
foo: foo.o
g++ -o foo foo.o $(LDFLAGS)
g++ -O0 -g -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include
-c -o foo.o foo.cc
g++ -o foo foo.o -lsigc-2.0
valgrind --tool=memcheck ./foo *
==19457== Memcheck, a memory error detector for x86-linux.
==19457== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward.
==19457== Using valgrind-2.1.1, a program supervision framework for
x86-linux.
==19457== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward.
==19457== For more details, rerun with: -v
==19457==
==19457== Invalid read of size 1
==19457== at 0x80495C6:
_ZNK4sigc13lambda_group2INS_21retype_return_functorIvNS_18bound_mem_functor2Ib3FooSsbEEEENS_6lambdaINS_8internal14lambda_select2EEENS6_INS7_14lambda_select1EEEEclIRKbRKSsEENSC_18deduce_result_typeIT_T0_vvvvvE4typeESJ_SK_
(group.h:227)
==19457== by 0x8049586:
_ZNK4sigc8internal11lambda_coreINS_13lambda_group2INS_21retype_return_functorIvNS_18bound_mem_functor2Ib3FooSsbEEEENS_6lambdaINS0_14lambda_select2EEENS8_INS0_14lambda_select1EEEEELb1EEclIRKbRKSsEENSE_18deduce_result_typeIT_T0_vvvvvE4typeESL_SM_
(base.h:71)
==19457== by 0x8049566: sigc::internal::slot_call2<sigc::
lambda<sigc::lambda_group2<sigc::retype_return_functor<void,
sigc::bound_mem_functor2<bool, Foo, std::string, bool> >,
sigc::lambda<sigc::internal::lambda_select2>,
sigc::lambda<sigc::internal::lambda_select1> > >, void, bool,
std::string>::call_it(sigc::internal::slot_rep*, bool const&,
std::string const&) (slot.h:158)
==19457== by 0x8049045: sigc::slot2<void, bool,
std::string>::operator()(bool const&, std::string const&) const
(slot.h:573)
==19457== Address 0x4FFFE247 is just below %esp. Possibly a bug in
GCC/G++
==19457== v 2.96 or 3.0.X. To suppress, use:
--workaround-gcc296-bugs=yes
0 : ./foo
==19457==
==19457== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 19
from
1)
==19457== malloc/free: in use at exit: 960 bytes in 1 blocks.
==19457== malloc/free: 3 allocs, 2 frees, 1080 bytes allocated.
==19457== For a detailed leak analysis, rerun with: --leak-check=yes
==19457== For counts of detected errors, rerun with: -v
_______________________________________________
libsigc-list mailing list
libsigc-list gnome org
http://mail.gnome.org/mailman/listinfo/libsigc-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]