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]

Incorrect code generation on optimization (-O3).


I have here a file, which generates incorrect code for -O3 optimization.
Haven't tested for -O1, or -O2, but works fine for default.

ps. Please cc the reply to me, since I am not subscribed.


-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/


#include <iostream>

inline int foo (int _x)
{
  //  int _y = 3;
  __asm__ ("addl $3, %0\n\t"
	   : "=g"(_x));
// 	   : "0"(_y),
// 	   "r"(_x));
	   //: "0");
      //return _x;
  return _x;
}



int main ()
{
  int t = 23;
  std::cout<<foo (t)<<std::endl;
  return 0;
}

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