diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1993-09-01 15:59:32 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1993-09-01 15:59:32 -0700 |
commit | 549a367ad6bf68e95e6c08fe9fb49a29a4e92177 (patch) | |
tree | a1e477951b0bfc41531b981d238cbb0c57ffaaad | |
parent | 915bb7632b64ad515e041b1c077b7c4306b6a8fa (diff) | |
download | gcc-549a367ad6bf68e95e6c08fe9fb49a29a4e92177.zip gcc-549a367ad6bf68e95e6c08fe9fb49a29a4e92177.tar.gz gcc-549a367ad6bf68e95e6c08fe9fb49a29a4e92177.tar.bz2 |
(finish_decl): For static const variables, preserve
initializers instead of discarding them.
From-SVN: r5245
-rw-r--r-- | gcc/c-decl.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index eede163..eca89fa 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3557,7 +3557,15 @@ finish_decl (decl, init, asmspec_tree) normal for a local extern redeclaration of an inline function to have a copy of the top-level decl's DECL_INLINE. */ if (DECL_INITIAL (decl) != 0) - DECL_INITIAL (decl) = error_mark_node; + { + /* If this is a static const variable, then preserve the + initializer instead of discarding it so that we can optimize + references to it. */ + if (TREE_STATIC (decl) && TREE_READONLY (decl)) + preserve_initializer (); + else + DECL_INITIAL (decl) = error_mark_node; + } } #if 0 |