Boost logo

Boost-Build :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2004-08-12 08:06:35


David Abrahams wrote:

>>>You're missing the fact that extend_full is only called when size ==
>>>capacity.
>>
>>Do you mean that self->size == self->capacity is a precondition for
>>calling extend_full.
>
>
> Yes, and it should be clear from the code that it holds. At least,
> it was for me.
>
>
>>Adding 'assert( self->size == self->capacity )' I
>>get an assertion failure during the bootstrapping though.
>
>
> Oh? Can you give any more info? What's the stack look like?
>
>

see attachment.
This trace is from the string regression test. From the moment the
string (or opt array) is not big enough and a push_back is done, the
capacity is 32 while the size is 31. The capacity can actually never be
equal to the size (well it depends if the definition of capacity counts
the terminating \0 or not).

So I added following assert instead:
assert( self->capacity == self->size + 1 )

and now again I got an assertion violation in var_defines which calls
string_append_range on a string with size == 0. Inside
string_append_range, the string is being filled up but when at some
moment the capacity does not suffice anymore (thus when
finish-start>self->capacity), extend_full is called to add the remainder
of the [start,finish] that is not added yet. However before calling
extend_full, the size is not set to reflect that already a substring was
added. That is way extend_full is called on a string with size==0 and a
capacity of 32.

 --------------040307020906030707090300 Content-Type: text/plain;
name="stack_trace"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="stack_trace"

myvatn.fft:/home/tk/cvstop/boost/tools/build/jam_src >build.sh
###
### Using 'gcc' toolset.
###
rm -rf bootstrap.gcc
mkdir bootstrap.gcc
gcc -o bootstrap.gcc/jam0 command.c compile.c execnt.c execunix.c execvms.c expand.c filent.c fileos2.c fileunix.c filevms.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c newstr.c option.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c
./bootstrap.gcc/jam0 -f build.jam --toolset=gcc --toolset-root= clean
jam0: strings.c:79: extend_full: Assertion `self->size == self->capacity' failed.
./build.sh: line 225: 19141 Aborted "$@"
myvatn.fft:/home/tk/cvstop/boost/tools/build/jam_src >gdb ./bootstrap.gcc/jam0
GNU gdb 6.1.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or 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.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run -f build.jam --toolset=gcc --toolset-root= clean
Starting program: /home/tk/cvstop/boost/tools/build/jam_src/bootstrap.gcc/jam0 -f build.jam --toolset=gcc --toolset-root= clean
jam0: strings.c:79: extend_full: Assertion `self->size == self->capacity' failed.

Program received signal SIGABRT, Aborted.
0x42028cc1 in kill () from /lib/i686/libc.so.6
(gdb) where
#0 0x42028cc1 in kill () from /lib/i686/libc.so.6
#1 0x42028ac8 in raise () from /lib/i686/libc.so.6
#2 0x4202a019 in abort () from /lib/i686/libc.so.6
#3 0x42021cd6 in __assert_fail () from /lib/i686/libc.so.6
#4 0x080569cc in extend_full ()
#5 0x08056b81 in string_append_range ()
#6 0x08056c54 in string_push_back ()
#7 0x08056cca in string_unit_test ()
#8 0x0804db37 in run_unit_tests ()
#9 0x0804dedc in main ()

 --------------040307020906030707090300--


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk