bug-lib-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug: G++?


From: ctng
Subject: bug: G++?
Date: Sat, 06 Dec 2003 13:37:07 +0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

hi,
A part of my program faced with a problem.
My code fragment:
           switch(myvar)
          {
                  case(...)
                   {
                    }
                   break;
                   .
                   .
. case (12345):
                  {
MYSTRUCT1 mys1 = {0, 0, 0, 0, "mystr1", 0, 2, 5, 6, 1, 7, 6, 1}; MYSTRUCT2 mystr2[3] = {{0, 12345 , "mystr2a" }, {1, 9999, 0 }, {2, 9999, 0}};
                   SearchWindow *searchWindow =NULL;
                   //printf("searchWindow addr = 0x%x\n", &searchWindow);
                   swaddr = 0;
                   swaddr = searchWindow= new SearchWindow(&mys1 ,mystr2);
                   ZafEventType rettype = searchWindow->Control();
                   delete searchWindow;
                    }
                     break;
                     .
                     .
                     .
            }

The problem:
The stack pointer '*searchWindow' did not received the return addr of 'new SearchWindow' (heap addr), despite the fact that 'new' didnt failed. What i saw: I traced thro the assembly instruction using the debugger, i found that there is not instruction that assigned the addr of 'new SearchWindow' to the stack pointer '*searchWindow'. However, there are instruction that assgined the addr of 'new SearchWindow' object to a mem location near
         the addr of the  stack pointer '*searchWindow'.

What i did:
If i comment several cases in the switch, when i do tracing again, i found an instruction that assigned the addr of 'new SearchWindow' to
           the stack pointer '*searchWindow'.

compiler version:
       GNU CPP version 2.7.9-970819 egcs-971225

compiler options:
-g -O0 -mcpu=arm7tdmi -mapcs-32 -mno-thumb-interwork -nostdinc -fforce-addr -DRW_MULTI_THREAD -D_REENTRANT -mno-sched-prolog -fno-builtin -fvolatile


thanks
ct, ng




reply via email to

[Prev in Thread] Current Thread [Next in Thread]