public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: C++ template bugs in gcc 4.6
@ 2011-05-22 14:17 Jonathan Wakely
  2011-05-22 14:24 ` Ruben Safir
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2011-05-22 14:17 UTC (permalink / raw)
  To: Ruben Safir; +Cc: gcc-bugs

re http://gcc.gnu.org/ml/gcc-bugs/2011-05/msg01899.html

The gcc-bugs mailing list is for mails automatically generated by
bugzilla, if you want to report a bug please do so in bugzilla, not by
email. See http://gcc.gnu.org/bugs/ for instructions.

If you want to ask for help using g++ then use the gcc-help mailing
list, see http://gcc.gnu.org/lists.html

Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: C++ template bugs in gcc 4.6
  2011-05-22 14:17 C++ template bugs in gcc 4.6 Jonathan Wakely
@ 2011-05-22 14:24 ` Ruben Safir
  2011-05-22 14:31   ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Ruben Safir @ 2011-05-22 14:24 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Ruben Safir, gcc-bugs

On Sun, May 22, 2011 at 02:29:08PM +0100, Jonathan Wakely wrote:
> re http://gcc.gnu.org/ml/gcc-bugs/2011-05/msg01899.html
> 
> The gcc-bugs mailing list is for mails automatically generated by
> bugzilla, if you want to report a bug please do so in bugzilla, not by
> email. See http://gcc.gnu.org/bugs/ for instructions.
> 
> If you want to ask for help using g++ then use the gcc-help mailing
> list, see http://gcc.gnu.org/lists.html
> 


Can't be done.  It's not working, aside from the fact that this is too
complex of an example to fit within the parameters.

I spent nearly 45 minutes gathering all the information together.  If
the post is not adequate, that is fine.  That's why i don't report bugs.


> Thanks.

-- 
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world  - RI Safir 1998

http://fairuse.nylxs.com  DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt.  I guess you missed that one."

© Copyright for the Digital Millennium


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: C++ template bugs in gcc 4.6
  2011-05-22 14:24 ` Ruben Safir
@ 2011-05-22 14:31   ` Jonathan Wakely
  2011-05-22 15:21     ` Ruben Safir
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2011-05-22 14:31 UTC (permalink / raw)
  To: Ruben Safir; +Cc: gcc-bugs

On 22 May 2011 15:16, Ruben Safir <ruben@mrbrklyn.com> wrote:
> On Sun, May 22, 2011 at 02:29:08PM +0100, Jonathan Wakely wrote:
>> re http://gcc.gnu.org/ml/gcc-bugs/2011-05/msg01899.html
>>
>> The gcc-bugs mailing list is for mails automatically generated by
>> bugzilla, if you want to report a bug please do so in bugzilla, not by
>> email. See http://gcc.gnu.org/bugs/ for instructions.
>>
>> If you want to ask for help using g++ then use the gcc-help mailing
>> list, see http://gcc.gnu.org/lists.html
>>
>
>
> Can't be done.  It's not working, aside from the fact that this is too
> complex of an example to fit within the parameters.

It's working fine for me.

As for too complex: nonsense.  Did you bother to read the link I provided?
You can attach preprocessed source, though you should really try to
reduce it to a minimal testcase - I don't believe mysql++ is really
necessary to demonstrate the problem.

None of that changes the fact gcc-bugs is the wrong list.

> I spent nearly 45 minutes gathering all the information together.  If
> the post is not adequate, that is fine.  That's why i don't report bugs.

Run your code under valgrind, it shows you were the first memory
corruption occurs.

If you don't want to report bugs then dont' be surprised if they don't
get fixed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: C++ template bugs in gcc 4.6
  2011-05-22 14:31   ` Jonathan Wakely
