For
int foo(void)
{
static int blah = 1;
return blah;
}
we should be able to promote blah to TREE_READONLY during ipa-reference (or
local analysis) if blah does not have its address taken and is not written
to in the function body.
This occurs for example in 189.lucas via
real(kind=r16), save :: mt,one=1,two=2,one_fourth,pi,theta,theta2
note the save attribute.
--
Summary: Local statics not promoted to const
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39672