[Bug c++/21454] New: const array doesn't live in the rodata section in C++
kazu at cs dot umass dot edu
gcc-bugzilla@gcc.gnu.org
Sun May 8 16:06:00 GMT 2005
Consider:
static const int array[] = { 0, 1, 2, 3 };
int
foo (unsigned int i)
{
return array[i];
}
I get:
.file "test.cc"
.text
.align 2
.p2align 2,,3
.globl _Z3fooj
.type _Z3fooj, @function
_Z3fooj:
.LFB2:
movl 4(%esp), %eax
movl array(,%eax,4), %eax
ret
.LFE2:
.size _Z3fooj, .-_Z3fooj
.data
.align 4
.type array, @object
.size array, 16
array:
.long 0
.long 1
.long 2
.long 3
.ident "GCC: (GNU) 4.1.0 20050508 (experimental)"
.section .note.GNU-stack,"",@progbits
Note ".data". We could use ".rodata" for this array.
--
Summary: const array doesn't live in the rodata section in C++
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21454
More information about the Gcc-bugs
mailing list