| From: Tyler Trafford <[EMAIL PROTECTED]>
|
| D. Hugh Redelmeier wrote:
|
| > I have boiled this down into a simple test case and reported the
| > problem to Redhat. We'll see what happens. See:
| > <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=154116>
|
| Out of curiousity, I just installed gcc-3.4 on Debian:
| gcc-3.4 (GCC) 3.4.4 20050314 (prerelease) (Debian 3.4.3-12)
[You and I had similar spelling bugs: I saw nothing wrong with
"curiousity", but it seems that the correct spelling is "curiosity".]
Thanks for testing this.
| gcc (GCC) 3.3.5 (Debian 1:3.3.5-12) worked fine.
Since this is fixed in a later gcc and since Fedora Core 4 is soon to
appear and since this bug does not seem to bite many programs, I
predict that there will be no update to FC3 to fix this problem.
The assembler warnings do not seem to make the compile be considered a
failure ($? is 0). I am guessing that the actual machine code will
work. So we can probably ignore the assembler warnings.
Analysis of assembly code for my small program (boring)
=======================================================
Here is an extract of the assembler code I get:
; buffer array is built in ax!
; al (for buffer[0]) := 1 (which is 0x115 >> 8)
movb $1, %al
movl %esp, %ebp ; frame pointer
; ah (for buffer[1]) := 277 (which is 0x115; should be 0x15)
; the actual compiled code will do the right thing
movb $277, %ah
; Create stack space for buffer array.
; Value of edx is immaterial.
; 4 bytes are pushed even though sizeof(buffer) == 2.
; The reason is that we want to keep the stack-pointer 4-byte
; aligned.
pushl %edx
; assign buffer[0] and buffer[1] all at once
movw %ax, -2(%ebp)
; push &buffer[0] on stack as parameter to i2c_master_recv
leal -2(%ebp), %eax
pushl %eax
call i2c_master_recv
This code looks correct to me, if you truncate the $277. I think that
this is what the assembler does, after grumbling.
This code is half efficient. It is easy to do better.
- why load constants into al and ah with separate instructions:
fuse them into a constant load of ax
- why push edx to make space for the value when you could push
the value itself? But note that this moves the padding from
before buffer to after it.
movl %esp, %ebp ; frame pointer
movw $(0x115 >> 8) | ((0x115 & 0xff) << 8), %ax
pushl %eax
movl %esp, %eax ; cannot push %esp directly
pushl %eax
call i2c_master_recv
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
ivtv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ivtv-devel