Global register variable definition is removed as dead code
Ian Lance Taylor
iant@google.com
Wed Dec 7 06:22:00 GMT 2011
Pitchumani Sivanupandi <pitchumani.s@hotmail.com> writes:
> 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
More information about the Gcc-help
mailing list