This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Incorrect code produced with inline functions & assembler


On Fri, 9 Feb 2001, Brian Hurt wrote:

> When compiled with -O2 -finline-functions the following code incorrectly
> removes the or-with-constant code.

Your code is incorrect.

>     __asm__ __volatile__ ("outl %0, %w1" : "=a" (val) : "Nd" (portno));
                                             ^^^^^^^^^^
This says %eax is an output of the asm, rather than an input.  Since %eax
is not mentioned as an input, it's quite reasonable for gcc to optimise
away code that seems to be only changing unused registers.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]