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]
Other format: [Raw text]

Re: Incorrect code generation on optimization (-O3).


Dhruv Matani <dhruvbird@gmx.net> writes:

> I have here a file, which generates incorrect code for -O3 optimization.
> 
> inline int foo (int _x)
> {
>   //  int _y = 3;
>   __asm__ ("addl $3, %0\n\t"
> 	   : "=g"(_x));
>   return _x;
> }

Not a bug in gcc. Since you don't specify _x to be an input to the
asm, gcc is free to clobber it with random stuff prior to the asm.

-- 
	Falk


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