[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
address changes on function call
From: |
Evan |
Subject: |
address changes on function call |
Date: |
Tue, 28 Jul 2009 10:55:17 -0700 (PDT) |
User-agent: |
G2/1.0 |
Hi everyone,
I am experiencing the following strange and fatal behavior. Given the
function below:
VectorN MatrixN::get_row1(unsigned i) const
{
VectorN v;
get_row2(i, v);
return v;
}
The variable 'v' has the address '0x7ffff8c4d988'. Stepping through
gdb to get_row2(), where 'v' is passed in by reference, reports:
MatrixN::get_row2 (this=0x7fff31c34940, i=0, result=@0x7fff31c34a50)
The address of 'v' (called 'result' in get_row2) has suddenly
changed! Even stranger, 'print v' while in get_row1() indicates:
$4 = {
_vptr.VectorN = 0x7fff31c34a50,
...
}
So, vptr (I assume this has to do with the fact that VectorN has
virtual methods) actually points to the address that is passed to
get_row2()! Regardless of this occurrence, any changes that I make to
'result' in get_row2() do not show up as they should in 'v' in get_row1
().
Unfortunately, this behavior is not reproducible in a small test
program, just in my library of 70k lines of code :)
Any elucidation about what might be happening would be greatly
appreciated.
Thanks!
Evan
- address changes on function call,
Evan <=