[ns] FW: memory overwrite in rtqueue ?
Nicolas Christin
nicolas@cs.virginia.edu
Tue Apr 2 10:45:02 2002
On Tue, 2 Apr 2002, Timothy.Bauge wrote:
>
> Dear all, I have a problem when adding code to rtqueue.h/cc in
> ns-2.1b8a. I have added 2 private member variables to class rtqueue (2
> doubles, var1 and var2). In the constructor, I initialise them to 0
> (see code extracts below). These are the only changes I've made to the
> code. This compiles fine, but does not run. The line of code which
> causes the segmentation fault seems to be the initialisation of var2.
Can you give a gdb stack trace? Compiling with gcc-2.96 sometimes
generate segfaults during construction or destruction of an object even
though the code may be syntactically and semantically valid. The kind of
problem you have seems only remotely related to that. Typically, the bug I
was referring to in 2.96 causes a new() or a delete() to cause a segfault.
Variable assignments can also crash everything, but that's quite unusual.
> I don't think my changes to rtqueue are controvercial... ? if I'm
> missing something here, please let me know.
I only skimmed your code, but didn't see anything weird indeed,
which is why a gdb stack trace would help. (Don't forget to print out the
values, the addresses, etc.) Not sure I can help you, but somebody else
might.
Best,
--Nick