Board index » cppbuilder » Can/did anybody solve this?
|
Allan Hansen
CBuilder Developer |
Can/did anybody solve this?2004-10-21 07:29:34 PM cppbuilder86 Some month ago, somebody posted this issue here. Now we are seing the exact same behaviour: The compiler (BCB5) sometimes spit out machinecode that doesn't include constants??? Would this not be a bug in the compiler/linker? Can anybody tell me how to report this to Borland? I can't find a knowledge base or similar that tells me if this is a know issue or what. Does any official representatives from Borland ever read (and act) on these posts? Allan Hansen I think I am getting to the core of the problem; I compared the CPU code for the case where it works and the case where it doesnt. If it works, the assembly code looks like this: ------------------------------------------------- 0x005452a4: double TMyObj::roundTwoDecimals(double amount) 55 push ebp 8BEC mov ebp,esp amount *= 100.0; D905E4525400 fld dword ptr [0x005452e4] DC4D0C fmul qword ptr [ebp+0x0c] DD5D0C fstp qword ptr [ebp+0x0c] amount += 0.5; D905E8525400 fld dword ptr [0x005452e8] ... 0x005452e4: 00 00 C8 42 0x005452e8: 00 00 00 3F Next function begins at 0x005452f8 ------------------------------------------------- So the constants 100.0 and 0.5 are stored immediately between the function and the next function, at 0x005452e4. Now if it doesn't work, it looks like this: ------------------------------------------------- 0x00545154: double TMyObj::roundTwoDecimals(double amount) 55 push ebp 8BEC mov ebp,esp amount *= 100.0; D90594515400 fld dword ptr [0x00545194] DC4D0C fmul qword ptr [ebp+0x0c] DD5D0C fstp qword ptr [ebp+0x0c] amount += 0.5; D90598515400 fld dword ptr [0x00545198] ... Next function begins immediately after this one at 0x00545194 ------------------------------------------------- So the function 'thinks' that the constant 100.0 is stored at 0x00545194, but that's already the entry point of the next function. I cannot find the 00 00 C8 42 and 00 00 00 3F. So apparently BCC simply forgets to generate in the two constants. Any ideas? Would this be a linker problem or a compiler problem? Bob |
