This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Incorrect code produced with inline functions & assembler
- To: Brian Hurt <bhurt at talkware dot net>
- Subject: Re: Incorrect code produced with inline functions & assembler
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Sat, 10 Feb 2001 13:02:47 +1100 (EST)
- cc: gcc-bugs at gcc dot gnu dot org
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.