@ 2011-05-22 15:21     ` Ruben Safir
  0 siblings, 0 replies; 5+ messages in thread
From: Ruben Safir @ 2011-05-22 15:21 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Ruben Safir, gcc-bugs

On Sun, May 22, 2011 at 03:24:11PM +0100, Jonathan Wakely wrote:
> On 22 May 2011 15:16, Ruben Safir <ruben@mrbrklyn.com> wrote:
> > On Sun, May 22, 2011 at 02:29:08PM +0100, Jonathan Wakely wrote:
> >> re http://gcc.gnu.org/ml/gcc-bugs/2011-05/msg01899.html
> >>
> >> The gcc-bugs mailing list is for mails automatically generated by
> >> bugzilla, if you want to report a bug please do so in bugzilla, not by
> >> email. See http://gcc.gnu.org/bugs/ for instructions.
> >>
> >> If you want to ask for help using g++ then use the gcc-help mailing
> >> list, see http://gcc.gnu.org/lists.html
> >>
> >
> >
> > Can't be done.  It's not working, aside from the fact that this is too
> > complex of an example to fit within the parameters.
> 
> It's working fine for me.
> 

well it doesn't for me.  seens to not like my email address.

> As for too complex: nonsense.  Did you bother to read the link I provided?


not interested in argueing...have other things I need to do.  I'm sorry
I made the report now.  Easier to just code around the bug.

Thanks for your time.



> You can attach preprocessed source, though you should really try to
> reduce it to a minimal testcase - I don't believe mysql++ is really
> necessary to demonstrate the problem.
> 
> None of that changes the fact gcc-bugs is the wrong list.
> 
> > I spent nearly 45 minutes gathering all the information together.  If
> > the post is not adequate, that is fine.  That's why i don't report bugs.
> 
> Run your code under valgrind, it shows you were the first memory
> corruption occurs.

doing that, thanks
> 
> If you don't want to report bugs then dont' be surprised if they don't
> get fixed.

nothing surprises me anymore...in more ways then most people can
comprehend...  The world sucks.  

Ruben

-- 
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world  - RI Safir 1998

http://fairuse.nylxs.com  DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt.  I guess you missed that one."

© Copyright for the Digital Millennium


^ permalink raw reply	[flat|nested] 5+ messages in thread

* C++ template bugs in gcc 4.6
@ 2011-05-22  7:48 Ruben Safir
  0 siblings, 0 replies; 5+ messages in thread
From: Ruben Safir @ 2011-05-22  7:48 UTC (permalink / raw)
  To: gcc-bugs


I've been working with gcc 4.6 with C++ doing some templates exercises

I seem to have some unexplained behavior which might be a bug, or maybe
I'm ignorant.

First - let me give you a link for my code

http://www.nylxs.com/docs/linklist.tgz

gcc version

ruben@www2:~> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-suse-linux/4.6/lto-wrapper
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.6
--enable-ssp --disable-libssp --disable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib
--with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.6
--enable-linux-futex --without-system-libunwind
--with-plugin-ld=/usr/bin/gold --with-arch-32=i586 --with-tune=generic
--build=i586-suse-linux
Thread model: posix
gcc version 4.6.0 20110415 [gcc-4_6-branch revision 172496] (SUSE Linux) 




specifically, I wrote a program to test my templates that create a
linked list class. There is a simple library to do some statistics on the list
members. It is doing a double delete core dump in a section of code that
I see no reason for a destructor call. It didn't do this for a simpler
version of the template argument call.

ddd ./test_del2
test_del2.cpp:84

79 for( i=0; i < 100; ++i){
80 std::cout << "index " << i << "-------------------------------
\n";
81 tally = new chainlist::List<stats::Distribution<int> >;
82 stats::take_tally<int>(a[i], tally );
83 std::cout << "Creating Tally " << std::endl;
84 tallies->insert(*tally);
85 std::cout << "inserted population figures for index " << i <<
"-------------------------------\n";
86 delete tally;
87
88 //visual inspection of population data to make sure the resiults work
89 // std::cout << "visual inspection of population data to make sure
the results work" << std::endl;

breaking on line 84 and the stepping through

263 void List<T>::insert ( T val )
264 {
265 if(!front()){
266 Node<T> * tmp = new Node<T>(val);
267 front(tmp);
268 endd(tmp);
269 cursor(tmp);
270 sizeup();
271 return;
272 }else{
273 Node<T> * tmp = new Node<T>(val, endd());
274 // endd()->next(tmp); // redundant
275 endd(tmp);
276 cursor(tmp);
277 sizeup();
278 return;
279 }
280 } /* --- end of method List<T>::insert ----

/home/ruben/cplus/link_list_template_mysql/linklist.h:265
is the next line

on line 266 is where it seems to be doing weird stuff

home/ruben/cplus/link_list_template_mysql/linklist.h:266

it calls the correct constructor for the node object
/home/ruben/cplus/link_list_template_mysql/linklist.h:82
81 Node<unk>::Node(unk val, Node<unk> *item_to_link_to){
82 value(val);
83 if(!item_to_link_to){
84 next_ = 0;
85 }
86
87 else{
88 next(item_to_link_to->next());
89 item_to_link_to->next(this);
90 }
91 }

I the calls the accessory method value() from the list class

108 }
109
110 template<class unk>
111 void Node<unk>::value(unk val){
112 value_ = new unk(val);
113 }
114
/home/ruben/cplus/link_list_template_mysql/linklist.h:112

it returns nomally

81 Node<unk>::Node(unk val, Node<unk> *item_to_link_to){
82 value(val);
83 if(!item_to_link_to){
84 next_ = 0;
85 }
86
87 else{
88 next(item_to_link_to->next());
89 item_to_link_to->next(this);
90 }
91 }
92 chainlist::Node<chainlist::List<stats::Distribution<int> > >::Node
(this=0x809f488, val=..., item_to_link_to=0x0) at
/home/ruben/cplus/link_list_template_mysql/linklist.h:83


then it calls for the List destructor, I have no idea way

373 template<class T>
374 List<T>::~List<T>(){
375 remove_all();
376 // std::cout << "Deleted All*************" << __LINE__ << std::endl;
377 }
378
(gdb) ptype List
Type chainlist::List<stats::Distribution<int> > has no component named
List.
(gdb) *** glibc detected ***
/home/ruben/cplus/link_list_template_mysql/test_del2: double free or
corruption (out): 0x0809f460 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7d9150b]
/lib/libc.so.6[0xb7d92de4]
/lib/libc.so.6(cfree+0x6d)[0xb7d95fdd]
/usr/lib/libstdc++.so.6(_ZdlPv+0x1f)[0xb7f7c87f]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x804b4a4]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x804b2c6]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x804aa30]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x804987d]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x80498f0]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x8048d42]
/lib/libc.so.6(__libc_start_main+0xfe)[0xb7d3aace]
/home/ruben/cplus/link_list_template_mysql/test_del2[0x8048961]
======= Memory map: ========
08048000-0804d000 r-xp 00000000 08:12 270203586
/home/ruben/cplus/link_list_template_mysql/test_del2
0804d000-0804e000 r--p 00004000 08:12 270203586
/home/ruben/cplus/link_list_template_mysql/test_del2
0804e000-0804f000 rw-p 00005000 08:12 270203586
/home/ruben/cplus/link_list_template_mysql/test_del2
0804f000-080b2000 rw-p 00000000 00:00 0 [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7d22000-b7d24000 rw-p 00000000 00:00 0
b7d24000-b7e7d000 r-xp 00000000 08:02 36311 /lib/libc-2.10.1.so
b7e7d000-b7e7e000 ---p 00159000 08:02 36311 /lib/libc-2.10.1.so
b7e7e000-b7e80000 r--p 00159000 08:02 36311 /lib/libc-2.10.1.so
b7e80000-b7e81000 rw-p 0015b000 08:02 36311 /lib/libc-2.10.1.so
b7e81000-b7e84000 rw-p 00000000 00:00 0
b7e84000-b7ea0000 r-xp 00000000 08:02 910019 /lib/libgcc_s.so.1
b7ea0000-b7ea1000 r--p 0001b000 08:02 910019 /lib/libgcc_s.so.1
b7ea1000-b7ea2000 rw-p 0001c000 08:02 910019 /lib/libgcc_s.so.1
b7ea2000-b7ec9000 r-xp 00000000 08:02 36319 /lib/libm-2.10.1.so
b7ec9000-b7eca000 r--p 00027000 08:02 36319 /lib/libm-2.10.1.so
b7eca000-b7ecb000 rw-p 00028000 08:02 36319 /lib/libm-2.10.1.so
b7ecb000-b7faf000 r-xp 00000000 08:02 348377
/usr/lib/libstdc++.so.6.0.16
b7faf000-b7fb3000 r--p 000e3000 08:02 348377
/usr/lib/libstdc++.so.6.0.16
b7fb3000-b7fb4000 rw-p 000e7000 08:02 348377
/usr/lib/libstdc++.so.6.0.16
b7fb4000-b7fbb000 rw-p 00000000 00:00 0
b7fde000-b7fe0000 rw-p 00000000 00:00 0
b7fe0000-b7ffe000 r-xp 00000000 08:02 36304 /lib/ld-2.10.1.so
b7ffe000-b7fff000 r--p 0001d000 08:02 36304 /lib/ld-2.10.1.so
b7fff000-b8000000 rw-p 0001e000 08:02 36304 /lib/ld-2.10.1.so
bffeb000-c0000000 rw-p 00000000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]

Program received signal SIGABRT, Aborted.
0xffffe430 in __kernel_vsyscall ()
(gdb) delete 7
(gdb)


I've rattled my brain on this and can't explain it ..


BTW bugzilla is dead....


-- 
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world  - RI Safir 1998

http://fairuse.nylxs.com  DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt.  I guess you missed that one."

© Copyright for the Digital Millennium


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-22 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-22 14:17 C++ template bugs in gcc 4.6 Jonathan Wakely
2011-05-22 14:24 ` Ruben Safir
2011-05-22 14:31   ` Jonathan Wakely
2011-05-22 15:21     ` Ruben Safir
  -- strict thread matches above, loose matches on Subject: below --
2011-05-22  7:48 Ruben Safir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).