Incorrect code produced with inline functions & assembler
Brian Hurt
bhurt@talkware.net
Fri Feb 9 14:08:00 GMT 2001
When compiled with -O2 -finline-functions the following code incorrectly
removes the or-with-constant code. Removing -O2 or -finline-functions
produces code (but does not inline functions).
Compiler: egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
CPU: Celeron-400 x86 single CPU
OS: Linux 2.2.14-5.0 (Redhat 6.2 unpatched)
Further comentary:
The relevent parts of the assembler are:
/* Optimized and WRONG */
#APP
inl %dx, %eax
outl %eax, %dx
#NO_APP
Notice the lack of any "or".
/* Unoptimized and RIGHT */
pushl $993
pushl $993
call inportl
addl $4,%esp
movl %eax,%eax
movl %eax,%edx
orl $305419896,%edx
pushl %edx
call outportl
addl $8,%esp
Notice the orl.
I have not yet tried other versions of gcc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.o
Type: application/x-object
Size: 735 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20010209/8548f605/attachment.bin>
More information about the Gcc-bugs
mailing list