We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HI,
I's that anyone know this problem. We through a function, search a entry and access the global pointer value to an empty pointer. But we realize that when the empty pointer go in the call function, the memory was change, it was shift 8 bytes, it's look like compiler problem.
(1). allocate a empty memory "*TablePtr". (2). before go in the function "test_get_entry_pointer", the memory value 1 "(void*)&TablePtr" is 0x20001EE4. (3). after go in the function, we realize the memory value 2 (same memory) "**Entry_Ptr" is different, the value was change to 0x20001EEC. (4). therefore the "GolbelValueTable" pointer value was access in the wrong memory (0x20001EEC).
Thanks.
{ TABLE_ENTRY *TablePtr;
/* execute function which happen pointer access wrong*/ Found = test_get_entry_pointer((void*)&TablePtr /*memory value 1*/, refID); }
/* function call */ BOOL test_get_entry_pointer(void **Entry_Ptr /*memory value 2*/, UINT8 SearchID) { for(i=0; i<TABLE_SIZE; i++){ if(GlobalValueTable[i].ID == SerachID) { Entry_Ptr = GolbelValueTable + i;
return TRUE; } else { return FALSE; } } }
Judging by the care with which you exhibited in your post, it is way more likely that you aren't interpreting the evidence correctly.
Says a guy with poor C and pasting skills. Compiler guys get no respect.
If you used proper typing you might catch some of your own failings.
*Entry_Ptr = &GlobalValueTable[i];
Tip: Pointers, they're like variables on the stack.
Opps !!! sorry, I never forget it. Thanks !!