Board index » cppbuilder » bcc 4.5 generating bad code

bcc 4.5 generating bad code


2004-04-20 09:49:07 PM
cppbuilder94
I have run into a problem with bcc 4.5 producing bad code.
The file is rather large, ~15,000 lines. We are compiling
with the -Z, Enable register load suppression optimization,
option turned on. The exact same function call produces
bad code where the second parameter to the function has
the wrong thing pushed on the stack.
The correctly compiled code looks like this:
?debug L 11415
les bx,dword ptr [bp+6]
mov ax,word ptr es:[bx+3]
add ax,2055
push word ptr es:[bx+5]
push ax
les bx,dword ptr es:[bx+3]
push word ptr es:[bx+2034]
push word ptr es:[bx+2032]
mov al,byte ptr es:[bx+2031]
push ax
push word ptr [bp+8]
push word ptr [bp+6]
push cs
call near ptr @Object@CreateResponse$quculnuc
The exact same function call 20 lines later in the file
produces this:
?debug L 11435
les bx,dword ptr [bp+6]
mov ax,word ptr es:[bx+3]
add ax,2055
push word ptr es:[bx+5]
push ax
push dx
push bx
les bx,dword ptr [bp+6]
les bx,dword ptr es:[bx+3]
mov al,byte ptr es:[bx+2031]
push ax
push word ptr [bp+8]
push word ptr [bp+6]
push cs
call near ptr @Object@CreateResponse$quculnuc
I have discovered that moving the function causing problems
to the top of the source file eliminates the bad code generation.
Also compiling without the -Z option produces larger but correct
code.
Any ideas? Thanks.
 
 

Re:bcc 4.5 generating bad code

Quote
I have run into a problem with bcc 4.5 producing bad code.
The file is rather large, ~15,000 lines. We are compiling
with the -Z, Enable register load suppression optimization,
option turned on. The exact same function call produces
bad code where the second parameter to the function has
the wrong thing pushed on the stack.
15,000 lines!?! There are many reasons (besides potential tool
instabilities) to avoid files sizes that large! I would suggest breaking
it into managable pieces to see if it cures the problem (let alone
preserve your sanity).
Regards,
Bruce