This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51447] New: global register variable definition incorrectly removed as dead code
- From: "pitchumani.s at atmel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Dec 2011 07:26:20 +0000
- Subject: [Bug c/51447] New: global register variable definition incorrectly removed as dead code
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447
Bug #: 51447
Summary: global register variable definition incorrectly
removed as dead code
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pitchumani.s@atmel.com
Global register variable assignment(ptr = func) in the test case below seem to
be removed as dead code during CSE. As per the gcc manual, global register
variable should not be removed even if it appears to be dead.
http://gcc.gnu.org/onlinedocs/gcc/Global-Reg-Vars.html
Discussion in gcc mailing list:
http://gcc.gnu.org/ml/gcc-help/2011-12/msg00057.html
Test case:
register void *ptr asm("rbx") ;
void testfn1(void* func)
{
ptr = func;
goto *(ptr);
}
Options: -S -O1
-- snip of assembly generated --
.globl testfn1
.type testfn1, @function
testfn1:
.LFB0:
jmp *%rdi
.LFE0:
.size testfn1, .-testfn1
-- snip end --