This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

basic_string<char,string_char_traits<char> >::npos ? [was: (no subject)]


	Hi there!

I send the message below yesterday. I was trying to report what seems to 
be a bug in the basic_string class.

After a bit more investigation, I found that the segfault is tied, IMHO, to 
the static member: 
	[[ size_t basic_string<>::npos = static_cast<size_t>(-1) ]]
which takes the value 4294967295 on my box.
Indeed running the program with xxgdb.1.12 makes the segfault to be 
catched in 
	[[ __builin_new(sz=4294967295) ]]

(Note that if I run the same program with gdb I get the segfault 
	in [[ __libc_malloc(bytes=3212837044]] )

That's all I can do with the knowledge I have. Help's welcome.


Max

P.S. If I said something silly, please points me on it with, if possible, a few 
explanation.


> From owner-egcs@cygnus.com Tue Oct  7 23:59 MET 1997
> Date: Tue, 7 Oct 1997 18:37:27 +0200
> From: Max Lawson <mlawson@drfmc.ceng.cea.fr>
> To: egcs-bugs@cygnus.com
> Cc: egcs@cygnus.com
> 
> 	Hi !
> 
> The added file is test.ii.gz (gzipped file) obtained with the command
> $g++ -g -Wall -O6 -save-temps ...
> 
> my box is given below:
> <<--
> Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/specs
> gcc version egcs-2.90.11 970929 (gcc2-970802 experimental)
> -->>
> 
> With gdb (ggd a.out core) I obtain:
> 
> <<--
> GDB is free software and you are welcome to distribute copies of it
>  under certain conditions; type "show copying" to see the conditions.
> There is absolutely no warranty for GDB; type "show warranty" for details.
> GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
> Core was generated by `a.out'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /usr/local/lib/libstdc++.so.2.8...done.
> Reading symbols from /lib/libm.so.5...done.
> Reading symbols from /lib/libc.so.5...done.
> Reading symbols from /lib/ld-linux.so.1...done.
> #0  0x40021f5c in basic_string<char, string_char_traits<char> >::replace ()
>     at std/bastring.h:157
> std/bastring.h:157: No such file or directory.
> -->>
> 
> and when I ask "where", I get what seems to be an infinite loop
> <<--
> #0  0x40021f5c in basic_string<char, string_char_traits<char> >::replace ()
>     at std/bastring.h:157
> #1  0x40025ed7 in basic_string<char, string_char_traits<char> >::basic_string
>     () at std/bastring.h:398
> #2  0x40021fac in basic_string<char, string_char_traits<char> >::replace ()
>     at std/bastring.h:157
> #3  0x40025ed7 in basic_string<char, string_char_traits<char> >::basic_string
>     () at std/bastring.h:398
> #4  0x40021fac in basic_string<char, string_char_traits<char> >::replace ()
>     at std/bastring.h:157
> [..]
> #297 0x40025ed7 in basic_string<char, string_char_traits<char> >::basic_string
>     () at std/bastring.h:398
> #298 0x40021fac in basic_string<char, string_char_traits<char> >::replace ()
>     at std/bastring.h:157
> ---Type <return> to continue, or q <return> to quit---
> -->>
> 
> I did use the following patches (hope I've not forgotten any):
> <<-- 
> ++ j. buck -> libstdc++ test failures
> ++ d. herrmann -> problem with strings in 970929
> ++ m. hollstein -> small changes to bootstrap handling
> ++ j. merrill -> undefined reference in libstdc++.so (to __IO_outfloat)
> ++ m. mitchell -> blitz bug/internal compiler error
> -->>
> and have moved to libc.5.4.39.
> 
> 
> Enjoy, Max


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]