Thanks. A bug is filed in gcc-bugs. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447 Thanks,Pitchumani.S > > Consider the following test case: > > // gcc-4.6.1// option: -O1 > > register void *ptr asm("rbx") ; > > void testfn1(void* func){ ptr = func; // removed as dead code goto *ptr;} > > When compiling with O1 option, 'ptr = func' definition is removed as dead code. But ref[1] says it should not be deleted even if it appears to be dead. > > In dead code elimination (gcc/dce.c), the register definition is not checked for "global register variable". > > Is gcc's behaviour is correct? > > ref1: http://gcc.gnu.org/onlinedocs/gcc/Global-Reg-Vars.html > > That is definitely a bug. Please file a bug report as described at > http://gcc.gnu.org/bugs . Thanks. > > Ian