Re: My local variable addresses are changing
From: Carl Daniel [VC++ MVP] (cpdaniel_remove_this_and_nospam_at_mvps.org.nospam)
Date: 03/23/04
- Next message: Rudy Ray Moore: "Disassembly notation in 7.1 - can't see variable's address"
- Previous message: Rudy Ray Moore: "My local variable addresses are changing"
- In reply to: Rudy Ray Moore: "My local variable addresses are changing"
- Next in thread: Rudy Ray Moore: "Re: My local variable addresses are changing"
- Reply: Rudy Ray Moore: "Re: My local variable addresses are changing"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 23 Mar 2004 13:15:37 -0800
Sounds like they're calling a function that messed with the stack pointer.
Look for use of alloca or longjmp, to name a couple of suspects.
-cd
Rudy Ray Moore wrote:
> I work on a large native c++ application. We have about 15
> developers. We recently moved to "Visual C++ .net 2003 7.1." Two
> devleopers have seen an odd problem since we migrated.
>
> The address of local variables change when they are passed to another
> function by reference (or when their addresses are passed). The
> address of the variable increases by 420 bytes.
>
> An example below illustrates the problem (but the problem does not
> happen in this example). While the problem is quite reproducable
> when it appears, I cannot make it appear at will.
>
> Looking at assembly doesn't help because in assembly local variables
> are listed by their c++ variable name in square brackets (assembly
> doesn't show the actual adresses of local variables). The assembly
> thing is also pretty hard to use (scroll bar don't work...?).
>
> The problem just appears in a certain "group" of developers (math
> people, not programmers), so I might suspect they are doing something
> weird in their project files or coding.
>
> Does anyone have any clues about how I can solve this problem?
>
> Thank you!
>
> Rudy
>
> ===
>
> class A
> {
> void f(double& d){}
>
> void g()
> {
> double d;
>
> cout << &d; // "0x0012fac8"
>
> f(d);
>
> cout << &d; // "0x0012fe10" (== 0x0012fac8 + 420)
> }
> }
>
> void main()
> {
> A a;
> a.g();
> }
- Next message: Rudy Ray Moore: "Disassembly notation in 7.1 - can't see variable's address"
- Previous message: Rudy Ray Moore: "My local variable addresses are changing"
- In reply to: Rudy Ray Moore: "My local variable addresses are changing"
- Next in thread: Rudy Ray Moore: "Re: My local variable addresses are changing"
- Reply: Rudy Ray Moore: "Re: My local variable addresses are changing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|